/* Station screens (mockups 4a/4b). Builds on the tokens in admin.css. */
:root {
    --ok: #7fd3a8;
    --speaking: #ffe14d;
    --tile-edge: #222c45;
    --tile-glow: #1b2540;
    --tile-base: #0d1220;
    --tile-note: #4e5b7a;
}

.join { max-width: 440px; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack .label { margin-top: 10px; }
.stack .btn { margin-top: 18px; }
.stack .input { flex: none; }

.code-input {
    height: 72px;
    text-align: center;
    letter-spacing: .2em;
    font: 600 32px var(--mono);
    color: var(--gold-light);
}

.code-input::placeholder { color: var(--line-strong); }

/* Call screen: video tiles after mockups 2a/2b, the sidebar down the left,
   the controls under the tiles and the Console, when open, down the right. */
.in-call {
    display: grid;
    grid-template: "side main console" minmax(0, 1fr) "side footer console" auto / auto minmax(0, 1fr) auto;
    height: 100dvh;
}

.call {
    grid-area: main;
    min-height: 0;
    width: 100%;
    max-width: none;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

/* The room's name and phase over the characters, sized to read from across
   the table; collapsed, a rail of portraits and initiative. */
.sidebar {
    grid-area: side;
    width: var(--sidebar-width, 380px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 12px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden auto;
}

.sidebar-top { display: flex; align-items: flex-start; gap: 8px; padding: 0 4px 16px 8px; border-bottom: 1px solid var(--line); }

.sidebar-title { flex: 1; min-width: 0; }

.room-title, .sidebar-sub {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-title { font-size: 24px; line-height: 1.15; }

.sidebar-phase { margin: 10px 0 0; font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }

.sidebar-phase.quiet { color: var(--muted); }

.sidebar-sub { margin-top: 2px; font-size: 16px; font-weight: 600; color: var(--text-soft); }

.phase-short { display: none; }

.sidebar-toggle {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
}

.sidebar-toggle:hover { background: var(--line-strong); }

.sidebar-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.sidebar-toggle svg { width: 22px; height: 22px; fill: currentColor; transition: rotate .15s; }

.cast { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.cast li {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 80px;
    padding: 12px;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--bg);
    box-shadow: inset 0 0 0 1px var(--line);
    transition: background .3s, box-shadow .3s, opacity .3s;
}

.cast .portrait { width: 52px; height: 52px; border-width: 3px; font-size: 17px; font-weight: 700; color: var(--character-color); background: color-mix(in srgb, var(--character-color) 12%, transparent); }

/* Named combatants (NPCs) have square-ish portraits, so they read apart from the players'. */
.cast li.npc .portrait { border-radius: 14px; }

.cast-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

.cast-name { min-width: 0; font-size: 24px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cast-npc { flex: none; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }

.cast-status { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.cast li.current .cast-status { color: var(--gold); }

.sidebar.collapsed { width: 112px; }

/* Drag the sidebar's edge, or use the arrow keys on it, to resize it. */
.sidebar-resize {
    grid-area: side;
    justify-self: end;
    z-index: 1;
    width: 9px;
    margin-right: -5px;
    cursor: col-resize;
    touch-action: none;
}

.sidebar-resize:is(:hover, :focus-visible, .dragging) { background: linear-gradient(90deg, transparent 3px, var(--gold) 3px 6px, transparent 6px); outline: 0; }

.sidebar.collapsed + .sidebar-resize { display: none; }

.sidebar.collapsed :is(.room-title, .sidebar-sub, .phase-long, .hand-banner, .cast-who, .cast-hand) { display: none; }

.sidebar.collapsed .sidebar-top { flex-direction: column-reverse; align-items: center; padding: 0 0 12px; }

.sidebar.collapsed .sidebar-phase { margin: 0; font-size: 13px; }

.sidebar.collapsed .phase-short { display: inline; }

.sidebar.collapsed .cast li { flex-direction: column; justify-content: center; padding: 12px 8px; }

.sidebar.collapsed .sidebar-toggle svg { rotate: 180deg; }

/* During combat (ADR-0013): each combatant's initiative in a box before its portrait. */
.cast-init {
    flex: none;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    box-sizing: border-box;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--bg);
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    transition: background .3s, color .3s;
}

.cast li.unrolled { opacity: .6; }

.cast li.unrolled .cast-init { color: var(--line-strong); }

/* Whose turn it is (#34): gold, the brightest thing in the sidebar. */
.cast li.current { background: color-mix(in srgb, var(--gold) 12%, transparent); box-shadow: inset 0 0 0 2px var(--gold), 0 0 24px color-mix(in srgb, var(--gold) 18%, transparent); }

.cast li.current .cast-init { border: 0; background: var(--gold); color: var(--bg); }

.cast li.current .cast-name { color: #fff; }

.tile.turn { outline: 4px solid var(--turn-color); outline-offset: -4px; }

/* Who's talking, in a color no character has; inside the turn ring when both. */
.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px var(--speaking);
    opacity: 0;
    transition: opacity .4s ease;
    pointer-events: none;
}

.tile.speaking::after { opacity: 1; transition-duration: .2s; }

.tile.turn::after { inset: 4px; border-radius: 2px; }

.cast-portrait { position: relative; flex: none; }

/* Collapsed, the portrait carries a count of the conditions, under an unread whisper's icon. */
.cast-count {
    position: absolute;
    bottom: -4px;
    right: -4px;
    display: none;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    box-sizing: border-box;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: #eb7a7a;
    color: var(--bg);
    font-size: 12px;
    font-weight: 800;
}

.sidebar.collapsed .cast-count { display: grid; }

.btn-quiet {
    height: 44px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--text-soft);
}

.btn-quiet:hover { background: var(--surface); }

/* Columns and rows come from layOutTiles() in tile-grid.js, sized to the stage;
   the first tile spans any cells the last row leaves empty. */
.tiles {
    position: relative;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
    grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
    gap: 10px;
}

.tiles > .tile:first-child { grid-column: span var(--lead, 1); }

/* Sizes the floating self tile; while presenting, the strip's height comes from its tiles instead. */
.call:not(.presenting) .tiles { container-type: size; }

/* Once anyone else is here, this station's tile shrinks to a corner, just big
   enough to check the framing. Alone, it fills the stage. */
.call:not(.presenting) .tiles:has(> :not(.self)) .tile.self {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 1;
    width: clamp(160px, min(24cqw, 40cqh * 4 / 3), 380px);
    aspect-ratio: 4 / 3;
    border: 1px solid color-mix(in srgb, var(--text) 40%, transparent);
    box-shadow: 0 10px 28px rgb(0 0 0 / .65), 0 2px 6px rgb(0 0 0 / .5);
}

.call:not(.presenting) .tiles:has(> :not(.self)) .tile.self figcaption { display: none; }

.call:not(.presenting) .tiles:has(> :not(.self)) .tile.self .muted-icon { top: 6px; right: 6px; width: 32px; height: 32px; }

.call:not(.presenting) .tiles:has(> :not(.self)) .tile.self .muted-icon svg { width: 18px; height: 18px; }

.tile {
    position: relative;
    margin: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 6px;
    outline: 1px solid var(--tile-edge);
    background: radial-gradient(ellipse at 50% 40%, var(--tile-glow), var(--tile-base));
}

.tile video { display: block; width: 100%; height: 100%; object-fit: cover; }

.tile.self video { transform: scaleX(-1); }

.tile figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(transparent, color-mix(in srgb, var(--bg) 90%, transparent));
    font-size: 19px;
}

/* Who sits at the station: character, then player, in muted type (#29). */
.tile .who { display: flex; flex-wrap: wrap; gap: 4px 20px; min-width: 0; }

.tile .seat { display: flex; align-items: center; gap: 8px; color: var(--muted); }

.tile .seat .portrait { width: 32px; height: 32px; font-size: 11px; }

.tile .seat b { color: var(--text); }

.tile .state { font-size: 15px; color: var(--muted); }

.tile[data-state="reconnecting"] .state { color: var(--gold); }

/* While the GM shares a screen, it fills the stage and the camera tiles
   move to a strip beside it, or below it on a tall screen. */
.call.presenting {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(160px, 18vw, 260px);
    gap: 10px;
}

.call.presenting .tiles { display: flex; flex-direction: column; overflow-y: auto; }

.call.presenting .tiles .tile { flex: none; aspect-ratio: 4 / 3; }

.presentation video { object-fit: contain; background: #000; }

@media (max-aspect-ratio: 1/1) {
    .call.presenting { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
    .call.presenting .tiles { flex-direction: row; overflow: auto hidden; }
    .call.presenting .tiles .tile { height: clamp(90px, 16vh, 160px); }
}

/* A table's handouts (#47) open over the call from its Handouts button:
   one full size, with the others to pick from below it. */
.call { position: relative; }

.handout-overlay {
    position: absolute;
    inset: 14px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    border-radius: 16px;
    background: rgb(5 8 16 / .94);
}

.handout-view { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 0; margin: 0; }
.handout-view img { min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.handout-view figcaption { display: grid; gap: 4px; max-width: 70ch; text-align: center; }
.handout-view figcaption b { font-size: 24px; }
.handout-view figcaption span { color: var(--text-soft); font-size: 18px; white-space: pre-line; }
.handout-view figcaption:not(:has(:not(:empty))) { display: none; }

.handout-strip { display: flex; justify-content: center; gap: 10px; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.handout-strip:not(:has(li + li)) { display: none; }
.handout-strip button { display: block; width: 88px; height: 66px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--surface); cursor: pointer; overflow: hidden; }
.handout-strip button[aria-current="true"] { border-color: var(--gold); }
.handout-strip img { width: 100%; height: 100%; object-fit: cover; }

.handout-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; }
.handout-close svg { width: 24px; height: 24px; fill: currentColor; }

.handouts-button { position: relative; }
.handouts-button[aria-expanded="true"] { background: var(--gold); color: var(--bg); }
.unseen-dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border: 2px solid var(--bg); border-radius: 50%; background: var(--gold); }

.left { max-width: 440px; margin: 10vh auto 0; text-align: center; }

.left .btn { display: block; width: 100%; margin-bottom: 24px; }

/* The account menu, on the room's screens outside the call. */
.station-account { position: absolute; top: 24px; right: clamp(16px, 4vw, 44px); z-index: 1; }

.in-call:has(.tiles:not([hidden])) .station-account { display: none; }

/* Lobby: device check before the call, in the 4a waiting-room style. */
.lobby {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    align-items: center;
    gap: clamp(20px, 4vw, 56px);
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.lobby-check { display: flex; flex-direction: column; gap: 12px; }

.lobby-check .tile { aspect-ratio: 4 / 3; box-shadow: 0 0 0 8px color-mix(in srgb, var(--gold) 12%, transparent); }

.lobby h1 { margin-bottom: 4px; }

.meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }

.meter span {
    display: block;
    height: 100%;
    background: var(--ok);
    transform: scaleX(var(--level, 0));
    transform-origin: left;
}

.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--text-soft); }

.check input { width: 20px; height: 20px; accent-color: var(--gold); }

.note { margin: 0; color: var(--muted); }

@media (max-width: 760px) {
    .lobby { grid-template-columns: minmax(0, 1fr); align-items: start; }
}

/* Call controls: a full-width footer of round buttons, after Google Meet's.
   The sizes are properties so the compact footer (#106) can shrink them. */
.in-call { --footer-pad: 12px; --round: 52px; --more: 40px; }

.call-footer {
    grid-area: footer;
    display: flex;
    justify-content: center;
    padding: var(--footer-pad) 14px calc(var(--footer-pad) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Resting controls dim slowly so they don't compete with the video, and
   brighten fast under the pointer. Touch screens can't hover, so they stay lit. */
@media (hover: hover) {
    .call-footer .controls { opacity: .5; transition: opacity 1.5s ease; }

    .call-footer:is(:hover, :focus-within) .controls,
    .controls:has(.open, .nudge:not([hidden])) { opacity: 1; transition-duration: .15s; }
}

.round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--round);
    height: var(--round);
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--line-strong);
    color: var(--text);
    font: 600 15px var(--sans);
    cursor: pointer;
    transition: background .15s, border-radius .15s;
}

.round:hover { background: color-mix(in srgb, var(--line-strong) 75%, var(--text)); }

.round:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.round:disabled { opacity: .45; cursor: default; }

.round svg { width: 24px; height: 24px; fill: currentColor; }

/* Toggles show their "on" icon until pressed. */
.round .off,
.round[aria-pressed="true"] .on { display: none; }

.round[aria-pressed="true"] .off { display: block; }

.round[aria-pressed="true"] { border-radius: 16px; background: #f9dedc; color: #601410; }

.round[aria-pressed="true"]:hover { background: #f2c9c5; }

/* The mic and camera buttons' "more" halves, and the device pickers they open on hover or click. */
.split { display: flex; border-radius: 999px; background: color-mix(in srgb, var(--line-strong) 60%, var(--surface)); }

.split .more { width: var(--more); background: transparent; color: var(--text-soft); }

.split .more:hover { background: var(--line-strong); }

.split .more svg { width: 20px; height: 20px; }

/* The mic's level as three dots that stretch into bars, the middle one most. */
.levels { display: flex; align-items: center; gap: 3px; height: 20px; }

.levels i { width: 4px; height: calc(4px + var(--level, 0) * var(--reach, 10px)); border-radius: 2px; background: currentColor; transition: height 80ms; }

.levels i:nth-child(2) { --reach: 16px; }

/* "Are you talking?" over the mute button, when a muted mic hears speech. */
.split { position: relative; }

.nudge {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 0;
    z-index: 1;
    width: max-content;
    max-width: 220px;
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--text);
    color: var(--surface);
    font: 14px/1.4 var(--sans);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}

.nudge strong { display: block; }

/* Points down at the mute button's middle, past the "more" half. */
.nudge::after {
    content: "";
    position: absolute;
    top: 100%;
    left: calc(var(--more) + var(--round) / 2 - 8px);
    border: 8px solid transparent;
    border-top-color: var(--text);
}

.call-footer { position: relative; }

.device-panel {
    display: none;
    position: absolute;
    left: 50%;
    /* Reaches down over the footer's padding, so the pointer can cross to it. */
    bottom: calc(100% - 14px);
    width: min(640px, calc(100vw - 32px));
    padding-bottom: 22px;
    transform: translateX(-50%);
}

.device-group:is(.open, :has(.more:hover)) .device-panel,
.device-panel:is(:hover, :focus-within) { display: block; }

.split .caret { transition: rotate .15s; }

/* The caret flips while its panel shows. */
.device-group:is(.open, :has(.more:hover), :has(.device-panel:is(:hover, :focus-within))) .caret { rotate: 180deg; }

.device-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}

.device { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; min-width: 0; }

.device[hidden] { display: none; }

.device-box .check { margin-top: 0; }

.device svg { flex: none; width: 20px; height: 20px; fill: var(--text-soft); }

.device .input { flex: 1; min-width: 0; height: 44px; }

.round.pill { width: auto; padding: 0 22px; }

.round.quiet { border: 1px solid var(--line-strong); background: transparent; color: var(--text-soft); }

.round.quiet:hover { background: var(--bg-glow); }

.round.hang-up { width: 76px; padding: 0; background: #dc362e; color: #fff; }

.round.hang-up:hover { background: #e9554d; }

/* The Console button and the station face, at the footer's right. */
.footer-end {
    position: absolute;
    right: 14px;
    top: var(--footer-pad);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Who this station is: who sits here on the button, and on hover, focus or
   a tap who it joined as and who its browser is signed in as. */
.station-menu { position: relative; }

.console-toggle { position: relative; }

.console-toggle svg { width: 24px; height: 24px; fill: currentColor; }

.console-toggle[aria-expanded="true"] { background: var(--gold); color: var(--bg); }

/* What's waiting in a closed Console (#101): a count of unread whispers,
   and a ring for something to act on now. */

.console-toggle.has-unread::after {
    content: attr(data-count);
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc362e;
    color: #fff;
    font: 700 12px/20px var(--sans);
    text-align: center;
}

.console-toggle.pulse { animation: console-pulse 1.6s ease-out infinite; }

/* Open, the Console shows it all itself. */
.console-toggle[aria-expanded="true"]::after { display: none; }

.console-toggle.pulse[aria-expanded="true"] { animation: none; }

@keyframes console-pulse {
    from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 70%, transparent); }
    to { box-shadow: 0 0 0 14px transparent; }
}

.station-face {
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.station-face:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* The ring is the seated character's color; with nobody seated the portrait
   inherits this one, gold on the GM's station. */
.station-face { --character-color: var(--muted); }

.station-menu.gm .station-face { --character-color: var(--gold); }

.station-card {
    display: none;
    position: absolute;
    right: 0;
    /* Reaches down over the footer's padding, so the pointer can cross to it. */
    bottom: calc(100% - 14px);
    padding-bottom: 22px;
}

.station-menu:is(.open, :hover, :focus-within) .station-card { display: block; }

.station-card dl {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 16px;
    width: max-content;
    max-width: min(360px, calc(100vw - 32px));
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    font: 14px/1.4 var(--sans);
}

.station-card dt { color: var(--muted); }

.station-card dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.station-card .seat { display: block; }

.station-card .device-id { font-family: var(--mono); }

/* Too narrow to sit beside the centered controls, so it wraps in after them:
   on a small screen, or once the Console takes the footer's room. */
.call-footer { container-type: inline-size; }

@container (max-width: 840px) {
    .footer-end { position: relative; right: auto; top: auto; }

    .call-footer .controls { flex: 1; }
}

/* What a station's tile shows when it is muted or has no picture. */
.muted-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg) 75%, transparent);
    color: var(--danger);
}

