:root {
  --bg: oklch(0.975 0.004 85);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.955 0.005 85);
  --text: oklch(0.22 0.01 260);
  --muted: oklch(0.5 0.012 260);
  --border: oklch(0.9 0.006 85);
  --accent: oklch(0.58 0.2 30);
  --accent-soft: oklch(0.58 0.2 30 / 0.1);
  --accent-text: oklch(0.5 0.19 30);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.04), 0 4px 16px oklch(0 0 0 / 0.04);
  --glass: oklch(0.985 0.004 85 / 0.82);
  --r-ctl: 8px;
  --r-card: 14px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(0.17 0.006 270);
    --surface: oklch(0.21 0.007 270);
    --surface-2: oklch(0.25 0.008 270);
    --text: oklch(0.94 0.004 85);
    --muted: oklch(0.7 0.01 270);
    --border: oklch(0.3 0.008 270);
    --accent: oklch(0.68 0.18 32);
    --accent-soft: oklch(0.68 0.18 32 / 0.14);
    --accent-text: oklch(0.75 0.15 35);
    --shadow: none;
    --glass: oklch(0.19 0.007 270 / 0.82);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
img { display: block; }

#app { max-width: 680px; margin: 0 auto; padding: 0 16px calc(var(--tabs-h) + var(--safe-b) + 34px); }
body.playing #app { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 96px); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 0 8px;
  background: var(--bg);
}
.brand { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.brand::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 3px; vertical-align: 2px; }
.updated { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Topic chips */
.chips {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 62px); z-index: 4;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 16px 12px; margin: 0 -16px; background: var(--bg);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 500; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
body.no-chips .chips { display: none; }

/* Feed cards */
.feed { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer; text-align: left; width: 100%;
  transition: transform 150ms ease-out;
}
.card:active { transform: scale(0.99); }
.card-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.card-body { padding: 14px 16px 12px; }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.meta .dot::before { content: "·"; }
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px;
}
.headline { font-size: 17px; line-height: 1.45; font-weight: 500; white-space: pre-line; overflow-wrap: anywhere; }
.card .headline { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-foot svg { width: 16px; height: 16px; }
.card-foot .stat { display: inline-flex; align-items: center; gap: 4px; }
.card-foot .listen { margin-left: auto; width: 40px; height: 40px; margin-right: -8px; }
.avatars { display: inline-flex; }
.av {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: var(--bg); background: var(--muted);
  border: 2px solid var(--surface); margin-left: -6px;
}
.av:first-child { margin-left: 0; }
.multi { color: var(--accent-text); font-weight: 600; }
.more { display: block; margin: 16px auto; height: 44px; padding: 0 20px; border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--surface); font-weight: 500; }

/* States */
.skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px; }
.sk { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sh 1.2s ease-in-out infinite; margin: 8px 0; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 18px; }
.btn {
  height: 44px; padding: 0 18px; border-radius: var(--r-ctl); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface);
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: oklch(0.99 0 0); }
.btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Tabs: floating pill with a sliding indicator */
.tabs {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 10px); width: min(440px, calc(100% - 24px)); height: var(--tabs-h);
  display: flex; padding: 6px; border-radius: 24px;
  background: var(--glass); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid var(--border); box-shadow: 0 10px 30px oklch(0 0 0 / 0.14), 0 2px 6px oklch(0 0 0 / 0.06);
}
.tab-ind {
  position: absolute; top: 6px; bottom: 6px; left: 0; width: var(--w, 0); border-radius: 18px; pointer-events: none;
  background: linear-gradient(135deg, var(--candy-1), var(--candy-2)); box-shadow: 0 4px 14px oklch(0.62 0.22 20 / 0.35);
  transform: translateX(var(--x, 0)); transition: transform 420ms cubic-bezier(.34,1.3,.64,1), width 420ms cubic-bezier(.34,1.3,.64,1);
}
.tabs a {
  position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 18px; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted);
  transition: color 250ms ease-out;
}
.tabs a svg { width: 22px; height: 22px; transition: transform 300ms cubic-bezier(.34,1.36,.64,1); }
.tabs a:active svg { transform: scale(.88); }
.tabs a[aria-current="page"] { color: oklch(0.99 0 0); }
.tabs a[aria-current="page"] svg { stroke-width: 2.2; transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .tab-ind { transition: none; } }

