/* ── GAMEPLAY VIEWER ─────────────────────────────
   Left: match selector (rail). Right: playout (stage). */
:root {
  --p1: #3b82f6;            /* blue side  */
  --p2: #ef4444;            /* red side   */
  --rail-w: 372px;
  --stage-bg: #06070f;
}

html.watch-html { overflow: hidden; }
body.watch-page { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }

.watch {
  height: 100%; display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "brand stage" "rail stage";
}
.watch.rail-off { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "stage"; }
.watch.rail-off .rail, .watch.rail-off .brand { display: none; }
.watch > .brand { grid-area: brand; padding: 0.7rem 1rem; background: var(--bg-nav); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.watch > .rail { grid-area: rail; }
.watch > .stage { grid-area: stage; }

/* ── RAIL ────────────────────────────────────── */
.rail { position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 0; background: var(--bg-nav); border-right: 1px solid var(--border); }
.rail-head { display: grid; gap: 0.7rem; padding: 1rem 1rem 0.8rem; border-bottom: 1px solid var(--border); }
.rail-title { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.rail-title h1 { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.rail-count { display: flex; align-items: baseline; gap: 0.6rem; font-size: 0.66rem; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; }
.rail-head .legend-search-wrap, .rail-head .legend-search { width: 100%; }
.rail-head .legend-search { min-width: 0; padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* Event type filter (Official Event / Showdown …) */
.rail-types { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rail-types[hidden] { display: none; }
.rail-types .series-pill { padding: 0.24rem 0.65rem; font-size: 0.6rem; }
.series-pill.sp-showdown { border-color: rgba(239,68,68,0.4); color: #f87171; }
.series-pill.sp-showdown.active { background: rgba(239,68,68,0.14); color: #f87171; }

/* Legend vs legend picker */
.lg-filter { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 0.45rem; }
.lg-vs { font-size: 0.58rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.lg-pick {
  display: flex; align-items: center; gap: 0.45rem; min-width: 0; height: 34px; padding: 0 0.6rem 0 0.3rem;
  background: var(--bg-card2); color: var(--text);
  border: 1px solid rgba(255,255,255,0.13); border-radius: 8px; text-align: left;
  transition: border-color 0.15s;
}
.lg-pick:hover, .lg-pick[aria-expanded="true"] { border-color: var(--accent); }
.lg-pick.is-set { border-color: rgba(59,130,246,0.55); background: rgba(59,130,246,0.1); }
.lg-pick svg { flex-shrink: 0; margin-left: auto; color: var(--dim); }
.lg-pick-icon { width: 24px; height: 24px; border-radius: 5px; font-size: 0.65rem; }
.lg-pick-name { min-width: 0; font-size: 0.74rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-pick-name.is-empty { padding-left: 0.35rem; font-weight: 500; color: var(--dim); }
.lg-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  max-height: min(420px, 60vh); overflow-y: auto; padding: 0.6rem;
  background: #131830; border: 1px solid rgba(255,255,255,0.16); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.55); scrollbar-width: thin;
}
.lg-pop[hidden] { display: none; }
.lg-pop-head { margin: 0.1rem 0.15rem 0.5rem; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.lg-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.3rem; }
.lg-tile {
  position: relative; display: grid; justify-items: center; gap: 0.25rem; padding: 0.4rem 0.1rem 0.35rem;
  background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 8px;
}
.lg-tile:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.lg-tile.is-on { border-color: var(--accent); background: rgba(59,130,246,0.14); color: #fff; }
.lg-tile .lg-icon { width: 40px; height: 40px; }
.lg-tile-name { max-width: 100%; font-size: 0.56rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-tile-n { position: absolute; top: 2px; right: 4px; min-width: 15px; padding: 0 3px; border-radius: 8px; background: #0b0d1a; border: 1px solid var(--border); font-size: 0.5rem; font-weight: 800; line-height: 13px; text-align: center; color: var(--muted); }

/* Spoiler switch + clear */
.rail-tools { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 22px; }
.spoiler-toggle { display: flex; align-items: center; gap: 0.5rem; padding: 0; background: none; border: 0; color: var(--text); }
.sw { position: relative; width: 30px; height: 17px; border-radius: 10px; background: rgba(255,255,255,0.14); transition: background 0.15s; flex-shrink: 0; }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.spoiler-toggle[aria-checked="true"] .sw { background: var(--accent-g); }
.spoiler-toggle[aria-checked="true"] .sw::after { transform: translateX(13px); }
.spoiler-label { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.spoiler-note { font-size: 0.64rem; color: var(--dim); }
.spoiler-toggle[aria-checked="true"] .spoiler-note { color: #fbbf24; }
.rail-refresh { display: inline-flex; align-items: center; justify-content: center; align-self: center; width: 20px; height: 20px; padding: 0; background: none; border: 0; border-radius: 5px; color: var(--dim); transition: color 0.15s, background 0.15s; }
.rail-refresh:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.rail-refresh:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rail-refresh.is-busy svg { animation: rl-spin 0.8s linear infinite; }
@keyframes rl-spin { to { transform: rotate(360deg); } }
.rail-clear { padding: 0; background: none; border: 0; color: var(--accent); font-size: 0.66rem; font-weight: 700; }
.rail-clear:hover { text-decoration: underline; }
.rail-clear[hidden] { display: none; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; height: 26px; padding: 0 0.6rem;
  background: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,0.14); border-radius: 7px;
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tool-btn:hover { color: #fff; border-color: var(--accent); background: rgba(59,130,246,0.12); }
.tool-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.rail-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
.rail-state { padding: 2.5rem 1.25rem; text-align: center; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.rail-state button { margin-top: 0.75rem; }

.g-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 1rem; text-align: left;
  background: #10142a; color: var(--text);
  border: 0; border-bottom: 1px solid var(--border);
}
.g-head:hover { background: #151a35; }
.g-name { flex: 1; min-width: 0; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-year { flex-shrink: 0; font-size: 0.62rem; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; }
.g-meta { flex-shrink: 0; font-size: 0.62rem; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; }
.g-chev { flex-shrink: 0; color: var(--dim); transition: transform 0.15s; }
.g-head[aria-expanded="false"] .g-chev { transform: rotate(-90deg); }

.m {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.5rem 1rem 0.5rem calc(1rem - 3px); text-align: left;
  background: transparent; color: inherit;
  border: 0; border-left: 3px solid transparent; border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}
.m { position: relative; scroll-margin: 44px 0 8px; }
/* Watched tick */
.m-check { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(34,197,94,0.16); color: #4ade80; font-size: 0.62rem; font-weight: 900; }
.m[aria-current="true"] .m-check { display: none; }
.m.is-watched .m-main, .m.is-watched .m-sub, .m.is-watched .m-round { color: var(--dim); }
.m.is-watched .lg-icon { opacity: 0.55; }
.m.is-watched[aria-current="true"] .m-main { color: #fff; }
.m:hover { background: rgba(255,255,255,0.04); }
.m[aria-current="true"] { background: rgba(59,130,246,0.13); border-left-color: var(--accent); }
.m-icons { display: flex; gap: 3px; flex-shrink: 0; }
.lg-icon {
  width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 800; color: var(--dim);
}
.lg-icon img { width: 100%; height: 100%; object-fit: cover; }
.lg-icon.is-art img { object-position: 50% 12%; transform: scale(1.75); transform-origin: 50% 20%; }   /* whole card art: zoom in on the face */
.m-text { display: grid; gap: 0.1rem; min-width: 0; flex: 1; }
.m-main, .m-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-main { font-size: 0.8rem; font-weight: 700; color: #e2e8f0; }
.m[aria-current="true"] .m-main { color: #fff; }
.m-main i { font-style: normal; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin: 0 0.35rem; }
.m-sub { font-size: 0.66rem; color: var(--muted); }
.m-round { font-weight: 700; color: #cbd5e1; }
.m.is-top .m-round { color: #facc15; }
.m-now { flex-shrink: 0; display: none; align-items: flex-end; gap: 2px; height: 12px; }
.m[aria-current="true"] .m-now { display: flex; }
.m-now span { width: 3px; height: 100%; background: var(--accent); border-radius: 1px; transform-origin: bottom; transform: scaleY(0.45); }
.is-playing .m-now span { animation: rl-eq 0.9s ease-in-out infinite; }
.m-now span:nth-child(2) { animation-delay: 0.3s; }
.m-now span:nth-child(3) { animation-delay: 0.6s; }
@keyframes rl-eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }

/* Event details (from the Events tab) under an open event */
.g-head.is-empty .g-name, .g-head.is-empty .g-meta { color: var(--dim); }
.g-info { display: grid; gap: 0.4rem; padding: 0.6rem 1rem 0.65rem; background: rgba(255,255,255,0.025); border-bottom: 1px solid rgba(255,255,255,0.06); }
.g-facts { font-size: 0.68rem; line-height: 1.5; color: var(--muted); }
.g-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.7rem; }
.g-links a { font-size: 0.66rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.g-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.g-none { padding: 0.8rem 1rem; font-size: 0.7rem; color: var(--dim); border-bottom: 1px solid rgba(255,255,255,0.04); }

/* Spoiler-hidden rows */
.g-reveal {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.45rem 1rem;
  background: rgba(245,158,11,0.07); color: #fbbf24;
  border: 0; border-bottom: 1px solid rgba(245,158,11,0.18);
  font-size: 0.66rem; font-weight: 600; text-align: left;
}
.g-reveal:hover { background: rgba(245,158,11,0.13); }
.g-reveal b { margin-left: auto; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.m.is-masked .lg-icon.is-unknown { border-style: dashed; color: var(--dim); }
.m.is-masked .m-main .m-round { font-weight: 700; }
.m.is-masked .m-sub { color: var(--dim); }
.m-reveal { flex-shrink: 0; padding: 0.2rem 0.5rem; border: 1px solid rgba(255,255,255,0.16); border-radius: 6px; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.m.is-masked:hover .m-reveal { color: #fff; border-color: rgba(255,255,255,0.4); }

.rail-foot { padding: 0.6rem 1rem; border-top: 1px solid var(--border); font-size: 0.6rem; line-height: 1.5; color: var(--dim); }
.rail-foot a { color: var(--muted); }
.rail-foot a:hover { color: var(--text); }
.rail-note { display: flex; gap: 0.45rem; margin-bottom: 0.5rem; padding: 0.5rem 0.6rem; background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.22); border-radius: 8px; color: var(--muted); }
.rail-note svg { flex-shrink: 0; margin-top: 0.12rem; color: var(--accent); }
.rail-note strong { color: #e2e8f0; font-weight: 700; }
.rail-foot .rail-note a { color: var(--accent); font-weight: 700; }
.rail-foot .rail-note a:hover { color: #93c5fd; text-decoration: underline; }
.rail-legal { margin: 0; text-align: center; text-wrap: balance; }
.rail-warn { color: #fbbf24; margin-bottom: 0.3rem; }

/* Player history: slides in over the list */
.pp {
  position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-nav); visibility: hidden; transform: translateX(-102%);
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
.pp.is-open { visibility: visible; transform: none; transition: transform 0.22s ease; }
.pp-head { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 0.8rem 0.8rem 1rem; background: linear-gradient(120deg, rgba(59,130,246,0.18), rgba(59,130,246,0) 60%); border-bottom: 1px solid var(--border); }
.pp-avatar { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.08); border: 1px solid var(--border); font-size: 1.1rem; font-weight: 800; color: var(--muted); }
.pp-id { min-width: 0; flex: 1; }
.pp-kicker { font-size: 0.56rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-g); }
.pp-id h2 { font-size: 1.1rem; font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-about { font-size: 0.68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-close { flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; background: transparent; border: 1px solid rgba(255,255,255,0.14); color: var(--muted); font-size: 0.8rem; }
.pp-close:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.pp-stats { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.55rem 0.75rem; padding: 0.7rem 1rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.72rem; color: var(--muted); }
.pp-stats b { color: var(--text); }
.pp-social { display: flex; gap: 0.75rem; }
.pp-social a { font-size: 0.66rem; font-weight: 700; color: var(--accent); }
.pp-social a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pp-legends { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.45rem 0.7rem; }
.pp-legend { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.68rem; }
.pp-legend .lg-icon { width: 26px; height: 26px; border-radius: 6px; font-size: 0.65rem; }
.pp-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
.pp-event { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 1rem; background: #10142a; border-bottom: 1px solid var(--border); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.pp-event span { font-size: 0.62rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--dim); }
.pp .m-main i { margin-left: 0; }
.pp-note { padding: 0.8rem 1rem; font-size: 0.66rem; color: var(--dim); }

/* ── STAGE ───────────────────────────────────── */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--stage-bg); }

/* Home: nothing picked yet, so recommend a match */
.home { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: clamp(0.9rem, 2.2vw, 1.75rem); scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
.stage.is-idle .home { display: block; }
.stage.is-idle .topbar, .stage.is-idle .screen-wrap, .stage.is-idle .botbar { display: none; }
.home > * { max-width: 1180px; margin-left: auto; margin-right: auto; }

/* Latest channel upload: a slim banner above the recommendations */
.latest {
  display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.75rem; padding: 0.5rem 0.9rem 0.5rem 0.5rem;
  background: linear-gradient(90deg, rgba(255,0,0,0.14), rgba(255,0,0,0) 55%), var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1); border-left: 3px solid #ff0000; border-radius: var(--rad);
  transition: border-color 0.15s, background 0.15s;
}
.latest:hover { border-color: rgba(255,255,255,0.3); border-left-color: #ff0000; }
.latest-thumb { width: 96px; aspect-ratio: 16 / 9; flex-shrink: 0; object-fit: cover; border-radius: 6px; background: #000; }
.latest-text { display: grid; gap: 0.15rem; min-width: 0; flex: 1; }
.latest-kicker { display: flex; align-items: center; gap: 0.4rem; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #ff5252; }
.latest-title { font-size: 0.92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.latest-cta { flex-shrink: 0; padding: 0.4rem 0.8rem; background: #ff0000; color: #fff; border-radius: 7px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; transition: background 0.15s; }
.latest:hover .latest-cta { background: #cc0000; }
.latest:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@container (max-width: 560px) { .latest-cta { display: none; } .latest-thumb { width: 80px; } .latest-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 0.82rem; } }

.feat {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 46vh; overflow: hidden;
  padding: 0; background: #0d1020; color: #fff; text-align: left;
  border: 1px solid rgba(255,255,255,0.12); border-radius: var(--rad-lg);
  transition: border-color 0.15s;
}
.feat:hover { border-color: rgba(255,255,255,0.35); }
.feat-art { position: absolute; top: 0; bottom: 0; width: 58%; overflow: hidden; }
.feat-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 14%; transform: scale(1.22); transform-origin: 50% 20%; transition: transform 0.5s ease; }
.feat:hover .feat-art img { transform: scale(1.27); }
.feat-art-1 { left: 0; clip-path: polygon(0 0, 100% 0, 79% 100%, 0 100%); background: linear-gradient(135deg, #16223f, #0d1020); }
.feat-art-2 { right: 0; clip-path: polygon(21% 0, 100% 0, 100% 100%, 0 100%); background: linear-gradient(225deg, #3a141b, #0d1020); }
.feat-art::after { content: ''; position: absolute; inset: 0; }
.feat-art-1::after { background: linear-gradient(90deg, rgba(59,130,246,0.38), rgba(59,130,246,0) 70%); }
.feat-art-2::after { background: linear-gradient(270deg, rgba(239,68,68,0.38), rgba(239,68,68,0) 70%); }
.feat-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,7,15,0.72) 0%, rgba(6,7,15,0) 26%, rgba(6,7,15,0) 48%, rgba(6,7,15,0.94) 100%); }
.feat-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: clamp(0.8rem, 2vw, 1.4rem) clamp(0.9rem, 2.4vw, 1.75rem); }
.feat-kicker { padding: 0.28rem 0.65rem; background: var(--accent-g); color: #000; border-radius: 5px; font-size: 0.62rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.feat-event { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; text-align: right; text-shadow: 0 1px 6px rgba(0,0,0,0.8); }
.feat-vs {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: clamp(1.3rem, 3.4vw, 2.8rem); font-weight: 900; font-style: italic; letter-spacing: 0.04em;
  text-shadow: 0 2px 18px rgba(0,0,0,0.9);
}
.feat-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 1rem; padding: clamp(0.8rem, 2vw, 1.5rem) clamp(0.9rem, 2.4vw, 1.75rem); }
.feat-side { display: grid; gap: 0.15rem; min-width: 0; }
.feat-p2 { text-align: right; }
.feat-name { font-size: clamp(1.05rem, 2.5vw, 2.1rem); font-weight: 900; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 12px rgba(0,0,0,0.85); }
.feat-legend { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.feat-p1 .feat-legend { color: #93c5fd; }
.feat-p2 .feat-legend { color: #fca5a5; }
.feat-play { padding: 0.6rem 1.3rem; background: var(--accent); border-radius: 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; transition: background 0.15s; }
.feat:hover .feat-play { background: #2563eb; }

.home-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }
.home-title { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.home { container-type: inline-size; }
.rec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin-top: 0.7rem; }
@container (min-width: 1300px) { .rec-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (max-width: 560px) { .rec-grid { grid-template-columns: minmax(0, 1fr); } }

/* Home: numbers, events, legends, players */
.home-gap { margin-top: 1.6rem; }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin-top: 1.2rem; }
.home-stats > div { display: grid; gap: 0.1rem; padding: 0.7rem 0.9rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--rad); }
.home-stats b { font-size: clamp(1.1rem, 2.4vw, 1.6rem); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.home-stats span { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.ev-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin-top: 0.7rem; }
.ev-tile { display: grid; gap: 0.2rem; align-content: start; padding: 0.8rem 0.9rem; text-align: left; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: var(--rad); transition: border-color 0.15s, background 0.15s; }
.ev-tile:hover, .lgc:hover, .plc:hover { border-color: var(--accent); background: #141c2f; }
.ev-flag { font-size: 1.3rem; line-height: 1.2; }
.ev-name { font-size: 0.9rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-sub { font-size: 0.68rem; color: var(--muted); }
.ev-foot { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.35rem; font-size: 0.62rem; font-weight: 700; color: var(--dim); }

.lgc-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; margin-top: 0.7rem; }
.lgc { display: grid; gap: 0.15rem; padding: 0 0 0.55rem; overflow: hidden; text-align: left; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: var(--rad); transition: border-color 0.15s, background 0.15s; }
.lgc-art { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden; margin-bottom: 0.35rem; background: linear-gradient(160deg, #0e1020, #181535); font-size: 1.6rem; font-weight: 900; color: rgba(255,255,255,0.2); }
.lgc-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 16%; transform: scale(1.25); transform-origin: 50% 22%; transition: transform 0.3s ease; }
.lgc:hover .lgc-art img { transform: scale(1.32); }
.lgc-name { padding: 0 0.6rem; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lgc-n { padding: 0 0.6rem; font-size: 0.62rem; color: var(--dim); }

.plc-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin-top: 0.7rem; }
.plc { display: flex; align-items: center; gap: 0.6rem; min-width: 0; padding: 0.6rem 0.7rem; text-align: left; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: var(--rad); transition: border-color 0.15s, background 0.15s; }
.plc-text { display: grid; gap: 0.1rem; min-width: 0; flex: 1; }
.plc-name { font-size: 0.78rem; font-weight: 700; }
.plc-sub { font-size: 0.62rem; color: var(--muted); }
.plc-name, .plc-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plc .lg-icon { width: 30px; height: 30px; }
.ev-tile:focus-visible, .lgc:focus-visible, .plc:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@container (max-width: 900px) { .lgc-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } .plc-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 560px) { .lgc:nth-child(n+7), .plc:nth-child(n+5) { display: none; } .lgc-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .plc-row { grid-template-columns: minmax(0, 1fr); } .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rec {
  display: flex; align-items: center; gap: 0.7rem; min-width: 0; padding: 0.7rem 0.8rem; text-align: left;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--rad);
  transition: border-color 0.15s, background 0.15s;
}
.rec:hover { border-color: var(--accent); background: #141c2f; }
.rec .lg-icon { width: 40px; height: 40px; }
.rec-text { display: grid; gap: 0.12rem; min-width: 0; }
.rec-label { font-size: 0.56rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-g); }
.rec-main { font-size: 0.8rem; font-weight: 700; }
.rec-main i { font-style: normal; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin: 0 0.35rem; }
.rec-sub { font-size: 0.66rem; color: var(--muted); }
.rec-label, .rec-main, .rec-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feat:focus-visible, .rec:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Match bar */
/* Match bar above the video */
.topbar {
  position: relative; flex-shrink: 0;
  background:
    linear-gradient(90deg, rgba(59,130,246,0.2), rgba(59,130,246,0) 36%, rgba(239,68,68,0) 64%, rgba(239,68,68,0.2)),
    var(--bg-nav);
  border-bottom: 1px solid var(--border);
}
.topbar::before, .topbar::after { content: ''; position: absolute; top: 0; bottom: 0; width: 3px; }
.topbar::before { left: 0; background: var(--p1); }
.topbar::after  { right: 0; background: var(--p2); }
.bug {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1.25rem;
  min-height: 78px; padding: 0.65rem 1.4rem;
}
.bug-side { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.bug-p1 { justify-content: flex-end; text-align: right; }
.bug-p1 .bug-text { order: -1; }
.bug-icon { width: 52px; height: 52px; border-radius: 10px; border-width: 2px; font-size: 1.1rem; transition: box-shadow 0.15s; }
.bug-p1 .bug-icon { border-color: var(--p1); }
.bug-p2 .bug-icon { border-color: var(--p2); }
a.bug-icon:hover { box-shadow: 0 0 0 3px rgba(255,255,255,0.12); }
.bug-text { display: grid; gap: 0.2rem; min-width: 0; }
.bug-name { display: flex; align-items: center; gap: 0.45rem; min-width: 0; font-size: 1.12rem; font-weight: 800; letter-spacing: 0.01em; line-height: 1.2; }
.bug-p1 .bug-name, .bug-p1 .bug-sub { justify-content: flex-end; }
.bug-name > a, .bug-name > span.bug-nm { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bug-player { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; padding: 0; background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit; }
.bug-player > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bug-player > b { flex-shrink: 0; min-width: 18px; padding: 0 5px; border-radius: 9px; background: rgba(255,255,255,0.12); font-size: 0.6rem; font-weight: 800; line-height: 18px; text-align: center; color: var(--muted); }
.bug-player:hover > span { text-decoration: underline; text-underline-offset: 3px; }
.bug-player:hover > b { background: var(--accent); color: #fff; }
.bug-name a:hover, .bug-sub a:hover, a.bug-event:hover { text-decoration: underline; text-underline-offset: 3px; }
.bug-flag { flex-shrink: 0; font-size: 0.95rem; }
.bug-sub { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.dom { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.6rem; }
.dom::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dom-fury { color: #f87171; } .dom-body { color: #fb923c; } .dom-mind { color: #60a5fa; }
.dom-chaos { color: #c084fc; } .dom-calm { color: #4ade80; } .dom-order { color: #facc15; }
.bug-guide { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.14rem 0.5rem; border-radius: 4px; background: #ff0000; color: #fff; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.08em; transition: background 0.15s; }
.bug-sub a.bug-guide:hover { background: #cc0000; text-decoration: none; }
/* Decklist buttons: player 1's at the far left of the bar, player 2's at the far right */
.bug-deck {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255,255,255,0.28); border-radius: 7px; background: rgba(11,13,26,0.45); color: #e2e8f0;
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  transition: border-color 0.15s, background 0.15s;
}
.bug-deck-1 { left: 1.2rem; }
.bug-deck-2 { right: 1.2rem; }
.bug-deck:hover { border-color: #fff; background: rgba(255,255,255,0.12); }
.bug.has-decks { padding-left: 7.2rem; padding-right: 7.2rem; }
.bug-mid { display: grid; gap: 0.15rem; justify-items: center; text-align: center; min-width: 120px; max-width: 260px; }
.bug-event { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-g); }
.bug-round { font-size: 0.98rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.15; }
.bug-vs { font-size: 0.6rem; font-weight: 900; letter-spacing: 0.16em; color: var(--dim); }

/* 16:9 screen, as large as the space allows */
.screen-wrap { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; }
.screen { position: relative; width: min(100cqw, calc(100cqh * 16 / 9)); aspect-ratio: 16 / 9; background: #000; }
.screen iframe, .screen #yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.screen-msg {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem;
  padding: 1.5rem; text-align: center;
  background: linear-gradient(rgba(6,7,15,0.82), rgba(6,7,15,0.92)), var(--poster, none) center / cover no-repeat, #06070f;
}
.screen-msg[hidden] { display: none; }
.screen-msg p { max-width: 34ch; font-size: 0.86rem; color: var(--muted); line-height: 1.55; }
.screen-msg strong { display: block; margin-bottom: 0.25rem; font-size: 1rem; color: var(--text); }

/* Draw mode: a pen layer over the video only, with its tools in the strip below */
.draw-canvas { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.draw-canvas[hidden], .draw-bar[hidden] { display: none; }
.stage.is-drawing .deck:not(.draw-bar) { display: none; }
.stage.is-drawing .screen { outline: 2px solid var(--accent-g); outline-offset: -2px; }
.draw-close:hover:not(:disabled) { color: #fff; background: rgba(239,68,68,0.3); }
.draw-cap { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.draw-group { display: flex; align-items: center; gap: 0.3rem; }
.draw-swatch { width: 18px; height: 18px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid rgba(255,255,255,0.25); cursor: pointer; transition: transform 0.12s; }
.draw-swatch:hover { transform: scale(1.12); }
.draw-swatch[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.draw-custom { position: relative; overflow: hidden; background: conic-gradient(#ef4444, #facc15, #22c55e, #3b82f6, #a855f7, #ef4444); }
.draw-custom input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }
.draw-size input { width: 84px; accent-color: var(--accent-g); }
.draw-dot-box { width: 26px; height: 26px; overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.draw-dot { border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,0.35); }

/* Transport strip */
/* Controls bar under the video (draw mode swaps its tools into the same bar) */
.botbar { flex-shrink: 0; background: var(--bg-nav); border-top: 1px solid var(--border); }
.deck { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.15rem 0.2rem; padding: 0.3rem 1rem; }
.deck-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; height: 26px; padding: 0 0.5rem;
  background: transparent; color: var(--muted); border: 0; border-radius: 6px;
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.deck-btn svg { flex-shrink: 0; }
.deck-btn:hover:not(:disabled) { color: var(--text); background: rgba(255,255,255,0.08); }
.deck-btn:disabled { opacity: 0.3; cursor: default; }
.deck-btn[hidden] { display: none; }
.deck-btn[aria-pressed="true"] { color: #fbbf24; background: rgba(245,158,11,0.12); }
.deck-btn.is-done { color: #4ade80; }
.deck-div { width: 1px; height: 14px; margin: 0 0.3rem; background: rgba(255,255,255,0.14); }
.deck-chip { flex-shrink: 0; padding: 0.14rem 0.5rem; border: 1px solid; border-radius: 4px; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.chip-origins { color: #fff; border-color: rgba(255,255,255,0.35); }
.chip-unleashed { color: #f87171; border-color: rgba(239,68,68,0.5); }
.chip-spiritforged { color: #c084fc; border-color: rgba(168,85,247,0.5); }
.chip-vendetta { color: #fbbf24; border-color: rgba(245,158,11,0.5); }
.chip-radiance { color: #5eead4; border-color: rgba(45,212,191,0.5); }

.m:focus-visible, .g-head:focus-visible, .g-reveal:focus-visible, .deck-btn:focus-visible, .bug a:focus-visible, .bug-deck:focus-visible, .bug-player:focus-visible, .pp-close:focus-visible, .lg-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lg-pick:focus-visible, .spoiler-toggle:focus-visible, .rail-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Fullscreen playout: match bar + video only */
.stage:fullscreen { width: 100vw; height: 100vh; }
.stage:-webkit-full-screen { width: 100vw; height: 100vh; }

@media (prefers-reduced-motion: reduce) {
  .is-playing .m-now span { animation: none; }
  .pp, .pp.is-open { transition: none; }
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 1180px) {
  :root { --rail-w: 320px; }
}
@media (max-width: 900px) {
  html.watch-html { overflow: visible; overflow-y: scroll; }
  body.watch-page { height: auto; overflow: visible; }
  .watch, .watch.rail-off { height: auto; display: flex; flex-direction: column; }
  .watch > .brand { order: -2; border-right: 0; }
  .stage { order: -1; position: sticky; top: 0; z-index: 20; }
  .stage.is-idle { position: static; }
  .home { overflow: visible; }
  .feat { max-height: none; }
  .lg-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }
  .rail { border-right: 0; overflow: visible; }
  /* On small screens the player history is a sheet from the bottom */
  .pp { position: fixed; inset: auto 0 0 0; z-index: 40; height: min(62vh, 560px); transform: translateY(102%); border-top: 1px solid rgba(255,255,255,0.18); border-radius: 14px 14px 0 0; box-shadow: 0 -18px 40px rgba(0,0,0,0.6); overflow: hidden; }
  .rail-list { overflow: visible; }
  .g-head { position: static; }
  .screen-wrap { flex: none; container-type: normal; display: block; }
  .screen { width: 100%; }
  .bug { gap: 0.6rem; min-height: 58px; padding: 0.45rem 0.8rem; }
  .bug-icon { width: 38px; height: 38px; border-radius: 8px; }
  .bug-name { font-size: 0.86rem; }
  .dom, .bug-guide > span, .bug-deck > span { display: none; }
  .bug-deck { padding: 0.35rem 0.45rem; }
  .bug-deck-1 { left: 0.6rem; }
  .bug-deck-2 { right: 0.6rem; }
  .bug.has-decks { padding-left: 2.9rem; padding-right: 2.9rem; }
  .bug-sub { font-size: 0.56rem; }
  .bug-mid { min-width: 0; max-width: 110px; }
  .bug-round { font-size: 0.7rem; }
  .bug-event { font-size: 0.5rem; letter-spacing: 0.1em; }
  .deck { padding: 0.25rem 0.5rem; }
  .deck:not(.draw-bar) .deck-label { display: none; }
  .deck:not(.draw-bar) .deck-btn { width: 36px; padding: 0; }
  #btn-rail, #btn-next + .deck-div { display: none; }
  .draw-size input { width: 70px; }
  .draw-cap, .draw-bar .deck-div { display: none; }
}
@media (max-width: 600px) {
  /* decklist buttons tuck into the corners of the event / round line */
  .bug-deck { top: 0.3rem; transform: none; padding: 0.16rem 0.38rem; }
  .bug.has-decks { padding-left: 0.8rem; padding-right: 0.8rem; }
  .feat { aspect-ratio: 4 / 3; }
  .feat-top { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .feat-event { text-align: left; font-size: 0.6rem; }
  .feat-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 0.7rem; }
  .feat-play { grid-column: 1 / -1; grid-row: 2; text-align: center; }
  /* Event + round on their own line so both names get half the width */
  .bug { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "mid mid" "p1 p2"; row-gap: 0.35rem; column-gap: 0.9rem; }
  .bug-p1 { grid-area: p1; }
  .bug-p2 { grid-area: p2; }
  .bug-mid { grid-area: mid; display: flex; align-items: baseline; justify-content: center; gap: 0.5rem; max-width: none; }
  .bug-round { font-size: 0.62rem; }
  .bug-event { font-size: 0.56rem; }
}