.muted-icon svg { display: block; width: 24px; height: 24px; }

.tile[data-muted="true"] .muted-icon { display: flex; }

.tile[data-camera="off"] video { visibility: hidden; }

/* A station with its camera off shows a monster drawing, tinted blue and
   faded so it reads as an etching in the tile's dark glow. */
.tile[data-camera="off"]::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--monster, none) center / cover no-repeat, #6f8fd0;
    background-blend-mode: multiply;
    opacity: .2;
}

/* Lobby while the table is closed: mockup 4a's waiting room. The QR
   and code sit in rings on the left; the room and its stations on the right. */
.waiting {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 500px);
    align-items: center;
    gap: clamp(24px, 4vw, 56px);
    padding: 0 clamp(0px, 3vw, 42px) clamp(16px, 4vh, 42px);
}

.waiting-door {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: clamp(24px, 8vh, 96px) 0;
}

/* The rings behind the door, sized as in the mockup (420, 640, 900). */
.rings,
.rings::before,
.rings::after {
    position: absolute;
    left: 50%;
    top: 50%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.rings { width: 420px; border: 1px solid var(--tile-edge); z-index: -1; }

.rings::before { content: ""; width: 640px; border: 1px dashed var(--line); }

.rings::after { content: ""; width: 900px; border: 1px solid #1a2340; }

.in-call:has(.waiting:not([hidden])) { overflow: hidden; }

.qr {
    width: clamp(180px, 34vh, 250px);
    aspect-ratio: 1;
    padding: 16px;
    border-radius: 14px;
    background: var(--text);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--gold) 12%, transparent), 0 20px 60px rgba(0, 0, 0, .5);
}

