:root {
  color-scheme: dark;
  /* one flat canvas; surfaces separate by tone and space, not borders */
  --page: #0e0e10; --panel: #16161a; --raise: #1f1f24; --hover: #ffffff0d; --line: #ffffff10;
  --fg: #f3f3f4; --muted: #8d8d96; --faint: #5c5c66;
  --ember: #ff6a3d; --ember-soft: #ff6a3d1f; --live: #ff4d4d;
  --r: 12px;
  --display: "Sora", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box }
html, body, #main { height: 100%; margin: 0 }
body { background: var(--page); color: var(--fg); font: 14px/1.4 var(--body); overflow: hidden; user-select: none; -webkit-font-smoothing: antialiased }
img { display: block }
button { font: inherit; color: inherit; cursor: pointer }
button:focus-visible, input:focus-visible, .card:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px }
::-webkit-scrollbar { width: 8px; height: 8px } ::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px }
:hover::-webkit-scrollbar-thumb { background: #ffffff1c }

.app { height: 100%; display: flex; flex-direction: column }

/* top bar */
.topbar { height: 60px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 20px }
.brand { width: 206px; flex: none; font: 700 18px var(--display); letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; cursor: pointer }
.iconbtn { background: none; border: none; border-radius: 10px; height: 36px; width: 36px; display: grid; place-items: center; color: var(--muted) }
.iconbtn:hover { background: var(--hover); color: var(--fg) }
.iconbtn svg { width: 20px; height: 20px; fill: currentColor }
.searchbox { flex: 0 1 520px; height: 40px; border-radius: 999px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238d8d96' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center; border: 1px solid transparent; color: var(--fg); padding: 0 16px 0 44px; font: 14px var(--body); transition: border-color .15s, background-color .15s }
.searchbox:hover { background-color: var(--raise) }
.searchbox:focus { outline: none; border-color: #ff6a3d80; background-color: var(--raise) }
.searchbox::placeholder { color: var(--muted) }
.spacer { flex: 1 }
.btn { font: 600 13px var(--body); border-radius: 10px; padding: 9px 16px; border: none; background: #ffffff14; color: var(--fg); display: inline-flex; align-items: center; gap: 8px; transition: background-color .15s, filter .15s }
.btn:hover { background: #ffffff24 }
.btn.p { background: var(--ember); color: #160d09 }
.btn.p:hover { filter: brightness(1.08) }
.btn.ghost { background: none; color: var(--muted) }
.btn.ghost:hover { background: var(--hover); color: var(--fg) }
.btn.glass { background: #ffffff1f; backdrop-filter: blur(12px) }
.btn.glass:hover { background: #ffffff33 }
.btn.small { padding: 7px 12px; font-size: 12.5px }
.btn svg { width: 16px; height: 16px; fill: currentColor }

.body { flex: 1; display: flex; min-height: 0 }

/* sidebar */
.side { width: 246px; flex: none; padding: 4px 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px }
.side h4 { font: 600 12px var(--body); color: var(--muted); margin: 12px 10px 8px; display: flex; justify-content: space-between }
.side h4 span { color: var(--faint); font-weight: 500 }
.fol { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 10px; cursor: pointer; transition: background-color .12s }
.fol:hover { background: var(--hover) }
.fol .av { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--raise); object-fit: cover }
.fol .txt { min-width: 0; flex: 1 }
.fol .n { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.fol .g { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.fol .cnt { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums }
.fol.off .av { filter: grayscale(1); opacity: .55 }
.fol.off .n { color: var(--muted); font-weight: 500 }
.more { background: none; border: none; color: var(--muted); font: 600 12px var(--body); text-align: left; padding: 8px 10px; border-radius: 10px; margin-top: 6px }
.more:hover { background: var(--hover); color: var(--fg) }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); flex: none; box-shadow: 0 0 0 3px #ff4d4d26 }
.side-note { color: var(--muted); font-size: 13px; margin: 10px; line-height: 1.5 }
.side-cta { margin: 6px 4px; padding: 16px; border-radius: var(--r); background: var(--panel); display: flex; flex-direction: column; gap: 12px; font-size: 13px; line-height: 1.5 }
.side-cta p { margin: 0; color: var(--muted) }

/* pages */
.main { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 28px 48px 16px; display: flex; flex-direction: column; gap: 36px }
.main.watching { padding: 0 8px 8px 0; overflow: hidden; gap: 0 }
.sec h3 { font: 600 19px var(--display); letter-spacing: -.01em; margin: 0 0 16px; display: flex; align-items: center; gap: 10px }
.sec h3 small { font: 500 13px var(--body); color: var(--muted) }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 26px 18px }
.grid.games { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px }
.error { color: #ffb4a3; background: #ff4d4d14; border-radius: 10px; padding: 12px 14px; font-size: 13px }
.loading { color: var(--muted); font-size: 13px }

/* cards */
.card { cursor: pointer; min-width: 0 }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: var(--r); overflow: hidden; background: var(--panel) }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease, filter .3s }
.card:hover .thumb img { transform: scale(1.035); filter: brightness(1.08) }
.viewers { position: absolute; bottom: 8px; left: 8px; background: #000000a0; backdrop-filter: blur(8px); color: #fff; font: 600 11.5px var(--body); padding: 3px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px }
.viewers.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live) }
.viewers.r { left: auto; right: 8px }
.multi { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 999px; border: none; background: #000000a0; backdrop-filter: blur(8px); color: #fff; font: 500 20px/1 var(--body); opacity: 0; transform: scale(.9); transition: opacity .15s, transform .15s }
.card:hover .multi { opacity: 1; transform: none }
.multi:hover { background: var(--ember); color: #160d09 }
.meta { display: flex; gap: 11px; margin-top: 11px }
.meta .av { width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--raise); object-fit: cover }
.meta .txt { min-width: 0 }
.ttl { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px }
.link:hover { color: var(--fg) }
.game .thumb { aspect-ratio: 3/4 }
.game .ttl { margin-top: 10px; font-size: 13.5px }
.game .sub { font-size: 12.5px }

/* hero */
.hero { position: relative; height: 400px; flex: none; border-radius: 20px; overflow: hidden; background: var(--panel) }
.hero video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(90deg, #0e0e10f2 0%, #0e0e1099 38%, #0e0e1000 70%), linear-gradient(0deg, #0e0e10b0 0%, #0e0e1000 45%) }
.hero .info { position: absolute; left: 36px; bottom: 34px; max-width: min(560px, 52%); display: flex; flex-direction: column; gap: 12px }
.kicker { font: 600 12px var(--body); color: #fff; display: flex; gap: 8px; align-items: center; background: #ffffff14; backdrop-filter: blur(12px); align-self: flex-start; padding: 5px 12px 5px 10px; border-radius: 999px }
.hero h2 { font: 700 30px/1.15 var(--display); letter-spacing: -.02em; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.hero p { margin: 0; color: #d6d6dc; font-size: 14px }
.btns { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap }
.hero .btn { padding: 11px 18px; font-size: 13.5px }

/* channel */
.chan-head { display: flex; gap: 22px; align-items: center; padding-top: 12px }
.chan-head img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover }
.chan-head h1 { font: 700 28px var(--display); letter-spacing: -.02em; margin: 0 }
.chan-head p { margin: 8px 0 0; color: var(--muted); max-width: 70ch; line-height: 1.55 }
.tabs { display: flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 999px; align-self: flex-start }
.tab { font: 600 13px var(--body); background: none; border: none; color: var(--muted); border-radius: 999px; padding: 8px 16px; transition: background-color .15s, color .15s }
.tab:hover { color: var(--fg) }
.tab.on { color: var(--fg); background: var(--raise) }
.chips { display: flex; flex-wrap: wrap; gap: 10px }
.chip { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 999px; padding: 5px 16px 5px 5px; cursor: pointer; font-weight: 600; font-size: 13px; transition: background-color .15s }
.chip:hover { background: var(--raise) }
.chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover }

/* watching */
.watch { flex: 1; display: flex; gap: 8px; min-height: 0; height: 100% }
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative }
.tiles { flex: 1; display: grid; gap: 8px; min-height: 0 }
.tiles.n1 { grid-template-columns: 1fr }
.tiles.n2 { grid-template-columns: 1fr 1fr }
.tiles.n3, .tiles.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr }
.tile { position: relative; border-radius: 16px; overflow: hidden; background: #000; min-height: 0 }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000 }
.tile.focus { box-shadow: inset 0 0 0 2px var(--ember) }
.tiles.n1 .tile.focus { box-shadow: none }
.tile .bar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 6px; align-items: center; opacity: 0; transition: opacity .2s; z-index: 2 }
.tile .lbl { background: #00000080; backdrop-filter: blur(10px); padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis }
.tile .x { background: #00000080; backdrop-filter: blur(10px); color: #fff; border: none; border-radius: 999px; height: 32px; width: 32px; margin-left: auto; font: 12px var(--body) }
.tile .x:hover { background: #ffffff30 }
.tiles.n1 .tile .lbl { display: none } /* the title is already under the player */
.tile.pl-show .bar { opacity: 1 }
.tile:not(.pl-show) { cursor: none }

/* theater: video fills the window, chat stays */
body.theater .topbar, body.theater .side { display: none }
body.theater .main.watching { padding: 8px }

/* cinema player: one slim bar that fades in on mouse move */
.pl { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: flex-end }
.pl > * { pointer-events: auto }
.pl-bar { padding: 40px 16px 12px; background: linear-gradient(0deg, #000000c8, #00000000); opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s }
.tile.pl-show .pl-bar, .pl-bar:focus-within { opacity: 1; transform: none }
.pl-row { display: flex; align-items: center; gap: 4px; color: #fff }
.pl-btn { background: none; border: none; color: #fff; height: 36px; min-width: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 7px; font: 600 12.5px var(--body) }
.pl-btn:hover { background: #ffffff1f }
.pl-btn svg { width: 22px; height: 22px; fill: currentColor }
.pl-vol { width: 84px; accent-color: #fff }
.pl-seek { width: 100%; margin: 0 0 8px; accent-color: var(--ember); height: 4px }
.pl-live { background: #ffffff1a; border: none; color: #fff; border-radius: 999px; padding: 5px 11px; font: 700 11px var(--body); letter-spacing: .05em; display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-variant-numeric: tabular-nums }
.pl-live .pl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live) }
.pl-live.behind .pl-dot { background: #9a9a9a }
.pl-live:hover { background: #ffffff30 }
.pl-delay { font-weight: 500; letter-spacing: 0; opacity: .75 }
.pl-time { font-size: 12.5px; margin-left: 6px; font-variant-numeric: tabular-nums; opacity: .9 }
.pl-sp { flex: 1 }
.pl-qwrap { position: relative }
.pl-menu { position: absolute; bottom: 46px; right: 0; background: #16161ae8; backdrop-filter: blur(16px); border-radius: 14px; padding: 6px; min-width: 140px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 12px 40px #0008 }
.pl-menu[hidden] { display: none }
.pl-menu button { background: none; border: none; color: var(--fg); text-align: left; padding: 8px 12px; border-radius: 8px; font: 13px var(--body) }
.pl-menu button:hover { background: #ffffff14 }
.pl-menu button.on { color: var(--ember); font-weight: 600 }
.pl-ad { align-self: center; margin-top: 16px; margin-bottom: auto; background: #00000090; backdrop-filter: blur(10px); color: var(--fg); padding: 8px 16px; border-radius: 999px; font-size: 13px }
.pl-ad[hidden] { display: none }
.pl-stats { position: absolute; top: 56px; left: 12px; background: #000000a8; backdrop-filter: blur(10px); border-radius: 12px; padding: 12px 14px; font: 12px var(--body); color: #fff; display: grid; gap: 4px; min-width: 214px; font-variant-numeric: tabular-nums }
.pl-stats[hidden] { display: none }
.pl-stats div { display: flex; justify-content: space-between; gap: 16px }
.pl-stats span { opacity: .65 }
.tile:fullscreen { border-radius: 0; box-shadow: none }

.wbar { height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 6px; font-size: 13px; color: var(--muted) }
.wbar .now { color: var(--fg); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0 }
.wbar .hint { white-space: nowrap; flex: none }
.seg { display: flex; background: var(--panel); border-radius: 999px; padding: 3px; margin-left: auto; flex: none }
.seg button { background: none; border: none; color: var(--muted); padding: 6px 13px; border-radius: 999px; font: 600 12px var(--body); transition: background-color .15s, color .15s }
.seg button:hover { color: var(--fg) }
.seg button.on { background: var(--raise); color: var(--fg) }

/* chat */
.chat { width: 340px; flex: none; background: var(--panel); border-radius: 16px; display: flex; flex-direction: column; min-height: 0; overflow: hidden }
.chat.overlay { position: absolute; right: 14px; top: 14px; bottom: 66px; width: 320px; border-radius: 14px; background: #0e0e10a0; backdrop-filter: blur(6px); pointer-events: none; z-index: 1 }
.chat .hd { padding: 14px 16px 10px; font: 600 13px var(--body); color: var(--fg) }
.chat.overlay .hd { display: none }
.msgs { flex: 1; overflow-y: auto; padding: 6px 16px 14px; display: flex; flex-direction: column-reverse; gap: 7px; font-size: 13.5px; line-height: 1.5; user-select: text }
.chat.overlay .msgs { overflow: hidden; text-shadow: 0 1px 3px #000 }
.msg { word-wrap: break-word; color: #e4e4e8 }
.msg b { font-weight: 600 }
.emote { display: inline-block; height: 26px; vertical-align: middle; margin: -4px 1px }
.chat .status { color: var(--muted); font-size: 12px; padding: 4px 16px }

/* sign-in dialog */
.modal-bg { position: fixed; inset: 0; background: #00000080; backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50 }
.modal { width: 420px; background: var(--panel); border-radius: 22px; padding: 30px; display: flex; flex-direction: column; gap: 16px; text-align: center; box-shadow: 0 24px 80px #000a }
.modal h2 { font: 700 21px var(--display); margin: 0 }
.modal p { margin: 0; color: var(--muted); line-height: 1.55 }
.code { font: 700 36px var(--display); letter-spacing: .14em; color: var(--ember); user-select: text; background: var(--raise); border-radius: 14px; padding: 14px 0 }
.modal .btns { justify-content: center }

/* ---- web additions ---- */
a { color: inherit; text-decoration: none }
.card { display: block }
html, body { overscroll-behavior: none }
@media (max-width: 900px) {
  .side { display: none }
  .brand { width: auto }
  .topbar { padding: 0 12px }
  .main { padding: 4px 16px 40px }
  .main.watching { padding: 0 }
  .watch { flex-direction: column; gap: 0 }
  .stage { flex: none }
  .tiles { aspect-ratio: 16/9; flex: none }
  .tile { border-radius: 0 }
  .wbar { padding: 0 12px }
  #chat-side { flex: 1; min-height: 0; display: flex }
  .chat { width: auto; flex: 1; border-radius: 0 }
  .hero { height: 300px }
  .hero .info { left: 20px; right: 20px; bottom: 20px; max-width: none }
  .hero h2 { font-size: 22px }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) }
}
@media (max-width: 520px) { .wbar .seg button { padding: 6px 9px } .searchbox { padding-left: 40px } #back { display: none } }
@media (max-width: 900px) {
  .searchbox { flex: 1 1 auto; min-width: 0 }
  .topbar .btn { flex: none }
  .pl-vol, .pl-theater, .pl-stat, .pl-time { display: none }
  .pl-bar { padding: 24px 6px 4px }
  .pl-btn { min-width: 32px; padding: 0 4px }
  .wbar .now { font-size: 13px }
}
@media (max-width: 520px) { .brand { font-size: 0; gap: 0 } }
