:root {
    --bg: #fbf7ef;
    --surface: #fffdf8;
    --ink: #1b1b1b;
    --muted: #57534e;
    --accent: #ef4444;
    --accent-dark: #b91c1c;
    --ok: #0f766e;
    --warn: #92400e;
    --danger: #7f1d1d;
    --edge: #d6d3d1;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

html {
    background: #ce1118;
}

body.mm-body {
    color: var(--ink);
    font-family: "Charter", "Bitstream Charter", "Sitka Text", "Cambria", serif;
    background: transparent;
}

h1,
h2,
h3,
p {
    margin: 0;
}

input,
button {
    font-family: inherit;
}

input {
    width: 100%;
    border: 1px solid var(--edge);
    border-radius: 7px;
    padding: 0.28rem 0.38rem;
    font-size: 0.8rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.72rem;
}

button {
    border: 0;
    border-radius: 8px;
    padding: 0.25rem 0.42rem;
    font-size: 0.74rem;
    cursor: pointer;
}

.primary-btn {
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.danger-btn {
    background: #fee2e2;
    color: var(--danger);
    font-weight: 700;
}

.small-btn,
.drag-handle {
    background: white;
    border: 1px solid var(--edge);
    color: var(--ink);
}

.ghost-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 2px solid var(--accent);
    line-height: 1;
}

.status-message {
    min-height: 1rem;
    font-size: 0.72rem;
    color: var(--muted);
}

.status-message.ok {
    color: var(--ok);
}

.status-message.warn {
    color: var(--warn);
}

.status-message.bad {
    color: var(--danger);
}

.muted {
    color: var(--muted);
}

.version-badge {
    position: fixed;
    right: 0.58rem;
    bottom: 0.48rem;
    z-index: 40;
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 0.68rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.82);
    background: rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0.22rem 0.42rem;
    pointer-events: none;
    user-select: none;
    backdrop-filter: blur(2px);
}

/* Game page */
body.mm-body:not(.creator-page) {
    min-height: 100vh;
    background: linear-gradient(180deg, #ff1515 0%, #e3181f 58%, #ce1118 84%, #ce1118 100%) no-repeat;
    background-color: #ce1118;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
}

.game-shell {
    min-height: 100vh;
    height: auto;
    padding: 0.56rem 0.8rem 0.74rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.28rem;
}

.game-topbar {
    position: relative;
    display: flex;
    align-items: center;
    width: min(760px, 100%);
    margin: 0 auto;
}

.game-topbar .archive-btn,
.game-topbar .topbar-actions {
    position: relative;
    z-index: 1;
}

.game-topbar .topbar-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
}

.rules-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: transparent;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    padding: 0;
}

.settings-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0;
    line-height: 1;
    padding: 0;
}

.settings-btn svg {
    width: 24px;
    height: 24px;
    display: block;
}

.archive-btn {
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: transparent;
    color: #fff;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: none;
    border-radius: 999px;
    height: 34px;
    padding: 0 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.picker-wrap {
    display: grid;
    gap: 0.24rem;
}

.picker-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.picker-row label {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.72rem;
    font-weight: 700;
}

.picker-select {
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.2rem 0.34rem;
}

.picker-select option {
    color: #111827;
}

.picker-load-btn {
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    border-radius: 8px;
    padding: 0.22rem 0.46rem;
}

.game-meta {
    color: #fff;
    font-weight: 700;
    font-size: 0.94rem;
    line-height: 1.3;
    text-align: center;
    overflow: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 440px);
}

.game-meta-title {
    display: block;
    font-size: clamp(1.12rem, 2.1vw, 1.45rem);
    font-weight: 800;
    line-height: 1.1;
}

.game-meta-sub {
    display: block;
    font-size: clamp(0.78rem, 1.2vw, 0.95rem);
    opacity: 0.9;
    line-height: 1.25;
}

.timezone-link {
    color: inherit;
    text-decoration: underline;
}

.game-main {
    width: min(760px, 100%);
    margin: 0.04rem auto 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(8, auto);
    align-content: start;
    gap: 0.36rem;
    min-height: 0;
}

.start-btn {
    width: min(448px, 100%);
    justify-self: center;
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
}

.start-btn:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.prompt-title {
    text-align: center;
    font-size: clamp(1.6rem, 4.6vw, 2.7rem);
    font-weight: 800;
    margin: 0;
}

.prompt-text {
    text-align: center;
    font-size: clamp(1.02rem, 2.05vw, 1.32rem);
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: none;
    opacity: 0.9;
    margin: 0;
    min-height: clamp(2.8rem, 9vh, 4.1rem);
    display: grid;
    place-items: center;
    line-height: 1.24;
    white-space: normal;
}