.qr svg { display: block; width: 100%; height: 100%; }

.qr .dark { fill: var(--bg); }

.code-tiles { display: flex; gap: 10px; }

.code-tiles span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(40px, 4.5vw, 58px);
    aspect-ratio: 58 / 70;
    border-radius: 12px;
    border: 1px solid var(--gold);
    font: 600 clamp(28px, 3vw, 40px) var(--mono);
    color: var(--gold-light);
}

/* The gap between the code's two halves. */
.code-tiles .gap { width: 6px; border: 0; }

.code-tiles .locked { width: auto; aspect-ratio: auto; padding: 14px 28px; font: 400 clamp(28px, 3vw, 40px) var(--serif); }

.waiting-hint { margin: 0; font-size: clamp(16px, 1.5vw, 19px); color: var(--muted); }

.waiting-info {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-top: clamp(0px, 4vh, 48px);
}

.eyebrow {
    margin: 0;
    font: 400 clamp(14px, 1.3vw, 17px) var(--sans);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.waiting h1 { margin: 8px 0 0; font-size: clamp(34px, 4vw, 52px); line-height: 1.05; overflow-wrap: anywhere; }

.waiting-gm { margin: 10px 0 0; font-size: clamp(17px, 1.6vw, 20px); color: var(--text-soft); }

.waiting-gm b { font-weight: 400; }

.waiting-when { margin: 10px 0 0; font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); }

