/* PlayForge — warm cream light theme by default, Playground-like dark theme optional. */
@font-face { font-family: 'Silkscreen'; src: url('../fonts/silkscreen.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'FusionPixel'; src: url('../fonts/fusion-pixel-zh.woff2') format('woff2'); font-display: swap; unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF; }

:root {
  --page: #f3efe3;
  --surface: #faf7ee;
  --surface-2: #ede8d9;
  --surface-3: #e4ddca;
  --glass: rgba(250, 247, 238, 0.86);
  --ink: #403b30;
  --ink-2: #5b5546;
  --muted: #8b8375;
  --line: #e4ddca;
  --line-2: #cfc7b0;
  --accent: #6650c9;
  --accent-ink: #4b37a8;
  --accent-soft: #ebe4fb;
  --accent-line: #b9a8f0;
  --on-accent: #fbf9ff;
  --lime: #7fb03a;
  --danger: #c4483f;
  --danger-soft: #f7e1dc;
  --ok: #3f8f5a;
  --shadow: 0 1px 2px rgba(80, 70, 50, 0.05), 0 6px 24px rgba(80, 70, 50, 0.06);
  --shadow-lg: 0 10px 40px rgba(80, 70, 50, 0.14);
  --radius: 16px;
  --font: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --pixel: 'Silkscreen', 'FusionPixel', ui-monospace, monospace;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --page: #111014;
  --surface: #1c1b1e;
  --surface-2: #232226;
  --surface-3: #2b292d;
  --glass: rgba(28, 27, 30, 0.88);
  --ink: #e6e1e6;
  --ink-2: #cac4cc;
  --muted: #938f99;
  --line: #36343a;
  --line-2: #48464a;
  --accent: #cdbdff;
  --accent-ink: #cdbdff;
  --accent-soft: rgba(205, 189, 255, 0.12);
  --accent-line: #8056ff;
  --on-accent: #2b0a7a;
  --lime: #b5f25a;
  --danger: #ffb4ab;
  --danger-soft: rgba(255, 120, 100, 0.12);
  --ok: #8fd6a4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex-shrink: 0; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- shell */
.topbar { position: sticky; top: 0; z-index: 40; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--page); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font-family: var(--pixel); font-size: 22px; letter-spacing: 0.5px; }
.brand-badge { white-space: nowrap; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.app { display: flex; min-height: calc(100vh - 64px); }
.rail { position: sticky; top: 64px; align-self: flex-start; width: 104px; padding: 24px 12px; flex-shrink: 0; }
.rail-inner { display: flex; flex-direction: column; gap: 6px; padding: 18px 8px; border-radius: 40px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.rail-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: 0; background: none; border-radius: 16px; color: var(--ink-2); font-size: 12px; text-decoration: none; }
.rail-item .rail-ico { width: 56px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .2s; }
.rail-item:hover .rail-ico { background: var(--surface-2); }
.rail-item.active { color: var(--accent-ink); font-weight: 600; }
.rail-item.active .rail-ico { background: var(--accent-soft); color: var(--accent-ink); }
.main { flex: 1; min-width: 0; }
.footer { display: flex; align-items: center; gap: 16px; padding: 18px 28px; margin: 0 24px; border-top: 2px solid var(--line); color: var(--muted); font-size: 13px; }
.footer .spacer { flex: 1; }
.budget-left { font-family: var(--mono); font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.budget-banner { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; border-bottom: 1px solid var(--accent-line); text-align: center; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .2s, border-color .2s, transform .1s, box-shadow .2s, opacity .2s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 10px rgba(102, 80, 201, 0.25); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-tonal { background: var(--surface-2); color: var(--accent-ink); border-color: var(--line); }
.btn-tonal:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 28px; font-size: 15px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--ink-2); transition: background .2s, color .2s; position: relative; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn.filled { background: var(--surface-2); border-color: var(--line); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.sm { width: 32px; height: 32px; }
.text-btn { border: 0; background: none; color: var(--ink-2); padding: 4px 8px; border-radius: 6px; font-size: 13px; text-underline-offset: 4px; }
.text-btn:hover { color: var(--ink); text-decoration: underline; }
.chip-btn { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.chip-btn:hover { border-color: var(--line-2); color: var(--ink); }
.lang-btn { min-width: 40px; font-weight: 700; font-size: 13px; }

/* ---------------------------------------------------------------- home */
.home { position: relative; display: flex; flex-direction: column; align-items: center; padding: 48px 24px 180px; min-height: calc(100vh - 140px); overflow: hidden; }
.pixel-title { font-family: var(--pixel); font-weight: 400; text-transform: uppercase; text-align: center; font-size: 32px; line-height: 1.3; letter-spacing: 2px; margin: 0; color: var(--ink); }
:lang(zh-CN) .pixel-title { letter-spacing: 3px; font-size: 34px; }
.hero { transition: opacity .4s, max-height .4s, margin .4s, transform .4s; max-height: 200px; margin-bottom: 36px; }
.hero.hidden { opacity: 0; max-height: 0; margin: 0; transform: translateY(-12px); overflow: hidden; }
.composer { width: 100%; max-width: 780px; background: var(--glass); backdrop-filter: blur(20px); border: 1px solid var(--line-2); border-radius: 36px; padding: 24px 24px 16px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); transition: border-color .3s, box-shadow .3s; position: relative; z-index: 20; }
.composer.focused { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.composer textarea { width: 100%; min-height: 28px; max-height: 180px; border: 0; outline: 0; background: transparent; resize: none; font-size: 16px; line-height: 24px; color: var(--ink); padding: 0; field-sizing: content; }
.composer textarea::placeholder { color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-height: 40px; }
.composer-row .grow { flex: 1; }
.send-btn { width: 44px; height: 44px; border-radius: 999px; border: 0; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); transition: background .2s, color .2s, transform .1s; }
.send-btn.ready { background: var(--accent); color: var(--on-accent); }
.send-btn.ready:hover { filter: brightness(1.07); }
.send-btn:active { transform: scale(.94); }
.dice-btn { background: var(--surface-2); }
.dice-btn.rolling .icon { animation: roll .55s cubic-bezier(.3,.7,.4,1); }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(200deg) scale(1.2); } 100% { transform: rotate(360deg) scale(1); } }
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.segmented button.on { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
:root[data-theme='dark'] .segmented button.on { background: #111014; }
.dim-dot { width: 14px; height: 14px; position: relative; display: inline-block; }
.dim-dot::before { content: ''; position: absolute; left: 0; top: 0; width: 8px; height: 8px; border-radius: 2px; background: #8056ff; }
.dim-dot::after { content: ''; position: absolute; right: 0; bottom: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }
.dim-dot.d3::before { transform: skewY(-20deg); }
.genre-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 14px; font-weight: 500; align-self: flex-start; margin-top: -6px; }
.genre-chip button { border: 0; background: none; padding: 0; color: var(--muted); display: grid; }
.attach-preview { display: flex; align-items: center; gap: 10px; align-self: flex-start; margin-top: -6px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.attach-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.home-links { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 28px; transition: opacity .4s; }
.home-links.hidden { opacity: 0; pointer-events: none; }
.guide-pill { display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--glass); color: var(--accent-ink); font-weight: 600; font-size: 14px; transition: border-color .2s, transform .2s, box-shadow .2s; }
.guide-pill:hover { border-color: var(--accent-line); transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-soft); }
.suggestions { width: 100%; max-width: 780px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.suggestion { display: inline-flex; align-items: flex-start; gap: 8px; align-self: flex-start; max-width: 100%; padding: 7px 14px 7px 10px; border-radius: 16px; border: 1px solid var(--line-2); background: transparent; text-align: left; font-size: 14px; color: var(--ink-2); animation: rise .35s both; }
.suggestion:hover { border-color: var(--accent-line); background: var(--surface); color: var(--ink); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.prompt-source { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.fan { position: absolute; left: 50%; bottom: -60px; transform: translateX(-50%); width: 820px; height: 240px; pointer-events: none; transition: opacity .4s; }
.fan.hidden { opacity: 0; }
.fan-card { position: absolute; left: 50%; bottom: 0; width: 132px; height: 180px; margin-left: -66px; border-radius: 14px; border: 1px solid var(--accent-line); background: var(--surface); box-shadow: var(--shadow); transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.3,.8,.3,1.2); pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; cursor: pointer; }
.fan-card img { width: 78px; height: 78px; object-fit: contain; image-rendering: pixelated; }
.fan-card span { font-size: 13px; font-weight: 600; color: var(--accent-ink); text-align: center; }
.fan-card:hover { z-index: 5; }

/* ---------------------------------------------------------------- dropdown */
.dd-wrap { position: relative; }
.dropdown { position: absolute; top: calc(100% + 8px); min-width: 240px; padding: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); z-index: 60; animation: pop .15s ease-out; }
.dropdown-up { top: auto; bottom: calc(100% + 8px); }
.dropdown-left { left: 0; }
.dropdown-right { right: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dd-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.dd-item:hover { background: var(--surface-2); }
.dd-item .dd-text { display: flex; flex-direction: column; gap: 2px; }
.dd-item .dd-title { font-size: 14px; font-weight: 600; }
.dd-item .dd-sub { font-size: 12px; color: var(--muted); }
.dd-item .dd-check { margin-left: auto; color: var(--accent-ink); }

/* ---------------------------------------------------------------- modal / confirm / toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(40, 34, 24, 0.32); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
:root[data-theme='dark'] .modal-backdrop { background: rgba(0, 0, 0, 0.55); }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-lg); padding: 24px; animation: pop .2s ease-out; }
.modal-wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 18px; flex: 1; }
.confirm { text-align: center; }
.confirm-icon { width: 56px; height: 56px; margin: 4px auto 14px; display: grid; place-items: center; border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); }
.confirm-title { margin: 0 0 8px; font-size: 22px; font-weight: 500; }
.confirm-desc { margin: 0 0 22px; color: var(--ink-2); font-size: 14px; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 18px; border-radius: 12px; background: var(--ink); color: var(--page); font-size: 14px; box-shadow: var(--shadow-lg); animation: rise .25s; max-width: min(560px, 90vw); }
.toast-error { background: var(--danger); color: #fff; }

/* ---------------------------------------------------------------- genre modal */
.genre-modal { position: fixed; inset: 0; z-index: 90; background: var(--page); display: flex; flex-direction: column; align-items: center; padding: 40px 24px; overflow: auto; animation: fade .25s; }
.genre-modal .close { position: absolute; top: 20px; right: 24px; }
.carousel { width: 100%; max-width: 1080px; overflow: hidden; margin-top: 36px; }
.carousel-track { display: flex; gap: 20px; transition: transform .45s cubic-bezier(.3,.8,.3,1); padding: 10px 4px 18px; }
.genre-card { flex: 0 0 calc((100% - 60px) / 4); aspect-ratio: 3 / 4.3; border-radius: 18px; border: 1px solid var(--accent-line); background: var(--surface); padding: 20px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; text-align: left; position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; }
.genre-card:hover { transform: translateY(-6px); box-shadow: 0 10px 30px var(--accent-soft); border-color: var(--accent); }
.genre-card .art { position: absolute; inset: 0 0 34% 0; display: grid; place-items: center; }
.genre-card .art img { width: 62%; max-height: 80%; object-fit: contain; image-rendering: pixelated; transition: transform .3s; }
.genre-card:hover .art img { transform: scale(1.08) rotate(-3deg); }
.genre-card .art .glow { position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%; filter: blur(30px); opacity: .35; }
.genre-card h3 { margin: 0; font-size: 20px; font-weight: 500; color: var(--accent-ink); position: relative; }
.genre-card p { margin: 0; font-size: 14px; min-height: 2.9em; color: var(--ink-2); position: relative; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.carousel-nav { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.dots { display: flex; gap: 8px; }
.dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; padding: 0; background: var(--line-2); }
.dots button.on { background: var(--accent); transform: scale(1.15); }
.round-nav { width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.round-nav:disabled { opacity: .3; }

/* ---------------------------------------------------------------- guide */
.guide { display: flex; flex-direction: column; align-items: center; padding: 24px 24px 80px; min-height: calc(100vh - 64px); }
.guide-top { width: 100%; max-width: 1200px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.guide-top .left { display: flex; gap: 8px; }
.guide-top .right { display: flex; justify-content: flex-end; }
.stepper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: 14px; color: var(--muted); }
.stepper .st { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 2px; color: inherit; }
.stepper .num { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; border: 1px solid var(--line-2); }
.stepper .st.done { color: var(--ink-2); }
.stepper .st.done .num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stepper .st.on { color: var(--ink); font-weight: 600; }
.stepper .st.on .num { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.stepper .sep { width: 14px; height: 1px; background: var(--line-2); }
.guide-q { margin: 56px 0 8px; font-size: 26px; }
.guide-sub { color: var(--accent-ink); margin: 0 0 32px; font-size: 15px; text-align: center; }
.deck { width: 100%; max-width: 1240px; display: flex; gap: 22px; overflow-x: auto; padding: 8px 4px 22px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.deck-card { flex: 0 0 240px; scroll-snap-align: start; border-radius: 4px; border: 1px solid var(--accent-line); background: var(--surface); text-align: left; padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s, box-shadow .25s, opacity .25s, border-color .25s; }
.deck-card:hover { transform: translateY(-6px); box-shadow: 0 10px 28px var(--accent-soft); }
.deck-card .img { aspect-ratio: 1 / 0.9; background: var(--surface-2); overflow: hidden; position: relative; }
.deck-card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.deck-card .img .emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; }
.deck-card .body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 130px; }
.deck-card h4 { margin: 0; font-size: 19px; font-weight: 500; color: var(--accent-ink); }
.deck-card p { margin: 0; font-size: 14px; color: var(--ink-2); }
.deck.has-pick .deck-card:not(.picked) { opacity: .5; }
.deck-card.picked { border: 2px solid var(--accent); box-shadow: 0 8px 26px var(--accent-soft); }
.deck-card.custom .img { display: grid; place-items: center; background: repeating-linear-gradient(0deg, var(--surface-2) 0 31px, var(--line) 31px 32px), repeating-linear-gradient(90deg, transparent 0 31px, var(--line) 31px 32px); }
.custom-plus { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; background: var(--surface); border: 2px dashed var(--accent-line); color: var(--accent-ink); }
.guide-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.hand { position: relative; height: 230px; width: 100%; max-width: 760px; margin-top: 24px; }
.hand-card { position: absolute; left: 50%; bottom: 0; width: 210px; border-radius: 6px; overflow: hidden; background: var(--surface); border: 1px solid var(--accent-line); box-shadow: var(--shadow); transition: transform .45s cubic-bezier(.3,.9,.3,1.15); animation: deal .45s both; }
@keyframes deal { from { transform: translate(-50%, 80px) rotate(0) !important; opacity: 0; } }
.hand-card .img { height: 120px; background: var(--surface-2); }
.hand-card .img img { width: 100%; height: 100%; object-fit: cover; }
.hand-card .img .emoji { height: 100%; display: grid; place-items: center; font-size: 46px; }
.hand-card .lbl { padding: 8px 12px 14px; }
.hand-card .lbl small { display: block; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.hand-card .lbl b { display: block; font-size: 13px; color: var(--accent-ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-row { width: 100%; max-width: 1240px; display: flex; gap: 20px; overflow-x: auto; padding: 8px 4px 22px; }
.review-card { flex: 0 0 300px; border: 1px solid var(--accent-line); border-radius: 6px; background: var(--surface); text-align: left; padding: 0; overflow: hidden; }
.review-card .img { height: 220px; background: var(--surface-2); }
.review-card .img img { width: 100%; height: 100%; object-fit: cover; }
.review-card .img .emoji { height: 100%; display: grid; place-items: center; font-size: 72px; }
.review-card .body { padding: 16px; }
.review-card small { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.review-card h4 { margin: 6px 0; font-size: 18px; font-weight: 500; color: var(--accent-ink); }
.review-card p { margin: 0; font-size: 13px; color: var(--ink-2); }
.review-card:hover { border-color: var(--accent); }
.custom-modal { max-width: 420px; text-align: left; }
.custom-modal textarea { width: 100%; min-height: 120px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface-2); padding: 12px 14px; resize: vertical; outline: none; }
.custom-modal textarea:focus { border-color: var(--accent); }
.custom-modal .prefix { font-size: 18px; margin: 4px 0 10px; }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin-top: 6px; }
.ready-box { width: 100%; max-width: 680px; }
.ready-box .composer textarea { max-height: 260px; }

/* ---------------------------------------------------------------- studio */
.studio { display: grid; grid-template-columns: 420px 1fr; height: calc(100vh - 64px); }
.studio.collapsed { grid-template-columns: 56px 1fr; }
.chat-panel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--page); position: relative; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 60px; }
.chat-head h2 { margin: 0; font-size: 20px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--mono); font-size: 10px; letter-spacing: .6px; color: var(--ink-2); white-space: nowrap; }
.mode-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg-user { align-self: stretch; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 14px 18px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg-user.clamp { max-height: 140px; overflow: hidden; position: relative; }
.msg-user.clamp::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(transparent, var(--surface-2)); }
.msg-time { font-size: 11px; color: var(--muted); text-align: right; margin-top: -8px; }
.msg-ai { font-size: 14px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.msg-ai .md { white-space: normal; }
.msg-ai .md p { margin: 0 0 6px; }
.msg-ai .md code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.msg-ai .tag { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.msg-sys { font-size: 12px; color: var(--muted); padding: 8px 12px; border-left: 3px solid var(--line-2); background: var(--surface); border-radius: 0 10px 10px 0; white-space: pre-wrap; max-height: 160px; overflow: auto; }
.msg-sys.error { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.msg-version { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-family: var(--mono); color: var(--accent-ink); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; margin-top: 6px; }
.plan-list { margin: 6px 0 0; padding-left: 18px; }
.plan-list li { margin: 3px 0; }
.status-line { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; }
.gdd-card { border: 1px solid var(--line-2); background: var(--surface); border-radius: 24px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.gdd-card .head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.gdd-card .title { font-size: 20px; font-weight: 600; margin: -4px 0 0; }
.gdd-card .tagline { font-size: 13px; color: var(--ink-2); margin-top: -6px; }
.gdd-row { display: flex; gap: 10px; font-size: 13px; line-height: 1.55; }
.gdd-row .ico { width: 20px; flex-shrink: 0; text-align: center; }
.gdd-row b { font-weight: 600; margin-right: 4px; }
.gdd-card hr { border: 0; border-top: 1px dashed var(--line-2); margin: 2px 0; width: 100%; }
.asset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.asset-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 4px; border-radius: 10px; border: 1px dashed var(--line-2); background: var(--surface-2); font-size: 13px; max-width: 100%; }
.asset-chip .thumb { width: 28px; height: 28px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.asset-chip .thumb img { width: 100%; height: 100%; object-fit: contain; }
.asset-chip.ready { border-style: solid; }
.asset-chip.generating .thumb { animation: pulse 1.2s infinite; }
.asset-chip.error { border-color: var(--danger); }
@keyframes pulse { 50% { opacity: .4; } }
.chat-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 10px 16px 0; }
.chat-input-wrap { padding: 10px 16px 16px; }
.chat-input { border: 1px solid var(--line-2); background: var(--surface); border-radius: 28px; padding: 16px 16px 12px 20px; display: flex; flex-direction: column; gap: 10px; transition: border-color .2s, box-shadow .2s; }
.chat-input.focused { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-input textarea { border: 0; outline: 0; background: transparent; resize: none; min-height: 44px; max-height: 160px; font-size: 15px; padding: 0; field-sizing: content; }
.chat-input .row { display: flex; align-items: center; gap: 6px; }
.chat-input .row .grow { flex: 1; }
.chat-disclaimer { font-size: 11px; color: var(--muted); margin: 8px 4px 0; }
.collapse-btn { position: absolute; right: -16px; top: 50%; z-index: 5; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); }
.collapsed-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0; }

.preview { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 22px 22px, var(--page); }
.preview-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 60px; }
.preview-bar .grow { flex: 1; }
.phases { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; backdrop-filter: blur(8px); }
.phases .ph { display: inline-flex; align-items: center; gap: 5px; }
.phases .ph .n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; border: 1px solid var(--line-2); }
.phases .ph.done { color: var(--ink-2); }
.phases .ph.done .n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.phases .ph.on { color: var(--ink); font-weight: 600; }
.phases .ph.on .n { border-color: var(--accent); color: var(--accent-ink); animation: pulse 1.4s infinite; }
.phases .sep { width: 10px; height: 1px; background: var(--line-2); }
.stage { position: relative; flex: 1; min-height: 0; margin: 0 16px 0; border-radius: 16px; overflow: hidden; background: #0b0a0d; border: 1px solid var(--line); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.stage-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: #f3efe3; overflow: hidden; }
.stage-overlay .bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(22px) brightness(.55); transform: scale(1.05); }
.stage-overlay .content { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 24px; max-width: 640px; }
.stage-overlay .label { font-family: var(--pixel); font-size: 22px; letter-spacing: 2px; text-transform: uppercase; }
.bar { width: 260px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; position: relative; }
.bar i { position: absolute; top: 0; bottom: 0; width: 30%; border-radius: 4px; background: #cdbdff; animation: slide 1.4s ease-in-out infinite; }
.bar.det i { animation: none; left: 0; transition: width .5s; }
@keyframes slide { 0% { left: -30%; } 100% { left: 100%; } }
.fun-line { font-size: 14px; opacity: .8; min-height: 20px; }
.code-stream { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: rgba(205,189,255,.75); white-space: pre-wrap; text-align: left; max-height: 120px; overflow: hidden; width: min(560px, 80vw); mask-image: linear-gradient(transparent, #000 40%); }
.placeholder-grid { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(var(--surface-3) 1px, transparent 1px) 0 0 / 80px 80px, linear-gradient(90deg, var(--surface-3) 1px, transparent 1px) 0 0 / 80px 80px, var(--surface-2); }
.placeholder-grid .brand-name { font-size: 48px; color: var(--ink); opacity: .85; }
.console { margin: 8px 16px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.console-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; }
.console-head .count { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 10px; }
.console-body { max-height: 180px; overflow: auto; padding: 4px 10px 8px; font-family: var(--mono); font-size: 12px; border-top: 1px solid var(--line); }
.console-line { padding: 2px 0; white-space: pre-wrap; word-break: break-all; color: var(--ink-2); }
.console-line.error { color: var(--danger); }
.console-line.warn { color: #b7791f; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.asset-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); overflow: hidden; display: flex; flex-direction: column; }
.asset-card .art { height: 150px; display: grid; place-items: center; background: conic-gradient(var(--surface-3) 25%, var(--surface) 0 50%, var(--surface-3) 0 75%, var(--surface) 0) 0 0 / 16px 16px; position: relative; }
.asset-card .art img { max-width: 90%; max-height: 132px; object-fit: contain; }
.asset-card .art img.bg { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.asset-card .art audio { width: 90%; }
.asset-card .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.asset-card .meta b { font-size: 14px; }
.asset-card .meta code { font-size: 11px; color: var(--muted); }
.asset-card textarea { width: 100%; min-height: 70px; font-size: 12px; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px; background: var(--surface); resize: vertical; }
.asset-card .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.form input, .form textarea, .form select { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); outline: none; }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--accent); }
.form textarea { min-height: 72px; resize: vertical; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.code-modal { display: grid; grid-template-columns: 240px 1fr; gap: 0; height: min(76vh, 760px); padding: 0; }
.code-modal .tree { border-right: 1px solid var(--line); padding: 12px 8px; overflow: auto; background: var(--surface-2); }
.code-modal .tree button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; border-radius: 8px; background: none; font-family: var(--mono); font-size: 12px; text-align: left; color: var(--ink-2); }
.code-modal .tree button.on, .code-modal .tree button:hover { background: var(--surface-3); color: var(--ink); }
.code-modal .tree .dir { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 10px 10px 4px; display: flex; gap: 6px; align-items: center; }
.code-modal .viewer { display: flex; flex-direction: column; min-width: 0; }
.code-modal .viewer-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.code-modal pre { margin: 0; flex: 1; overflow: auto; padding: 14px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.55; background: var(--surface); color: var(--ink); white-space: pre; tab-size: 2; }
.code-modal .img-view { flex: 1; display: grid; place-items: center; overflow: auto; background: conic-gradient(var(--surface-3) 25%, var(--surface) 0 50%, var(--surface-3) 0 75%, var(--surface) 0) 0 0 / 16px 16px; }
.code-modal .img-view img { max-width: 92%; max-height: 92%; }
.side-sheet { position: absolute; top: 60px; right: 16px; bottom: 16px; width: 340px; z-index: 30; background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .2s; }
.side-sheet .sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-sheet .sheet-head h3 { margin: 0; font-size: 16px; flex: 1; }
.side-sheet .sheet-body { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.side-sheet .sheet-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.slider { display: flex; flex-direction: column; gap: 6px; }
.slider .lbl { display: flex; justify-content: space-between; font-size: 13px; }
.slider .lbl span:last-child { font-family: var(--mono); color: var(--accent-ink); }
.slider input[type=range] { width: 100%; accent-color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.version { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.version.cur { border-color: var(--accent-line); background: var(--accent-soft); }
.version .vn { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent-ink); min-width: 28px; }
.version .vbody { flex: 1; min-width: 0; font-size: 13px; }
.version .vbody small { color: var(--muted); display: block; }
.version .vnote { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-box { display: flex; gap: 8px; }
.share-box input { flex: 1; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; }

/* ---------------------------------------------------------------- my games + play */
.games-sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 95; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .25s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.games-sheet .list { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.game-row { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; color: inherit; }
.game-row:hover { border-color: var(--accent-line); }
.game-row .th { width: 96px; height: 54px; border-radius: 10px; background: var(--surface-3); overflow: hidden; flex-shrink: 0; }
.game-row .th img { width: 100%; height: 100%; object-fit: cover; }
.game-row .info { flex: 1; min-width: 0; }
.game-row .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.game-row .info small { color: var(--muted); font-size: 12px; }
.play-page { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; }
.play-page iframe { flex: 1; border: 0; width: 100%; }
.play-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--page); border-bottom: 1px solid var(--line); }
.play-bar b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center-msg { min-height: 60vh; display: grid; place-items: center; text-align: center; gap: 12px; }

.spinner { display: inline-block; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .composer-row .prompt-source { display: none; }
}
@media (max-width: 1100px) {
  .genre-card { flex-basis: calc((100% - 40px) / 3); }
  .studio { grid-template-columns: 360px 1fr; }
}
@media (max-width: 860px) {
  .rail { display: none; }
  .topbar { padding: 0 14px; }
  .home { padding: 28px 14px 150px; }
  .pixel-title { font-size: 22px; }
  :lang(zh-CN) .pixel-title { font-size: 24px; }
  .composer { padding: 18px 14px 12px; border-radius: 28px; }
  .composer-row { gap: 6px; flex-wrap: wrap; }
  .segmented button span.lbl { display: none; }
  .genre-card { flex-basis: calc((100% - 20px) / 2); }
  .fan { width: 420px; bottom: -90px; }
  .fan-card { width: 110px; height: 150px; margin-left: -55px; }
  .fan-card img { width: 56px; height: 56px; }
  .studio { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: calc(100vh - 64px); }
  .studio .preview { order: -1; height: 62vh; }
  .chat-panel { border-right: 0; border-top: 1px solid var(--line); min-height: 60vh; }
  .collapse-btn { display: none; }
  .guide-top { grid-template-columns: 1fr auto; }
  .guide-top .stepper { grid-column: 1 / -1; grid-row: 2; }
  .deck-card { flex-basis: 200px; }
  .code-modal { grid-template-columns: 1fr; grid-template-rows: 160px 1fr; }
  .code-modal .tree { border-right: 0; border-bottom: 1px solid var(--line); }
  .side-sheet { left: 12px; right: 12px; width: auto; }
  .footer { flex-wrap: wrap; margin: 0 12px; }
}
@media (max-width: 600px) {
  .fan { display: none; }
  .home { padding-bottom: 60px; min-height: auto; }
  .brand-name { font-size: 18px; }
  .composer-row .grow { display: none; }
  .composer-row .send-btn { margin-left: auto; }
  .chip-btn span { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .guide-q { font-size: 20px; margin-top: 32px; }
  .hand { display: none; }
  .deck-card { flex-basis: 72vw; }
  .review-card { flex-basis: 72vw; }
  .footer span:last-child { display: none; }
  .preview-bar { flex-wrap: wrap; padding: 8px 10px; gap: 2px; min-height: 52px; }
  .preview-bar .icon-btn { width: 36px; height: 36px; }
  .preview-bar .share-btn .lbl { display: none; }
  .preview-bar .share-btn { padding: 0 10px; }
  .stage { margin: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