/* Mini player */
.player {
  position: fixed; z-index: 35; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabs-h) + var(--safe-b) + 18px);
  width: min(440px, calc(100% - 24px));
  display: flex; align-items: center; gap: 4px; padding: 8px 8px 10px 10px;
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: 0 8px 24px oklch(0 0 0 / 0.12);
}
.pl-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.pl-info { flex: 1; min-width: 0; padding: 0 6px; cursor: pointer; }
.pl-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-progress { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; background: var(--border); border-radius: 2px; overflow: hidden; }
.pl-progress div { height: 100%; width: 0; background: var(--accent); transition: width 250ms linear; }

/* Panel (story detail / reader) */
.panel {
  position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
  animation: slide-in 220ms ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.panel-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px;
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.panel-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-actions { display: flex; }
.panel-body { max-width: 680px; margin: 0 auto; padding: 16px 16px calc(var(--tabs-h) + var(--safe-b) + 110px); }
.hero-img { width: 100%; border-radius: var(--r-card); aspect-ratio: 16/9; object-fit: cover; background: var(--surface-2); margin-bottom: 14px; }
.story-h { font-size: 22px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; white-space: pre-line; overflow-wrap: anywhere; margin: 6px 0 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.section { margin-top: 28px; }
.section h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.section h2 svg { width: 16px; height: 16px; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.row { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); text-decoration: none; width: 100%; text-align: left; }
.row:first-child { border-top: 0; }
button.row:hover, a.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 15px; line-height: 1.4; font-weight: 500; overflow-wrap: anywhere; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.row-desc { font-size: 14px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-thumb { width: 72px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.src-name { font-weight: 600; color: var(--text); }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 6px 0 14px; cursor: pointer; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.tl-item.now::before { background: var(--accent); border-color: var(--accent); }
.tl-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-text { font-size: 15px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tl-item.now .tl-text { font-weight: 600; }

.wiki { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px; }
.wiki img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; }
.wiki p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.wiki + .wiki { margin-top: 8px; }

.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.video { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; text-align: left; }
.video img, .video iframe { width: 100%; aspect-ratio: 16/9; object-fit: cover; border: 0; display: block; }
.video .v-t { padding: 8px 10px 10px; font-size: 14px; font-weight: 500; line-height: 1.35; }
.video .v-s { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }

.keys { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.keys.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 0 16px; }
.keys.scroll::-webkit-scrollbar { display: none; }
.keys.scroll .key { flex: none; height: 36px; }
.key { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.key[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-ctl);
}

/* Reader */
.reader { font-size: 18px; line-height: 1.65; }
.reader h1 { font-size: 26px; line-height: 1.25; letter-spacing: -0.015em; margin: 4px 0 8px; }
.reader .byline { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.reader img, .reader figure { max-width: 100%; height: auto; border-radius: 8px; margin: 12px 0; }
.reader figcaption { font-size: 13px; color: var(--muted); }
.reader a { color: var(--accent-text); }
.reader blockquote { margin: 16px 0; padding-left: 14px; border-left: 3px solid var(--border); color: var(--muted); }
.notice { background: var(--surface-2); border-radius: var(--r-card); padding: 14px 16px; font-size: 15px; color: var(--muted); margin: 12px 0; }

/* Listen tab */
.card-plain { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px; margin-bottom: 12px; }
.card-plain h3 { margin: 0 0 4px; font-size: 17px; }
.card-plain p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-ctl); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 36px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 10px 0; }
.bar div { height: 100%; background: var(--accent); width: 0; transition: width 200ms; }
.queue .row { cursor: pointer; }
.queue .row.cur .row-title { color: var(--accent-text); }
.page-h { font-size: 22px; font-weight: 700; margin: 4px 0 12px; letter-spacing: -0.01em; }

/* Story mode */
.storymode { position: fixed; inset: 0; z-index: 40; background: radial-gradient(120% 80% at 20% 10%, oklch(0.35 0.09 30), #111 70%); color: #fafafa; overflow: hidden; }
.sm-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.sm-shade { position: absolute; inset: 0; background: linear-gradient(180deg, oklch(0 0 0 / 0.55) 0%, oklch(0 0 0 / 0) 25%, oklch(0 0 0 / 0.35) 50%, oklch(0 0 0 / 0.9) 100%); }
.sm-bars { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 12px; right: 12px; display: flex; gap: 4px; }
.sm-bars span { flex: 1; height: 3px; border-radius: 2px; background: oklch(1 0 0 / 0.3); overflow: hidden; }
.sm-bars span i { display: block; height: 100%; width: 0; background: #fff; }
.sm-bars span.done i { width: 100%; }
.sm-text { position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); padding: 0 24px; max-width: 680px; margin: 0 auto; }
.sm-meta { font-size: 14px; opacity: 0.85; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.sm-meta .badge { color: #fff; background: var(--accent); }
.sm-headline { font-size: clamp(24px, 6vw, 34px); line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; white-space: pre-line; text-shadow: 0 1px 12px oklch(0 0 0 / 0.4); display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.sm-zone { position: absolute; z-index: 1; top: 0; bottom: 0; width: 35%; }
.sm-left { left: 0; } .sm-right { right: 0; }
.sm-controls { position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); display: flex; justify-content: center; gap: 24px; }
.icon-btn.light { color: #fff; background: oklch(1 0 0 / 0.14); }
.icon-btn.big { width: 56px; height: 56px; }

.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 90px); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity 200ms ease-out, transform 200ms ease-out; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 900px) {
  .headline { font-size: 18px; }
}

/* Video briefs */
.card.brief { padding: 14px 16px; }
.brief-top { display: flex; gap: 12px; align-items: flex-start; }
.brief-thumb { width: 120px; aspect-ratio: 16 / 9; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.brief .row-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.brief-text { margin-top: 10px; font-size: 15px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.brief-player { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--r-card); margin-bottom: 14px; display: block; background: #000; }
#br-media { cursor: pointer; }

/* ================= Game layer ================= */
:root {
  --gold: oklch(0.83 0.16 85);
  --gold-2: oklch(0.7 0.16 60);
  --candy-1: oklch(0.68 0.24 0);
  --candy-2: oklch(0.72 0.2 40);
  --candy-3: oklch(0.8 0.17 80);
  --mint: oklch(0.78 0.15 165);
  --grape: oklch(0.55 0.24 300);
  --pill-bg: oklch(0.96 0.03 80);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pill-bg: oklch(0.27 0.03 60); }
}

/* HUD */
.hud { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.updated { display: none; }
@media (min-width: 560px) { .updated { display: block; margin-left: auto; } .hud { margin-left: 8px; } }
.pill {
  height: 32px; padding: 0 10px 0 6px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px;
  background: var(--pill-bg); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -2px 0 oklch(0 0 0 / 0.08);
}
.pill .pi { font-size: 16px; line-height: 1; }
.coins b { min-width: 2ch; }
.coin-i { display: inline-block; }
.streak .pi { display: inline-block; animation: flick 2.8s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flick { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.lvl { position: relative; width: 36px; height: 36px; display: grid; place-items: center; }
.lvl svg { position: absolute; inset: 0; width: 36px; height: 36px; transform: rotate(-90deg); stroke-width: 3.5; }
.lvl-bg { stroke: var(--border); }
.lvl-fg { stroke: var(--candy-1); stroke-dasharray: 97.4; transition: stroke-dashoffset 600ms cubic-bezier(.2,1.2,.4,1); }
.lvl b { font-size: 13px; font-weight: 800; position: relative; }

/* Cards: candy pop */
.card { position: relative; animation: pop-in 520ms cubic-bezier(.22,1,.36,1) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.card:active { transform: scale(0.985); }
.card.breaking { border-color: transparent; box-shadow: 0 0 0 2px var(--accent), 0 6px 24px oklch(0.6 0.22 30 / 0.22); }
.card.breaking::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 28px oklch(0.65 0.22 30 / 0.35); animation: breathe 3.2s ease-in-out infinite; will-change: opacity; }
@keyframes breathe { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.card.breaking .badge { background: var(--accent); color: oklch(0.99 0 0); }
.card.jackpot { border: 0; padding: 2px; background: none; isolation: isolate; }
.card.jackpot::before { content: ""; position: absolute; z-index: -2; left: 50%; top: 50%; width: 160%; aspect-ratio: 1; transform: translate(-50%, -50%); background: conic-gradient(var(--gold), var(--candy-1), var(--grape), var(--mint), var(--gold)); animation: spin-border 6s linear infinite; will-change: transform; }
.card.jackpot::after { content: ""; position: absolute; z-index: -1; inset: 2px; border-radius: calc(var(--r-card) - 2px); background: var(--surface); }
.card.jackpot .card-img { border-radius: calc(var(--r-card) - 2px) calc(var(--r-card) - 2px) 0 0; }
@keyframes spin-border { to { transform: translate(-50%, -50%) rotate(360deg); } }
.medal {
  position: absolute; z-index: 2; top: 10px; left: 10px; height: 30px; min-width: 30px; padding: 0 8px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: oklch(0.25 0.05 70);
  background: linear-gradient(180deg, oklch(0.92 0.14 92), var(--gold-2)); box-shadow: 0 2px 8px oklch(0 0 0 / 0.25), inset 0 -2px 0 oklch(0 0 0 / 0.15);
}
.rank2 .medal { background: linear-gradient(180deg, oklch(0.95 0.01 250), oklch(0.75 0.02 250)); }
.rank3 .medal { background: linear-gradient(180deg, oklch(0.85 0.09 60), oklch(0.6 0.11 50)); color: oklch(0.98 0 0); }
.jackpot:not(:has(.card-img)) .card-body { padding-top: 48px; }
.sticker {
  position: absolute; z-index: 2; top: 10px; right: 10px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .06em;
  color: oklch(0.99 0 0); background: linear-gradient(135deg, var(--candy-1), var(--candy-2)); transform: rotate(6deg);
  box-shadow: 0 3px 10px oklch(0.6 0.24 10 / 0.4); animation: sway 3.6s ease-in-out infinite;
}
@keyframes sway { 0%, 100% { transform: rotate(6deg); } 50% { transform: rotate(2deg) scale(1.04); } }
.multi-src .multi { background: linear-gradient(90deg, var(--candy-1), var(--candy-2)); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }

/* Reaction bar (Telegram-style chips) */
.rxbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.rx {
  height: 32px; padding: 0 10px 0 7px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background-color 200ms ease-out, color 200ms ease-out;
}
.rx .rx-e { font-size: 18px; line-height: 1; width: 20px; text-align: center; }
.rx-n { display: inline-grid; overflow: hidden; height: 20px; line-height: 20px; }
.rx-n b { grid-area: 1 / 1; font-weight: 600; }
.rx[aria-pressed="true"] { background: var(--accent); color: oklch(0.99 0 0); }
.rx:active { transform: scale(.94); }
.rx-add { width: 32px; height: 32px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--muted); background: var(--surface-2); transition: transform 150ms ease-out; }
.rx-add svg { width: 19px; height: 19px; }
.rx-add:active { transform: scale(.9); }
.panel-body .rxbar { margin: 0 0 14px; }
.rx-ov { position: fixed; inset: 0; z-index: 65; }
.rx-picker {
  position: fixed; display: flex; gap: 2px; padding: 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 12px 32px oklch(0 0 0 / 0.18), 0 2px 8px oklch(0 0 0 / 0.08);
}
.rx-pick { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; transition: transform 200ms cubic-bezier(.34,1.36,.64,1); }
.rx-pick:hover, .rx-pick:focus-visible { transform: scale(1.22); }
.rx-pick:active { transform: scale(1.1); }
.rx-pe { width: 36px; height: 36px; display: grid; place-items: center; font-size: 30px; line-height: 1; }
.rx-pe svg, .rx-big svg { width: 100% !important; height: 100% !important; }
.rx-big { position: fixed; display: grid; place-items: center; font-size: 110px; line-height: 1; pointer-events: none; z-index: 66; will-change: transform; transform: translate(-50%, -50%); }
.p.dot { border-radius: 50%; }
.card { -webkit-touch-callout: none; }

/* Particles */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.p { position: absolute; left: 0; top: 0; will-change: transform, opacity; backface-visibility: hidden; }
.p.emo { font-size: 22px; line-height: 1; }
.p.emo.big { font-size: 34px; }
.p.confetti { width: 8px; height: 12px; border-radius: 2px; }
.p.smoke { width: 14px; height: 14px; border-radius: 50%; background: oklch(0.85 0.02 60 / 0.8); }
.p.ring { width: 80px; height: 80px; border-radius: 50%; border: 3px solid oklch(0.6 0.24 300); }
.p.gain {
  font-weight: 900; font-size: 22px; color: var(--gold); white-space: nowrap; letter-spacing: -0.02em;
  -webkit-text-stroke: 1px oklch(0.4 0.12 60); text-shadow: 0 2px 0 oklch(0.4 0.12 60), 0 4px 12px oklch(0 0 0 / 0.3);
}
.p.gain i { font-style: normal; font-size: 14px; color: oklch(0.99 0 0); background: linear-gradient(135deg, var(--candy-1), var(--grape)); -webkit-text-stroke: 0; text-shadow: none; padding: 2px 7px; border-radius: 999px; margin-left: 4px; vertical-align: 3px; }
.p.gain.hot { font-size: 28px; }

/* Banners */
.banner { position: fixed; z-index: 80; left: 50%; top: 30%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; animation: ban-in 560ms cubic-bezier(.34,1.36,.64,1) both; }
.banner.out { animation: ban-out 400ms ease-in forwards; }
@keyframes ban-in { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } }
@keyframes ban-out { to { transform: translate(-50%, -80%) scale(.9); opacity: 0; } }
.banner-big { font-size: 52px; font-weight: 900; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; color: var(--gold); -webkit-text-stroke: 2px oklch(0.35 0.12 50); text-shadow: 0 4px 0 oklch(0.35 0.12 50), 0 10px 30px oklch(0 0 0 / 0.35); }
.banner.fire .banner-big { color: oklch(0.78 0.19 50); }
.banner-small { margin-top: 8px; font-size: 15px; font-weight: 700; color: oklch(0.99 0 0); background: oklch(0.2 0.02 270 / 0.85); padding: 6px 14px; border-radius: 999px; display: inline-block; }

/* Daily spin entry */
.spin-card {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border-radius: var(--r-card); text-align: left;
  color: oklch(0.99 0 0); background: linear-gradient(135deg, var(--grape), var(--candy-1) 60%, var(--candy-2));
  box-shadow: 0 6px 20px oklch(0.55 0.24 330 / 0.35), inset 0 -3px 0 oklch(0 0 0 / 0.15);
  animation: pop-in 520ms cubic-bezier(.22,1,.36,1) both;
}
.spin-reels { font-size: 22px; background: oklch(0 0 0 / 0.25); padding: 6px 8px; border-radius: 10px; letter-spacing: 2px; flex: none; }
.spin-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.spin-t b { font-size: 16px; }
.spin-t span { font-size: 13px; opacity: .9; }
.spin-go { flex: none; font-weight: 900; font-size: 14px; padding: 8px 14px; border-radius: 999px; color: oklch(0.3 0.08 60); background: linear-gradient(180deg, oklch(0.93 0.14 92), var(--gold-2)); box-shadow: inset 0 -2px 0 oklch(0 0 0 / 0.2); animation: throb 2.4s ease-in-out infinite; }
@keyframes throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Slot machine + sheets */
.slot-ov { position: fixed; inset: 0; z-index: 60; background: oklch(0.1 0.02 300 / 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: end center; padding: 16px 16px calc(16px + var(--safe-b)); animation: fade 200ms ease-out; }
@media (min-width: 600px) { .slot-ov { place-items: center; } }
@keyframes fade { from { opacity: 0; } }
.slot {
  position: relative; width: min(380px, 100%); padding: 22px 18px 16px; border-radius: 24px; text-align: center; color: oklch(0.99 0 0);
  background: radial-gradient(120% 90% at 50% 0%, oklch(0.5 0.22 330), oklch(0.28 0.14 300)); box-shadow: 0 20px 60px oklch(0 0 0 / 0.5), inset 0 0 0 3px var(--gold);
  animation: ban-in 420ms cubic-bezier(.34,1.36,.64,1) both;
}
.slot-title { font-size: 26px; font-weight: 900; letter-spacing: .08em; color: var(--gold); text-shadow: 0 3px 0 oklch(0.35 0.12 50); }
.slot-lights { display: flex; justify-content: space-between; margin: 10px 4px 12px; }
.slot-lights i { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); animation: bulb 1.8s ease-in-out infinite; animation-delay: var(--d); will-change: opacity; }
@keyframes bulb { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.reels { display: flex; gap: 8px; justify-content: center; padding: 10px; border-radius: 16px; background: oklch(0.15 0.04 300); box-shadow: inset 0 4px 12px oklch(0 0 0 / 0.6); }
.reel { width: 84px; height: 72px; overflow: hidden; border-radius: 10px; background: linear-gradient(180deg, oklch(0.85 0 0), oklch(1 0 0) 30%, oklch(1 0 0) 70%, oklch(0.85 0 0)); }
.sym { height: 72px; display: grid; place-items: center; font-size: 42px; }
.slot-msg { margin: 14px 0 12px; font-size: 14px; min-height: 22px; }
.slot-msg b { font-size: 20px; color: var(--gold); margin-right: 6px; }
.slot.won-big { animation: jolt 600ms cubic-bezier(.34,1.36,.64,1); }
@keyframes jolt { 40% { transform: scale(1.03); } }
.spin-btn { width: 100%; height: 54px; font-size: 20px; font-weight: 900; letter-spacing: .06em; border: 0; color: oklch(0.3 0.08 60); background: linear-gradient(180deg, oklch(0.93 0.14 92), var(--gold-2)); box-shadow: inset 0 -4px 0 oklch(0 0 0 / 0.2), 0 6px 16px oklch(0 0 0 / 0.3); border-radius: 14px; }
.spin-btn:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 oklch(0 0 0 / 0.2); }
.slot-close { margin-top: 8px; height: 44px; font-size: 14px; color: oklch(1 0 0 / 0.75); }
.sheet { width: min(420px, 100%); background: var(--surface); color: var(--text); border-radius: 20px; padding: 20px 18px 14px; animation: sheet-up 380ms cubic-bezier(.22,1,.36,1) both; }
.sheet-h { font-size: 24px; font-weight: 800; }
.sheet .bar div { background: linear-gradient(90deg, var(--candy-1), var(--candy-2), var(--gold)); }
.sheet-sub { color: var(--muted); font-size: 14px; margin: 6px 0 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.stat-grid div { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.stat-grid b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 12px; color: var(--muted); }

@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
/* Lottie SVGs must not inherit the icon stroke style */
.rx-big svg, .rx-pe svg, .pill .pi svg { fill: initial; stroke: none; stroke-width: initial; width: 100% !important; height: 100% !important; }

/* ===== Media controls: always on top of pages ===== */
.icon-btn.sm { width: 38px; height: 38px; }
.icon-btn.sm svg { width: 20px; height: 20px; }
.icon-btn.play { width: 42px; height: 42px; background: var(--accent); color: oklch(0.99 0 0); }
.icon-btn.play:hover { background: var(--accent); filter: brightness(1.08); }
.icon-btn.play svg { width: 20px; height: 20px; }
.player { gap: 2px; }
.pl-art { position: relative; width: 44px; height: 44px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.pl-art .pl-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.pl-art-i { width: 20px; height: 20px; color: var(--muted); }
.pl-art .pl-img:not([hidden]) + .pl-art-i { display: none; }
body.locked .player, body.locked .vdock.mini { bottom: calc(var(--safe-b) + 12px); }
body.video-on .player { display: none; }

.vdock {
  position: fixed; z-index: 37; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 12px 36px oklch(0 0 0 / 0.22);
}
.vd-frame { background: #000; overflow: hidden; }
#vd-yt { display: block; width: 100%; height: 100%; border: 0; }
.vd-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.vd-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-ctl { display: flex; align-items: center; }
.vd-seekrow { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
#vd-seek { flex: 1; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
#vd-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--border) var(--p, 0%)); }
#vd-seek::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--border) var(--p, 0%)); }
#vd-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
#vd-seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

/* Big: top card, page dimmed below (tap the dim area to shrink) */
.vdock.big { top: calc(env(safe-area-inset-top, 0px) + 8px); width: min(680px, calc(100% - 16px)); border-radius: 18px; overflow: hidden; animation: vd-in 300ms cubic-bezier(.22,1,.36,1); }
.vdock.big .vd-frame { width: 100%; aspect-ratio: 16 / 9; }
.vdock.big .vd-body { padding: 10px 14px 10px; }
.vdock.big .vd-title { font-size: 16px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vdock.big .vd-ctl { justify-content: space-between; margin-top: 2px; }
.vdock.big #vd-size { order: -1; }
.vdock.big .icon-btn.play { width: 52px; height: 52px; }
.vdock.big .icon-btn.play svg { width: 24px; height: 24px; }
.vdock.big .vd-mini-only { display: none; }
@keyframes vd-in { from { opacity: 0; transform: translate(-50%, -12px) scale(.98); } }
.vd-scrim { position: fixed; inset: 0; z-index: 36; background: oklch(0.1 0.01 270 / 0.5); animation: fade 200ms ease-out; }
body:not(.video-big) .vd-scrim { display: none; }

/* Mini: bar above the tabs, like the audio player */
.vdock.mini {
  bottom: calc(var(--tabs-h) + var(--safe-b) + 18px); width: min(440px, calc(100% - 24px));
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-radius: var(--r-card);
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
}
.vdock.mini .vd-frame { width: 96px; aspect-ratio: 16 / 9; flex: none; border-radius: 8px; }
.vdock.mini .vd-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; }
.vdock.mini .vd-info { flex: 1; min-width: 0; cursor: pointer; }
.vdock.mini .vd-title { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vdock.mini .vd-seekrow, .vdock.mini .vd-big-only { display: none; }
.vdock.mini .pl-progress { left: 12px; right: 12px; }
.vdock .pl-progress div { width: 0; }

/* Brief hero: play affordance */
#br-media { position: relative; display: block; width: 100%; padding: 0; }
.hero-play { position: absolute; left: 50%; top: calc(50% - 7px); transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: oklch(0 0 0 / 0.55); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hero-play svg { width: 28px; height: 28px; margin-left: 3px; }