.waiting-when b { font-weight: 600; color: var(--text-soft); }

.waiting hr { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--line); }

/* "Last time…" from the latest recap (#55): readable across the table, and it scrolls rather than pushing the stations down. */
.last-time { display: flex; flex-direction: column; gap: 8px; }

.last-time-title { margin: 0; font: 400 clamp(22px, 2.2vw, 30px)/1.15 var(--serif); }

.last-time-story { max-height: 32vh; overflow: hidden auto; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.45; color: var(--text-soft); }

.last-time-story p { margin: 0 0 .6em; }

.at-table { display: flex; flex-direction: column; gap: 12px; }

.at-table ul { display: contents; }

.at-table li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: clamp(18px, 1.7vw, 21px);
}

.at-table li::before {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ok);
}

.at-table li b { overflow-wrap: anywhere; }

/* Who sits at each station, under its name (#29). */
.at-table .station { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.at-table .seats { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: .8em; }

.at-table .seat { color: var(--muted); }

.at-table .seat b { color: var(--text); }

.at-table li .state { color: var(--gold); font-size: .85em; }

.at-table li[data-state="connecting"]::before { box-sizing: border-box; background: none; border: 2px solid var(--gold); }

.at-table li .self { margin-left: auto; font-size: 16px; color: var(--muted); white-space: nowrap; }

.toasts { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-end; gap: 10px; }

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 8px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    font-size: 18px;
    animation: toast-in .2s ease-out;
}