.prompt-text-line {
    display: inline;
}

.prompt-text strong {
    display: inline;
    font-weight: 800;
    white-space: normal;
}

/* Cassette tape with geometrically accurate proportions */
.cassette {
    /* SVG cassette dimensions: 1682x1084.5 = aspect ratio ~1.55 */
    /* Scale cassette based on viewport: min 220px, max 400px, responsive between */
    --cassette-width: clamp(198px, 28vw, 356px);
    width: min(var(--cassette-width), 90%);
    aspect-ratio: 1682 / 1084.5;
    justify-self: center;
    position: relative;
    border: none;
    outline: none;
    margin-inline: auto;
}

.cassette-svg-container {
    position: absolute;
    inset: 0;
    transform: scale(var(--cassette-pulse-scale, 1));
    transform-origin: 50% 50%;
    transition: transform 70ms linear;
    will-change: transform;
    backface-visibility: hidden;
    background: transparent;
}

.cassette[data-variant="smoke"] {
    opacity: 0.99;
}

.cassette[data-variant="graphite"] {
    opacity: 0.99;
}

.cassette.inactive {
    opacity: 0.99;
}

/* Clue text above cassette */
.cassette-clue {
    position: absolute;
    left: 4%;
    right: 4%;
    top: 8.7%;
    height: 21.2%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.14rem;
    margin: 0;
    line-height: 1.14;
    font-size: var(--cassette-clue-size, clamp(0.84rem, 1.55vw, 1.1rem));
    color: rgba(252, 252, 252, 0.98);
    text-align: center;
    text-wrap: balance;
    pointer-events: none;
    z-index: 6;
    text-shadow: none;
}

.cassette-clue strong {
    font-weight: 800;
    color: #ffffff;
}

.cassette-clue-text {
    display: inline;
}

.cassette-clue-main {
    font-weight: 800;
    color: rgba(252, 252, 252, 0.98);
}

.cassette-clue-note {
    font-size: 0.64em;
    font-style: normal;
    line-height: 1.15;
    color: rgba(250, 250, 250, 0.9);
    white-space: nowrap;
    white-space: nowrap;
}

/* Click-to-start overlay on cassette */
.cassette-start-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
    pointer-events: none;
    z-index: 7;
    white-space: nowrap;
}

.cassette.ready {
    cursor: pointer;
}

.cassette.ready:hover .cassette-start-prompt {
    opacity: 1;
}

.cassette.ready .cassette-svg-container::after {
    content: none;
}

.cassette-start-prompt.hidden {
    display: none;
}

.cassette-tape-number {
    display: none !important;
}

/* Tape image */
.cassette-tape {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 2;
    pointer-events: none;
    filter: brightness(1.02) saturate(1) contrast(0.98) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.34));
}

.cassette-tape-wrapper {
    display: none;
}

/* Wheel positioning - behind tape, centered in holes */
.cassette-wheel {
    position: absolute;
    z-index: 1;
    transform-origin: 50% 50%;
}

/* Wheel A: 718x718, top-left at (124, 122) - adjusted slightly right and up */
#wheel-left {
    width: 42.69%;
    /* 718/1682 */
    height: auto;
    left: 7.67%;
    /* 124/1682 + 0.3% */
    top: 10.75%;
    /* 122/1084.5 - 0.5% */
}

/* Wheel B: 536x536, top-left at (928, 213) - adjusted slightly left and up */
#wheel-right {
    width: 31.87%;
    /* 536/1682 */
    height: auto;
    left: 54.87%;
    /* 928/1682 - 0.3% */
    top: 19.14%;
    /* 213/1084.5 - 0.5% */
}

.cassette-transport-flash {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: clamp(2.4rem, 9vw, 4rem);
    font-weight: 800;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
    opacity: 0;
    pointer-events: none;
    z-index: 8;
}

.cassette-transport-flash svg {
    width: 1em;
    height: 1em;
    display: block;
}

.cassette-transport-flash.flash {
    animation: cassette-transport-fade 340ms ease-out;
}

@keyframes cassette-transport-fade {
    0% {
        opacity: 0;
        transform: scale(0.86);
    }

    12% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.04);
    }
}

.transport-row {
    width: min(760px, 100%);
    justify-self: center;
    display: block;
    margin-top: -0.22rem;
    align-items: stretch;
}

.cassette-stage {
    position: relative;
    width: min(980px, 100%);
    justify-self: center;
    display: block;
    padding-top: 0;
    padding-bottom: clamp(1rem, 2.8vh, 2rem);
    margin-bottom: 0.02rem;
}

