/* دفورا — dark game-platform look (after Rosebud / Bitmagic), motion from the Apple Design skill (app.js),
   polish rules from better-ui / better-typography / better-layout, timing tokens from animate + motion-choreography. */

@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn[wght].woff2") format("woff2-variations"), url("/static/fonts/Vazirmatn[wght].woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --font: "Vazirmatn", -apple-system, system-ui, sans-serif;
  --bg: #0b0a14; --bg-2: #12111d; --surface: #181726; --surface-2: #211f33; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
  --label: #f4f2ff; --label-2: rgba(244,242,255,.62); --label-3: rgba(244,242,255,.34);
  --accent: #a855f7; --accent-2: #ec4899; --accent-ink: #fff; --glow: rgba(168,85,247,.45);
  --green: #34d399; --red: #fb7185; --orange: #fbbf24; --teal: #22d3ee;
  --bubble: #262439; --bubble-ink: #f4f2ff;
  --bar: rgba(11,10,20,.72); --bar-edge: rgba(255,255,255,.08);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.6); --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.8);
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px; /* concentric radii: outer = inner + padding (better-ui) */
  --nav-h: 60px; --tab-h: 56px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* ===== Verbatim from the Apple Design skill ===== */
:root { font: 100%/1.5 var(--font); }
.display { font-size: clamp(2rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -0.02em; font-optical-sizing: auto; }
.button:active { transform: scale(0.97); transition: transform 100ms ease-out; }
.toolbar { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border-top: 1px solid rgba(255, 255, 255, 0.4); }
@media (prefers-color-scheme: dark) { .toolbar { background: rgba(28, 28, 30, 0.6); border-top-color: rgba(255, 255, 255, 0.12); } }
@media (prefers-reduced-motion: reduce) { .sheet { transition: opacity 200ms ease; transform: none !important; } }
@media (prefers-reduced-transparency: reduce) { .toolbar { background: white; backdrop-filter: none; -webkit-backdrop-filter: none; } }
/* dark product: the toolbar material is the site's own ink */
.toolbar { background: var(--bar); border-top: 0; border-bottom: 1px solid var(--bar-edge); }
@media (prefers-reduced-transparency: reduce) { .toolbar { background: var(--bg); } }

/* ===== Base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--label); font-size: 16px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; overscroll-behavior-y: none; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
[data-press] { user-select: none; -webkit-user-select: none; }
.button { transform: scale(1); transition: transform 160ms var(--ease-out); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.display { font-weight: 800; margin: 0; }
.display.small { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
.lede { color: var(--label-2); font-size: 17px; line-height: 1.6; margin: 12px 0 0; }
.lede a { color: var(--accent); font-weight: 600; }
.section-title { margin: 36px 0 14px; display: flex; align-items: baseline; justify-content: space-between; }
.section-title h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.section-title a { color: var(--accent); font-size: 15px; font-weight: 600; padding: 6px 10px; border-radius: var(--r-sm); min-height: 36px; display: inline-flex; align-items: center; }
.empty { color: var(--label-2); text-align: center; padding: 48px 0; }
.empty a { color: var(--accent); }

/* ===== Navigation ===== */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
.navbar-inner { position: relative; height: var(--nav-h); width: min(1240px, 100% - 32px); margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.wordmark { grid-column: 1; justify-self: start; display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.segmented { grid-column: 2; position: relative; display: flex; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.segmented a { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; padding: 7px 18px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--label-2); min-height: 36px; }
.segmented a.on { color: #fff; }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px -6px var(--glow); will-change: transform, width; }
.nav-end { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--label-2); font-size: 15px; font-weight: 600; padding: 8px 10px; border-radius: var(--r-sm); }
.back svg { transform: scaleX(-1); }
.nav-login { color: var(--label); font-weight: 600; font-size: 14px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-2); min-height: 38px; display: inline-flex; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 15px; display: grid; place-items: center; }
.menu { position: fixed; z-index: 60; min-width: 250px; max-width: calc(100vw - 16px); padding: 6px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); transform-origin: top right; will-change: transform, opacity; }
.menu-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .menu-head small { display: block; color: var(--label-2); font-size: 12px; margin-top: 2px; white-space: nowrap; }
.menu a, .menu button { display: block; width: 100%; text-align: start; padding: 10px 12px; border-radius: 9px; font-size: 15px; min-height: 40px; }
.menu a:hover, .menu button:hover { background: rgba(255,255,255,.06); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: none; grid-template-columns: 1fr 1fr 1fr; border-top: 1px solid var(--bar-edge); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--label-2); min-height: 44px; }
.tabbar a svg { transition: transform 200ms var(--ease-out); }
.tabbar a.on { color: var(--accent); }
.tabbar a.on svg { transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 4px 10px var(--glow)); }
@media (max-width: 720px) {
  .tabbar { display: grid; }
  .segmented { display: none; }
  .navbar-inner { grid-template-columns: 1fr auto; }
  .nav-end { grid-column: 2; }
  body.detail .tabbar { display: none; }
  body.detail { padding-bottom: 0; }
  .auth-page .display { font-size: 1.9rem; }
}
@media (min-width: 721px) { body { padding-bottom: 56px; } }

