/* Rapids. Built to feel like the streaming apps people already know (Kick, Twitch): near-black,
   dense, sidebar of channels, thumbnails everywhere, chat on the right. Teal is the one brand color;
   red is reserved for LIVE, as on every streaming site. */
:root {
  --bg: #0b0e10;
  --surface: #121619;
  --raised: #1a1f23;
  --hover: #22292e;
  --line: #262d33;
  --text: #eff2f3;
  --muted: #a1abb2;
  --dim: #6c777f;
  --teal: #2ee6c9;
  --teal-ink: #04201c;
  --live: #eb0400;
  --nav: 52px;
  --side: 240px;
  --chat: 340px;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --brand: "Unbounded", var(--ui);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.45 var(--ui); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* Top nav */
.nav { position: fixed; inset: 0 0 auto 0; height: var(--nav); z-index: 30; display: flex; align-items: center; gap: 16px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.logo { display: flex; align-items: center; gap: 8px; font: 800 18px/1 var(--brand); letter-spacing: -.02em; }
.logo svg { width: auto; height: 20px; }
.nav .browse { font-weight: 600; font-size: 15px; padding: 6px 10px; border-radius: 6px; color: var(--text); }
.nav .browse:hover, .nav .browse[aria-current="page"] { color: var(--teal); }
.search { flex: 1; min-width: 0; max-width: 420px; margin: 0 auto; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; height: 36px; }
.search:focus-within { border-color: var(--teal); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; height: 100%; }
.search svg { color: var(--muted); }
.nav .right { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: 6px; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--teal); color: var(--teal-ink); white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.gray { background: var(--raised); color: var(--text); }
.btn.gray:hover { background: var(--hover); filter: none; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 15px; }
.me { display: flex; align-items: center; gap: 8px; padding: 2px 8px 2px 2px; border-radius: 999px; font-weight: 600; }
.me:hover { background: var(--raised); }

/* Avatars */
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--ui); color: rgba(0,0,0,.6); flex: none; }
.av.md { width: 40px; height: 40px; font-size: 15px; }
.av.lg { width: 64px; height: 64px; font-size: 24px; }
.av.ring { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--live); }

/* Live and count markers */
.livetag { display: inline-flex; align-items: center; background: var(--live); color: #fff; font-weight: 700; font-size: 12px; line-height: 1; padding: 4px 6px; border-radius: 4px; letter-spacing: .03em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); display: inline-block; flex: none; }
.cat { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--raised); color: var(--muted); font-size: 12px; font-weight: 600; }
.cat:hover { background: var(--hover); color: var(--text); }

/* Frame: sidebar + content */
.frame { padding-top: var(--nav); }
.sidebar { position: fixed; top: var(--nav); bottom: 0; left: 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 0 20px; z-index: 20; }
.sidebar h3 { font-size: 13px; font-weight: 700; margin: 6px 12px 6px; color: var(--text); }
.sidebar .row { display: flex; align-items: center; gap: 10px; padding: 6px 12px; }
.sidebar .row:hover { background: var(--raised); }
.sidebar .row .txt { min-width: 0; flex: 1; }
.sidebar .row .txt b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .row .txt span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .row .n { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.sidebar .row.off { opacity: .55; }
.sidebar .row.off .n { color: var(--dim); }
.sidebar .none { color: var(--dim); font-size: 13px; padding: 2px 12px 8px; margin: 0; }
.sidebar .sep { height: 1px; background: var(--line); margin: 10px 12px; }
.content { margin-left: var(--side); padding: 24px 28px 48px; min-width: 0; }

/* Home: featured */
.featured { display: grid; grid-template-columns: minmax(0, 1fr) 300px; background: var(--surface); border-radius: 10px; overflow: hidden; margin-bottom: 28px; }
.featured .player { border-radius: 0; }
.featured .info { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.featured .info .who { display: flex; gap: 10px; align-items: center; }
.featured .info b { font-size: 16px; display: block; }
.featured .info .viewers { color: var(--live); font-weight: 600; font-size: 13px; }
.featured .info p { margin: 0; color: var(--text); }
.featured .info .btn { align-self: flex-start; margin-top: auto; }
.featured .info .cat { align-self: flex-start; }
.quiet { padding: 32px; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border-radius: 10px; margin-bottom: 28px; border: 1px solid var(--line); }
.quiet b { font-size: 18px; display: block; margin-bottom: 2px; }
.quiet span { color: var(--muted); }

/* Sections and grids */
.head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.head h2 em { color: var(--teal); font-style: normal; }
.head a { color: var(--teal); font-size: 13px; font-weight: 600; margin-left: auto; }
.block { margin-bottom: 32px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px 16px; }
.card .thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--raised); border-radius: 6px; overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.card:hover .thumb { transform: translate(4px, -4px); box-shadow: -4px 4px 0 var(--teal); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; font: 800 40px/1 var(--brand); color: rgba(0,0,0,.35); }
.card .thumb .livetag { position: absolute; top: 8px; left: 8px; }
.card .thumb .eyes { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,.72); font-size: 13px; padding: 1px 6px; border-radius: 4px; }
.card .thumb .offtag { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.72); color: var(--muted); font-size: 12px; font-weight: 600; padding: 3px 6px; border-radius: 4px; }
.card .meta { display: flex; gap: 10px; margin-top: 10px; }
.card .meta .txt { min-width: 0; }
.card .meta .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.card .meta .u { color: var(--muted); font-size: 13px; display: block; }
.card .meta .cat { margin-top: 6px; }
.empty { color: var(--muted); }