.transport-row.hidden {
    display: none;
}

.timeline-wrap {
    position: relative;
    display: grid;
    grid-template-rows: auto auto;
    gap: 0.12rem;
    width: 100%;
}

.timeline-surface {
    position: relative;
    width: 100%;
    height: 72px;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    cursor: not-allowed;
    touch-action: none;
    box-shadow: none;
    --timeline-main-height: 75%;
}

.timeline-surface::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: var(--timeline-main-height);
    height: 1px;
    background: rgba(255, 255, 255, 0.32);
    pointer-events: none;
    z-index: 3;
}

.timeline-surface:focus,
.timeline-surface:focus-visible {
    outline: none;
}

.timeline-surface.seekable {
    cursor: pointer;
}

.timeline-waveform {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
    z-index: 2;
}

.timeline-segments {
    display: none;
}

.timeline-segments::before,
.timeline-segments::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

.timeline-segments::before {
    left: 0;
}

.timeline-segments::after {
    right: 0;
}

.timeline-segment {
    display: block;
    text-align: center;
    font-size: 0.58rem;
    line-height: 1.1;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    text-transform: none;
    background: rgba(0, 0, 0, 0.58);
    padding: 0.08rem 0.18rem;
    border-radius: 0;
}

.timeline-time-badge {
    position: absolute;
    top: calc(var(--timeline-main-height) - 0.47rem);
    padding: 0.08rem 0.18rem;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.58);
    color: rgba(255, 255, 255, 0.95);
    font-family: "Menlo", "Roboto Mono", "SFMono-Regular", "Consolas", monospace;
    font-size: 0.66rem;
    line-height: 1;
    z-index: 5;
    pointer-events: none;
}

.timeline-time-left {
    left: 8px;
}

.timeline-time-right {
    right: 8px;
}

.buzz-btn {
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 400;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.4rem 0.9rem;
}

.buzz-panel {
    width: min(760px, 100%);
    justify-self: center;
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    position: relative;
    --buzz-card-width: min(420px, 92vw);
}

.buzz-idle-row {
    width: var(--buzz-card-width);
    justify-self: center;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.buzz-idle-row .buzz-btn,
.buzz-idle-row .start-round-btn {
    flex: 1 1 auto;
    width: auto;
    height: auto;
    border: 1px solid #000000;
    border-radius: 14px;
}

.start-round-btn {
    background: #2563eb;
}

.start-round-btn:hover {
    background: #1d4ed8;
}

.transport-toggle-btn {
    flex: 0 0 auto;
    width: 3.8rem;
    display: grid;
    place-items: center;
    border: 1px solid #000000;
    border-radius: 14px;
    background: #000000;
    color: #fff;
    cursor: pointer;
    padding: 0;
}

.transport-toggle-btn svg {
    width: 1.8rem;
    height: 1.8rem;
}

.transport-toggle-btn-reveal {
    position: absolute;
    top: 0;
    left: calc(50% + (var(--buzz-card-width) / 2) + 0.5rem);
    right: 0;
    height: 100%;
    width: auto;
}

.buzz-card {
    width: var(--buzz-card-width);
    justify-self: center;
    display: block;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

.answer-revealed-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.15rem;
}

.answer-revealed-row .answer-kicker {
    margin: 0;
}

.wrong-guesses.answer-revealed-result {
    margin-top: 0.3rem;
}

.buzz-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    border: 1px solid #000000;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.22);
}

.buzz-input-wrap {
    grid-column: 1 / -1;
    position: relative;
    border-bottom: 1px solid #000000;
}

.buzz-card #guess-input {
    display: block;
    width: 100%;
    background: #ffffff;
    color: #111827;
    border-radius: 14px 14px 0 0;
    padding: 0.62rem 0.8rem;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
}

.buzz-card #guess-input::placeholder {
    color: rgba(17, 24, 39, 0.45);
}

.buzz-card #guess-input:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(17, 24, 39, 0.35);
}

.buzz-card #guess-input:disabled {
    color: #111827;
    -webkit-text-fill-color: #111827;
    opacity: 1;
    background: #e5e7eb;
}

.buzz-card #guess-input.wrong,
.buzz-card #guess-input.wrong:disabled {
    background: #fecaca;
    color: #7f1d1d;
    -webkit-text-fill-color: #7f1d1d;
    opacity: 1;
}

.buzz-card.answer-revealed .buzz-grid {
    border: none;
    background: transparent;
}