/* ===== Content ===== */
.view { width: min(1240px, 100% - 32px); margin: 0 auto; padding-top: calc(var(--nav-h) + env(safe-area-inset-top)); }
.page { padding-bottom: 24px; }

/* Hero: the prompt sits on a synthwave horizon — the one signature moment on the page */
.hero { position: relative; margin: 0 calc(50% - 50vw); padding: 64px 16px 56px; overflow: hidden; isolation: isolate; }
.horizon { position: absolute; inset: 0; z-index: -1; background: radial-gradient(90% 60% at 50% 100%, #3b1d6e 0%, #1a1030 45%, var(--bg) 100%); }
.horizon .sun { position: absolute; left: 50%; bottom: 38%; width: 46vmin; height: 46vmin; transform: translate(-50%, 50%); border-radius: 50%; background: radial-gradient(circle at 50% 40%, #ff7ad9 0%, #b04cff 45%, transparent 70%); filter: blur(40px); opacity: .5; }
.horizon .grid { position: absolute; left: -20%; right: -20%; bottom: -2px; height: 46%; transform-origin: 50% 100%; transform: perspective(520px) rotateX(62deg);
  background-image: linear-gradient(to right, rgba(216,180,254,.22) 1px, transparent 1px), linear-gradient(to bottom, rgba(216,180,254,.22) 1px, transparent 1px);
  background-size: 60px 60px; -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 100%); mask-image: linear-gradient(to top, #000 10%, transparent 100%);
  animation: gridflow 3s linear infinite; }
@keyframes gridflow { from { background-position: 0 0; } to { background-position: 0 60px; } }
@media (prefers-reduced-motion: reduce) { .horizon .grid { animation: none; } }
.hero-inner { width: min(760px, 100%); margin: 0 auto; text-align: center; }
.hero .display { font-size: clamp(2.1rem, 5.2vw, 3.6rem); }
.hero .lede { margin-top: 12px; }

.composer { margin: 26px auto 0; text-align: start; background: rgba(24,23,38,.78); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 14px 16px 12px; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(168,85,247,.08), 0 0 80px -20px var(--glow); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-2)); box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 80px -20px var(--glow); }
.composer textarea { width: 100%; resize: none; border: 0; background: transparent; padding: 4px 2px; font-size: 18px; line-height: 1.6; outline: none; min-height: 84px; }
.composer textarea::placeholder { color: var(--label-3); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 12px; scrollbar-width: none; cursor: grab; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.chips.dragging { cursor: grabbing; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 36px; padding: 7px 14px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--label-2); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background 160ms var(--ease-out), color 160ms var(--ease-out); }
.chip:hover { background: rgba(168,85,247,.16); color: var(--label); }
.composer-foot { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.engine { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.05); }
.engine .button { padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--label-2); min-height: 32px; }
.engine .button.on { background: rgba(255,255,255,.1); color: var(--label); }
.counter { margin-inline-start: auto; font-size: 12px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.btn-primary { display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 700; font-size: 16px; padding: 10px 22px; border-radius: 12px; min-height: 44px; box-shadow: 0 10px 24px -10px var(--glow); }
.btn-primary[disabled] { opacity: .45; pointer-events: none; }
.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 18px 0 0; font-size: 13px; color: var(--label-2); }
.stats b { color: var(--label); font-weight: 700; }
.stats i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-inline-end: 6px; box-shadow: 0 0 10px var(--red); }

