
/* ============ WatchTogether — component styles (plain CSS, no build step) ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/22px var(--font-sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wt-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.wt-ico--sm { width: 16px; height: 16px; }
.wt-ico--fill { fill: currentColor; stroke: none; }
.wt-muted { color: var(--ink-muted); }
.wt-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.wt-row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.wt-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.wt-spacer { flex: 1; }
.wt-overline { font: 600 11px/16px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.wt-h1 { font: 700 28px/34px var(--font-display); letter-spacing: -.01em; margin: 0; }
.wt-h2 { font: 600 19px/26px var(--font-display); margin: 0; }
.wt-hero { font: 700 40px/44px var(--font-display); letter-spacing: -.02em; margin: 0; }

/* ---------- Brand ---------- */
.wt-logo { display: inline-flex; align-items: center; gap: 10px; font: 700 19px/1 var(--font-display); letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.wt-logo__mark { width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--lamp); display: grid; place-items: center; }
.wt-logo__mark svg { width: 18px; height: 18px; }
.wt-logo__mark .a { fill: var(--on-lamp); }
.wt-logo__mark .b { fill: var(--on-lamp); opacity: .45; }

/* ---------- Buttons ---------- */
.wt-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.wt-btn:hover { border-color: var(--line-strong); }
.wt-btn--primary { background: var(--lamp); color: var(--on-lamp); border-color: var(--lamp); }
.wt-btn--primary:hover { filter: brightness(1.06); border-color: var(--lamp); }
.wt-btn--ghost { background: transparent; border-color: transparent; }
.wt-btn--ghost:hover { background: var(--surface-2); border-color: transparent; }
.wt-btn--danger { background: transparent; color: var(--danger); border-color: var(--line); }
.wt-btn--danger-solid { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.wt-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.wt-btn--lg { height: 48px; padding: 0 22px; font-size: 16px; }
.wt-btn--icon { width: 40px; padding: 0; }
.wt-btn--icon.wt-btn--sm { width: 32px; }
.wt-btn--block { width: 100%; }
.wt-btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- Forms ---------- */
.wt-field { display: flex; flex-direction: column; gap: 6px; }
.wt-label { font-size: 13px; font-weight: 600; }
.wt-input { height: 42px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); width: 100%; }
.wt-input::placeholder { color: var(--ink-muted); }
.wt-input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.wt-input--code { font: 500 20px/1 var(--font-mono); letter-spacing: .4em; text-align: center; height: 52px; }
.wt-input--num { width: 72px; text-align: center; font-family: var(--font-mono); }
.wt-hint { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.wt-alert { display: flex; gap: var(--space-2); align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; line-height: 20px; }
.wt-alert--error { background: var(--danger-soft); color: var(--ink); }
.wt-alert--error .wt-ico { color: var(--danger); }
.wt-alert--notice { background: var(--lamp-soft); color: var(--ink); }
.wt-alert--notice .wt-ico { color: var(--lamp-ink); }
.wt-search { position: relative; display: flex; align-items: center; }
.wt-search .wt-ico { position: absolute; left: 12px; color: var(--ink-muted); }
.wt-search .wt-input { padding-left: 40px; border-radius: var(--radius-full); border-color: var(--line); }
.wt-select { appearance: none; height: 42px; padding: 0 36px 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); width: 100%; }
.wt-range { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: var(--line-strong); width: 100%; }
.wt-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); }

/* ---------- Tabs & segmented ---------- */
.wt-tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--line); }
.wt-tab { background: none; border: 0; padding: 10px 0; margin-bottom: -1px; font-weight: 600; color: var(--ink-muted); border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.wt-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--lamp); }
.wt-tab .wt-count { font: 500 12px/1 var(--font-mono); color: var(--ink-muted); background: var(--surface-2); padding: 3px 6px; border-radius: var(--radius-full); }
.wt-seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.wt-seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 4px; font-weight: 600; font-size: 13px; color: var(--ink-muted); cursor: pointer; }
.wt-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