.buzz-card.answer-revealed .buzz-input-wrap {
    border-bottom: none;
}

.buzz-card.answer-revealed #guess-input,
.buzz-card.answer-revealed #guess-input:disabled {
    background: transparent;
    color: #fff;
    -webkit-text-fill-color: #fff;
    font-size: 1.2rem;
    line-height: 1.15;
    padding: 0.1rem 0;
}

.buzz-wrong-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #dc2626;
    font-weight: 900;
    font-size: 1rem;
    pointer-events: none;
}

.cancel-buzz-btn,
.submit-answer-btn {
    border: none;
    border-radius: 0;
    padding: 0.62rem 0.5rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.cancel-buzz-btn {
    border-right: 1px solid #000000;
    background: rgba(55, 65, 81, 0.92);
    color: #fff;
    font-weight: 400;
}

.cancel-buzz-btn:hover {
    background: rgba(31, 41, 55, 0.95);
}

.submit-answer-btn {
    background: #dc2626;
    color: #fff;
    font-weight: 400;
}

.submit-answer-btn:hover {
    background: #b91c1c;
}

.submit-answer-btn:active {
    background: #991b1b;
}

.buzz-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Label area - top section with clue text */
.cassette-label {
    background: var(--cassette-label-bg);
    border: 2px solid var(--cassette-trim);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.label-text {
    width: 100%;
}

.cassette-label .cassette-clue {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.3;
    text-align: center;
    color: var(--cassette-label-ink);
    font-weight: 700;
}

/* Window - middle section with reels */
.cassette-window {
    background: linear-gradient(180deg,
            var(--cassette-window-gloss) 0%,
            var(--cassette-window) 100%);
    border: 2px solid var(--cassette-window-edge);
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Reel containers - hold the spinning reels */
.reel-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
            rgba(255, 255, 255, 0.8) 0%,
            transparent 40%),
        linear-gradient(180deg, #e8f0fb 0%, #c8d7ea 100%);
    border: 2px solid rgba(50, 70, 100, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Reels - the spinning hubs */
.reel {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 4px solid var(--cassette-reel-core);
    background:
        radial-gradient(circle at center, #fff 0 10px, transparent 11px),
        repeating-conic-gradient(from 0deg,
            var(--cassette-reel-ring) 0deg 18deg,
            #f0f5fc 18deg 36deg);
    position: relative;
}

.cassette.playing .reel {
    animation: wheel-spin 1.2s linear infinite;
}

@keyframes wheel-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Reel hub center */
.reel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--cassette-reel-ring);
}

/* Visible tape between reels */
.tape-visible {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 20px;
    margin: 0 12px;
}

/* Tape guides */
.tape-visible::before,
.tape-visible::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(50, 70, 100, 0.25);
}

.tape-visible::before {
    left: 0;
}

.tape-visible::after {
    right: 0;
}

.tape-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #2c4059;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

/* Bottom strip */
.cassette-bottom {
    border-top: 1px solid rgba(50, 70, 100, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pressure-pad {
    width: 40px;
    height: 10px;
    background: linear-gradient(180deg, #d8e3f0 0%, #b5c6dc 100%);
    border: 1px solid rgba(50, 70, 100, 0.3);
    border-radius: 2px;
}

#guess-input {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.98);
    font-size: 0.98rem;
    font-weight: 800;
    padding: 0.38rem 0 0.26rem;
    text-align: center;
}

#guess-input::placeholder {
    color: rgba(226, 232, 240, 0.62);
}

#guess-input:focus::placeholder {
    color: transparent;
}

#guess-input.correct {
    font-weight: 800;
}

#guess-input:disabled {
    color: rgba(255, 255, 255, 0.98);
    -webkit-text-fill-color: rgba(255, 255, 255, 0.98);
    opacity: 1;
}

#guess-input:focus {
    outline: none;
    box-shadow: none;
}

.guess-form-row {
    width: min(760px, 100%);
    justify-self: center;
    display: flex;
    gap: 0;
    align-items: center;
}

.answer-entry-row {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 0.02rem;
}

.answer-entry-row .answer-kicker {
    flex: 0 0 auto;
}

.answer-entry-row #guess-input {
    width: min(560px, 90vw);
    min-width: min(320px, 70vw);
    max-width: min(560px, 90vw);
    font-size: clamp(1.3rem, 2.8vw, 1.9rem);
    line-height: 1.2;
}

.transport-row+.cassette-status+.give-up-btn+.result-band .guess-form-row {
    margin-top: calc(-0.46rem - 2px);
}

