:root {
  --bg: #12131c; --bg2: #191b27; --card: #1f2231; --card2: #262a3c; --line: #2f3449; --text: #eceef7; --muted: #a2a8c3; --faint: #737a99;
  --accent: #9b8cff; --accent2: #ff8fab; --mint: #5ef2c2; --warn: #ffcf6b; --danger: #ff6b81; --ok: #5ef2c2;
  --radius: 14px; --gutter: 16px; --maxw: 1200px; --nav-h: 60px;
  --brand: linear-gradient(120deg, #ff8fab, #9b8cff 55%, #5ef2c2);
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100dvh; font-size: 22px; font-weight: 800; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar & nav ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 var(--gutter); background: rgba(18, 19, 28, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 900; font-size: 20px; letter-spacing: -.02em; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.topnav { display: none; gap: 4px; margin-left: 12px; }
.topnav a { padding: 7px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.topnav a.on, .topnav a:hover { color: var(--text); background: var(--card); }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); background: var(--card); color: var(--muted); white-space: nowrap; }
.pill.demo { color: #1b1530; background: var(--warn); border-color: transparent; }
.pill.real { color: #0b2a22; background: var(--mint); border-color: transparent; }
.langtog { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.langtog button { border: 0; background: transparent; padding: 5px 10px; font-size: 12px; font-weight: 800; color: var(--muted); }
.langtog button.on { background: var(--accent); color: #fff; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(18, 19, 28, .96); border-top: 1px solid var(--line); }
.bottomnav a { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; color: var(--faint); font-weight: 700; }
.bottomnav a .ico { font-size: 19px; line-height: 1; }
.bottomnav a.on { color: var(--text); }
main { max-width: var(--maxw); margin: 0 auto; padding: 16px var(--gutter) calc(var(--nav-h) + 28px); }
@media (min-width: 900px) { .topnav { display: flex; } .bottomnav { display: none; } main { padding-bottom: 48px; } }

/* ---------- common ---------- */
h1 { font-size: 24px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 8px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.section { margin: 26px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.section-head a { font-size: 13px; color: var(--muted); font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 700; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: #46507a; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.brand { background: var(--brand); border-color: transparent; color: #12131c; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.on { background: #2e2a55; border-color: var(--accent); color: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.tag { font-size: 12px; color: var(--accent); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 14px; }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
input[type=text], input[type=search], input[type=email], input[type=password], select, textarea { width: 100%; min-height: 40px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); }
textarea { resize: vertical; min-height: 84px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- gate ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter); background: radial-gradient(1200px 600px at 20% -10%, #2b2650, transparent), radial-gradient(900px 500px at 110% 110%, #11373a, transparent), var(--bg); }
.gate-card { width: min(520px, 100%); text-align: center; }
.gate .big { font-size: 46px; font-weight: 900; letter-spacing: -.03em; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate ul { text-align: left; padding: 0; list-style: none; margin: 22px 0; display: grid; gap: 10px; }
.gate li { padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.gate .btn { width: 100%; min-height: 50px; font-size: 16px; }
.gate-login { margin-top: 14px; text-align: left; }
.gate-login summary { cursor: pointer; color: var(--muted); font-weight: 700; text-align: center; padding: 8px; }
.gate-login .btn { min-height: 44px; font-size: 15px; }

/* ---------- works ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.wcard { display: block; overflow: hidden; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); transition: transform .12s; }
.wcard:hover { transform: translateY(-2px); border-color: #46507a; }
.wcard img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; background: var(--card2); }
.wcard .body { padding: 10px 11px 12px; }
.wcard .t { font-weight: 800; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wcard .d { margin-top: 3px; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wcard .meta { margin-top: 7px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--faint); }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 46%); gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.hscroll > * { scroll-snap-align: start; }
@media (min-width: 700px) { .hscroll { grid-auto-columns: minmax(180px, 23%); } }
.hero { position: relative; display: grid; grid-template-columns: 1fr; overflow: hidden; border-radius: 20px; border: 1px solid var(--line); background: var(--card); }
.hero img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.hero .over { padding: 16px; }
@media (min-width: 800px) { .hero { grid-template-columns: 1.2fr 1fr; } .hero img { aspect-ratio: auto; height: 100%; min-height: 320px; } .hero .over { padding: 28px; align-self: center; } }
.banner { padding: 12px 14px; border-radius: 12px; background: #2b2412; border: 1px solid #5a4b1d; color: #ffe6a8; font-size: 13.5px; }
.searchbox { position: relative; }
.ac { position: absolute; z-index: 20; top: 46px; left: 0; right: 0; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); overflow: hidden; }
.ac button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: transparent; }
.ac button:hover { background: var(--card); }
.filters { display: grid; gap: 10px; margin: 14px 0; }
.filters .lbl { font-size: 12px; color: var(--faint); font-weight: 700; margin-right: 4px; min-width: 52px; }

/* ---------- detail ---------- */
.detail-top { display: grid; gap: 16px; }
.detail-top img.cover { width: 100%; height: auto; border-radius: 18px; aspect-ratio: 2 / 3; object-fit: cover; border: 1px solid var(--line); }
@media (min-width: 860px) { .detail-top { grid-template-columns: 360px 1fr; gap: 28px; } }
.charlist { display: grid; gap: 10px; }
.charrow { display: flex; gap: 12px; align-items: flex-start; padding: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; background: var(--card2); border: 1px solid var(--line); object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; }
.level { font-size: 12px; font-weight: 800; color: var(--mint); }
.scenes { display: grid; gap: 10px; }
@media (min-width: 700px) { .scenes { grid-template-columns: repeat(2, 1fr); } }
.scene { padding: 14px; display: grid; gap: 10px; align-content: space-between; }
.scene .preview { font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.scene .preview i { color: var(--faint); }

/* ---------- chat ---------- */
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 56px - var(--nav-h)); margin: -16px calc(-1 * var(--gutter)) 0; }
main.chat-main { padding-bottom: 0; }
@media (min-width: 900px) { .chat-wrap { height: calc(100dvh - 56px); } main.chat-main { padding-bottom: 0; } }
@media (min-width: 1100px) { .chat-wrap { grid-template-columns: minmax(0, 1fr) 360px; } }
.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.chat-head { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter); border-bottom: 1px solid var(--line); background: var(--bg2); }
.chat-head .t { font-weight: 800; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .faces { display: flex; flex: none; }
.chat-head .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .chat-head .faces img:nth-child(n+2) { display: none; } }
.chat-head .faces img { margin-left: -8px; border: 2px solid var(--bg2); }
.chat-head .faces img:first-child { margin-left: 0; }
.msgs { overflow-y: auto; overflow-x: hidden; padding: 14px var(--gutter) 24px; display: grid; align-content: start; gap: 12px; scroll-behavior: smooth; }
.msg { display: grid; gap: 6px; }
.narr { text-align: center; color: var(--muted); font-style: italic; font-size: 14px; padding: 2px 12px; }
.line { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; }
.line .who { font-size: 12.5px; font-weight: 800; color: var(--accent); margin-bottom: 3px; }
.bubble { display: inline-block; max-width: 100%; padding: 9px 12px; border-radius: 4px 14px 14px 14px; background: var(--card); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.act { color: var(--faint); font-style: italic; }
.mine { justify-self: end; max-width: 86%; }
.mine .bubble { border-radius: 14px 4px 14px 14px; background: #2e2a55; border-color: #463f86; }
.msg-tools { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 46px; }
.msg-tools .btn { min-height: 28px; padding: 3px 9px; font-size: 12px; border-radius: 8px; }
.speak { min-height: 28px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); font-size: 12px; font-weight: 700; color: var(--muted); }
.speak.on { color: #12131c; background: var(--mint); border-color: transparent; }
.speak.done::after { content: " ✓"; }
.badge-demo { white-space: nowrap; align-self: center; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; color: #1b1530; background: var(--warn); margin-left: 6px; vertical-align: 1px; }
.intro-badge { justify-self: center; font-size: 11px; color: var(--faint); border: 1px dashed var(--line); padding: 1px 10px; border-radius: 999px; }
.cands { display: flex; align-items: center; gap: 6px; padding-left: 46px; font-size: 12.5px; color: var(--muted); }
.trans { margin-left: 46px; padding: 8px 10px; border-left: 3px solid var(--accent); background: rgba(155, 140, 255, .08); border-radius: 0 10px 10px 0; font-size: 13.5px; color: var(--muted); white-space: pre-wrap; }
.jl { margin-left: 46px; padding: 10px 12px; border-radius: 12px; background: rgba(94, 242, 194, .07); border: 1px solid #275c4f; font-size: 13px; display: grid; gap: 6px; }
.jl .vocab { display: flex; flex-wrap: wrap; gap: 6px; }
.jl .vocab span { padding: 2px 8px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); }
.pending .bubble { border-style: dashed; }
.mlist { display: grid; gap: 12px; align-content: start; }
.msg-tools.r { justify-content: flex-end; padding-left: 0; }
.cand-pick { display: grid; gap: 8px; margin-left: 46px; }
.cand { padding: 10px 12px; display: grid; gap: 6px; }
.cand.on { border-color: var(--accent); }
.cand-n { padding-left: 46px; }
.chat-foot { min-width: 0; }
.typing { color: var(--faint); font-size: 13px; padding-left: 46px; }
.status-bar { padding: 8px 12px; margin: 0 var(--gutter) 8px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.status-bar.warn { background: #3a2c12; color: #ffd98a; border: 1px solid #6a5420; }
.status-bar.ok { background: #12352d; color: #9ff5d7; border: 1px solid #2c6a5a; }
.composer { border-top: 1px solid var(--line); padding: 10px var(--gutter) 12px; background: var(--bg2); display: grid; gap: 8px; }
.composer .row textarea { min-height: 44px; max-height: 140px; height: 44px; }
.composer .tools { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.composer .tools::-webkit-scrollbar { display: none; }
.composer .tools > * { flex: none; }
.panel { display: none; min-height: 0; overflow-y: auto; background: var(--bg2); }
@media (min-width: 1100px) { .panel { display: block; } .tools-toggle { display: none !important; } }
.tabs { display: flex; gap: 4px; padding: 10px; position: sticky; top: 0; background: var(--bg2); border-bottom: 1px solid var(--line); z-index: 2; }
.tabs button { flex: 1; min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; }
.tabs button.on { background: var(--card2); color: var(--text); }
.panel-body { padding: 12px; display: grid; gap: 12px; }
.relcard { padding: 12px; display: grid; gap: 8px; }
.bar { height: 8px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.axes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.axes div { text-align: center; font-size: 10.5px; color: var(--faint); }
.axes b { display: block; font-size: 13px; color: var(--text); }
.gift-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- sheet (mobile tools, dialogs) ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55); display: grid; align-items: end; }
.sheet { max-height: 86dvh; overflow-y: auto; background: var(--bg2); border-radius: 18px 18px 0 0; border: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 900px) { .sheet-bg { align-items: center; justify-items: center; } .sheet { width: min(560px, 92vw); border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg2); z-index: 3; }

/* ---------- rooms list ---------- */
.roomrow { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px; }
.roomrow img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.roomrow .t { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roomrow .l { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; }
.form .two { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .form .two { grid-template-columns: 1fr 1fr; } }
.form > .btn.sm, .subcard > .btn.sm, .stack > .btn.sm { justify-self: start; }
.subcard { padding: 12px; display: grid; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px); z-index: 80; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
@media (min-width: 900px) { #toasts { bottom: auto; top: 68px; } }
.toast { padding: 11px 14px; border-radius: 12px; background: #2b2f45; border: 1px solid var(--line); font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); transition: opacity .4s; }
.toast-ok { border-color: #2c6a5a; } .toast-err { border-color: #7a2f3d; } .toast.out { opacity: 0; }

/* ---- shared states + site footer (feature views) */
.state { text-align: center; padding: 48px 16px; max-width: 520px; margin: 0 auto; }
.state h2 { margin: 0 0 8px; }
.state p { margin: 0 0 16px; }
.row.center { justify-content: center; }
.sitefoot { margin: 40px 0 8px; padding-top: 16px; border-top: 1px solid var(--line, #2a2c3a); text-align: center; }
.sitefoot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-bottom: 6px; }
.sitefoot a { color: var(--muted, #a3a6b8); font-size: 13px; text-decoration: none; }
.sitefoot a:hover { text-decoration: underline; }

/* ---- accounts / shop (views/account.js, views/shop.js) */
.narrow { max-width: 460px; margin: 0 auto; }
.social-list { display: grid; gap: 8px; }
.btn.social { width: 100%; min-height: 46px; font-size: 15px; border: 0; }
.btn.social.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.btn.social.kakao { background: #fee500; color: rgba(0, 0, 0, .85); }
.btn.social.naver { background: #03c75a; color: #fff; }
.btn.social.off { background: var(--card2); color: var(--faint); border: 1px dashed var(--line); }
.gate-social { margin-top: 14px; display: grid; gap: 8px; }
.gate-social .btn { min-height: 46px; font-size: 15px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { overflow-wrap: anywhere; }
.pill.prov.kakao { background: #fee500; color: #191600; border-color: transparent; }
.pill.prov.naver { background: #03c75a; color: #fff; border-color: transparent; }
.pill.prov.google { background: #fff; color: #1f1f1f; }
.pill.st-paid { background: var(--mint); color: #0b2a22; border-color: transparent; }
.pill.st-pending, .pill.st-created { background: var(--warn); color: #1b1530; border-color: transparent; }
.pill.st-failed, .pill.st-expired, .pill.st-canceled { color: var(--danger); }
.pill.st-refunded, .pill.st-partially_refunded { color: var(--accent); }
.danger-zone { border-color: #5a2633; }
.warn { color: var(--warn); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--faint); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.shop-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; }
.product .pieces { font-size: 18px; } .product .price { font-weight: 800; }
.stack.tight > * + * { margin-top: 2px; } .right { text-align: right; align-items: flex-end; }
.orow { color: inherit; text-decoration: none; display: flex; }
.stack.tight { display: flex; flex-direction: column; }

/* Shipped, pre-generated art. Videos load/play only on user request (also respects reduced motion). */
.intro-video { display: block; width: min(100%, 260px); aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; background: var(--card2); }
.lineup { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: var(--radius); margin-bottom: 14px; }
.scene-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; }
.msgs.scene-art { background-size: cover; background-position: center; }
.listening-cast { margin: 0; justify-self: center; text-align: center; font-size: 12px; color: var(--muted); }
.listening-video { display: block; width: 140px; height: 140px; object-fit: cover; border-radius: 18px; background: var(--card2); }