.toast b {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--ok);
    font: 600 11px var(--mono);
}

@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.waiting-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 760px) {
    .waiting { grid-template-columns: minmax(0, 1fr); align-items: start; overflow: hidden auto; }
    .in-call:has(.waiting:not([hidden])) { overflow: visible; }
}

/* The footer's QR button opens this, for players at the table to scan. */
.invite-dialog {
    width: min(400px, calc(100vw - 32px));
    padding: 28px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    text-align: center;
}

.invite-dialog::backdrop { background: color-mix(in srgb, var(--bg) 75%, transparent); }

.invite-dialog h2 { margin: 0; }

.invite-dialog .qr { width: min(260px, 100%); margin: 20px auto; }

.invite-link { margin: 0 0 6px; font: 600 15px var(--mono); color: var(--gold-light); overflow-wrap: anywhere; }

.invite-dialog .btn-link { font-size: 14px; }

.invite-dialog .btn { width: 100%; margin-top: 22px; }

/* A character with a whisper they haven't read (#44): never who sent it or what it says. */
.portrait.whispered { position: relative; overflow: visible; }
.portrait.whispered img { border-radius: 50%; }
.portrait.whispered::after {
    content: '…';
    position: absolute;
    top: -4px;
    right: -6px;
    display: grid;
    place-items: center;
    width: 18px;
    height: 14px;
    border-radius: 8px 8px 8px 2px;
    background: var(--gold);
    color: var(--bg);
    font: 700 11px/1 var(--mono);
}