.guess-submit-btn {
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-weight: 800;
    font-size: 0.83rem;
    border-radius: 10px;
    padding: 0.52rem 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.guess-submit-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.guess-submit-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

.guess-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.give-up-btn {
    width: min(448px, 100%);
    justify-self: center;
    border: 1px solid rgba(255, 255, 255, 0.78);
    background: rgba(0, 0, 0, 0.22);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
}

.give-up-btn:hover {
    background: rgba(0, 0, 0, 0.3);
}

.game-subrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-score {
    color: rgba(255, 255, 255, 0.92);
    font-family: inherit;
    font-size: 0.82rem;
}

.ghost-danger {
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: transparent;
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
}

.status-message {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.76rem;
}

/* Answer display above table */
.answer-display {
    /* Removed - replaced by answer-share-section */
}

.share-btn {
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 10px;
    padding: 0.65rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.95);
}

.case-panel {
    width: 100%;
    max-width: clamp(600px, 85vw, 1000px);
    justify-self: center;
}

.case-panel.hidden {
    display: none;
}

.reveal-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    align-items: start;
}

.answer-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
    text-align: center;
    display: grid;
    justify-items: center;
    gap: 0;
}

.answer-kicker {
    font-size: clamp(0.72rem, 1vw, 0.86rem);
    letter-spacing: 0.04em;
    opacity: 0.9;
    margin-bottom: -0.12rem;
}

.answer-value {
    font-size: clamp(1.3rem, 2.8vw, 1.9rem);
    font-weight: 800;
    line-height: 1.2;
}

#answer-text {
    margin: 0;
}

.answer-note {
    font-size: 0.8rem;
    opacity: 0.92;
}

.answer-inline {
    width: min(760px, 100%);
    justify-self: center;
    min-height: 1.6em;
}

.result-band {
    width: min(760px, 100%);
    justify-self: center;
    position: relative;
    min-height: 0;
}

.result-band .answer-text {
    position: relative;
    z-index: 1;
}

.share-btn {
    width: auto;
    min-width: 0;
    max-width: min(560px, 92vw);
    min-height: 48px;
    height: auto;
    border-radius: 12px;
    margin: 0;
    padding: 0.5rem 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 400;
    font-family: "Helvetica", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.2;
    border: 1px solid #ffffff;
    background: #ffffff;
    color: #101010;
    text-align: center;
    white-space: pre-line;
    word-break: break-word;
}

.share-btn:hover {
    background: #f3f4f6;
    border-color: #f3f4f6;
}

.share-block {
    display: grid;
    gap: 0.28rem;
    justify-items: center;
}

.share-row {
    display: flex;
    width: fit-content;
    justify-content: center;
    align-items: center;
    gap: 0.48rem;
    flex-wrap: nowrap;
    margin: 0 auto;
}

.share-prefix {
    font-size: 0.92rem;
    font-weight: 400;
    opacity: 0.95;
}

.share-note {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.35;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

.case-shell {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.case-title {
    display: none;
}

.wrong-guesses {
    position: relative;
    margin-top: 0.6rem;
    display: flex;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.16rem;
}

.wrong-heading {
    font-size: clamp(0.72rem, 1vw, 0.86rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
}

.wrong-guesses-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: inline;
    font-size: clamp(0.72rem, 1vw, 0.86rem);
    line-height: 1.2;
}

.wrong-guesses-list li {
    display: inline;
    color: #fff;
    font-size: inherit;
    font-weight: 700;
}

.wrong-guesses-list li+li::before {
    content: ", ";
    font-weight: 400;
}

.reveal-pop {
    margin-top: 0;
    border: 2px solid rgba(42, 63, 94, 0.65);
    border-radius: 10px;
    background: rgba(255, 251, 242, 0.96);
    color: #1f2937;
    padding: 0.4rem 0.44rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
    min-height: 0;
    overflow: hidden;
}

.cassette-status {
    display: none;
}

.reveal-table {
    border: none;
    overflow: visible;
}

.reveal-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1fr) 36px;
    gap: 0.4rem;
    align-items: center;
    padding: 0.32rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.36);
    font-size: 0.96rem;
    color: #fff;
    font-family: "Helvetica Neue Condensed Bold", "HelveticaNeue-CondensedBold", "Arial Narrow", sans-serif;
    font-stretch: condensed;
    letter-spacing: 0.01em;
    font-weight: 700;
}

.reveal-row.reveal-animate {
    opacity: 0;
    animation: reveal-row-fade 780ms ease-out forwards;
}

@keyframes reveal-row-fade {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal-link {
    color: #fff;
    text-decoration: underline;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 16px;
    height: 16px;
    line-height: 0;
    margin-left: 4px;
}

.reveal-link-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    justify-self: start;
    text-align: left;
}

