@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Libre+Bodoni:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap');

:root {
    --paper: #f7f4ee;
    --paper-deep: #eee8dd;
    --ink: #171717;
    --muted: #676159;
    --rule: #cec7bb;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --accent: #252525;
    --danger: #8a342c;
    --success: #365a43;
    --radius: 10px;
    --shadow: 0 10px 28px rgba(24, 20, 15, 0.065);

    /* One variable controls the entire literary/display voice. */
    --font-display: 'Libre Bodoni', 'Bodoni 72', Didot, 'Bodoni MT', Georgia, serif;
    --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    line-height: 1.5;
}

a { color: inherit; }
button, input, select { font: inherit; }

.site-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--rule);
}

.brand {
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 2.5vw, 2.15rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    text-decoration: none;
}

.header-meta {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero {
    min-height: calc(100vh - 96px);
    display: grid;
    align-content: center;
    gap: 34px;
    padding: 58px 0 76px;
}

.hero-copy { max-width: 820px; }

.eyebrow {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

h1, h2, h3,
.scene-text,
.sentence-card,
.word-card,
.room-code,
.vote-copy,
.score-value {
    font-family: var(--font-display);
}

h1 {
    margin: 0;
    font-size: clamp(3.4rem, 9vw, 7.25rem);
    font-weight: 600;
    line-height: 0.9;
    letter-spacing: -0.058em;
}

h2 {
    margin: 0 0 10px;
    font-size: clamp(1.9rem, 4vw, 2.9rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.035em;
}

h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.lede {
    max-width: 650px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.18rem);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    max-width: 760px;
}

.panel,
.action-card,
.sentence-card,
.word-card,
.vote-card,
.score-card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.action-card {
    display: block;
    padding: 28px;
    text-decoration: none;
    transition: transform 120ms ease, box-shadow 120ms ease;
}
.action-card:hover,
.action-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(24, 20, 15, 0.095);
}
.action-card strong {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 600;
}
.action-card span { color: var(--muted); }

.page { padding: 44px 0 72px; }
.panel { padding: clamp(22px, 4vw, 38px); }
.narrow-panel { max-width: 720px; }

.form-grid { display: grid; gap: 18px; }
label { display: grid; gap: 7px; font-weight: 650; }

input, select {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    background: #fff;
    color: var(--ink);
    border: 1px solid #aaa39a;
    border-radius: 7px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 11px 18px;
    background: var(--ink);
    color: #fff;
    border: 1px solid var(--ink);
    border-radius: 7px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}
.button.secondary, button.secondary { background: transparent; color: var(--ink); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.room-code {
    font-size: clamp(2.5rem, 8vw, 5.2rem);
    font-weight: 600;
    letter-spacing: 0.1em;
}
.room-code-input {
    font-family: var(--font-display);
    font-size: clamp(2rem, 8vw, 3.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.scene-strip {
    padding: 16px 0 22px;
    border-bottom: 1px solid var(--rule);
}
.scene-label {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}
.scene-text {
    max-width: 980px;
    font-size: clamp(1.15rem, 2vw, 1.55rem);
    font-weight: 500;
    line-height: 1.2;
}

.tv-stage {
    min-height: 66vh;
    display: grid;
    place-items: center;
    padding: 38px 0;
}
.sentence-card {
    width: min(980px, 100%);
    padding: clamp(30px, 6vw, 68px);
    font-size: clamp(2.2rem, 6vw, 5.35rem);
    font-weight: 500;
    line-height: 1;
    text-align: center;
    letter-spacing: -0.035em;
    transform-origin: center;
}
.sentence-card.reveal { animation: cardReveal 420ms cubic-bezier(.2,.7,.2,1); }
@keyframes cardReveal {
    from { opacity: 0; transform: perspective(900px) rotateX(-8deg) translateY(12px); }
    to { opacity: 1; transform: perspective(900px) rotateX(0) translateY(0); }
}

.vote-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.vote-card {
    min-height: 160px;
    display: grid;
    grid-template-columns: 54px 1fr;
    align-items: center;
    gap: 18px;
    padding: 22px;
}
.vote-number {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    font-weight: 800;
}
.vote-copy { font-size: clamp(1.2rem, 2.2vw, 1.75rem); line-height: 1.15; }

.hand-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.word-card {
    min-height: 116px;
    display: grid;
    place-items: center;
    padding: 16px;
    background: var(--surface-strong);
    color: var(--ink);
    font-size: clamp(1.3rem, 4vw, 1.85rem);
    font-weight: 500;
    line-height: 1.05;
    text-align: center;
    cursor: pointer;
    transition: transform 100ms ease, border-color 100ms ease, background 100ms ease;
}
.word-card:hover { transform: translateY(-1px); }
.word-card.is-selected { border: 2px solid var(--ink); background: #f1ede5; }
.word-card small {
    display: block;
    margin-top: 8px;
    font-family: var(--font-ui);
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.composer {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin: 20px 0 24px;
}
.composer-slot {
    min-height: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    border: 1px dashed #989087;
    border-radius: 7px;
    background: rgba(255,255,255,.35);
    color: var(--muted);
    text-align: center;
}
.composer-slot.filled { border-style: solid; color: var(--ink); }
.composer-word { font-family: var(--font-display); font-size: 1.02rem; line-height: 1.05; }
.composer-empty,
.composer-rule,
.composer-glue {
    font-family: var(--font-ui);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .07em;
    line-height: 1.15;
    text-transform: uppercase;
}
.composer-rule { color: var(--muted); }
.composer-glue { color: var(--ink); text-transform: none; letter-spacing: .02em; }

.room-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
    gap: 20px;
    align-items: start;
}
.player-list { display: grid; gap: 9px; margin: 18px 0 0; padding: 0; list-style: none; }
.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--rule);
}
.player-row:first-child { border-top: 0; }

.score-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.score-card { min-width: 110px; padding: 12px 16px; box-shadow: none; }
.score-name { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.score-value { font-size: 1.6rem; font-weight: 600; }

.notice {
    padding: 12px 14px;
    border: 1px solid var(--rule);
    border-radius: 7px;
    background: rgba(255,255,255,.45);
}
.notice.error { border-color: #c7a19c; color: var(--danger); }
.notice.success { border-color: #9ab2a0; color: var(--success); }

.timer { font-variant-numeric: tabular-nums; font-weight: 800; }
.muted { color: var(--muted); }
.spacer-top { margin-top: 28px; }

@media (max-width: 900px) {
    .room-layout { grid-template-columns: 1fr; }
    .composer { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .site-header { align-items: flex-start; }
    .action-grid, .vote-grid { grid-template-columns: 1fr; }
    .hand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero { min-height: auto; padding-top: 74px; }
    .composer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- Alpha gameplay state UI ---- */
.player-page { max-width: 980px; margin: 0 auto; }
.player-status-row,
.phase-line,
.screen-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.player-status-row { margin: 18px 0 14px; }
.phase-line { justify-content: flex-start; margin: 18px 0; color: var(--muted); }
.phase-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.timer {
    font-variant-numeric: tabular-nums;
    letter-spacing: .03em;
}
.game-panel { min-height: 280px; }
.waiting-mark {
    display: grid;
    place-items: center;
    width: 86px;
    height: 86px;
    margin: 28px 0 4px;
    border: 1px solid var(--rule);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 2.2rem;
}
.inline-error { margin-top: 14px; }
.mini-winner {
    display: grid;
    gap: 8px;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--rule);
}
.mini-winner strong {
    font-family: var(--font-display);
    font-size: 1.65rem;
    line-height: 1.12;
}
.mini-winner span { color: var(--muted); }
.phone-vote-grid { display: grid; gap: 12px; margin-top: 22px; }
.phone-vote-card {
    width: 100%;
    display: grid;
    grid-template-columns: 46px 1fr;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 14px;
    background: var(--surface-strong);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    text-align: left;
}
.phone-vote-card .vote-copy { font-size: 1.2rem; }

.screen-tools {
    min-height: 54px;
    padding: 10px 0 18px;
    border-top: 1px solid var(--rule);
}
.button.compact { min-height: 36px; padding: 6px 11px; font-size: .78rem; }
.lobby-screen { text-align: center; }
.lobby-screen p:last-child { color: var(--muted); }
.status-card { display: grid; gap: 12px; }
.status-card strong { font-size: clamp(3.2rem, 10vw, 7rem); }
.status-card small,
.winner-card small {
    display: block;
    margin-top: 18px;
    font-family: var(--font-ui);
    color: var(--muted);
    font-size: clamp(.85rem, 1.6vw, 1rem);
    font-weight: 650;
    letter-spacing: .04em;
}
.screen-kicker {
    display: block;
    margin-bottom: 12px;
    font-family: var(--font-ui);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.vote-screen { width: 100%; }
.vote-instruction {
    margin: 0 0 22px;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    text-align: center;
}
.winner-card { border-width: 2px; }
.notice.subtle { background: transparent; border-color: var(--rule); }

@media (max-width: 760px) {
    .site-shell { width: min(100% - 20px, 1180px); }
    .site-header { padding: 14px 0; }
    .hand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .composer { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .composer-slot { min-height: 64px; }
    .vote-grid { grid-template-columns: 1fr; }
    .room-layout { grid-template-columns: 1fr; }
    .player-status-row { position: sticky; top: 0; z-index: 5; padding: 8px 0; background: color-mix(in srgb, var(--paper) 94%, transparent); }
}

@media (max-width: 420px) {
    .hand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .word-card { min-height: 96px; padding: 10px; font-size: 1.2rem; }
    .composer { gap: 6px; }
    .composer-slot { font-size: .78rem; }
}

/* Alpha operations / diagnostics */
.danger-button {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 42%, var(--rule));
}
.danger-button:hover { border-color: var(--danger); }
.narrow-page { max-width: 860px; margin-inline: auto; }
.readiness-panel { padding: clamp(24px, 4vw, 42px); }
.readiness-heading {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    margin-bottom: 28px;
}
.readiness-heading h1 { margin-bottom: 8px; }
.small-lede { max-width: 640px; font-size: 1rem; }
.readiness-orb {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border: 1px solid var(--rule);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 2.2rem;
}
.readiness-orb.is-ready { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, var(--rule)); }
.readiness-orb.needs-work { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--rule)); }
.check-list { border-top: 1px solid var(--rule); }
.check-row {
    display: grid;
    grid-template-columns: 28px minmax(160px, .75fr) 1.5fr;
    gap: 12px;
    align-items: baseline;
    padding: 13px 0;
    border-bottom: 1px solid var(--rule);
}
.check-icon { font-weight: 800; }
.check-row.is-good .check-icon { color: var(--success); }
.check-row.is-bad .check-icon { color: var(--danger); }
.check-row.is-warning .check-icon { color: var(--muted); }
.check-label { font-weight: 700; }
.check-detail { color: var(--muted); }

@media (max-width: 620px) {
    .readiness-heading { grid-template-columns: 1fr; }
    .readiness-orb { width: 58px; height: 58px; }
    .check-row { grid-template-columns: 24px 1fr; }
    .check-detail { grid-column: 2; }
}

.volume-control { display: inline-flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--muted); }
.volume-control span { font-weight: 600; letter-spacing: .02em; }
.volume-control input[type="range"] { width: 110px; accent-color: var(--ink); }
@media (max-width: 680px) { .volume-control { width: 100%; } .volume-control input[type="range"] { flex: 1; } }

/* ---- Alpha mechanical hotfix ---- */
.join-share-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 24px;
    align-items: center;
    margin: 24px 0;
    padding: 20px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: rgba(255,255,255,.46);
}
.join-url {
    margin: 0 0 16px;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: .9rem;
}
.join-qr,
.screen-join-qr {
    display: block;
    width: 220px;
    height: 220px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 8px;
}
.host-player-note { margin: 14px 0 0; }
.screen-join-qr { margin: 22px auto 16px; }
.phone-reveal-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin-top: 22px;
    padding: 22px;
    background: var(--surface-strong);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.phone-reveal-card strong {
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 5vw, 2.35rem);
    line-height: 1.08;
    font-weight: 500;
}
.word-card:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.player-page .scene-strip {
    padding: 18px 18px 20px;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}
.player-page .scene-text {
    font-size: clamp(1.45rem, 5vw, 2rem);
    line-height: 1.12;
}

@media (max-width: 760px) {
    .join-share-card { grid-template-columns: 1fr; }
    .join-qr { margin: 0 auto; }
    .join-share-card .button-row > * { flex: 1 1 100%; }
    .player-page .scene-strip { position: relative; }
}

/* ---- Alpha structure cards + balanced hand + swap overlay ---- */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.hand-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.structure-card {
    margin: 18px 0 24px;
    padding: 16px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 86%, var(--paper-deep));
}
.structure-card-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.structure-card-heading span {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.structure-card-heading strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
}
.structure-composer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    font-size: 1rem;
}
.structure-slot {
    flex: 0 1 112px;
    min-width: 92px;
    min-height: 66px;
}
.structure-glue {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 9px;
    border-radius: 999px;
    background: #e8e5df;
    color: #4b4742;
    font-size: .8rem;
    font-weight: 750;
    line-height: 1.1;
}
.structure-glue.choice-preview { font-size: .68rem; }
.glue-choice-wrap { display: inline-flex; }
.glue-select {
    width: auto;
    min-width: 74px;
    min-height: 38px;
    padding: 5px 28px 5px 10px;
    border: 1px solid #b8b2aa;
    border-radius: 999px;
    background-color: #e8e5df;
    color: #3f3b36;
    font-size: .8rem;
    font-weight: 800;
    text-transform: none;
}
.structure-help {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: .78rem;
}
.hand-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 10px;
}
.hand-legend span {
    padding: 4px 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.word-card.pos-noun, .structure-slot.pos-noun { border-color: #b94d4d; background: #fff4f2; }
.word-card.pos-verb, .structure-slot.pos-verb { border-color: #416fa8; background: #f1f6fd; }
.word-card.pos-adjective, .structure-slot.pos-adjective { border-color: #4e8257; background: #f2f8f1; }
.word-card.pos-adverb, .structure-slot.pos-adverb { border-color: #b87928; background: #fff7eb; }
.hand-legend .pos-noun { color: #943d3d; }
.hand-legend .pos-verb { color: #345d8f; }
.hand-legend .pos-adjective { color: #3d6a45; }
.hand-legend .pos-adverb { color: #93611f; }

.phase-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(20, 18, 15, .82);
    animation: phaseOverlayIn 160ms ease-out;
}
.phase-overlay-card {
    width: min(720px, 100%);
    padding: clamp(28px, 6vw, 58px);
    border-radius: 14px;
    background: var(--surface-strong);
    color: var(--ink);
    box-shadow: 0 24px 80px rgba(0,0,0,.28);
    text-align: center;
}
.phase-overlay-card strong {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 4.2rem);
    font-weight: 600;
    line-height: 1;
}
.phase-overlay-card p {
    margin: 18px auto 0;
    max-width: 560px;
    color: var(--muted);
    font-size: clamp(1rem, 2.5vw, 1.35rem);
}
@keyframes phaseOverlayIn { from { opacity: 0; } to { opacity: 1; } }

.screen-build {
    width: min(1040px, 100%);
    display: grid;
    gap: 20px;
}
.screen-build .structure-card { margin: 0; }
.compact-status { padding: clamp(20px, 4vw, 34px); font-size: 1rem; }
.compact-status strong { font-size: clamp(2.5rem, 8vw, 5rem); }

@media (max-width: 760px) {
    .hand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .structure-card-heading { display: grid; gap: 3px; }
    .structure-card-heading strong { font-size: 1rem; }
    .structure-slot { flex-basis: 98px; min-width: 82px; min-height: 60px; }
    .structure-glue, .glue-select { font-size: .74rem; }
    .phase-overlay { padding: 14px; }
}

/* ---- Alpha 0.3 play-surface cleanup ---- */
.pos-noun { --pos-color: #c53b3b; }
.pos-verb { --pos-color: #2f6fbe; }
.pos-adjective { --pos-color: #3f8a4d; }
.pos-adverb { --pos-color: #d88416; }

/* The sentence is one horizontal strip. It scrolls sideways on narrow phones
   rather than wrapping into a second sentence-shaped pile. */
.structure-card {
    margin: 0 0 16px;
    padding: 12px 14px 13px;
    background: var(--surface);
    border: 1px solid var(--rule);
}
.structure-card-heading {
    margin-bottom: 8px;
}
.structure-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.structure-composer {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    width: max-content;
    min-width: 100%;
    padding: 2px 1px 5px;
}
.structure-slot {
    flex: 0 0 94px;
    min-width: 94px;
    min-height: 64px;
    padding: 6px;
    border: 10px solid var(--pos-color, var(--rule)) !important;
    border-radius: 8px;
    background: var(--surface-strong) !important;
}
.structure-glue {
    flex: 0 0 auto;
    min-height: auto;
    padding: 4px 5px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: .96rem;
    font-weight: 600;
    white-space: nowrap;
}
.structure-help {
    margin: 7px 0 0;
    font-size: .72rem;
}
.composer-word { font-size: .98rem; overflow-wrap: anywhere; }
.composer-empty { font-size: .58rem; }
.composer-rule { font-size: .54rem; }

/* Explicit 4 x 4 hand. Four cards in each POS row, every time. */
.hand-matrix {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}
.hand-pos-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
}
.hand-pos-label {
    display: grid;
    place-items: center;
    padding: 4px;
    border-left: 10px solid var(--pos-color, var(--rule));
    color: var(--ink);
    font-size: .62rem;
    font-weight: 850;
    letter-spacing: .05em;
    line-height: 1.05;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}
.hand-pos-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.hand-pos-cards .word-card {
    min-width: 0;
    min-height: 78px;
    padding: 6px 4px;
    border: 10px solid var(--pos-color, var(--rule)) !important;
    border-radius: 8px;
    background: var(--surface-strong) !important;
    font-size: clamp(.9rem, 2vw, 1.12rem);
    box-shadow: none;
}
.hand-pos-cards .word-card span { min-width: 0; overflow-wrap: anywhere; }
.hand-pos-cards .word-card small {
    margin-top: 5px;
    font-size: .48rem;
    line-height: 1.05;
    letter-spacing: .035em;
}
.hand-pos-cards .word-card.is-selected {
    border-color: var(--pos-color, var(--rule)) !important;
    outline: 3px solid var(--ink);
    outline-offset: 1px;
    transform: translateY(-1px);
}
.hand-pos-cards .word-card:disabled { opacity: .34; }

/* Scene gets the stage first, then shrinks back to the normal strip in BUILD. */
.player-page .scene-strip.scene-intro {
    min-height: 42vh;
    display: grid;
    align-content: center;
    padding: clamp(24px, 7vw, 54px);
    margin-bottom: 14px;
}
.player-page .scene-strip.scene-intro .scene-label {
    margin-bottom: 12px;
}
.player-page .scene-strip.scene-intro .scene-text {
    max-width: none;
    font-size: clamp(2.25rem, 8vw, 4.5rem);
    line-height: .98;
    letter-spacing: -.035em;
}
.scene-feature-card {
    width: min(1120px, 100%);
    min-height: 58vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    padding: clamp(36px, 7vw, 86px);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.scene-feature-card strong {
    display: block;
    max-width: 1050px;
    font-family: var(--font-display);
    font-size: clamp(3rem, 7.4vw, 7.4rem);
    font-weight: 600;
    line-height: .92;
    letter-spacing: -.05em;
}

/* Physical-feeling wipe between phases. */
.phase-wipe {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
    background: var(--ink);
    transform: translateX(-105%);
    animation: hsPhaseWipe 700ms cubic-bezier(.72, 0, .22, 1) both;
}
@keyframes hsPhaseWipe {
    0% { transform: translateX(-105%); }
    44% { transform: translateX(0); }
    56% { transform: translateX(0); }
    100% { transform: translateX(105%); }
}

.screen-build {
    width: min(1120px, 100%);
    gap: 14px;
}
.screen-build .structure-slot {
    flex-basis: 108px;
    min-width: 108px;
}
.screen-build .structure-glue { font-size: 1.12rem; }

@media (max-width: 760px) {
    .structure-card-heading { display: flex; gap: 8px; }
    .structure-card-heading strong { font-size: .9rem; text-align: right; }
    .structure-slot {
        flex-basis: 76px;
        min-width: 76px;
        min-height: 58px;
        border-width: 8px !important;
    }
    .structure-glue { font-size: .82rem; padding-inline: 2px; }
    .hand-pos-row { grid-template-columns: 34px minmax(0, 1fr); gap: 5px; }
    .hand-pos-label { border-left-width: 8px; font-size: .52rem; padding: 2px; }
    .hand-pos-cards { gap: 5px; }
    .hand-pos-cards .word-card {
        min-height: 68px;
        padding: 4px 2px;
        border-width: 8px !important;
        font-size: clamp(.72rem, 3.1vw, .92rem);
    }
    .hand-pos-cards .word-card small { font-size: .42rem; }
    .player-page .scene-strip:not(.scene-intro) { padding: 12px 14px 14px; }
    .player-page .scene-strip:not(.scene-intro) .scene-text { font-size: 1.18rem; }
}

@media (max-width: 390px) {
    .site-shell { width: calc(100% - 12px); }
    .panel { padding: 16px 10px; }
    .hand-pos-row { grid-template-columns: 28px minmax(0, 1fr); }
    .hand-pos-cards .word-card {
        min-height: 64px;
        border-width: 7px !important;
        font-size: .7rem;
    }
    .structure-slot { flex-basis: 70px; min-width: 70px; border-width: 7px !important; }
}


/* ---- Alpha 0.3.1 sentence rail + unmistakable POS color correction ---- */
/* Do not make the player pan a sentence sideways. It reads left-to-right and
   wraps as one continuous sentence when a phone needs a second row. */
.structure-scroll {
    width: 100%;
    overflow: visible !important;
}
.structure-composer {
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: center;
    align-content: flex-start;
    justify-content: flex-start;
    gap: 6px 5px;
    padding: 3px 0;
}
.structure-slot {
    flex: 0 1 92px !important;
    min-width: 76px !important;
    min-height: 58px;
    padding: 5px;
    background: #fff !important;
    border-radius: 7px;
}
.structure-glue {
    flex: 0 0 auto;
    padding: 0 2px;
    background: transparent !important;
    color: #211f1b;
    font-family: var(--font-display);
    font-size: .98rem;
    font-weight: 650;
    line-height: 1.05;
    white-space: nowrap;
}

/* Direct color declarations, not only CSS variables. This keeps the grammar
   colors obvious even if a browser handles custom-property inheritance oddly. */
.word-card.pos-noun,
.structure-slot.pos-noun { border: 10px solid #d13f3f !important; }
.word-card.pos-verb,
.structure-slot.pos-verb { border: 10px solid #3478c9 !important; }
.word-card.pos-adjective,
.structure-slot.pos-adjective { border: 10px solid #4b9656 !important; }
.word-card.pos-adverb,
.structure-slot.pos-adverb { border: 10px solid #df8a19 !important; }

/* One clean row per POS, four cards per row. */
.hand-matrix {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}
.hand-pos-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 4px !important;
}
.hand-pos-label {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    padding: 2px 4px 4px !important;
    border: 0 !important;
    border-bottom: 5px solid var(--pos-color, #777) !important;
    writing-mode: horizontal-tb !important;
    transform: none !important;
    font-size: .63rem !important;
    letter-spacing: .075em;
}
.hand-pos-cards {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
}
.hand-pos-cards .word-card {
    min-width: 0;
    min-height: 65px;
    padding: 4px 3px;
    background: #fff !important;
    border-radius: 7px;
    font-size: clamp(.76rem, 2.8vw, 1rem);
    line-height: 1;
}
.hand-pos-cards .word-card:disabled {
    opacity: .48;
    filter: none;
}

@media (max-width: 760px) {
    .structure-card { padding: 10px 9px 11px; }
    .structure-card-heading { margin-bottom: 7px; }
    .structure-slot {
        flex: 0 1 68px !important;
        min-width: 58px !important;
        min-height: 52px;
        border-width: 8px !important;
        padding: 3px;
    }
    .structure-glue { font-size: .78rem; padding: 0 1px; }
    .composer-word { font-size: .82rem; }
    .composer-empty { font-size: .48rem; }
    .composer-rule { font-size: .45rem; }
    .hand-pos-cards { gap: 4px !important; }
    .hand-pos-cards .word-card {
        min-height: 58px;
        border-width: 8px !important;
        padding: 3px 2px;
        font-size: clamp(.67rem, 3vw, .84rem);
    }
    .hand-pos-cards .word-card small { font-size: .39rem; margin-top: 3px; }
}

@media (max-width: 390px) {
    .structure-composer { gap: 4px 3px; }
    .structure-slot {
        flex-basis: 62px !important;
        min-width: 54px !important;
        border-width: 7px !important;
    }
    .structure-glue { font-size: .72rem; }
    .hand-pos-cards .word-card {
        min-height: 54px;
        border-width: 7px !important;
        font-size: .66rem;
    }
}

/* ---- Alpha usability pass: scene pacing, POS primer, clearer host controls ---- */
.player-page .scene-strip.scene-intro {
    min-height: 56vh;
    padding: clamp(30px, 8vw, 64px);
    border-width: 2px;
}
.player-page .scene-strip.scene-intro .scene-text {
    font-size: clamp(2.7rem, 10vw, 5.2rem);
    line-height: .98;
    letter-spacing: -.04em;
    text-wrap: balance;
}
.scene-feature-card {
    min-height: 68vh;
    padding: clamp(48px, 8vw, 104px);
}
.scene-feature-card strong {
    font-size: clamp(3.7rem, 8vw, 8.6rem);
    line-height: .94;
    text-wrap: balance;
}

.pos-demo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}
.pos-demo-item {
    min-height: 94px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 14px 16px;
    border: 8px solid var(--rule);
    border-radius: 12px;
    background: var(--surface-strong);
}
.pos-demo-item strong {
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: .02em;
}
.pos-demo-item span { color: var(--muted); font-size: .9rem; }
.pos-demo-item.pos-noun { border-color: #d64545 !important; }
.pos-demo-item.pos-verb { border-color: #3274d9 !important; }
.pos-demo-item.pos-adjective { border-color: #3c9b57 !important; }
.pos-demo-item.pos-adverb { border-color: #df8a28 !important; }
.tv-pos-demo {
    width: min(1120px, 100%);
    min-height: 62vh;
    display: grid;
    place-content: center;
    gap: 20px;
    text-align: center;
}
.tv-pos-demo h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(3rem, 6vw, 6rem);
    line-height: .98;
}
.tv-pos-demo .pos-demo {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    margin-top: 8px;
}
.tv-pos-demo .pos-demo-item { min-height: 135px; border-width: 10px; }
.tv-pos-demo .pos-demo-item strong { font-size: 1.5rem; }
.tv-pos-demo .pos-demo-item span { font-size: 1rem; }

.host-launch-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
}
.host-launch-card {
    display: grid;
    gap: 5px;
    min-height: 132px;
    align-content: center;
    padding: 22px;
    border: 2px solid var(--ink);
    border-radius: var(--radius);
    background: var(--surface-strong);
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.host-launch-card:hover { transform: translateY(-2px); }
.host-launch-card strong {
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 3vw, 2.25rem);
    line-height: 1;
}
.host-launch-card small { color: var(--muted); line-height: 1.35; }
.host-launch-primary { background: var(--ink); color: var(--surface-strong); }
.host-launch-primary small, .host-launch-primary .host-launch-kicker { color: rgba(255,255,255,.78); }
.host-launch-kicker {
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
}
.host-invite-section {
    margin: 22px 0;
    padding: 20px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: rgba(255,255,255,.46);
}
.host-invite-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
}
.host-qr-block { display: grid; gap: 8px; justify-items: center; }
.host-qr-block span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.host-share-actions { display: grid; gap: 10px; align-content: center; }
.host-share-actions .join-url { margin: 0 0 4px; }
.host-share-actions button { width: 100%; min-height: 48px; }
.host-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}
.host-start-button { min-width: 190px; min-height: 52px; font-size: 1.05rem; }

@media (max-width: 760px) {
    .player-page .scene-strip.scene-intro { min-height: 60vh; padding: 28px 20px; }
    .player-page .scene-strip.scene-intro .scene-text { font-size: clamp(2.45rem, 11vw, 4rem); }
    .pos-demo { grid-template-columns: 1fr 1fr; gap: 8px; }
    .pos-demo-item { min-height: 82px; padding: 10px 12px; border-width: 7px; }
    .host-launch-grid { grid-template-columns: 1fr; }
    .host-invite-grid { grid-template-columns: 1fr; }
    .host-share-actions { width: 100%; }
}


/* ---- Alpha 0.3.4 human-paced fixed-stage usability pass ---- */
/* White blink, not a black curtain. */
.phase-wipe {
    background: #fff !important;
    transform: none !important;
    animation: hsWhiteBlink 360ms ease-in-out both !important;
}
@keyframes hsWhiteBlink {
    0%, 100% { opacity: 0; }
    42%, 58% { opacity: .96; }
}

/* TV is a hard 16:9 stage. Nothing gets to escape the frame. */
.tv-body {
    width: 100vw;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #e9e5dd;
}
.tv-shell {
    width: min(100vw, calc(100vh * 16 / 9)) !important;
    height: min(100vh, calc(100vw * 9 / 16)) !important;
    aspect-ratio: 16 / 9;
    margin: 0 !important;
    padding: 0 clamp(14px, 2vw, 30px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    background: var(--paper);
}
.tv-shell .site-header { min-height: 0; padding: clamp(8px, 1.2vh, 14px) 0; gap: 12px; }
.tv-shell .brand { font-size: clamp(1.15rem, 2vw, 1.8rem); }
.tv-shell .score-grid { flex-wrap: nowrap; overflow: hidden; gap: 6px; }
.tv-shell .score-card { min-width: 76px; padding: 6px 9px; }
.tv-shell .score-value { font-size: 1.15rem; }
.tv-shell .scene-strip { padding: 7px 0 9px; overflow: hidden; }
.tv-shell .scene-text { max-width: none; font-size: clamp(.9rem, 1.5vw, 1.25rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-stage { min-height: 0 !important; height: 100%; padding: clamp(8px, 1.6vh, 18px) 0 !important; overflow: hidden; align-content: center; }
.screen-tools { min-height: 0; padding: 7px 0 8px; overflow: hidden; }
.scene-feature-card {
    width: min(88%, 1080px);
    max-height: 82%;
    min-height: 0 !important;
    padding: clamp(26px, 4.2vw, 60px) !important;
    border: 2px solid var(--rule);
    border-radius: 28px !important;
    background: var(--surface-strong);
    overflow: hidden;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}
.scene-feature-card strong {
    max-width: 100%;
    font-size: clamp(2rem, 4.25vw, 4.6rem) !important;
    line-height: 1.03 !important;
    letter-spacing: -.035em !important;
    overflow-wrap: anywhere;
}
.tv-stage .sentence-card, .tv-stage .vote-screen, .tv-stage .screen-build, .tv-stage .tv-pos-demo { max-height: 100%; overflow: hidden; }
.tv-stage .sentence-card { padding: clamp(20px, 3.5vw, 50px); font-size: clamp(1.8rem, 4.6vw, 4.5rem); border-radius: 24px; }
.tv-pos-demo { min-height: 0 !important; height: 100%; gap: 12px; }
.tv-pos-demo h1 { font-size: clamp(2rem, 4vw, 4rem); }
.tv-pos-demo .pos-demo-item { min-height: 0; height: clamp(90px, 15vh, 130px); border-width: 5px; border-radius: 18px; }

/* Sentence rail uses a light POS stroke. Connectors and filled words share one typographic size. */
.structure-slot { border-width: 2px !important; border-radius: 13px !important; }
.word-card.pos-noun { border-color: #d13f3f !important; }
.word-card.pos-verb { border-color: #3478c9 !important; }
.word-card.pos-adjective { border-color: #4b9656 !important; }
.word-card.pos-adverb { border-color: #df8a19 !important; }
.structure-slot.pos-noun { border: 2px solid #d13f3f !important; }
.structure-slot.pos-verb { border: 2px solid #3478c9 !important; }
.structure-slot.pos-adjective { border: 2px solid #4b9656 !important; }
.structure-slot.pos-adverb { border: 2px solid #df8a19 !important; }
.structure-glue, .composer-word {
    font-family: var(--font-display) !important;
    font-size: 1rem !important;
    font-weight: 650 !important;
    line-height: 1.05 !important;
}
.word-card, .phone-vote-card, .scene-strip, .structure-card, .pos-demo-item { border-radius: 14px !important; }
.hand-pos-cards .word-card { border-radius: 14px !important; }

/* The needed POS row comes to the player. */
.hand-pos-row.is-active-pos { order: -1; opacity: 1; }
.hand-pos-row.is-active-pos .hand-pos-label { font-weight: 900; }
.hand-pos-row.is-active-pos .hand-pos-label span { margin-left: 8px; color: var(--ink); font-size: .6rem; letter-spacing: .03em; }
.hand-pos-row.is-inactive-pos { opacity: .44; }

/* Phone is a fixed play surface. No page scrolling during normal gameplay. */
.player-body { height: 100dvh; min-height: 0; overflow: hidden; }
.player-body > .site-shell { height: 100dvh; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.player-body .site-header { padding: 8px 0; min-height: 48px; }
.player-body .brand { font-size: 1.25rem; }
.player-body .header-meta { font-size: .64rem; }
.player-body .player-page { min-height: 0; height: 100%; padding: 6px 0 8px; overflow: hidden; }
#player-app { height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 5px; overflow: hidden; }
.player-body .player-status-row { margin: 0; min-height: 30px; }
.player-body .game-panel { min-height: 0; height: 100%; padding: 9px 10px; overflow: hidden; }
.player-body .game-panel > .eyebrow { display: none; }
.player-body .game-panel h2 { font-size: clamp(1.15rem, 5vw, 1.55rem); margin-bottom: 3px; }
.player-body .game-panel #player-copy { margin: 0 0 5px; font-size: .72rem; line-height: 1.25; }
.player-body #player-action { min-height: 0; height: calc(100% - 52px); overflow: hidden; }
.player-body[data-phase="SCENE"] .game-panel { display: none; }
.player-body .scene-strip { padding: 7px 10px 8px; }
.player-body .scene-label { margin-bottom: 1px; font-size: .58rem; }
.player-body .scene-text { font-size: clamp(.95rem, 4vw, 1.2rem); line-height: 1.08; }
.player-body .scene-strip.scene-intro { min-height: 0 !important; height: 100%; padding: 18px !important; display: grid; align-content: center; border-radius: 18px !important; }
.player-body .scene-strip.scene-intro .scene-text { font-size: clamp(1.5rem, 7vw, 2.4rem) !important; line-height: 1.06; }
.player-body .structure-card { margin: 0 0 5px; padding: 6px 7px; }
.player-body .structure-card-heading { margin-bottom: 3px; }
.player-body .structure-card-heading span { font-size: .5rem; }
.player-body .structure-card-heading strong { font-size: .72rem; }
.player-body .structure-composer { gap: 3px 3px; }
.player-body .structure-slot { flex: 0 1 62px !important; min-width: 52px !important; min-height: 38px !important; padding: 2px 3px !important; }
.player-body .structure-glue, .player-body .composer-word { font-size: .78rem !important; }
.player-body .composer-empty { font-size: .42rem; }
.player-body .composer-rule { display: none; }
.player-body .structure-help { display: none; }
.player-body .hand-matrix { gap: 3px; }
.player-body .hand-pos-row { gap: 2px !important; }
.player-body .hand-pos-label { min-height: 14px; padding: 0 3px 2px !important; font-size: .5rem !important; border-bottom-width: 2px !important; }
.player-body .hand-pos-cards { gap: 3px !important; }
.player-body .hand-pos-cards .word-card { min-height: 42px !important; padding: 2px !important; border-width: 4px !important; font-size: clamp(.62rem, 2.8vw, .76rem); line-height: .94; }
.player-body .hand-pos-row.is-active-pos .word-card { min-height: 52px !important; }
.player-body .hand-pos-cards .word-card small { display: none; }
.player-body .spacer-top { margin-top: 5px; }
.player-body .button-row { gap: 5px; }
.player-body .button-row button { min-height: 36px; padding: 5px 10px; font-size: .72rem; flex: 1; }
.player-body .pos-demo { margin-top: 6px; gap: 5px; height: calc(100% - 6px); }
.player-body .pos-demo-item { min-height: 0 !important; padding: 7px 8px; border-width: 4px; }
.player-body .pos-demo-item strong { font-size: .85rem; }
.player-body .pos-demo-item span { font-size: .64rem; }
.player-body .phone-vote-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px; margin-top: 4px; }
.player-body .phone-vote-card { min-height: 0; height: clamp(46px, 8vh, 64px); grid-template-columns: 28px 1fr; gap: 5px; padding: 5px; }
.player-body .phone-vote-card .vote-number { width: 26px; height: 26px; font-size: .68rem; }
.player-body .phone-vote-card .vote-copy { font-size: .68rem; line-height: 1.05; }
.player-body .phase-overlay { padding: 10px; }
.player-body .phase-overlay-card { padding: 18px 16px; border-radius: 18px; }
.player-body .phase-overlay-card strong { font-size: 1.7rem; }
.player-body .phase-overlay-card p { margin-top: 8px; font-size: .82rem; }

/* ---- Alpha 0.3.6 party-paced refinement ---- */
/* Phase change: dim toward charcoal, kiss the screen with pale light, then reveal next phase. */
.phase-wipe {
    background: linear-gradient(135deg, rgba(46,44,42,.78), rgba(63,60,57,.72) 48%, rgba(247,244,237,.90) 62%, rgba(255,255,255,.95) 70%, rgba(46,44,42,.70)) !important;
    transform: none !important;
    animation: hsPartyCrossfade 780ms cubic-bezier(.22,.61,.36,1) both !important;
    pointer-events: none;
}
@keyframes hsPartyCrossfade {
    0% { opacity: 0; }
    24% { opacity: .78; }
    52% { opacity: .94; }
    70% { opacity: .42; }
    100% { opacity: 0; }
}

/* TV scene is a card within the hard 16:9 stage. It can never demand scrolling. */
.tv-stage .scene-feature-card {
    width: min(86%, 1040px);
    height: min(68%, 560px);
    max-height: 68%;
    padding: clamp(24px, 3.2vw, 48px) !important;
    border-radius: 30px !important;
    box-shadow: 0 18px 48px rgba(39,35,31,.10);
}
.tv-stage .scene-feature-card strong {
    font-size: clamp(1.8rem, 3.15vw, 3.45rem) !important;
    line-height: 1.10 !important;
    max-width: 94%;
}

/* Reveal keeps memory on screen. Current answer is large; prior answers stay as named mini cards. */
.reveal-stage {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1.35fr) minmax(92px, .65fr);
    gap: clamp(10px, 1.6vh, 18px);
    align-items: stretch;
}
.reveal-focus-card {
    min-height: 0;
    max-height: 100%;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
    gap: 12px;
    padding: clamp(20px, 3vw, 42px);
    border: 1px solid var(--rule);
    border-radius: 28px;
    background: var(--surface-strong);
    box-shadow: 0 16px 40px rgba(39,35,31,.10);
    overflow: hidden;
}
.reveal-focus-card strong {
    max-width: 94%;
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 3.55vw, 3.8rem);
    line-height: 1.08;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
}
.reveal-memory-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}
.reveal-memory-card {
    min-width: 0;
    min-height: 0;
    padding: 9px 10px 8px;
    border: 1px solid var(--rule);
    border-radius: 15px;
    background: rgba(255,255,255,.74);
    display: grid;
    align-content: center;
    gap: 5px;
    overflow: hidden;
}
.reveal-memory-card strong {
    min-width: 0;
    font-size: clamp(.68rem, 1.12vw, 1rem);
    line-height: 1.05;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.reveal-memory-card small {
    color: var(--muted);
    font-weight: 800;
    font-size: clamp(.58rem, .85vw, .76rem);
}

/* Voting expands the same remembered answers into the center of the stage. */
.tv-stage .vote-screen {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 10px;
}
.tv-stage .vote-instruction { margin: 0; font-size: clamp(1rem, 1.6vw, 1.45rem); }
.tv-stage .vote-grid {
    min-height: 0;
    height: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(8px, 1.2vw, 14px);
    align-content: center;
}
.tv-stage .vote-card {
    min-height: 0;
    height: 100%;
    padding: clamp(10px, 1.5vw, 18px);
    border-radius: 20px;
    overflow: hidden;
}
.tv-stage .vote-copy {
    min-width: 0;
    font-size: clamp(.82rem, 1.45vw, 1.35rem);
    line-height: 1.08;
    display: grid;
    gap: 6px;
}
.tv-stage .vote-copy small,
.phone-vote-card .vote-copy small,
.phone-reveal-card small {
    display: block;
    color: var(--muted);
    font-size: .72em;
    font-weight: 800;
    margin-top: 4px;
}

/* Rounded cards everywhere the player's hand appears. */
.word-card,
.structure-slot,
.phone-vote-card,
.phone-reveal-card,
.mini-winner,
.score-card {
    border-radius: 14px !important;
}

/* The sentence uses one typographic rhythm. POS is signaled by a restrained 2px stroke. */
.structure-slot { border-width: 2px !important; }
.structure-glue,
.composer-word {
    font-size: .92rem !important;
    line-height: 1.06 !important;
    font-weight: 700 !important;
}

/* Phone: all four rows remain present; the needed POS owns Row 1. */
.player-body .hand-matrix {
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    gap: 3px;
}
.player-body .hand-pos-row { order: 2; }
.player-body .hand-pos-row.is-active-pos { order: 1 !important; opacity: 1; }
.player-body .hand-pos-row.is-inactive-pos { opacity: .58; }
.player-body .hand-pos-row.is-active-pos .hand-pos-cards .word-card {
    box-shadow: 0 3px 10px rgba(39,35,31,.08);
}


/* Exquisite Forks canonical identity + PF Games navigation */
.header-brand-cluster { display:flex; align-items:center; gap:14px; min-width:0; }
.pf-games-link {
    flex:0 0 auto;
    color:var(--muted);
    font-size:.72rem;
    font-weight:800;
    letter-spacing:.11em;
    text-transform:uppercase;
    text-decoration:none;
    border-left:1px solid var(--rule);
    padding-left:14px;
}
.pf-games-link:hover,.pf-games-link:focus-visible { color:var(--ink); }
.ef-brand { display:inline-flex; align-items:center; text-decoration:none; }
.ef-logo { display:inline-flex; flex-direction:column; align-items:flex-start; line-height:.78; }
.ef-logo-exquisite {
    font-family:var(--font-ui);
    font-size:.34em;
    font-weight:800;
    letter-spacing:.31em;
    padding-left:.12em;
}
.ef-logo-forks {
    font-family:var(--font-display);
    font-weight:600;
    letter-spacing:-.055em;
}
.compact-logo { font-size:2rem; }
.hero-logo { margin:0; line-height:1; }
.hero-logo-mark { font-size:clamp(4rem,11vw,8.7rem); }
.hero-logo-mark .ef-logo-exquisite { font-size:.18em; letter-spacing:.42em; margin-bottom:.38em; }
.tv-header .header-brand-cluster { gap:9px; }
.tv-header .pf-games-link { font-size:.58rem; padding-left:9px; }
@media (max-width:640px) {
  .compact-logo { font-size:1.55rem; }
  .pf-games-link { font-size:.62rem; padding-left:9px; }
  .site-header { gap:10px; }
}


/* Alpha 0.1.2: fast phase fade, replacing the wipe/flash transition. */
.phase-fade {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
    background: #2e2c2a;
    animation: efQuickFade 280ms ease-in-out both;
}
@keyframes efQuickFade {
    0% { opacity: 0; }
    46% { opacity: .82; }
    54% { opacity: .82; }
    100% { opacity: 0; }
}
.tutorial-summary {
    max-width: 900px;
    margin: 0 auto 16px;
    font-size: clamp(1rem, 2vw, 1.35rem);
    line-height: 1.35;
    text-align: center;
}


/* Alpha 0.1.3: keep the BUILD action bar visible on every phone viewport. */
.player-body[data-phase="BUILD"] .game-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}
.player-body[data-phase="BUILD"] #player-action {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 4px;
    min-height: 0;
    height: auto;
    overflow: hidden;
}
.player-body[data-phase="BUILD"] #player-action > .structure-card {
    min-height: 0;
    margin-bottom: 0;
}
.player-body[data-phase="BUILD"] #player-action > .hand-matrix {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-bottom: 2px;
}
.player-body[data-phase="BUILD"] #player-action > .button-row {
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 3px;
    background: var(--surface-strong);
    position: relative;
    z-index: 2;
}
.player-body[data-phase="BUILD"] #lock-sentence {
    min-height: 40px;
    font-size: .78rem;
    font-weight: 800;
}
@media (max-height: 700px) {
    .player-body[data-phase="BUILD"] .game-panel h2 { font-size: 1.05rem; }
    .player-body[data-phase="BUILD"] .game-panel #player-copy { font-size: .66rem; margin-bottom: 3px; }
    .player-body[data-phase="BUILD"] .structure-slot { min-height: 34px !important; }
    .player-body[data-phase="BUILD"] .hand-pos-cards .word-card { min-height: 38px !important; }
    .player-body[data-phase="BUILD"] .hand-pos-row.is-active-pos .word-card { min-height: 45px !important; }
}