.gate { margin: 12px 0 0; font-size: 14px; color: var(--label-2); text-align: center; }
.gate a { color: var(--accent); font-weight: 700; }
.btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 12px; border: 1px solid var(--line-2); color: var(--label); font-weight: 600; min-height: 44px; }

/* Account */
#view-me { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 24px); }
.me-out { text-align: center; max-width: 520px; margin: 0 auto; padding: 24px 0; }
.me-art { width: min(300px, 80%); height: auto; margin: 0 auto 10px; display: block; }
.me-cta { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.me-card { display: flex; align-items: center; gap: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg), 0 0 80px -30px var(--glow); }
.me-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff; flex: 0 0 auto; }
.me-id { flex: 1; min-width: 0; }
.me-id h1 { margin: 0; font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-id p { margin: 2px 0 0; color: var(--label-2); font-size: 14px; text-align: start; }
.me-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.me-stats > div { position: relative; padding: 14px 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.me-stats b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.me-stats span { display: block; font-size: 12px; color: var(--label-2); margin-top: 4px; }
.me-stats .bar { position: absolute; left: 14px; right: 14px; bottom: 10px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.me-stats .bar em { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 500ms var(--ease-out); }
@media (max-width: 720px) {
  .me-stats { grid-template-columns: repeat(2, 1fr); }
  .me-card { flex-wrap: wrap; } .me-card .btn-ghost { width: 100%; }
}

/* Templates */
.panel { margin-top: 28px; padding: 26px 22px 22px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 24px; }
.panel-title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; text-align: center; }
.panel-sub { margin: 6px 0 20px; color: var(--label-2); text-align: center; font-size: 15px; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 14px; }
@media (max-width: 720px) {
  .templates { grid-template-columns: repeat(2, 1fr); gap: 10px; } .tpl .art { font-size: 44px; } .panel { padding: 20px 14px 16px; border-radius: 18px; }
  .hero { padding: 36px 14px 40px; }
  .hero .display { font-size: 2rem; }
  .composer { padding: 12px 12px 10px; }
  .composer textarea { font-size: 16px; min-height: 72px; }
  .composer-foot { gap: 8px; }
  .engine { width: 100%; justify-content: space-between; }
  .engine .button { flex: 1; text-align: center; }
  .counter { order: 3; }
  .composer-foot .btn-primary { order: 2; flex: 1; justify-content: center; }
  .stats { gap: 6px 14px; font-size: 12px; }
  .actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .action { padding: 10px 4px; font-size: 11px; }
  .stage-meta { flex-wrap: wrap; white-space: normal; gap: 8px 14px; }
  .section-title { margin: 28px 0 12px; } .section-title h2 { font-size: 19px; }
  .rail .card { flex-basis: 200px; }
  .assets { grid-template-columns: repeat(2, 1fr); }
  .genres { padding-top: 12px; }
}
.tpl { position: relative; aspect-ratio: 1 / 1; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); display: flex; align-items: flex-end; padding: 12px; color: #fff; text-align: start; isolation: isolate; transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
.tpl::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--tpl-bg); }
.tpl::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(0,0,0,.65), transparent 60%); }
.tpl .art { position: absolute; top: 10%; left: 50%; transform: translateX(-50%); font-size: clamp(52px, 8vw, 84px); line-height: 1; filter: drop-shadow(0 12px 24px rgba(0,0,0,.45)); }
.tpl img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; transition: transform 500ms var(--ease-out); }
.tpl:has(img) .art { display: none; }
.tpl:hover img { transform: scale(1.05); }
.tpl b { position: relative; font-size: 15px; font-weight: 700; }
.tpl small { position: relative; display: block; font-size: 12px; color: rgba(255,255,255,.75); margin-top: 2px; }
.tpl:hover { border-color: var(--line-2); box-shadow: 0 16px 36px -14px rgba(0,0,0,.7); }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 16px 36px -14px var(--glow); }
.tpl .check { position: absolute; top: 10px; inset-inline-end: 10px; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: none; place-items: center; }
.tpl.on .check { display: grid; }