.reveal-link-head {
    width: 16px;
}

.reveal-link-icon {
    width: 16px;
    height: 16px;
    display: block;
    color: currentColor;
    transform: scale(1.8);
    transform-origin: center;
}

.reveal-link-icon path {
    fill: currentColor;
}

.reveal-artist-head,
.reveal-artist-cell,
.reveal-link-head,
.reveal-link-cell {
    justify-self: start;
    text-align: left;
}

.reveal-row.head {
    font-family: "Helvetica Neue Condensed Bold", "HelveticaNeue-CondensedBold", "Arial Narrow", sans-serif;
    font-stretch: condensed;
    letter-spacing: 0.01em;
    font-weight: 900;
    border-bottom: 2px solid rgba(255, 255, 255, 0.65);
    background: transparent;
    z-index: 1;
}

.reveal-row:last-child {
    border-bottom: 0;
}

.rules-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    display: none;
    place-items: center;
    z-index: 20;
}

.rules-modal:not(.hidden) {
    display: grid;
}

.rules-modal.hidden {
    display: none !important;
}

.rules-card {
    width: min(540px, calc(100vw - 2rem));
    border-radius: 12px;
    background: #fff;
    color: #111827;
    padding: 0.8rem;
    font-family: inherit;
}

.settings-card {
    width: min(420px, calc(100vw - 2rem));
}

.archive-card-wrap {
    width: min(760px, calc(100vw - 1.6rem));
}

.archive-table-wrap {
    margin-top: 0.56rem;
    max-height: min(72vh, 560px);
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
}

.archive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.archive-table thead th {
    position: sticky;
    top: 0;
    background: #1f2937;
    color: #fff;
    text-align: left;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.5rem 0.6rem;
    z-index: 1;
}

.archive-row {
    border-bottom: 1px solid rgba(31, 41, 55, 0.15);
    cursor: pointer;
    transition: background 0.15s;
}

.archive-row:hover {
    background: rgba(239, 68, 68, 0.1);
}

.archive-row:last-child {
    border-bottom: none;
}

.archive-row td {
    padding: 0.5rem 0.6rem;
    color: #1f2937;
    vertical-align: middle;
}

.archive-col-date {
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.74rem;
    font-family: "IBM Plex Mono", "Menlo", monospace;
}

.archive-col-tape {
    white-space: nowrap;
    font-weight: 800;
    font-size: 0.74rem;
    font-family: "IBM Plex Mono", "Menlo", monospace;
}

.archive-col-question {
    font-size: 0.78rem;
    line-height: 1.3;
}

.archive-col-result {
    white-space: nowrap;
    text-align: center;
}

.archive-col-result-empty {
    color: #9ca3af;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.archive-col-result-squares {
    font-size: 1rem;
    letter-spacing: 0.06em;
}

.archive-result-btn {
    border: none;
    background: transparent;
    font-size: 1rem;
    letter-spacing: 0.06em;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 6px;
}

.archive-result-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.archive-copy-all-btn {
    margin-top: 0.6rem;
    width: 100%;
    border: 1px solid rgba(31, 41, 55, 0.4);
    background: #1f2937;
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
}

.archive-copy-all-btn:hover {
    background: #111827;
}

.rules-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rules-head h3 {
    margin: 0;
    font-size: 1.06rem;
}

.rules-close-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    color: #111827;
    font-weight: 700;
    padding: 0.1rem 0.34rem;
}

.rules-list {
    margin: 0.6rem 0 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.28rem;
    font-size: 0.88rem;
}

.rules-pref {
    margin-top: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #1f2937;
}

.rules-pref input {
    width: 16px;
    height: 16px;
    font-family: inherit;
}

/* Keep How To Play content compact and scrollable so all text fits. */
#rules-modal .rules-card {
    width: min(600px, calc(100vw - 1.25rem));
    max-height: min(86vh, 760px);
    overflow: auto;
    padding: 0.66rem 0.72rem;
}

#rules-modal .rules-head h3 {
    font-size: 0.98rem;
}

#rules-modal p {
    font-size: 0.82rem;
    line-height: 1.32;
    margin: 0.42rem 0 0;
}

#rules-modal .rules-list {
    margin: 0.42rem 0 0;
    padding-left: 1.04rem;
    gap: 0.2rem;
    font-size: 0.8rem;
}

#rules-modal .rules-pref {
    margin-top: 0.52rem;
    font-size: 0.78rem;
}

