/* ModMonk3y live page. Built on the site.css tokens (surfaces, borders, text, radius, spacing);
   Twitch purple is kept only as this page's accent (--tw-purple). Nothing here redefines the shared
   tokens, body font or .skip, so the global header, tabs, footer and phone tab bar look the same as every page.
   Space is reserved for everything twitch.js fills in (avatar, title, meta line, lists) so the page doesn't jump. */
:root { --tw-purple: #9146ff; --tw-purple-hi: #772ce8; --tw-purple-text: oklch(78% 0.13 300); --tw-live: #eb0400; }

.tw-wrap { width: min(var(--page-max), 100% - 32px); margin-inline: auto; }

/* ---- channel header */
.tw-head { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--bg); }
.tw-banner { position: absolute; inset: 0; background: linear-gradient(120deg, #2b1458, var(--bg) 70%); background-size: cover; background-position: center; }
.tw-banner::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, color-mix(in oklch, var(--bg) 40%, transparent), color-mix(in oklch, var(--bg) 92%, transparent)); }
.tw-head-in { position: relative; padding: var(--sp-6) 0 var(--sp-5); display: grid; gap: var(--sp-3); }
.tw-id { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3) var(--sp-5); }
/* the avatar keeps its 88px slot (a placeholder circle) before twitch.js sets the picture */
.tw-avatar, .tw-avatar[hidden] { display: block; width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--tw-chan, var(--surface-3)); background: var(--surface-2); }
.tw-avatar.is-live { border-color: var(--tw-live); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--tw-live); }
.tw-id-txt { min-width: 0; }
.tw-name-row { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; min-height: calc(var(--step-3) * 1.15); }
.tw-name-row h1 { margin: 0; font-size: var(--step-3); font-weight: 850; letter-spacing: -.015em; }
.tw-live { background: var(--tw-live); color: #fff; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: var(--radius-xs); letter-spacing: .05em; }
.tw-offline { background: var(--surface-3); color: var(--fg-muted); font-weight: 750; font-size: 12px; padding: 2px 8px; border-radius: var(--radius-xs); }
/* title + meta: one line each is reserved before the data arrives */
.tw-title { margin: var(--sp-1) 0 2px; min-height: 1.45em; font-weight: 650; font-size: var(--step-0); line-height: 1.45; overflow-wrap: anywhere; }
.tw-meta { margin: 0; min-height: 1.5em; display: flex; gap: 2px var(--sp-4); flex-wrap: wrap; color: var(--fg-muted); font-size: 14px; line-height: 1.5;
  font-variant-numeric: tabular-nums; }
.tw-meta span:empty { display: none; }
.tw-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.tw-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 15px; font-weight: 750; cursor: pointer; text-decoration: none;
  background: var(--surface-2); color: var(--fg); box-shadow: var(--hi); transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
.tw-btn:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--fg); }
.tw-btn.primary { background: var(--tw-purple); border-color: transparent; color: #fff; }
.tw-btn.primary:hover { background: var(--tw-purple-hi); color: #fff; }

/* ---- player + chat: both boxes have their final size before the embeds load */
.tw-main { padding: var(--sp-5) 0 var(--sp-6); display: grid; gap: var(--sp-5); }
.tw-stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: #000; box-shadow: var(--shadow-2); }
.tw-stage[hidden] { display: none; }
.tw-ratio { position: relative; aspect-ratio: 16 / 9; background: #000; }
.tw-ratio iframe, .tw-chat iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tw-chat { position: relative; min-height: 360px; background: var(--surface-1); border-left: 1px solid var(--border); }
.tw-note { margin: 0; padding: var(--sp-3) var(--sp-4); background: var(--surface-1); border: 1px solid var(--border); border-left: 4px solid var(--tw-purple);
  border-radius: var(--radius-sm); color: var(--fg-muted); }
.tw-note a, .tw-small a, .tw-about a { color: var(--link); }

/* ---- panels */
.tw-panels { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.tw-panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--hi); padding: var(--sp-5); min-width: 0; }
@media (max-width: 560px) { .tw-panel { padding: var(--sp-4); } }
.tw-panel h2 { margin: 0 0 var(--sp-3); font-size: var(--step-1); font-weight: 800; }
.tw-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.tw-panel-head h2 { margin: 0; }
.tw-seg { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; }
.tw-seg button { appearance: none; min-height: 40px; border: 0; background: transparent; color: var(--fg-muted); font: inherit; font-size: 14px; font-weight: 750;
  padding: 0 14px; border-radius: var(--radius-pill); cursor: pointer; }
.tw-seg button:hover { color: var(--fg); }
.tw-seg button[aria-pressed="true"] { background: var(--tw-purple); color: #fff; }
.tw-feed, .tw-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
/* loading skeleton until twitch.js fills the lists */
.tw-feed:empty, .tw-board:empty { min-height: 220px; border-radius: var(--radius-sm);
  background: repeating-linear-gradient(180deg, var(--surface-2) 0 52px, transparent 52px 58px); opacity: .6; }
.tw-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: var(--sp-2); align-items: start; padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tw-item.cheer { border-left: 3px solid var(--tw-purple); } .tw-item.tip { border-left: 3px solid var(--accent); }
.tw-item-txt { overflow-wrap: anywhere; }
.tw-amt { color: var(--tw-purple-text); font-variant-numeric: tabular-nums; } .tw-item.tip .tw-amt { color: var(--accent); }
.tw-msg { display: block; color: var(--fg-muted); font-size: 13px; margin-top: 2px; }
.tw-when { color: var(--fg-muted); font-size: 12px; white-space: nowrap; }
.tw-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: var(--sp-2); align-items: center; min-height: 44px; padding: 6px var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tw-row b { overflow-wrap: anywhere; }
.tw-row.r1 { box-shadow: inset 3px 0 0 var(--reward); } .tw-row.r2 { box-shadow: inset 3px 0 0 #c9d1d9; } .tw-row.r3 { box-shadow: inset 3px 0 0 #cd8a54; }
.tw-rank { font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.tw-score { color: var(--tw-purple-text); font-weight: 850; font-variant-numeric: tabular-nums; }
.tw-row.r1 .tw-score { color: var(--reward); }
.tw-empty { color: var(--fg-muted); padding: var(--sp-3); background: var(--surface-2); border-radius: var(--radius-sm); }
.tw-about { margin: 0 0 var(--sp-2); color: var(--fg); white-space: pre-line; overflow-wrap: anywhere; }
.tw-small { color: var(--fg-muted); font-size: 14px; }
.tw-foot { color: var(--fg-muted); font-size: 14px; }
.tw-foot .tw-wrap { display: flex; gap: var(--sp-3); justify-content: space-between; flex-wrap: wrap; }

@media (max-width: 900px) {
  .tw-stage { grid-template-columns: 1fr; }
  .tw-chat { border-left: 0; border-top: 1px solid var(--border); height: 420px; }
}
@media (max-width: 640px) {
  .tw-head-in { padding: var(--sp-5) 0 var(--sp-4); }
  /* avatar beside the name, buttons in a full-width row underneath */
  .tw-id { grid-template-columns: 64px minmax(0, 1fr); gap: var(--sp-3); align-items: start; }
  .tw-avatar, .tw-avatar[hidden] { width: 64px; height: 64px; }
  .tw-meta { min-height: 44px; }   /* game + followers (+ viewers/uptime when live) take two lines in this narrow column */
  .tw-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
}