/* Cards & rails */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.rail { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; scrollbar-width: none; margin: 0 -2px; }
.rail::-webkit-scrollbar { display: none; }
.rail .card { flex: 0 0 240px; scroll-snap-align: start; }
.rail .card.wide { flex-basis: 480px; }
.card { position: relative; display: block; border-radius: var(--r-md); overflow: hidden; background: var(--surface); border: 1px solid var(--line); content-visibility: auto; contain-intrinsic-size: 240px 170px; transition: border-color 160ms var(--ease-out), transform 200ms var(--ease-out); }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card .thumb { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(160deg, #2a2050, #12101f); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 400ms var(--ease-out); }
.card:hover .thumb img { transform: scale(1.04); }
.card .thumb span.ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; opacity: .8; }
.card .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.8) 0%, rgba(0,0,0,.2) 45%, transparent 70%); }
.card .badge { position: absolute; top: 10px; inset-inline-start: 10px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; border: 1px solid rgba(255,255,255,.15); }
.card .badge.live { background: color-mix(in srgb, var(--orange) 80%, black); border-color: transparent; }
.card .body { position: absolute; left: 12px; right: 12px; bottom: 10px; color: #fff; }
.card h3 { margin: 0; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.card .meta { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; color: rgba(255,255,255,.75); font-variant-numeric: tabular-nums; }
.card .meta span { display: inline-flex; align-items: center; gap: 4px; }
.card .meta .owner { margin-inline-start: auto; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.genres { display: flex; gap: 8px; overflow-x: auto; padding: 18px 0 6px; scrollbar-width: none; }
.genres::-webkit-scrollbar { display: none; }
.genres .button { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--label-2); border: 1px solid var(--line); min-height: 36px; }
.genres .button.on { color: #fff; background: rgba(168,85,247,.22); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }

/* Search, leaderboard, remix, admin, packs */
.search { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 0 14px; min-height: 46px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; color: var(--label-2); }
.search input { flex: 1; background: transparent; border: 0; outline: none; font-size: 16px; min-height: 44px; color: var(--label); }
.search:focus-within { border-color: var(--accent); }
.remix-form { margin-top: 12px; padding: 12px 14px 10px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line-2)); border-radius: var(--r-md); }
.remix-form textarea { width: 100%; background: transparent; border: 0; outline: none; resize: none; font-size: 16px; line-height: 1.5; }
.remix-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }
.under { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: start; margin-top: 6px; }
.board .section-title { margin: 18px 0 8px; }
.lb { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.lb li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.lb li i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 12px; background: rgba(255,255,255,.08); flex: 0 0 auto; }
.lb li:nth-child(1) i { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1200; }
.lb li:nth-child(2) i { background: #cbd5e1; color: #111; } .lb li:nth-child(3) i { background: #d97706; color: #fff; }
.lb li b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.remix-of { grid-column: 1 / -1; margin: 6px 0 0; font-size: 13px; color: var(--label-2); } .remix-of a { color: var(--accent); }
.mod { display: flex; gap: 14px; align-items: center; padding-top: 22px; white-space: nowrap; }
.link { color: var(--label-3); font-size: 13px; padding: 6px 8px; border-radius: 8px; min-height: 36px; }
.link:hover { color: var(--label); background: rgba(255,255,255,.05); }
.link.danger { color: var(--red); }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.pack { padding: 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px; }
.pack b { font-size: 28px; font-weight: 800; } .pack span { color: var(--label-2); font-size: 13px; }
.pack .btn-primary { margin-top: 8px; justify-content: center; }
.admin { margin-top: 28px; padding: 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.admin h3 { margin: 18px 0 8px; font-size: 15px; color: var(--label-2); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.tile b { display: block; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile span { display: block; font-size: 12px; color: var(--label-2); margin-top: 4px; }
.otp-peek { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.otp-peek input { min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: 15px; outline: none; width: 180px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--label-2); font-weight: 600; font-size: 12px; }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plain li { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.plain li small { color: var(--label-2); flex-basis: 100%; }
.plain .link { margin-inline-start: auto; }
@media (max-width: 720px) { .under { grid-template-columns: 1fr; } .mod { padding-top: 6px; } .two { grid-template-columns: 1fr; } .actions { grid-template-columns: repeat(4, 1fr); } .action { font-size: 10px; } }

/* Admin panel */
#view-admin { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 20px); }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.admin-tabs .button { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--label-2); white-space: nowrap; min-height: 36px; }
.admin-tabs .button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.admin-pane { padding: 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.admin-pane h3 { margin: 18px 0 8px; font-size: 15px; color: var(--label-2); font-weight: 600; }
.ops { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.tbl .link { min-height: 32px; padding: 4px 8px; }
.tbl input.num { width: 72px; min-height: 32px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); text-align: center; color: var(--label); }
.imggen textarea { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 12px 14px; font-size: 16px; outline: none; resize: vertical; color: var(--label); }
.imggen-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.imggen select { min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--label); font: inherit; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--label-2); }
.imggen-out { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.imggen-out figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.imggen-out img { width: 100%; display: block; background: repeating-conic-gradient(#222 0 25%, #2c2c3a 0 50%) 0 0 / 20px 20px; }
.imggen-out figcaption { padding: 8px 12px; font-size: 12px; color: var(--label-2); display: flex; justify-content: space-between; gap: 8px; }
.imggen-out figcaption a { color: var(--accent); }
.eng-log { height: min(60vh, 520px); overflow-y: auto; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px; }
.eng-log .msg.tool { align-self: flex-end; font-size: 12px; color: var(--label-3); font-family: ui-monospace, monospace; direction: ltr; text-align: left; }
.eng-log .msg.error { align-self: center; color: var(--red); }
.eng-send { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.eng-send textarea { flex: 1; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 10px 14px; font-size: 16px; outline: none; resize: none; color: var(--label); }
.action.danger { color: var(--red); }
.admin-link { margin: 14px 0 0; }
@media (max-width: 720px) { .admin-pane { padding: 12px; } .tbl { font-size: 12px; } .tbl th, .tbl td { padding: 6px; } }

/* Plans */
#view-plans { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 28px); }
.plans-head { text-align: center; max-width: 620px; margin: 0 auto 26px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 360px)); gap: 16px; justify-content: center; }
.plan { position: relative; padding: 24px 22px 20px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 12px; }
.plan.pro { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-2)); box-shadow: var(--shadow-lg), 0 0 90px -30px var(--glow); }
.plan h3 { margin: 0; font-size: 18px; font-weight: 700; }
.plan .price { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; } .plan .price small { font-size: 14px; color: var(--label-2); font-weight: 500; }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; color: var(--label-2); font-size: 15px; }
.plan ul li::before { content: "✓ "; color: var(--green); }
.plan ul b { color: var(--label); }
.plan .btn-primary, .plan .btn-ghost { justify-content: center; text-align: center; }
.ribbon { position: absolute; top: -12px; inset-inline-start: 18px; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.me-plan { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); flex-wrap: wrap; }
.me-plan b { display: block; font-size: 16px; } .me-plan span { color: var(--label-2); font-size: 13px; }
.tbl input.txt { width: 220px; max-width: 100%; min-height: 32px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--label); direction: ltr; }
@media (max-width: 720px) { .plans { grid-template-columns: 1fr; } }

/* Landing: showcase, live, how, caps */
.showcase { margin-top: 36px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 24px; align-items: center; padding: 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 24px; }
.showcase-stage { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--line-2); box-shadow: var(--shadow-lg), 0 0 120px -40px var(--glow); }
.showcase-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.showcase-veil { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,.15)); }
.showcase-veil[hidden] { display: none; }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--accent); }
.showcase-info h2 { margin: 6px 0 8px; font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.showcase-info p { margin: 0 0 8px; color: var(--label-2); font-size: 15px; line-height: 1.6; }
.showcase-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.showcase-thumbs { display: flex; gap: 8px; margin-top: 16px; }
.showcase-thumbs button { width: 84px; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; border: 2px solid transparent; opacity: .7; transition: opacity 160ms var(--ease-out), border-color 160ms var(--ease-out); }
.showcase-thumbs button.on { opacity: 1; border-color: var(--accent); }
.showcase-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.live { margin-top: 36px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; } .live-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 132px; }
.live-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.live-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 14px; }
.live-list li .who { font-weight: 700; white-space: nowrap; }
.live-list li .what { color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.live-list li .stage { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); white-space: nowrap; }
.live-list li .stage.done { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.live-list li.quiet { color: var(--label-3); justify-content: center; }
.live-list li a { color: var(--label); font-weight: 700; }
.how { margin-top: 40px; }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step3 { padding: 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 8px; }
.step3 svg { width: 44px; height: 44px; }
.step3 b { font-size: 16px; } .step3 span { color: var(--label-2); font-size: 14px; line-height: 1.6; }
.caps { margin-top: 40px; padding: 26px 22px; background: radial-gradient(80% 100% at 50% 0%, #241a4a, var(--bg-2) 70%); border: 1px solid var(--line); border-radius: 24px; }
.caps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cap { text-align: center; }
.cap b { display: block; font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; font-variant-numeric: tabular-nums; background: linear-gradient(135deg, #fff, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cap span { color: var(--label-2); font-size: 13px; }
.cap-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.cap-tags span { padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--label-2); background: rgba(255,255,255,.05); border: 1px solid var(--line); }
@media (max-width: 900px) { .showcase { grid-template-columns: 1fr; } .live-grid { grid-template-columns: 1fr; } .steps3 { grid-template-columns: 1fr; } .caps-grid { grid-template-columns: repeat(2, 1fr); } }

/* Community chat */
.badge-dot { position: absolute; top: 4px; inset-inline-end: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.segmented a, .tabbar a { position: relative; }
.chat-page { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 12px); padding-bottom: 12px; }
.chat-topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.online { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--label-2); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.online i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.chat-box { position: relative; display: flex; flex-direction: column; height: calc(100dvh - var(--nav-h) - env(safe-area-inset-top) - 24px - 56px); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; overscroll-behavior: contain; }
.cm { display: flex; gap: 10px; align-items: flex-end; max-width: 78%; }
.cm.me { align-self: flex-end; flex-direction: row-reverse; }
.cm .av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.cm .bub { background: var(--bubble); color: var(--bubble-ink); padding: 8px 12px; border-radius: 16px; border-bottom-right-radius: 5px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.cm.me .bub { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 16px; border-bottom-left-radius: 5px; }
.cm .who { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--label-3); margin-bottom: 3px; }
.cm .who b { color: var(--label-2); font-weight: 600; }
.cm .del { color: var(--label-3); font-size: 12px; padding: 2px 6px; border-radius: 6px; opacity: 0; transition: opacity 120ms; }
.cm:hover .del { opacity: 1; }
.cm .gcard { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin-top: 6px; padding: 8px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.12); color: inherit; }
.cm .gcard img { width: 96px; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; display: block; }
.cm .gcard b { display: block; font-size: 14px; } .cm .gcard small { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }
.cm .gcard .play { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.15); }
.cm.sys { align-self: center; font-size: 12px; color: var(--label-3); }
.new-msgs { position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; box-shadow: var(--shadow); z-index: 2; }
.chat-attach { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.chat-attach img { width: 56px; aspect-ratio: 16/10; object-fit: cover; border-radius: 6px; }
.chat-send { display: flex; gap: 8px; align-items: flex-end; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.chat-send textarea { flex: 1; resize: none; border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 14px; padding: 9px 14px; max-height: 120px; outline: none; font-size: 15px; line-height: 1.4; color: var(--label); }
.chat-send textarea:focus { border-color: var(--accent); }
.chat-send .icon { width: 38px; height: 38px; border-radius: 10px; color: var(--label-2); display: grid; place-items: center; border: 1px solid var(--line); }
.chat-send .send-btn { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.chat-gate { margin: 0; padding: 12px; text-align: center; font-size: 14px; color: var(--label-2); border-top: 1px solid var(--line); } .chat-gate a { color: var(--accent); font-weight: 700; }
.picker { position: fixed; inset: 0; z-index: 46; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.picker-card { width: min(920px, 100%); max-height: 84vh; overflow-y: auto; padding: 8px 18px 18px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.picker-card .section-title { margin-top: 10px; }
@media (max-width: 720px) { .cm { max-width: 92%; } .chat-page { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 8px); width: 100%; padding-bottom: 0; } .chat-box { height: calc(100dvh - var(--nav-h) - env(safe-area-inset-top) - var(--tab-h) - env(safe-area-inset-bottom) - 8px); border-radius: 18px 18px 0 0; border-bottom: 0; } .tabbar { grid-template-columns: repeat(4, 1fr); } .tabbar a { font-size: 10px; } body.chat { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); } }
@media (min-width: 721px) { body.chat { padding-bottom: 0; } }
.cm .av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.cm .rx { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.cm .rx button { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid transparent; color: var(--label); min-height: 24px; }
.cm .rx button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.cm .react-btn { color: var(--label-3); font-size: 14px; padding: 0 6px; opacity: 0; transition: opacity 120ms; }
.cm:hover .react-btn, .cm:focus-within .react-btn { opacity: 1; }
@media (hover: none) { .cm .react-btn, .cm .del { opacity: 1; } }
.react-bar { position: absolute; z-index: 3; display: flex; gap: 4px; padding: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); }
.react-bar button { font-size: 20px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; transition: transform 120ms var(--ease-out); }
.react-bar button:hover { transform: scale(1.25); background: rgba(255,255,255,.08); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.me-avatar { position: relative; overflow: hidden; cursor: pointer; }
.me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-avatar::after { content: "📷"; position: absolute; inset: auto 0 0 0; font-size: 12px; text-align: center; background: rgba(0,0,0,.45); padding: 2px 0; opacity: 0; transition: opacity 120ms; }
.me-avatar:hover::after { opacity: 1; }
.me-bio { margin: 6px 0 0 !important; color: var(--label-2); font-size: 14px !important; white-space: pre-wrap; }
.me-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.me-edit { margin-top: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 12px; }
.me-edit textarea { width: 100%; min-height: 64px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: 15px; outline: none; resize: vertical; color: var(--label); }
.me-edit-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card .owner img, .lb li img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-inline-end: 4px; }

.faq-home { margin-top: 40px; }
.faq-home details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px; margin: 8px 0; }
.faq-home summary { cursor: pointer; font-weight: 700; list-style: none; }
.faq-home summary::-webkit-details-marker { display: none; }
.faq-home p { margin: 8px 0 0; color: var(--label-2); line-height: 1.7; }
.seo-links { margin: 18px 0 0; font-size: 13px; color: var(--label-3); line-height: 2; }
.seo-links a { color: var(--label-2); }

/* Auth */
.auth-page { display: grid; place-items: start center; padding-top: calc(var(--nav-h) + 40px); }
.auth { width: min(440px, 100%); padding: 28px 24px 22px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg), 0 0 80px -30px var(--glow); }
.auth .display { margin: 0; } .auth .lede { margin: -4px 0 6px; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--label-2); }
.field input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: 17px; outline: none; transition: box-shadow 160ms var(--ease-out), border-color 160ms var(--ease-out); }
.field input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.field input:user-invalid { border-color: var(--red); }
.field small { font-size: 12px; color: var(--label-3); }
.form-error { margin: 0; color: var(--red); font-size: 14px; }
.auth .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }
.switch { margin: 4px 0 0; text-align: center; font-size: 14px; color: var(--label-2); } .switch a { color: var(--accent); font-weight: 600; }