@media (max-width: 560px) {
    #rules-modal .rules-card {
        width: calc(100vw - 0.9rem);
        max-height: 90vh;
        padding: 0.56rem 0.58rem;
    }

    #rules-modal .rules-head h3 {
        font-size: 0.92rem;
    }

    #rules-modal p {
        font-size: 0.76rem;
        line-height: 1.28;
    }

    #rules-modal .rules-list {
        font-size: 0.74rem;
        padding-left: 0.94rem;
        gap: 0.16rem;
    }

    #rules-modal .rules-pref {
        font-size: 0.72rem;
    }
}

.confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 25;
}

.confetti-piece {
    position: absolute;
    border-radius: 2px;
    opacity: 0.95;
    transform: translate3d(0, -20px, 0) rotate(0deg);
    animation-name: confetti-fall;
    animation-timing-function: cubic-bezier(0.12, 0.72, 0.24, 1);
    animation-fill-mode: forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translate3d(0, -20px, 0) rotate(var(--confetti-rot));
        opacity: 0.95;
    }

    100% {
        transform: translate3d(var(--confetti-drift), 105vh, 0) rotate(calc(var(--confetti-rot) + 360deg));
        opacity: 0;
    }
}

@keyframes wheel-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none;
}

/* Creator mode: combined timeline builder */
body.creator-page {
    overflow: auto;
}

.creator-shell {
    width: 100vw;
    min-height: 100vh;
    height: auto;
    padding: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
}

.segment {
    min-height: 0;
    overflow: hidden;
    background: var(--surface);
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--edge);
}

.segment-head {
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: 0.2rem;
    padding: 0.34rem 0.42rem;
}

.head-title-wrap h1 {
    font-size: clamp(1.02rem, 2vw, 1.46rem);
    line-height: 1;
    margin-top: 0.08rem;
}

.head-fields {
    display: grid;
    grid-template-columns: minmax(260px, 520px);
    gap: 0.25rem;
}

.head-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.hidden-file-input {
    display: none;
}

.creator-tape-select {
    border: 1px solid var(--edge);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 0.2rem 0.34rem;
    font-size: 0.74rem;
    font-weight: 700;
    max-width: 180px;
}

.mini-note {
    font-size: 0.72rem;
    margin-right: auto;
}

.segment-strip {
    padding: 0.2rem;
    overflow: auto;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0.22rem;
    min-height: 280px;
}

.selected-editor-canvases {
    display: grid;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 0.2rem;
    height: 224px;
    min-height: 224px;
    flex-shrink: 0;
    padding-bottom: 0.1rem;
    border-bottom: 1px solid var(--edge);
    overflow: hidden;
}

.selected-wave-lane {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 2px;
}

.selected-wave-label {
    font-size: 0.67rem;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 800;
    color: rgba(17, 24, 39, 0.82);
}

.selected-spectrogram {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    display: block;
    align-self: stretch;
    border: 1px solid rgba(17, 24, 39, 0.3);
    background: var(--surface);
}

.segments-strip {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-content: start;
    overflow: auto;
    padding-top: 0.04rem;
}

.segments-table-head {
    display: grid;
    grid-template-columns: 10px 44px minmax(0, 1fr) minmax(0, 0.92fr) minmax(90px, 0.72fr);
    align-items: end;
    gap: 0;
    padding: 0.1rem 0 0.24rem;
    border-bottom: 2px solid #111827;
    text-transform: none;
}

.segments-table-head-cell {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    color: #111827;
    padding: 0 0.16rem;
}

.segments-table-head-spacer {
    padding: 0;
}

.segment-card {
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    display: grid;
    grid-template-columns: 10px 44px minmax(0, 1fr) minmax(0, 0.92fr) minmax(90px, 0.72fr);
    grid-template-rows: auto;
    gap: 0;
    align-items: center;
    padding: 0;
    min-height: 0;
    border-bottom: 1px solid rgba(17, 24, 39, 0.16);
}

.segment-card.selected {
    background: rgba(239, 68, 68, 0.12);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.35);
}

.segment-card.playing {
    background: rgba(34, 197, 94, 0.1);
}

.segment-card.selected.playing {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.14), rgba(34, 197, 94, 0.12));
}

.segment-grip {
    margin: 0;
    height: 100%;
    border-right: 1px solid rgba(17, 24, 39, 0.14);
    background:
        repeating-linear-gradient(0deg,
            rgba(17, 24, 39, 0.18) 0,
            rgba(17, 24, 39, 0.18) 4px,
            rgba(17, 24, 39, 0.08) 4px,
            rgba(17, 24, 39, 0.08) 8px);
    cursor: grab;
}