/* A character's conditions tonight (#46): a chip for each under its name in the sidebar, each in its own color. */
.cast-who { flex: 1; display: grid; gap: 6px; min-width: 0; }
.cast-conditions { display: flex; flex-wrap: wrap; gap: 4px; }
.cast-condition { padding: 5px 8px; border-radius: 6px; background: var(--condition-color); color: var(--bg); font-size: 14px; font-weight: 800; line-height: 1; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; max-width: 100%; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; }

/* A character with a hand up (#48): a gold glow and a hand over the top. */
.portrait.hand-raised { position: relative; overflow: visible; isolation: isolate; }
.portrait.hand-raised img { border-radius: 50%; }
.portrait.hand-raised::before {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: 1;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--gold), 0 0 14px 4px var(--gold);
    pointer-events: none;
}
.hand-icon {
    position: absolute;
    z-index: 2;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font: 14px/1 system-ui, sans-serif;
}

/* While the session records for its recap (#50), at the top right of the call. */
.recording-badge {
    position: fixed;
    top: 12px;
    right: 14px;
    z-index: 5;
    margin: 0;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(220, 54, 46, .9);
    color: #fff;
    font: 600 13px var(--mono);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.recording-badge.paused { background: var(--surface); color: var(--muted); border: 1px solid var(--line-strong); }

.station-card .record-row { grid-column: 1 / -1; }

/* Raised hands in the sidebar (#48): a banner naming them, and a ringing hand on each row. */
@keyframes hand-ring {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 55%, transparent); }
    70%, 100% { box-shadow: 0 0 0 12px transparent; }
}