/* ===== Studio ===== */
.studio-page { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 20px); }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.stage-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.stage-title { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.stage-sub { margin: 6px 0 0; color: var(--label-2); font-size: 14px; }
.quality { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.quality .button { padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--label-2); min-height: 30px; }
.quality .button.on { background: rgba(255,255,255,.1); color: var(--label); }
.stage-meta { display: flex; gap: 14px; font-size: 13px; color: var(--label-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stage { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg), 0 0 120px -40px var(--glow); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; will-change: transform, opacity, filter; }
.progress { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 16px; gap: 12px; will-change: transform, opacity, filter; background: radial-gradient(80% 60% at 50% 100%, #2a1650, var(--surface) 70%); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.steps li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--label-3); }
.steps li i { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; }
.steps li.on { color: var(--label); }
.steps li.on i { border-color: var(--accent); background: conic-gradient(var(--accent) 0 25%, transparent 25% 100%); animation: spin 1s linear infinite; }
.steps li.did { color: var(--label-2); }
.steps li.did i { border: 0; background: var(--green); }
.steps li.did i::after { content: ""; width: 5px; height: 9px; border: solid #0b0a14; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.steps li.bad i { border: 0; background: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
.eta { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; }
.eta-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--label-2); }
.eta-row b { font-size: 15px; color: var(--label); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.eta-bar { display: block; height: 4px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.eta-bar em { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 900ms linear; }
.log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 8%); mask-image: linear-gradient(to bottom, transparent, #000 8%); }
.line { max-width: 92%; padding: 7px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; will-change: transform, opacity; }
.line.say { background: var(--bubble); color: var(--bubble-ink); align-self: flex-start; border-bottom-right-radius: 4px; }
.line.tool { color: var(--label-2); font-size: 13px; padding: 2px 6px; display: inline-flex; gap: 6px; align-items: center; }
.line.tool.search { color: var(--teal); } .line.tool.asset { color: var(--orange); } .line.tool.skill { color: var(--accent); }
.line.error { background: color-mix(in srgb, var(--red) 16%, var(--surface)); color: var(--red); }
.actions { display: flex; gap: 8px; margin: 14px 0 0; }
.action { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--label-2); font-size: 12px; font-weight: 600; min-height: 44px; }
.action:hover { color: var(--label); border-color: var(--line-2); }
.action.liked { color: var(--accent-2); }
.action.liked svg { fill: currentColor; }
.action[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.asset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; will-change: transform, opacity; }
.asset .preview { aspect-ratio: 4 / 3; background: radial-gradient(120% 90% at 50% 100%, #3a2a66, #14111f); display: grid; place-items: center; position: relative; }
.asset .preview canvas, .asset .preview img { width: 100%; height: 100%; display: block; object-fit: contain; }
.asset .preview span { font-size: 36px; }
.asset .meta { padding: 8px 12px 10px; }
.asset .meta b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset .meta small { display: block; font-size: 12px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.asset .meta a { color: var(--accent); }

.sheet { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); min-height: 460px; max-height: min(78vh, 760px); position: sticky; top: calc(var(--nav-h) + 20px); box-shadow: var(--shadow); overflow: hidden; }
.grip { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.pill.done { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.pill.err { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.msgs { flex: 1; overflow-y: auto; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; overscroll-behavior: contain; }
.msg { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; will-change: transform, opacity; }
.msg.user { align-self: flex-start; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-end; background: var(--bubble); color: var(--bubble-ink); border-bottom-left-radius: 5px; }
.msg.note { align-self: center; font-size: 12px; color: var(--label-2); padding: 2px 8px; }
.send { display: flex; gap: 8px; align-items: flex-end; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.send textarea { flex: 1; resize: none; border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 14px; padding: 9px 14px; max-height: 120px; outline: none; font-size: 15px; line-height: 1.4; }
.send textarea:focus { border-color: var(--accent); }
.send button { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.send[aria-disabled="true"] { opacity: .45; pointer-events: none; }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .studio .stage-col { padding-bottom: 150px; }
  .stage-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 32; height: 84dvh; max-height: none; min-height: 0; border-radius: 18px 18px 0 0; background: var(--surface); box-shadow: 0 -10px 40px -10px rgba(0,0,0,.6); will-change: transform; touch-action: none; transform: translateY(0); contain: layout paint; }
  .grip { display: grid; place-items: center; padding: 10px 0 2px; cursor: grab; touch-action: none; }
  .grip span { width: 40px; height: 5px; border-radius: 999px; background: var(--label-3); }
  .sheet-head { padding-top: 4px; border-bottom: 0; }
}

/* Present the stage */
.scrim { position: fixed; inset: 0; z-index: 44; background: rgba(0,0,0,.65); opacity: 0; will-change: opacity; }
.stage-bar { display: none; }
.stage.presented { position: fixed; z-index: 45; border-radius: 18px; box-shadow: var(--shadow-lg); will-change: transform, left, top, width, height; }
.stage.presented .stage-bar { display: flex; align-items: center; justify-content: space-between; position: absolute; top: 0; left: 0; right: 0; height: 44px; padding: 0 10px; z-index: 2; cursor: grab; touch-action: none; background: linear-gradient(to bottom, rgba(0,0,0,.55), rgba(0,0,0,0)); }
.stage.presented .grab { width: 36px; height: 5px; border-radius: 999px; background: rgba(255,255,255,.75); }
.stage.presented .bar-btn { color: #fff; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.18); min-height: 32px; }

/* Toast */
.toast { position: fixed; top: calc(var(--nav-h) + env(safe-area-inset-top) + 10px); left: 0; right: 0; width: max-content; max-width: calc(100% - 32px); margin: 0 auto; transform: translateY(-20px); opacity: 0; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 50; pointer-events: none; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); will-change: transform, opacity; }

@media (prefers-reduced-motion: reduce) { .steps li.on i { animation: none; } .button, .card, .card .thumb img { transition: none; } }
@media (prefers-contrast: more) { .card, .stage, .sheet, .action, .asset, .composer, .tpl { border-color: var(--label-2); } }