/* ---------- Badges ---------- */
.wt-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-muted); white-space: nowrap; }
.wt-badge--lamp { background: var(--lamp-soft); color: var(--lamp-ink); }
.wt-badge--signal { background: var(--signal-soft); color: var(--signal); }
.wt-badge--danger { background: var(--danger-soft); color: var(--danger); }
.wt-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.wt-dot--live { background: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }

/* ---------- App chrome ---------- */
.wt-topbar { display: flex; align-items: center; gap: var(--space-6); height: 64px; padding: 0 var(--space-8); border-bottom: 1px solid var(--line); background: var(--surface); }
.wt-topbar .wt-search { flex: 1; max-width: 420px; }
.wt-nav { display: flex; gap: var(--space-1); }
.wt-nav a { padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink-muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.wt-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.wt-page { padding: var(--space-8); max-width: 1216px; margin: 0 auto; }
.wt-section { margin-top: var(--space-8); }
.wt-section__head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.wt-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.wt-card__body { padding: var(--space-6); }

/* ---------- Avatars ---------- */
.wt-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 13px/1 var(--font-sans); color: #1c1916; flex: none; position: relative; }
.wt-av--sm { width: 24px; height: 24px; font-size: 11px; }
.wt-av--lg { width: 40px; height: 40px; font-size: 15px; }
.wt-av.h1 { background: #f2b544; } .wt-av.h2 { background: #8fd1c3; } .wt-av.h3 { background: #f0a39a; }
.wt-av.h4 { background: #b9c7f0; } .wt-av.h5 { background: #d7c48a; } .wt-av.h6 { background: #c9b2e6; }
.wt-av--speaking { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--signal); }
.wt-avstack { display: flex; }
.wt-avstack .wt-av { box-shadow: 0 0 0 2px var(--surface); }
.wt-avstack .wt-av + .wt-av { margin-left: -6px; }

/* ---------- Posters & video cards ---------- */
.wt-poster { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden; background: #2a2622; }
.wt-poster::before { content: ""; position: absolute; width: 70%; aspect-ratio: 1; border-radius: 50%; right: -18%; top: -30%; background: rgba(255,255,255,.14); }
.wt-poster::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 38%; background: rgba(0,0,0,.28); }
.wt-art-1 { background: #3b5b52; } .wt-art-2 { background: #7a4a32; } .wt-art-3 { background: #34455f; }
.wt-art-4 { background: #6b5a2c; } .wt-art-5 { background: #5a3d56; } .wt-art-6 { background: #2f5a6b; }
.wt-art-7 { background: #7a3a3a; } .wt-art-8 { background: #4d5a34; }
.wt-poster__dur { position: absolute; right: 8px; bottom: 8px; z-index: 1; font: 500 12px/1 var(--font-mono); color: var(--player-ink); background: var(--scrim); padding: 4px 6px; border-radius: 4px; }
.wt-poster__tag { position: absolute; left: 8px; top: 8px; z-index: 1; }
.wt-poster--stack { box-shadow: 6px -6px 0 -1px var(--surface-2), 12px -12px 0 -2px var(--line); overflow: visible; margin: 12px 12px 0 0; }
.wt-poster--stack::before, .wt-poster--stack::after { display: none; }
.wt-vcard { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; }
.wt-vcard__title { font-weight: 600; font-size: 15px; line-height: 20px; }
.wt-vcard__meta { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.wt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-6) var(--space-6); }

/* ---------- Room cards ---------- */
.wt-roomcard { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0; }
.wt-roomcard__now { display: flex; gap: var(--space-3); align-items: center; }
.wt-roomcard__now .wt-poster { width: 88px; flex: none; border-radius: var(--radius-sm); }
.wt-roomcard__now .wt-poster::before { display: none; }
.wt-roomcard--new { align-items: center; justify-content: center; border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--ink-muted); text-align: center; }

/* ---------- Episode list ---------- */
.wt-ep { display: grid; grid-template-columns: 40px 176px 1fr auto; gap: var(--space-4); align-items: center; padding: var(--space-3); border-radius: var(--radius-md); }
.wt-ep:hover { background: var(--surface-2); }
.wt-ep__num { font: 500 15px/1 var(--font-mono); color: var(--ink-muted); text-align: right; }
.wt-ep .wt-poster::before { display: none; }

/* ---------- Player ---------- */
.wt-player { position: relative; background: var(--player-bg); border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 16 / 9; color: var(--player-ink); }
.wt-player__frame { position: absolute; inset: 0; }
.wt-player__frame::before { content: ""; position: absolute; width: 46%; aspect-ratio: 1; border-radius: 50%; right: 8%; top: 12%; background: rgba(255,255,255,.12); }
.wt-player__frame::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; background: rgba(0,0,0,.25); }

/* poster art tints also apply to the player frame and gate stage */
.wt-player.wt-art-1, .wt-stage.wt-art-1 { background: #3b5b52; } .wt-player.wt-art-2, .wt-stage.wt-art-2 { background: #7a4a32; } .wt-player.wt-art-3, .wt-stage.wt-art-3 { background: #34455f; } .wt-player.wt-art-4, .wt-stage.wt-art-4 { background: #6b5a2c; } .wt-player.wt-art-5, .wt-stage.wt-art-5 { background: #5a3d56; } .wt-player.wt-art-6, .wt-stage.wt-art-6 { background: #2f5a6b; } .wt-player.wt-art-7, .wt-stage.wt-art-7 { background: #7a3a3a; } .wt-player.wt-art-8, .wt-stage.wt-art-8 { background: #4d5a34; }
.wt-controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px 12px; background: var(--scrim); display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.wt-controls__row { display: flex; align-items: center; gap: 6px; }
.wt-pbtn { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--player-ink); display: grid; place-items: center; cursor: pointer; }
.wt-pbtn:hover { background: rgba(255,255,255,.12); }
.wt-seek { position: relative; height: 16px; display: flex; align-items: center; }
.wt-seek__track { position: absolute; left: 0; right: 0; height: 4px; border-radius: 4px; background: rgba(255,255,255,.28); }
.wt-seek__buf { position: absolute; left: 0; height: 4px; border-radius: 4px; background: rgba(255,255,255,.5); }
.wt-seek__prog { position: absolute; left: 0; height: 4px; border-radius: 4px; background: var(--lamp); }
.wt-seek__thumb { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--lamp); transform: translateX(-50%); box-shadow: 0 0 0 3px rgba(0,0,0,.35); }
.wt-ptime { font: 500 13px/1 var(--font-mono); font-variant-numeric: tabular-nums; margin-left: 6px; }
.wt-ptitle { font-weight: 600; font-size: 14px; margin-left: 8px; opacity: .9; }
.wt-player__top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; z-index: 2; }
.wt-sync { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: var(--radius-full); background: var(--scrim); color: var(--player-ink); font-size: 12px; font-weight: 600; }
.wt-sync .wt-dot { background: var(--signal); }
.wt-toast { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: var(--radius-full); background: var(--scrim); color: var(--player-ink); font-size: 12px; }