.hand-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--gold); color: var(--bg); }
.hand-banner[hidden] { display: none; }
.hand-banner svg { flex: none; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hand-banner div { display: grid; min-width: 0; }
.hand-banner b { font-size: 19px; font-weight: 800; line-height: 1.15; }
.hand-banner span { font-size: 14px; font-weight: 600; opacity: .75; }

.cast li.hand:not(.current) { background: color-mix(in srgb, var(--gold) 6%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 50%, transparent); }

/* The sidebar has its own hand, so its portraits don't glow too. */
.cast .portrait.hand-raised::before, .cast .hand-icon { display: none; }

.cast-hand, .cast-hand-badge { display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: var(--bg); animation: hand-ring 1.8s ease-out infinite; }
.cast-hand { flex: none; width: 44px; height: 44px; }
.cast-hand svg { width: 24px; height: 24px; }
.cast-hand-badge { position: absolute; top: -6px; left: -6px; display: none; width: 24px; height: 24px; box-sizing: border-box; border: 2px solid var(--surface); }
.cast-hand-badge svg { width: 13px; height: 13px; stroke-width: 2.6; }
.sidebar.collapsed .cast-hand-badge { display: grid; }

/* A tile with a hand up at its station: a gold ring and a pill. */
.tile.hand { outline: 3px solid var(--gold); outline-offset: -3px; }
.tile-hand { position: absolute; top: 12px; left: 12px; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--gold); color: var(--bg); font-size: 15px; font-weight: 800; white-space: nowrap; }
.tile-hand svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
    .cast-hand, .cast-hand-badge { animation: none; }

    .console-toggle.pulse { animation: none; box-shadow: 0 0 0 3px var(--gold); }
}

/* A table's Console (#99): its account's play page, docked on the right
   and pushing the call left; narrower screens get it over the call. */
.console-panel {
    grid-area: console;
    display: flex;
    flex-direction: column;
    width: var(--console-width, 400px);
    min-height: 0;
    border-left: 1px solid var(--line);
    background: var(--bg);
}

.console-panel[hidden] { display: none; }

.console-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }

.console-panel iframe { flex: 1; width: 100%; border: 0; }

.console-resize {
    grid-area: console;
    justify-self: start;
    z-index: 1;
    width: 9px;
    margin-left: -5px;
    cursor: col-resize;
    touch-action: none;
}

.console-resize:is(:hover, :focus-visible, .dragging) { background: linear-gradient(90deg, transparent 3px, var(--gold) 3px 6px, transparent 6px); outline: 0; }

@media (min-width: 901px) {
    .in-call:has(.console-panel:not([hidden])) .station-account { right: calc(var(--console-width, 400px) + clamp(16px, 4vw, 44px)); }
}

@media (max-width: 900px) {
    .console-panel { position: fixed; inset: 0 0 0 auto; z-index: 10; width: min(100vw, var(--console-width, 400px)); box-shadow: -12px 0 40px rgba(0, 0, 0, .5); }

    .console-resize { display: none; }
}

/* While the Console is open (#106), someone sits at the screen, so the cast,
   footer and tile labels shrink from their across-the-table sizes. */
.at-hand .room-title { font-size: 18px; }
.at-hand .sidebar-phase { font-size: 13px; }
.at-hand .sidebar-sub { font-size: 14px; }
.at-hand .cast { gap: 6px; }
.at-hand .cast li { min-height: 56px; padding: 8px; }
.at-hand .cast .portrait { width: 40px; height: 40px; }
.at-hand .cast-name { font-size: 17px; }
.at-hand .cast-status { font-size: 12px; }
.at-hand .cast-init { width: 40px; height: 40px; font-size: 20px; }
.at-hand .cast-condition { padding: 3px 6px; font-size: 12px; }
.at-hand .hand-banner b { font-size: 16px; }
.at-hand .hand-banner span { font-size: 13px; }
.at-hand .cast-hand { width: 34px; height: 34px; }
.at-hand .cast-hand svg { width: 18px; height: 18px; }
.at-hand .sidebar.collapsed { width: 88px; }

.at-hand { --footer-pad: 8px; --round: 44px; --more: 34px; }
.at-hand .round svg { width: 20px; height: 20px; }
.at-hand .round.hang-up { width: 64px; }

.at-hand .tile figcaption { font-size: 15px; }
.at-hand .tile .seat .portrait { width: 24px; height: 24px; }
.at-hand .tile .state { font-size: 13px; }
