:root {
  color-scheme: light;
  --bg: #fff7f3;
  --surface: #ffffff;
  --surface-2: #fff0ea;
  --ink: #241a19;
  --muted: #7d716e;
  --accent: #ff665a;
  --accent-2: #ff665a;
  --accent-soft: #ffe1dc;
  --nav: rgba(255,255,255,.86);
  --line: rgba(36,26,25,.09);
  --shadow: 0 10px 28px rgba(38,27,24,.12);
  --radius: 20px;
  --font: "DM Sans", sans-serif;
  --display: "DM Sans", sans-serif;
  --profiles: url('./assets/profiles-vi.png');
  --profiles-extra: url('./assets/profiles-vi-women.png?v=2');
  --profiles-nine: url('./assets/profiles-vi-nine.png?v=2');
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: #ece9e5; }
body { font-family: var(--font); color: var(--ink); overscroll-behavior: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }

#app {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 80px rgba(30,20,20,.12);
}

.market-th { --bg:#fffaf3; --surface-2:#f5eff8; --ink:#2c2730; --muted:#756e78; --accent:#7c3b86; --accent-2:#7c3b86; --accent-soft:#eee2f1; --profiles:url('./assets/profiles-th.png'); --profiles-extra:url('./assets/profiles-th-women.png?v=2'); --profiles-nine:url('./assets/profiles-th-nine.png?v=2'); --font:"Noto Sans Thai",sans-serif; --display:"Noto Sans Thai",sans-serif; }
.market-tr { --bg:#faf7f2; --surface-2:#f4ece9; --ink:#272221; --muted:#756b68; --accent:#a3263d; --accent-2:#a3263d; --accent-soft:#f2dfe3; --profiles:url('./assets/profiles-tr.png'); --profiles-extra:url('./assets/profiles-tr-women.png?v=2'); --profiles-nine:url('./assets/profiles-tr-nine.png?v=2'); --font:"Manrope",sans-serif; --display:"Noto Serif",serif; }
.market-ko { --bg:#f8f8fa; --surface-2:#efeff5; --ink:#222228; --muted:#74747e; --accent:#5546c9; --accent-2:#5546c9; --accent-soft:#e9e7f8; --profiles:url('./assets/profiles-ko.png'); --profiles-extra:url('./assets/profiles-ko-women.png?v=2'); --profiles-nine:url('./assets/profiles-ko-nine.png?v=2'); --font:"Noto Sans KR",sans-serif; --display:"Noto Sans KR",sans-serif; }

.app-shell { min-height: 100dvh; padding: max(12px, env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom)); background:var(--bg); }
.topbar { display:flex; align-items:center; justify-content:space-between; height:52px; position:relative; z-index:10; }
.brand { display:flex; align-items:center; gap:9px; font-family:var(--display); font-weight:700; font-size:21px; letter-spacing:-.5px; }
.brand-mark { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; color:#fff; background:var(--accent); }
.brand-mark svg { width:18px; }
.icon-btn, .avatar-btn { width:42px; height:42px; border:1px solid var(--line); border-radius:50%; background:color-mix(in srgb,var(--surface) 86%,transparent); display:grid; place-items:center; box-shadow:0 8px 24px rgba(30,20,20,.06); cursor:pointer; }
.icon-btn svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.market-pill { border:1px solid var(--line); background:var(--surface); border-radius:12px; height:38px; padding:0 10px; display:flex; align-items:center; gap:7px; font-weight:700; cursor:pointer; }

.page { display:none; animation:fadeIn .28s ease; }
.page.active { display:block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px) } }
.eyebrow { margin:14px 0 4px; color:var(--accent); font-weight:700; font-size:12px; letter-spacing:.08em; text-transform:uppercase; }
.page-title { margin:0 0 14px; font-family:var(--display); font-size:26px; line-height:1.18; letter-spacing:-.7px; }

.card-stage { position:relative; height:clamp(330px, calc(100dvh - 360px), 520px); margin-top:8px; }
.profile-card { position:absolute; inset:0; border-radius:var(--radius); overflow:hidden; background:var(--surface); box-shadow:var(--shadow); transform-origin:50% 100%; touch-action:none; transition:transform .32s cubic-bezier(.2,.8,.2,1),opacity .24s; }
.profile-card:nth-last-child(2) { transform:scale(.96) translateY(13px); opacity:.8; }
.profile-card:nth-last-child(3) { transform:scale(.92) translateY(25px); opacity:.5; }
.profile-photo { position:absolute; inset:0; background-image:linear-gradient(to top,rgba(15,12,12,.86) 0%,rgba(15,12,12,.08) 48%,transparent 72%),var(--media,var(--profiles)); background-repeat:no-repeat; background-size:var(--media-size,200% 200%); background-position:var(--media-x,0) var(--media-y,0); }
.photo-top { position:absolute; top:16px; left:16px; right:16px; display:flex; justify-content:space-between; align-items:center; }
.verified, .distance { height:30px; display:flex; align-items:center; gap:5px; padding:0 10px; border-radius:99px; color:#fff; background:rgba(20,15,15,.34); backdrop-filter:blur(10px); font-size:12px; font-weight:600; }
.verified { width:30px; padding:0; justify-content:center; background:#2675d8; }
.card-copy { position:absolute; left:22px; right:22px; bottom:20px; color:#fff; }
.name-line { display:flex; align-items:center; gap:8px; }
.name-line h2 { margin:0; font-family:var(--display); font-size:31px; letter-spacing:-1px; text-shadow:0 2px 12px rgba(0,0,0,.2); }
.name-line span { font-size:23px; font-weight:400; }
.profile-meta { margin:7px 0 12px; display:flex; align-items:center; gap:8px; font-size:13px; opacity:.92; }
.profile-meta i { width:4px; height:4px; border-radius:50%; background:#fff; opacity:.6; }
.bio { margin:0 0 14px; font-size:14px; line-height:1.45; max-width:95%; }
.tags { display:flex; gap:7px; flex-wrap:wrap; }
.tag { padding:7px 10px; border:1px solid rgba(255,255,255,.35); border-radius:99px; font-size:11px; font-weight:600; background:rgba(20,15,15,.18); backdrop-filter:blur(8px); }
.stamp { position:absolute; top:86px; padding:8px 14px; border:3px solid; border-radius:10px; font-size:26px; font-weight:800; opacity:0; transform:rotate(-12deg); }
.stamp.like { left:20px; color:#71f2be; }
.stamp.nope { right:20px; color:#ff8a84; transform:rotate(12deg); }

.actions { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:18px; }
.action { width:54px; height:54px; border:1px solid var(--line); border-radius:50%; background:var(--surface); display:grid; place-items:center; box-shadow:0 5px 14px rgba(45,30,30,.08); cursor:pointer; transition:.18s ease; }
.action:active { transform:scale(.9); }
.action.primary { width:62px; height:62px; color:#fff; background:var(--accent); border-color:var(--accent); box-shadow:none; }
.action.pass { color:#8e8792; }
.action.star { color:var(--accent-2); }
.action svg { width:25px; fill:none; stroke:currentColor; stroke-width:2.2; }

.bottom-nav { position:fixed; z-index:30; left:50%; bottom:0; width:min(100%,480px); height:calc(70px + env(safe-area-inset-bottom)); padding:7px 12px env(safe-area-inset-bottom); display:grid; grid-template-columns:repeat(4,1fr); border-top:1px solid var(--line); background:rgba(255,255,255,.96); transform:translateX(-50%); }
.nav-item { position:relative; border:0; background:transparent; color:var(--muted); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; font-size:10px; font-weight:600; cursor:pointer; }
.nav-item svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2; }
.nav-item.active { color:var(--accent); }
.nav-item.active::before { content:""; position:absolute; top:-7px; width:28px; height:3px; border-radius:0 0 3px 3px; background:var(--accent); }

.likes-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.mini-card { position:relative; aspect-ratio:.78; overflow:hidden; border-radius:24px; background:var(--surface); box-shadow:0 12px 30px rgba(35,20,20,.1); cursor:pointer; }
.mini-photo, .chat-avatar { background-image:var(--media,var(--profiles)); background-size:var(--media-size,200% 200%); background-position:var(--media-x,0) var(--media-y,0); background-repeat:no-repeat; }
.mini-card .mini-photo { position:absolute; inset:0; }
.mini-card::after { content:""; position:absolute; inset:45% 0 0; background:linear-gradient(transparent,rgba(20,10,10,.82)); }
.mini-copy { position:absolute; z-index:2; left:14px; right:12px; bottom:12px; color:white; }
.mini-copy b { display:block; font-size:17px; }
.mini-copy span { font-size:11px; opacity:.8; }

.story-row { display:flex; gap:14px; overflow:auto; margin:0 -18px 18px; padding:2px 18px 8px; scrollbar-width:none; }
.story { flex:0 0 60px; text-align:center; font-size:10px; color:var(--muted); }
.story .chat-avatar { width:56px; height:56px; border-radius:50%; border:3px solid var(--bg); outline:2px solid var(--accent); margin-bottom:5px; }
.chat-list { display:flex; flex-direction:column; gap:8px; }
.chat-row { width:100%; padding:12px; border:0; border-radius:20px; background:transparent; display:grid; grid-template-columns:54px 1fr auto; align-items:center; gap:12px; text-align:left; cursor:pointer; }
.chat-row:active { background:var(--surface-2); }
.chat-avatar { width:54px; height:54px; border-radius:18px; }
.chat-main { min-width:0; }
.chat-main b { display:block; margin-bottom:3px; }
.chat-main span { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:var(--muted); font-size:12px; }
.chat-time { color:var(--muted); font-size:10px; }
.unread { width:9px; height:9px; border-radius:50%; background:var(--accent); margin:6px 0 0 auto; }

.profile-hero { padding:28px 20px 22px; border-radius:32px; background:var(--surface); text-align:center; box-shadow:0 18px 42px rgba(40,30,30,.08); }
.profile-avatar { width:112px; height:112px; margin:0 auto 16px; border-radius:50%; overflow:hidden; border:4px solid var(--bg); outline:1px solid var(--line); background:var(--accent-soft); }
.avatar-illustration { display:block; width:100%; height:100%; }
.avatar-bg { fill:var(--accent-soft); }
.avatar-body, .avatar-heart { fill:var(--accent); }
.avatar-hair, .avatar-hair-fringe { fill:#312727; }
.avatar-face, .avatar-ear, .avatar-hand { fill:#f4c7a8; }
.avatar-blush { fill:#ef8e91; opacity:.62; }
.avatar-eyes path, .avatar-smile { fill:none; stroke:#312727; stroke-width:3; stroke-linecap:round; }
.avatar-arm { fill:none; stroke:var(--accent); stroke-width:9; stroke-linecap:round; }
.avatar-bob { transform-origin:60px 73px; animation:avatarBob 2.8s ease-in-out infinite; }
.avatar-eyes { transform-origin:60px 51px; animation:avatarBlink 4.4s ease-in-out infinite; }
.avatar-wave { transform-origin:90px 91px; animation:avatarWave 1.8s ease-in-out infinite; }
.avatar-heart { transform-origin:101px 28px; animation:avatarHeart 1.6s ease-in-out infinite; }
.guest-profile { padding:32px 24px 30px; }
.guest-gate { margin-top:4px; min-height:270px; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.guest-action { width:100%; min-height:50px; margin-top:20px; border:0; border-radius:16px; color:#fff; background:var(--accent); font-weight:700; cursor:pointer; }
.guest-profile h2 { font-size:21px; }
.guest-profile p { max-width:250px; margin:8px auto 0; line-height:1.55; }
@keyframes avatarBob { 0%,100% { transform:translateY(0) rotate(-1deg); } 50% { transform:translateY(-3px) rotate(1deg); } }
@keyframes avatarBlink { 0%,43%,47%,100% { transform:scaleY(1); } 45% { transform:scaleY(.08); } }
@keyframes avatarWave { 0%,100% { transform:rotate(-7deg); } 50% { transform:rotate(9deg); } }
@keyframes avatarHeart { 0%,100% { transform:scale(1); } 50% { transform:scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .avatar-bob, .avatar-eyes, .avatar-wave, .avatar-heart { animation:none; } }
.profile-hero h2 { margin:0; font-family:var(--display); }
.profile-hero p { margin:6px 0 15px; color:var(--muted); font-size:13px; }
.completion { height:8px; border-radius:99px; background:var(--surface-2); overflow:hidden; }
.completion i { display:block; width:78%; height:100%; border-radius:inherit; background:var(--accent); }
.settings-list { margin-top:14px; display:flex; flex-direction:column; gap:8px; }
.setting { padding:15px 16px; display:flex; align-items:center; gap:12px; border-radius:18px; background:var(--surface); }
.setting .setting-icon { width:36px; height:36px; border-radius:12px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent); }
.setting b { flex:1; font-size:14px; text-align:left; }
.setting span { width:28px; height:28px; display:grid; place-items:center; color:var(--ink); font-size:28px; font-weight:600; line-height:1; opacity:.58; transform:translateY(-1px); }

.sheet-backdrop, .match-modal, .chat-modal { position:absolute; z-index:80; inset:0; display:none; background:rgba(20,15,20,.5); backdrop-filter:blur(9px); }
.sheet-backdrop.open, .match-modal.open, .chat-modal.open { display:flex; }
.sheet-backdrop { align-items:flex-end; }
.sheet { width:100%; padding:12px 18px calc(26px + env(safe-area-inset-bottom)); border-radius:30px 30px 0 0; background:var(--surface); animation:sheetUp .28s ease; }
@keyframes sheetUp { from { transform:translateY(100%); } }
.handle { width:42px; height:5px; border-radius:99px; background:var(--line); margin:0 auto 18px; }
.sheet h3 { margin:0 0 4px; font-family:var(--display); font-size:22px; }
.sheet p { margin:0 0 16px; color:var(--muted); font-size:12px; }
.market-option { width:100%; padding:12px; margin:7px 0; border:1px solid var(--line); border-radius:18px; display:flex; align-items:center; gap:12px; background:var(--surface); text-align:left; cursor:pointer; }
.market-option.active { border-color:var(--accent); background:var(--accent-soft); }
.flag { width:42px; height:42px; border-radius:13px; display:grid; place-items:center; font-size:23px; background:var(--bg); }
.market-option b { display:block; }
.market-option small { color:var(--muted); }
.check { margin-left:auto; color:var(--accent); }

.match-modal { align-items:center; justify-content:center; padding:24px; text-align:center; color:var(--ink); background:rgba(20,18,20,.72); }
.match-content { width:100%; padding:30px 20px 18px; border-radius:24px; background:var(--surface); animation:pop .4s cubic-bezier(.2,1.2,.3,1); }
@keyframes pop { from { opacity:0; transform:scale(.72); } }
.match-content h2 { margin:18px 0 4px; font-family:var(--display); font-size:40px; }
.match-content p { margin:0 0 24px; opacity:.8; }
.match-faces { display:flex; justify-content:center; }
.match-face { width:104px; height:104px; border:4px solid white; border-radius:50%; background-image:var(--profiles); background-size:200% 200%; box-shadow:0 8px 18px rgba(0,0,0,.16); }
.match-face.me { background-position:0 0; transform:rotate(-8deg) translateX(10px); }
.match-face.them { background-position:100% 100%; transform:rotate(8deg) translateX(-10px); }
.match-btn { width:100%; height:54px; margin:6px 0; border:0; border-radius:18px; font-weight:700; cursor:pointer; }
.match-btn.primary { color:white; background:var(--accent); }
.match-btn.ghost { color:var(--ink); background:var(--surface-2); }

.chat-modal { position:fixed; inset:auto; top:0; bottom:0; left:50%; width:min(100%,480px); height:100dvh; transform:translateX(-50%); flex-direction:column; overflow:hidden; background:var(--bg); backdrop-filter:none; }
.chat-head { height:76px; padding:max(14px,env(safe-area-inset-top)) 16px 8px; display:grid; grid-template-columns:42px 1fr 42px; align-items:center; gap:10px; background:var(--surface); }
.chat-person { text-align:center; }
.chat-person b { display:block; font-size:14px; }
.chat-person span { color:var(--accent-2); font-size:10px; }
.chat-head-spacer { width:42px; height:42px; }
.preview-scroll { flex:1; min-height:0; overflow-y:auto; padding:14px 16px 22px; overscroll-behavior:contain; }
.preview-photo { position:relative; width:100%; aspect-ratio:1; border-radius:22px; overflow:hidden; background-image:linear-gradient(to top,rgba(20,14,15,.3),transparent 45%),var(--media,var(--profiles)); background-repeat:no-repeat; background-size:var(--media-size,200% 200%); background-position:var(--media-x,0) var(--media-y,0); box-shadow:var(--shadow); }
.preview-badge { position:absolute; left:14px; bottom:14px; min-height:30px; padding:7px 10px; border-radius:99px; color:#fff; background:var(--accent); font-size:10px; font-weight:800; letter-spacing:.05em; }
.preview-card { margin-top:12px; padding:18px; border-radius:20px; background:var(--surface); }
.preview-title { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.preview-title h2 { margin:0; font-family:var(--display); font-size:23px; }
.preview-distance { flex:none; padding:6px 9px; border-radius:99px; color:var(--accent); background:var(--accent-soft); font-size:11px; font-weight:700; }
.preview-meta { margin:6px 0 12px; color:var(--muted); font-size:12px; }
.preview-bio { margin:0; font-size:14px; line-height:1.55; }
.preview-tags { display:flex; flex-wrap:wrap; gap:7px; margin-top:14px; }
.preview-tags span { padding:7px 10px; border-radius:99px; color:var(--ink); background:var(--surface-2); font-size:11px; font-weight:600; }
.preview-message { margin-top:12px; padding:16px; border-radius:20px; background:var(--surface); }
.preview-message small { display:block; margin-bottom:8px; color:var(--accent); font-size:10px; font-weight:700; }
.preview-message .bubble { max-width:100%; box-shadow:none; background:var(--surface-2); }
.preview-action { padding:10px 16px calc(10px + env(safe-area-inset-bottom)); background:var(--surface); box-shadow:0 -8px 24px rgba(30,20,20,.07); }
.preview-action button { width:100%; min-height:54px; border:0; border-radius:17px; color:#fff; background:var(--accent); font-weight:800; cursor:pointer; }
.messages { flex:1; overflow:auto; padding:22px 18px; display:flex; flex-direction:column; gap:10px; }
.bubble { max-width:78%; padding:11px 14px; border-radius:18px 18px 18px 5px; background:var(--surface); font-size:13px; line-height:1.4; box-shadow:0 6px 18px rgba(30,20,20,.05); }
.bubble.mine { align-self:flex-end; border-radius:18px 18px 5px 18px; color:white; background:var(--accent); }
.message-form { padding:10px 12px calc(10px + env(safe-area-inset-bottom)); display:flex; gap:8px; background:var(--surface); }
.message-form input { flex:1; min-width:0; height:46px; padding:0 16px; border:1px solid var(--line); border-radius:99px; outline:none; background:var(--bg); }
.send-btn { width:46px; height:46px; border:0; border-radius:50%; color:white; background:var(--accent); display:grid; place-items:center; }

.auth-modal { position:fixed; z-index:120; inset:0; left:50%; width:min(100%,480px); transform:translateX(-50%); display:none; align-items:flex-end; padding:16px; background:rgba(20,15,20,.56); backdrop-filter:blur(8px); }
.auth-modal.open { display:flex; }
.auth-sheet { position:relative; width:100%; padding:28px 20px calc(20px + env(safe-area-inset-bottom)); border-radius:26px; background:var(--surface); animation:sheetUp .28s ease; text-align:center; }
.auth-close { position:absolute; top:14px; right:14px; width:44px; height:44px; border:0; border-radius:50%; display:grid; place-items:center; background:var(--surface-2); color:var(--ink); cursor:pointer; }
.auth-close svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.auth-mark { width:58px; height:58px; margin:2px auto 14px; border-radius:18px; display:grid; place-items:center; color:var(--accent); background:var(--accent-soft); }
.auth-mark svg { width:28px; height:28px; fill:none; stroke:currentColor; stroke-width:1.8; }
.auth-sheet h2 { margin:0; font-family:var(--display); font-size:24px; }
.auth-sheet p { margin:10px auto 20px; max-width:320px; color:var(--muted); font-size:14px; line-height:1.55; }
.auth-primary { width:100%; min-height:52px; border:0; border-radius:16px; color:#fff; background:var(--accent); font-weight:800; cursor:pointer; }

.toast { position:absolute; z-index:100; left:50%; bottom:98px; max-width:82%; padding:11px 16px; border-radius:99px; color:#fff; background:rgba(25,20,24,.88); font-size:12px; font-weight:600; transform:translate(-50%,18px); opacity:0; transition:.22s; pointer-events:none; white-space:nowrap; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.empty-state { padding:70px 25px; text-align:center; color:var(--muted); }

@media (min-width: 641px) {
  #app { min-height: min(900px,100dvh); }
}
@media (max-height: 720px) {
  .card-stage { height:340px; }
  .bio { display:none; }
  .app-shell { padding-top:8px; }
  .actions { margin-top:10px; }
  .action { width:48px; height:48px; }
  .action.primary { width:58px; height:58px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration:.01ms!important; transition-duration:.01ms!important; } }