/* Category tiles */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.ctile { display: block; }
.ctile .art { aspect-ratio: 3 / 4; border-radius: 6px; display: grid; place-items: center; transition: transform .12s ease, box-shadow .12s ease; }
.ctile:hover .art, .ctile[aria-current="true"] .art { transform: translate(4px, -4px); box-shadow: -4px 4px 0 var(--teal); }
.ctile .art svg { width: 44%; height: auto; color: rgba(0,0,0,.55); }
.ctile b { display: block; margin-top: 8px; font-size: 14px; }
.ctile span { color: var(--muted); font-size: 13px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.chip { flex: none; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--raised); border: 0; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--teal); color: var(--teal-ink); }

/* Player */
.player { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; overflow: hidden; }
.player iframe { border: 0; width: 100%; height: 100%; display: block; }
.player .offline { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; background: radial-gradient(90% 90% at 50% 40%, #142026, #000); }
.player .offline b { display: block; font-size: 20px; margin-bottom: 4px; }
.player .offline span { color: var(--muted); }

/* Channel page */
.watch { margin-left: var(--side); margin-right: var(--chat); min-width: 0; }
.chaninfo { padding: 16px 20px; display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.chaninfo .txt { flex: 1; min-width: 220px; }
.chaninfo h1 { font-size: 18px; font-weight: 700; margin: 0; }
.chaninfo .title { margin: 2px 0 6px; font-size: 15px; }
.chaninfo .line2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.chaninfo .viewers { display: inline-flex; gap: 5px; align-items: center; color: var(--live); font-weight: 600; }
.chaninfo .acts { display: flex; gap: 8px; align-items: center; }
.btn.following { background: var(--raised); color: var(--text); }
.about { margin: 4px calc(var(--chat) + 20px) 32px calc(var(--side) + 20px); background: var(--surface); border-radius: 8px; padding: 18px 20px; }
.about h2 { font-size: 16px; margin: 0 0 4px; }
.about p { margin: 0; color: var(--muted); }
.about .report { background: none; border: 0; padding: 0; color: var(--dim); cursor: pointer; font-size: 13px; margin-top: 10px; display: inline-flex; gap: 6px; align-items: center; }
.about .report:hover { color: var(--text); }

/* Tip splash over the player */
.splash { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; overflow: hidden; }
.splash .ring { position: absolute; width: 110px; height: 110px; border-radius: 50%; border: 3px solid var(--teal); opacity: 0; animation: ripple 1.7s cubic-bezier(.2, .7, .3, 1) forwards; }
.splash .ring:nth-child(2) { animation-delay: .16s; }
.splash .ring:nth-child(3) { animation-delay: .32s; border-color: #fff; }
.splash .card { position: relative; text-align: center; background: rgba(11, 14, 16, .9); border: 2px solid var(--teal); border-radius: 12px; padding: 12px 22px; max-width: 80%; animation: pop 3.6s ease forwards; }
.splash .amt { font: 800 clamp(24px, 4vw, 44px)/1 var(--brand); color: var(--teal); letter-spacing: -.02em; }
.splash .from { font-weight: 700; margin-top: 6px; }
.splash .msg { color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
@keyframes ripple { 0% { opacity: .9; transform: scale(.2); } 100% { opacity: 0; transform: scale(5.5); } }
@keyframes pop { 0% { opacity: 0; transform: translateY(16px) scale(.92); } 10% { opacity: 1; transform: none; } 82% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }

/* Chat */
.chat { position: fixed; top: var(--nav); right: 0; bottom: 0; width: var(--chat); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 15; }
.chat .top { height: 50px; display: grid; place-items: center; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.feed { flex: 1; overflow-y: auto; padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.feed .welcome { color: var(--muted); padding: 6px 10px; }
.msg { padding: 4px 10px; border-radius: 4px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg:hover { background: var(--raised); }
.msg .nm { font-weight: 700; }
.msg .colon { margin-right: 4px; }
.badge { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; margin-right: 4px; vertical-align: -3px; font-size: 11px; font-weight: 800; }
.badge.host { background: var(--live); color: #fff; }
.badge.tipper { background: var(--teal); color: var(--teal-ink); }
.msg.tip { background: rgba(46, 230, 201, .1); border-left: 3px solid var(--teal); border-radius: 0 4px 4px 0; margin: 4px 0; padding: 8px 10px; }
.msg.tip .amt { display: block; font-weight: 800; color: var(--teal); font-size: 15px; }
.compose { padding: 10px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.compose .inp { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.compose .inp:focus-within { border-color: var(--teal); }
.compose input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 9px 10px; }
.compose .bar { display: flex; gap: 8px; align-items: center; }
.compose .bar .grow { flex: 1; }
.tipbtn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--teal); font-weight: 700; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.tipbtn:hover { background: var(--raised); }
.tippanel { background: var(--raised); border-radius: 8px; padding: 10px; display: grid; gap: 8px; }
.tippanel .row { display: flex; gap: 6px; }
.tippanel .amounts { display: flex; gap: 6px; flex-wrap: wrap; }
.tippanel input, .tippanel select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
.tippanel .amtin { width: 90px; }
.tippanel .note { flex: 1; }
.tippanel .fine { color: var(--muted); font-size: 12px; margin: 0; }

/* Studio */
.studio { max-width: 760px; }
.studio h1 { font-size: 24px; margin: 0 0 4px; }
.studio .lede { color: var(--muted); margin: 0 0 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 14px; }
.panel h2 { font-size: 16px; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; }
.panel h2 .step { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); font-size: 12px; }
.panel.done h2 .step { background: var(--teal); color: var(--teal-ink); }
.panel.later { opacity: .5; }
.panel p { color: var(--muted); margin: 0 0 14px; }
.panel .body { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; width: 100%; }
.field .pre { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.field .pre span { padding-left: 11px; color: var(--muted); }
.field .pre input { border: 0; padding-left: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.secret { display: flex; gap: 8px; }
.secret code { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; overflow-x: auto; white-space: nowrap; font: 500 13px/1.4 ui-monospace, Menlo, monospace; }
.err { color: #ff8f80; font-size: 13px; margin: 0; min-height: 1.2em; }
.okay { color: var(--teal); }

/* Wallet picker */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal .box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: 100%; max-width: 360px; }
.modal .box h3 { font-size: 18px; margin: 0 0 4px; }
.modal .box p { color: var(--muted); margin: 0 0 14px; }
.wallet-opt { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--raised); border: 1px solid transparent; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font-weight: 600; text-align: left; }
.wallet-opt:hover { border-color: var(--teal); }
.wallet-opt img { width: 26px; height: 26px; border-radius: 6px; }

/* Narrow desktop: icon-only sidebar */
@media (max-width: 1280px) {
  :root { --side: 56px; }
  .sidebar h3, .sidebar .row .txt, .sidebar .row .n, .sidebar .none, .sidebar .sep { display: none; }
  .sidebar .row { justify-content: center; padding: 6px 0; }
}
/* Tablet and phone: no sidebar, chat under the player */
@media (max-width: 900px) {
  :root { --side: 0px; --chat: 0px; }
  .sidebar { display: none; }
  .nav .browse { display: none; }
  .search { max-width: none; }
  .content { padding: 16px; }
  .featured { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; gap: 20px; }
  .watch { margin: 0; }
  .watch .player { position: sticky; top: var(--nav); z-index: 10; }
  .chat { position: static; width: auto; height: 70vh; border-left: 0; border-top: 1px solid var(--line); }
  .chaninfo { padding: 12px 16px; }
  .about { margin: 0 16px 16px; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .logo span { display: none; }
  .nav { gap: 8px; padding: 0 8px; }
  .nav .btn { padding: 0 10px; }
  .nav .golive span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card .thumb, .ctile .art { transition: none; }
  .splash .ring { display: none; }
  .splash .card { animation: fade 3.6s ease forwards; }
  @keyframes fade { 0%, 100% { opacity: 0; } 10%, 85% { opacity: 1; } }
}
