:root {
  --bg: #000; --card: #121216; --card2: #1c1c22; --line: rgba(255,255,255,.1); --ink: #f5f5f5; --dim: #a3a3ad;
  --brand: #e8875b; --claude: var(--brand); --kimi: #6fa8ff; --acc: #ffb547; --good: #4cd38a; --bad: #ff6b5e; --up: #ffb547; --down: #7fa8ff;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --tabbar: 52px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* no double-tap zoom on iOS: a double tap is an upvote here; scrolling and pinch still work */
html, body, .reel, .tap { touch-action: manipulation; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* the phone column: full screen on a phone, a centred column on a desktop */
#app { position: fixed; inset: 0; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); }
main { position: relative; flex: 1; min-height: 0; margin-top: var(--safe-t); }
.view { position: absolute; inset: 0; display: none; }
.view.on { display: block; }

/* bottom tab bar, Instagram style: black, icons, small labels */
#tabs { flex: none; height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: #000; border-top: 1px solid rgba(255,255,255,.07); z-index: 30; }
#tabs button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #8e8e98; font-size: 10px; font-weight: 600; }
#tabs svg { width: 25px; height: 25px; }
#tabs button.on { color: #fff; }
#tabs button.on svg { stroke-width: 2.3; }
#tabs #due { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--brand); color: #1a0d06; font-size: 10px; line-height: 16px; font-weight: 800; }

/* feed */
.feed { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.reel { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #000 center top / cover no-repeat; user-select: none; -webkit-user-select: none; }
.reel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; background: transparent; }
.tall .reel { background-size: 100% auto; background-position: center top; }
.tall .reel video { object-fit: contain; object-position: center top; }
.wide .reel { background-size: contain; background-position: center top; }
.wide .reel video { object-fit: contain; object-position: center top; }
.reel .tap { position: absolute; inset: 0; z-index: 2; }
.reel .cap { position: absolute; left: 0; right: 60px; bottom: 0; z-index: 3; padding: 56px 14px 16px;
  background: linear-gradient(0deg, rgba(0,0,0,.62) 0%, rgba(0,0,0,.35) 55%, rgba(0,0,0,0) 100%); pointer-events: none; }
.cap .who { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.cap .av { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: rgba(255,255,255,.14); border: 1.5px solid rgba(255,255,255,.75); }
.cap .who small { display: block; font-size: 12px; font-weight: 500; color: #dcdce2; }
.cap .t { margin-top: 8px; font-size: 15px; font-weight: 700; line-height: 1.25; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.cap .tk { display: block; width: 100%; margin-top: 3px; text-align: left; font-size: 13.5px; color: #ececf0; text-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: auto; }
.cap .tk span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.rail { position: absolute; right: 4px; bottom: 18px; z-index: 4; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.rail button { width: 52px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fff; font-size: 11px; font-weight: 600; filter: drop-shadow(0 1px 3px rgba(0,0,0,.55)); }
.rail svg { width: 30px; height: 30px; transition: transform .15s; }
.rail button:active svg { transform: scale(.86); }
.rail [data-act="up"].on { color: var(--up); }
.rail [data-act="down"].on { color: var(--down); }
.rail button.on svg { fill: currentColor; }
.rail [data-act="more"] svg { fill: currentColor; stroke: none; }
.flash { position: absolute; left: 50%; top: 45%; z-index: 6; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.45); pointer-events: none; animation: flash .7s ease-out forwards; }
.flash svg { width: 34px; height: 34px; fill: #fff; stroke: #fff; }
@keyframes flash { 0% { opacity: 0; transform: scale(.7); } 15% { opacity: 1; transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1); } }
.reel.paused .tap::after { content: ""; position: absolute; left: 50%; top: 45%; width: 0; height: 0; margin: -22px 0 0 -14px; border-left: 34px solid rgba(255,255,255,.85); border-top: 22px solid transparent; border-bottom: 22px solid transparent; filter: drop-shadow(0 2px 10px rgba(0,0,0,.5)); }
.burst { position: absolute; z-index: 7; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: var(--up); pointer-events: none; animation: burst .8s ease-out forwards; }
.burst svg { width: 100%; height: 100%; fill: currentColor; stroke: #fff; stroke-width: 1; filter: drop-shadow(0 4px 14px rgba(0,0,0,.4)); }
@keyframes burst { 0% { transform: scale(.3) rotate(-12deg); opacity: 0; } 20% { transform: scale(1.15) rotate(0); opacity: 1; } 45% { transform: scale(1); } 100% { transform: scale(1.05) translateY(-60px); opacity: 0; } }

/* first screen: autoplay muted, one tap turns the sound on */
.unmute { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 8px; padding: 11px 18px 11px 14px;
  border-radius: 999px; background: rgba(0,0,0,.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-weight: 700; font-size: 15px; animation: pulse 2s ease-in-out infinite; }
.unmute svg { width: 22px; height: 22px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255,255,255,.08); } }
.back { position: absolute; top: 10px; left: 10px; z-index: 8; display: flex; align-items: center; gap: 2px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(0,0,0,.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-weight: 700; font-size: 13px; }
.back svg { width: 20px; height: 20px; stroke-width: 2.4; }
.boot { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #000; transition: opacity .3s; }
.boot.gone { opacity: 0; pointer-events: none; }
.boot .logo { font-size: 56px; font-weight: 900; letter-spacing: -.04em; }
.boot .logo span { color: var(--brand); }
.boot p { margin: 0; color: var(--dim); }

/* end of a reel: the gist, a vote, the quiz, what to watch next */
.endcard { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 24px 22px 28px;
  background: rgba(6,6,10,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow-y: auto; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; } }
.endcard .k { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--acc); }
.endcard .tk { font-size: 23px; font-weight: 800; line-height: 1.25; }
.endcard .ask { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14px; }
.endcard .ask button { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); }
.endcard .ask button svg { width: 24px; height: 24px; }
.endcard .ask button.on[data-act="up"] { color: var(--up); } .endcard .ask button.on[data-act="down"] { color: var(--down); }
.endcard .ask button.on svg { fill: currentColor; }
.endcard .row { display: flex; gap: 10px; flex-wrap: wrap; }
.endcard .hint { margin-top: 6px; text-align: center; color: var(--dim); font-size: 13px; }
.btn { padding: 12px 18px; border-radius: 999px; background: rgba(255,255,255,.12); font-weight: 700; font-size: 15px; }
.btn.primary { background: #fff; color: #111; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.chain { display: block; width: 100%; padding: 12px 14px; text-align: left; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.chain small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.chain b { display: block; font-size: 16px; margin: 3px 0 2px; }
.chain span { font-size: 13px; color: var(--dim); }
.caught { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 30px; background: radial-gradient(90% 60% at 50% 40%, #1d1a26, #000 70%); }
.caught .ok { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; border: 2.5px solid var(--good); color: var(--good); }
.caught .ok svg { width: 38px; height: 38px; stroke-width: 2.6; }
.caught h2 { margin: 6px 0 0; font-size: 22px; } .caught p { margin: 0; color: var(--dim); max-width: 280px; }

/* pages */
.page { height: 100%; overflow-y: auto; padding: 14px 14px 28px; -webkit-overflow-scrolling: touch; }
.page h1 { font-size: 24px; margin: 4px 2px 10px; letter-spacing: -.02em; }
.page h2 { font-size: 17px; margin: 22px 2px 10px; }
.page .lede { color: var(--dim); margin: 0 2px 14px; font-size: 14px; }
.search { position: sticky; top: -14px; z-index: 2; margin: -14px -14px 0; padding: 14px 14px 8px; background: #000; }
.search input { width: 100%; padding: 10px 14px 10px 38px; border-radius: 12px; border: 0; background: var(--card2) no-repeat 12px center / 18px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a3ad' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.6-3.6'/%3E%3C/svg%3E"); outline: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 8px 0 12px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 7px 14px; border-radius: 10px; background: var(--card2); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chips button.on { background: #fff; color: #111; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 -14px; }
.tile { position: relative; aspect-ratio: 9 / 16; overflow: hidden; background: #15151a center / cover no-repeat; text-align: left; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.75), rgba(0,0,0,0) 55%); }
.tile .tt { position: absolute; left: 7px; right: 7px; bottom: 7px; z-index: 1; font-size: 12px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .seen { position: absolute; top: 6px; right: 6px; z-index: 1; display: flex; align-items: center; gap: 3px; padding: 2px 7px 2px 4px; border-radius: 999px; background: rgba(0,0,0,.6); font-size: 10.5px; font-weight: 700; }
.tile .seen svg { width: 13px; height: 13px; stroke: var(--good); stroke-width: 3; }
.tile .off { position: absolute; top: 6px; left: 6px; z-index: 1; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: var(--good); font-size: 10.5px; font-weight: 700; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; }
.empty { color: var(--dim); text-align: center; padding: 34px 16px; font-size: 14px; }
.stat { display: flex; gap: 8px; margin: 4px 0 6px; }
.stat div { flex: 1; padding: 12px; border-radius: 14px; background: var(--card); }
.stat b { display: block; font-size: 22px; } .stat span { color: var(--dim); font-size: 12px; font-weight: 600; }
.link { color: var(--dim); font-size: 13px; text-decoration: underline; margin: 10px 2px; }
.card { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--card); margin-bottom: 8px; width: 100%; text-align: left; }
.card img, .card .ph { width: 48px; height: 85px; border-radius: 8px; object-fit: cover; flex: none; background: #222; display: grid; place-items: center; font-size: 24px; }
.card .t { font-weight: 700; line-height: 1.25; }
.card .s { color: var(--dim); font-size: 13px; margin-top: 2px; }
.card.due { background: linear-gradient(120deg, #3a2316, var(--card)); }

/* bottom sheets */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet .scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.sheet .panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; max-height: 86%; background: #18181d; border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; padding-bottom: var(--safe-b); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .grab { height: 22px; flex: none; position: relative; }
.sheet .grab::after { content: ""; position: absolute; left: 50%; top: 9px; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: rgba(255,255,255,.25); }
.sheet .body { overflow-y: auto; padding: 2px 18px 22px; }
.sheet h3 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--acc); margin: 18px 0 6px; }
.sheet h2 { margin: 2px 0 4px; font-size: 21px; line-height: 1.2; }
.sheet p { margin: 0 0 8px; color: #e4e4ea; }
.sheet .muted { color: var(--dim); font-size: 14px; }
.sheet ul { margin: 0; padding-left: 18px; color: var(--dim); font-size: 14px; }
.sheet .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.counter { border-left: 3px solid var(--bad); padding-left: 12px; }
.why-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.why-chips button { padding: 11px 15px; border-radius: 12px; background: var(--card2); font-weight: 600; }
.quiz .q { font-size: 19px; font-weight: 800; margin: 6px 0 14px; }
.quiz button.o { display: block; width: 100%; text-align: left; padding: 13px 15px; border-radius: 13px; background: rgba(255,255,255,.07); margin-bottom: 8px; font-weight: 600; }
.quiz button.o.right { background: rgba(76,211,138,.22); outline: 2px solid var(--good); }
.quiz button.o.wrong { background: rgba(255,107,94,.18); outline: 2px solid var(--bad); }
.quiz .why { margin-top: 10px; color: var(--dim); }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 18px); transform: translateX(-50%); z-index: 60; background: #fff; color: #111; padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; white-space: nowrap; }

/* lab only: the second maker's text reels, the blind Arena, viewer votes */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; margin-bottom: 7px; }
.badge.claude { background: var(--claude); color: #1a0d06; } .badge.kimi { background: var(--kimi); color: #06101f; } .badge.ghost { background: rgba(255,255,255,.16); color: #fff; }
.story { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 56px 22px 120px; }
.story .segs { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 4px; z-index: 3; }
.story .segs span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.25); overflow: hidden; }
.story .segs span i { display: block; height: 100%; width: 0; background: #fff; }
.story .em { font-size: 42px; margin-top: 18px; }
.story .topic { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-top: 10px; }
.story h2 { font-size: 26px; line-height: 1.15; margin: 10px 0 14px; }
.story .p { font-size: 17px; line-height: 1.5; color: #e9e4dc; }
.story .src { margin-top: auto; font-size: 12px; color: var(--dim); }
.story .tapL, .story .tapR { position: absolute; top: 0; bottom: 0; z-index: 2; }
.story .tapL { left: 0; width: 35%; } .story .tapR { right: 0; width: 65%; }
.score { display: flex; gap: 10px; margin: 0 0 18px; }
.score div { flex: 1; padding: 14px; border-radius: 16px; background: var(--card); text-align: center; }
.score b { display: block; font-size: 28px; line-height: 1.1; }
.score .c b { color: var(--claude); } .score .k b { color: var(--kimi); }
.score span { font-size: 12px; color: var(--dim); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.pair .done { color: var(--good); font-size: 12px; font-weight: 800; }
#overlay { position: fixed; inset: 0; z-index: 45; background: #000; max-width: 480px; margin: 0 auto; }
#overlay .reel { height: 100%; }
#overlay .x { position: absolute; top: calc(var(--safe-t) + 10px); left: 12px; z-index: 10; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.5); font-size: 20px; }
.ab { display: flex; gap: 10px; margin: 14px 0; }
.ab button { flex: 1; padding: 22px 10px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); font-weight: 800; font-size: 18px; }
.ab button.seen { border-color: var(--good); }
.ab small { display: block; font-weight: 600; font-size: 12px; color: var(--dim); margin-top: 4px; }
.vote { display: flex; gap: 8px; flex-wrap: wrap; } .vote button { flex: 1; min-width: 90px; }
.reveal { padding: 14px; border-radius: 16px; background: var(--card); margin-top: 12px; }
table.votes { width: 100%; border-collapse: collapse; font-size: 13px; }
table.votes td, table.votes th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.votes td.n { text-align: right; font-variant-numeric: tabular-nums; }

/* listen */
.player { padding: 16px; border-radius: 20px; background: linear-gradient(160deg, #241a33, #121219); margin-bottom: 16px; }
.player img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 14px; }
.player .t { font-size: 19px; font-weight: 800; margin-top: 12px; }
.player .s { color: var(--dim); font-size: 14px; }
.player .now { margin-top: 12px; font-size: 18px; line-height: 1.45; min-height: 80px; }
.player .ctl { display: flex; justify-content: center; align-items: center; gap: 30px; margin-top: 12px; }
.player .ctl button svg { width: 26px; height: 26px; fill: currentColor; }
.player .ctl .pp { width: 62px; height: 62px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; }
.player .pbar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); margin-top: 12px; }
.player .pbar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--brand); }
.card.playing { outline: 2px solid var(--brand); }

/* account card in Library */
.account { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--card); margin: 0 0 12px; }
.account img { width: 40px; height: 40px; border-radius: 50%; flex: none; background: #222; }
.account div { flex: 1; min-width: 0; } .account b { display: block; } .account span { display: block; color: var(--dim); font-size: 13px; margin-top: 2px; }
.account.out { flex-direction: column; align-items: stretch; } .account .link { margin: 0; flex: none; }
.gbtn { min-height: 44px; margin-top: 8px; }
.endcard .btn svg { width: 18px; height: 18px; vertical-align: -3px; }
.endcard .link { text-align: left; margin: 0; color: #d8d8e0; }