.segment-grip:active {
    cursor: grabbing;
}

.segment-cell {
    min-width: 0;
    padding: 0.18rem 0.16rem;
}

.segment-index-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.segment-title-cell,
.segment-artist-cell,
.segment-link-cell {
    display: flex;
    align-items: center;
}

.segment-inline-input {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ink);
    box-shadow: none;
    outline: none;
}

.segment-inline-input::placeholder {
    color: rgba(87, 83, 78, 0.72);
}

.segment-inline-input:focus {
    outline: none;
    box-shadow: inset 0 -2px 0 var(--accent);
}

.segment-index {
    font-size: 0.72rem;
    font-weight: 800;
    font-family: "IBM Plex Mono", monospace;
    white-space: nowrap;
}

.slot-meta {
    font-size: 0.52rem;
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#combined-preview-btn {
    white-space: nowrap;
}

#upload-all-btn {
    white-space: nowrap;
}

.start-input {
    width: 46px;
    min-width: 46px;
    font-size: 0.64rem;
    padding: 0.15rem 0.2rem;
    margin: 0;
}

@media (max-width: 560px) {
    .game-shell {
        padding-left: 0;
        padding-right: 0;
    }

    .game-topbar,
    .game-main {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .picker-row {
        gap: 0.22rem;
    }

    .picker-select {
        max-width: 42vw;
    }

    .transport-row {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
    }

    .cassette-stage {
        width: min(100%, 560px);
        padding-inline: 0.35rem;
        padding-top: 0;
        padding-bottom: clamp(0.78rem, 2.2vh, 1.3rem);
        gap: 0.5rem;
        margin-bottom: 0.14rem;
    }

    .timeline-segments {
        left: 12px;
        right: 12px;
        bottom: 3px;
        gap: 0.18rem;
    }

    .timeline-time-left {
        left: 12px;
    }

    .timeline-time-right {
        right: 12px;
    }

    .result-band {
        min-height: 0;
    }

    .timeline-surface {
        border-radius: 0;
    }

    .guess-form-row {
        flex-direction: column;
    }

    .guess-submit-btn {
        display: block;
    }

    .cassette {
        --cassette-width: clamp(188px, 56vw, 258px);
    }

    .cassette-clue {
        left: 4.6%;
        right: 4.6%;
        top: 9%;
        height: 22.8%;
        font-size: var(--cassette-clue-size, clamp(0.62rem, 2.5vw, 0.9rem));
    }

    .guess-form-row {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .answer-entry-row {
        justify-content: center;
        align-items: center;
    }

    .answer-entry-row #guess-input {
        min-width: min(280px, 76vw);
    }

    .share-row {
        gap: 0.26rem;
    }

    .share-prefix {
        font-size: 0.8rem;
        font-weight: 400;
    }

    .share-btn {
        max-width: min(360px, 94vw);
        font-size: 0.76rem;
        font-weight: 400;
    }

    .share-note {
        font-size: 0.68rem;
    }

    .reveal-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .case-panel {
        max-width: 95vw;
    }

    .answer-text {
        font-size: 1rem;
    }

    .case-shell {
        padding: 0.75rem;
    }

    .reveal-row {
        font-size: 0.96rem;
        gap: 0.3rem;
    }

    body.creator-page {
        overflow: auto;
    }

    .creator-shell {
        height: auto;
        grid-template-rows: auto;
    }

    .segment-strip {
        min-height: 140px;
    }

    .segments-strip {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .segments-table-head {
        grid-template-columns: 10px 38px minmax(0, 1fr) minmax(0, 0.9fr) minmax(84px, 0.8fr);
    }

    .segment-card {
        grid-template-columns: 10px 38px minmax(0, 1fr) minmax(0, 0.9fr) minmax(84px, 0.8fr);
        grid-template-rows: auto;
        gap: 0;
        padding-bottom: 0;
    }

    .segment-inline-input {
        font-size: 0.78rem;
    }

    .segment-cell {
        padding: 0.15rem 0.12rem;
    }

    .selected-editor-canvases {
        height: 214px;
    }

    .head-fields {
        grid-template-columns: 1fr;
    }

    .head-actions {
        flex-wrap: wrap;
    }

    .guess-controls {
        flex-direction: column;
    }

    .buzz-card {
        width: min(94vw, 460px);
    }

    .archive-col-question {
        font-size: 0.72rem;
    }

    .archive-table thead th {
        font-size: 0.6rem;
        padding: 0.4rem 0.4rem;
    }

    .archive-row td {
        padding: 0.4rem 0.4rem;
    }
}