/* waiting overlay (F-B2..B4) */
.wt-waiting { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; background: rgba(0,0,0,.35); }
.wt-waiting__pill { display: flex; align-items: center; gap: 14px; padding: 14px 22px 14px 16px; border-radius: var(--radius-full); background: var(--scrim); }
.wt-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--lamp); }
.wt-waiting__title { font-weight: 600; font-size: 16px; }
.wt-waiting__sub { font-size: 13px; opacity: .8; }

/* join gate (F-R10) */
.wt-gate { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); z-index: 3; }
.wt-gate__card { width: 380px; max-width: calc(100% - 32px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: var(--space-4); }

/* ---------- Room layout ---------- */
.wt-room { display: grid; grid-template-columns: 1fr 360px; gap: var(--space-6); padding: var(--space-6); height: 100%; }
.wt-room__side { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; min-height: 0; }
.wt-room__sidehead { padding: var(--space-4); border-bottom: 1px solid var(--line); }
.wt-room__tabs { padding: 0 var(--space-4); }
.wt-room__tabs .wt-tabs { gap: var(--space-4); }
.wt-room__scroll { flex: 1; overflow: hidden; padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }

/* members */
.wt-member { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.wt-member__name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; }
.wt-member__you { font-weight: 400; color: var(--ink-muted); }
.wt-mic { color: var(--ink-muted); display: grid; place-items: center; }
.wt-mic--on { color: var(--signal); }

/* chat */
.wt-msg { display: flex; gap: 10px; align-items: flex-start; }
.wt-msg__body { min-width: 0; }
.wt-msg__head { display: flex; gap: 8px; align-items: baseline; }
.wt-msg__user { font-weight: 600; font-size: 14px; }
.wt-msg__at { font: 400 11px/1 var(--font-mono); color: var(--ink-muted); }
.wt-msg__text { font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.wt-msg--sys { font-size: 13px; color: var(--ink-muted); display: flex; gap: 8px; align-items: center; padding-left: 42px; }
.wt-msg--sys .wt-ico { width: 14px; height: 14px; }
.wt-composer { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); align-items: center; }
.wt-composer .wt-input { height: 40px; }
.wt-counter { font: 400 11px/1 var(--font-mono); color: var(--ink-muted); }

/* voice bar */
.wt-voicebar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); background: var(--surface-2); }
.wt-micbtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; flex: none; }
.wt-micbtn--on { background: var(--signal); color: #06240f; border-color: var(--signal); }
.wt-voicebar__state { font-weight: 600; font-size: 14px; line-height: 18px; }

/* queue */
.wt-qitem { display: grid; grid-template-columns: 20px 72px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: var(--radius-md); }
.wt-qitem:hover { background: var(--surface-2); }
.wt-qitem .wt-poster { border-radius: var(--radius-sm); }
.wt-qitem .wt-poster::before { display: none; }
.wt-qitem__idx { font: 500 12px/1 var(--font-mono); color: var(--ink-muted); text-align: center; }
.wt-qitem__title { font-weight: 600; font-size: 14px; line-height: 18px; }
.wt-qitem__meta { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.wt-qitem--current { background: var(--lamp-soft); }
.wt-qitem--current .wt-qitem__idx { color: var(--lamp-ink); }

/* ---------- Admin ---------- */
.wt-stat { padding: var(--space-4) var(--space-6) var(--space-6); display: flex; flex-direction: column; gap: 6px; }
.wt-stat__value { font: 500 28px/32px var(--font-mono); font-variant-numeric: tabular-nums; }
.wt-stat__value small { font-size: 15px; color: var(--ink-muted); }
.wt-meter { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: flex; margin-top: 6px; }
.wt-meter > span { display: block; height: 100%; }
.wt-meter .lib { background: var(--lamp); } .wt-meter .other { background: var(--line-strong); }
.wt-legend { display: flex; gap: var(--space-4); font-size: 12px; color: var(--ink-muted); margin-top: 4px; }
.wt-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.wt-spark { width: 100%; height: 56px; display: block; margin-top: 4px; }
.wt-spark .area { fill: var(--lamp-soft); } .wt-spark .ln { fill: none; stroke: var(--lamp); stroke-width: 2; }
.wt-spark .peak { stroke: var(--line-strong); stroke-dasharray: 3 3; stroke-width: 1; }
.wt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.wt-table th { text-align: left; font: 600 11px/16px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.wt-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.wt-table tr:last-child td { border-bottom: 0; }
.wt-drop { border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: var(--space-8); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; background: var(--surface-2); }
.wt-progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.wt-progress > span { display: block; height: 100%; background: var(--lamp); border-radius: 6px; }
.wt-progress--paused > span { background: var(--line-strong); }
.wt-upload { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.wt-upload--failed { background: var(--danger-soft); border-color: transparent; }

/* ---------- Mobile room ---------- */
.wt-phone { width: 390px; min-height: 844px; background: var(--bg); display: flex; flex-direction: column; }
.wt-phone .wt-player { border-radius: 0; }
.wt-fab { position: absolute; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); color: var(--ink); }
.wt-table th:first-child, .wt-table td:first-child { padding-left: var(--space-6); } .wt-table th:last-child, .wt-table td:last-child { padding-right: var(--space-6); }
