:root {
    color-scheme: light;
    --bg: #f4f1ec;
    --surface: rgba(250, 248, 244, .82);
    --glass: rgba(255, 255, 255, .58);
    --ink: #111;
    --muted: #666;
    --faint: #9a9a9a;
    --border: rgba(0, 0, 0, .10);
    --success: #35a66a;
    --error: #d84e4e;
    --shadow: 0 24px 80px rgba(0, 0, 0, .10);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100dvh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 255, 255, .86), transparent 32%),
        radial-gradient(circle at 88% 80%, rgba(218, 207, 193, .38), transparent 34%),
        var(--bg);
}

button,
select {
    font: inherit;
}

.tg-shell {
    position: relative;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) 150px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: calc(100dvh - 52px);
    margin: 26px;
    padding: 30px 36px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 32px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .92);
    backdrop-filter: blur(28px) saturate(1.14);
}

.tg-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.tg-brand,
.tg-header-actions,
.tg-controls,
.tg-footer,
.tg-score-card,
.tg-side-nav {
    display: flex;
    align-items: center;
}

.tg-brand {
    gap: 16px;
    color: var(--ink);
    text-decoration: none;
}

.tg-logo {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    background: #111;
    border-radius: 9px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}

.tg-logo span {
    width: 20px;
    height: 20px;
    border: 4px solid #fff;
    border-radius: 50%;
}

.tg-brand strong {
    font-size: 17px;
    font-weight: 700;
}

.tg-header-actions {
    gap: 14px;
}

.tg-icon-button,
.tg-sign,
.tg-seek,
.tg-play,
.tg-lang {
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.tg-icon-button,
.tg-seek {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: #151515;
    background: rgba(255, 255, 255, .54);
    border-radius: 50%;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.tg-icon-button:hover,
.tg-seek:hover,
.tg-play:hover,
.tg-sign:hover,
.tg-choice:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .10);
}

.tg-sign {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 28px;
    color: #fff;
    background: #111;
    border-radius: 999px;
    font-weight: 760;
    text-decoration: none;
}

.tg-bars {
    width: 18px;
    height: 18px;
    background: linear-gradient(90deg, transparent 0 15%, #111 15% 28%, transparent 28% 43%, #111 43% 56%, transparent 56% 72%, #111 72% 85%, transparent 85%);
}

.tg-side-nav {
    align-self: center;
    justify-self: center;
    flex-direction: column;
    gap: 22px;
    width: 112px;
    padding: 24px 12px;
    background: rgba(255, 255, 255, .42);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .04), inset 0 1px 0 rgba(255, 255, 255, .82);
}

.tg-side-nav button {
    display: grid;
    gap: 8px;
    width: 100%;
    place-items: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.tg-side-nav b {
    font-size: 13px;
    font-weight: 540;
}

.tg-nav-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    color: #868686;
    border-radius: 50%;
}

.tg-side-nav .is-active .tg-nav-icon {
    color: #fff;
    background: #111;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .14);
}

.tg-side-nav .is-active b {
    color: #222;
    font-weight: 700;
}

.tg-wave-icon::before {
    content: "≋";
    font-size: 24px;
    transform: rotate(90deg);
}

.tg-trophy-icon::before {
    content: "♕";
    font-size: 22px;
}

.tg-clock-icon::before {
    content: "◷";
    font-size: 26px;
}

.tg-stage {
    display: grid;
    align-self: center;
    justify-self: center;
    width: min(760px, 100%);
    place-items: center;
    padding-top: 6px;
}

.tg-round {
    display: grid;
    gap: 4px;
    margin-bottom: 24px;
    text-align: center;
}

.tg-round span {
    font-size: 14px;
}

.tg-round strong {
    font-size: 27px;
    letter-spacing: -.04em;
}

.cassette-wrap {
    width: min(520px, 88vw);
    filter: drop-shadow(0 24px 28px rgba(0, 0, 0, .16));
    transition: transform 430ms cubic-bezier(.16, 1, .3, 1), opacity 280ms ease;
}

.cassette-wrap.is-changing {
    opacity: .18;
    transform: translateX(-22px) scale(.965) rotate(-1deg);
}

.cassette {
    position: relative;
    aspect-ratio: 1.72 / 1;
    padding: 34px 28px 28px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .40), rgba(140, 130, 118, .18)),
        rgba(154, 143, 130, .32);
    border: 1px solid rgba(70, 62, 55, .24);
    border-radius: 16px;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, .72), inset 0 -16px 36px rgba(60, 50, 42, .12);
}

.cassette::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(70, 62, 55, .18);
    border-radius: 13px;
}

.cassette-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 128px;
    padding: 0 28px;
    color: #2a2928;
    background:
        repeating-linear-gradient(0deg, rgba(70, 50, 30, .055) 0 1px, transparent 1px 29px),
        rgba(255, 252, 244, .70);
    border: 1px solid rgba(90, 78, 66, .18);
    border-radius: 14px;
    font-size: 28px;
    z-index: 1;
}

.cassette-window {
    position: absolute;
    left: 105px;
    right: 105px;
    top: 110px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 0 17px;
    background: rgba(30, 28, 25, .72);
    border: 4px solid rgba(90, 82, 75, .60);
    border-radius: 42px;
    z-index: 2;
}

.reel {
    position: relative;
    display: block;
    width: 66px;
    height: 66px;
    background:
        radial-gradient(circle, #efeee9 0 20%, transparent 21%),
        conic-gradient(from 0deg, #efeee9 0 12%, #827a72 12% 22%, #efeee9 22% 35%, #827a72 35% 46%, #efeee9 46% 60%, #827a72 60% 72%, #efeee9 72% 86%, #827a72 86% 100%);
    border: 8px solid rgba(255, 255, 255, .72);
    border-radius: 50%;
    box-shadow: inset 0 0 0 5px rgba(70, 60, 50, .42), 0 4px 10px rgba(0, 0, 0, .18);
}

.tg-shell.is-playing .reel {
    animation: spin 1.8s linear infinite;
}

.tape-band {
    position: absolute;
    inset: 10px 84px;
    background: repeating-linear-gradient(90deg, rgba(33, 29, 25, .75) 0 3px, rgba(47, 41, 36, .75) 3px 6px);
    border-radius: 10px;
}

.cassette-bottom {
    position: absolute;
    left: 120px;
    right: 120px;
    bottom: 18px;
    display: flex;
    justify-content: space-around;
}

.cassette-bottom span,
.screw {
    width: 19px;
    height: 19px;
    background: rgba(120, 111, 101, .38);
    border: 1px solid rgba(80, 72, 64, .25);
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, .4);
}

.screw {
    position: absolute;
    z-index: 3;
}

.screw::after {
    content: "✣";
    display: grid;
    height: 100%;
    place-items: center;
    color: rgba(30, 28, 25, .70);
    font-size: 11px;
}

.screw-a { left: 8px; top: 8px; }
.screw-b { right: 8px; top: 8px; }
.screw-c { left: 8px; bottom: 8px; }
.screw-d { right: 8px; bottom: 8px; }

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

.tg-controls {
    justify-content: center;
    margin-top: 30px;
}

.tg-seek {
    position: relative;
    width: 44px;
    height: 44px;
    font-weight: 800;
}

.tg-seek small {
    position: absolute;
    font-size: 10px;
}

.tg-play {
    display: grid;
    width: 66px;
    height: 66px;
    place-items: center;
    background: #111;
    border-radius: 50%;
    box-shadow: 0 16px 32px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.tg-play.needs-tap {
    animation: playPulse 900ms ease-in-out infinite;
}

@keyframes playPulse {
    50% {
        transform: scale(1.08);
        box-shadow: 0 18px 42px rgba(0, 0, 0, .22), 0 0 0 10px rgba(17, 17, 17, .08);
    }
}

.tg-play span {
    width: 0;
    height: 0;
    margin-left: 4px;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-left: 16px solid #fff;
}

.tg-shell.is-playing .tg-play span {
    width: 18px;
    height: 22px;
    margin-left: 0;
    border: 0;
    background: linear-gradient(90deg, #fff 0 34%, transparent 34% 64%, #fff 64%);
}

.tg-progress {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 12px;
    width: min(590px, 92%);
    margin-top: 18px;
    font-size: 14px;
}

.tg-progress-track {
    position: relative;
    height: 3px;
    background: rgba(0, 0, 0, .12);
    border-radius: 999px;
}

.tg-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    background: #111;
    border-radius: inherit;
}

.tg-progress-track b {
    position: absolute;
    left: 0;
    top: 50%;
    width: 10px;
    height: 10px;
    background: #111;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.tg-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 34px;
    margin-top: 12px;
}

.tg-waveform span {
    width: 4px;
    height: var(--h);
    background: rgba(0, 0, 0, .18);
    border-radius: 999px;
}

.tg-shell.is-playing .tg-waveform span {
    animation: wave 760ms ease-in-out infinite;
    animation-delay: var(--d);
}

@keyframes wave {
    50% { transform: scaleY(1.65); background: rgba(0, 0, 0, .30); }
}

.tg-question {
    margin: 26px 0 14px;
    font-size: 16px;
}

.tg-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: min(740px, 100%);
}

.tg-choice {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 76px;
    padding: 0 18px;
    color: var(--ink);
    background: rgba(255, 255, 255, .44);
    border: 1px solid var(--border);
    border-radius: 18px;
    text-align: left;
    cursor: pointer;
}

.tg-choice i {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    background: rgba(255, 255, 255, .52);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-style: normal;
}

.tg-choice strong {
    overflow: hidden;
    font-size: 16px;
    font-weight: 620;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-choice.is-correct {
    border-color: rgba(53, 166, 106, .82);
    box-shadow: 0 0 0 4px rgba(53, 166, 106, .10);
}

.tg-choice.is-wrong {
    border-color: rgba(216, 78, 78, .84);
    box-shadow: 0 0 0 4px rgba(216, 78, 78, .08);
}

.tg-choice.is-locked:not(.is-correct):not(.is-wrong) {
    opacity: .48;
}

.tg-score-card {
    align-self: center;
    justify-self: center;
    flex-direction: column;
    width: 136px;
    background: rgba(255, 255, 255, .38);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .04), inset 0 1px 0 rgba(255, 255, 255, .8);
}

.tg-score-card div {
    display: grid;
    width: 100%;
    gap: 8px;
    padding: 22px 14px;
    text-align: center;
}

.tg-score-card div + div {
    border-top: 1px solid rgba(0, 0, 0, .08);
}

.tg-score-card span {
    font-size: 13px;
}

.tg-score-card strong {
    font-size: 25px;
}

.tg-footer {
    grid-column: 1 / -1;
    justify-content: space-between;
    align-self: end;
}

.tg-lang {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0;
    background: transparent;
    border: 0;
}

.tg-zone {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.tg-footer a {
    margin-left: 20px;
    color: #777;
    font-weight: 680;
    text-decoration: none;
}

.tg-dialog {
    width: min(420px, calc(100vw - 36px));
    padding: 0;
    background: transparent;
    border: 0;
}

.tg-dialog:not([open]) {
    display: none;
}

.tg-dialog::backdrop {
    background: rgba(244, 241, 236, .46);
    backdrop-filter: blur(18px);
}

.tg-dialog > div {
    position: relative;
    padding: 28px;
    background: rgba(255, 255, 255, .76);
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.tg-dialog button {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--border);
    border-radius: 50%;
}

.tg-dialog p,
.tg-dialog h2 {
    margin: 0;
}

.tg-dialog h2 {
    margin: 6px 0 14px;
    font-size: 30px;
    letter-spacing: -.05em;
}

.tg-dialog span {
    color: var(--muted);
    line-height: 1.7;
}

.tg-toast {
    position: fixed;
    left: 50%;
    bottom: 34px;
    z-index: 30;
    padding: 12px 16px;
    color: #fff;
    background: rgba(17, 17, 17, .92);
    border-radius: 999px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .16);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.tg-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.tg-game-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    background: rgba(244, 241, 236, .36);
    backdrop-filter: blur(18px) saturate(1.16);
}

.tg-game-overlay[hidden] {
    display: none;
}

.tg-loader,
.tg-countdown {
    display: grid;
    place-items: center;
    min-width: min(340px, calc(100vw - 48px));
    padding: 30px;
    background: rgba(255, 255, 255, .70);
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(31, 35, 46, .16), inset 0 1px 0 rgba(255, 255, 255, .92);
}

.tg-loader[hidden],
.tg-countdown[hidden] {
    display: none;
}

.tg-loader span {
    width: 54px;
    height: 54px;
    margin-bottom: 16px;
    border: 4px solid rgba(0, 0, 0, .10);
    border-top-color: #111;
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

.tg-loader strong,
.tg-countdown strong {
    font-size: 18px;
}

.tg-loader small {
    margin-top: 8px;
    color: var(--muted);
}

.tg-countdown span {
    font-size: clamp(72px, 14vw, 140px);
    font-weight: 950;
    line-height: .86;
    letter-spacing: -.08em;
}

@media (max-width: 980px) {
    .tg-shell {
        grid-template-columns: 1fr;
        min-height: auto;
        margin: 14px;
        padding: 22px 18px;
    }

    .tg-header-actions {
        gap: 8px;
    }

    .tg-side-nav,
    .tg-score-card {
        justify-self: stretch;
        flex-direction: row;
        width: auto;
        margin-top: 18px;
        order: 3;
    }

    .tg-side-nav {
        display: none;
    }

    .tg-score-card {
        grid-row: auto;
    }

    .tg-score-card div {
        padding: 14px 10px;
    }

    .tg-score-card div + div {
        border-top: 0;
        border-left: 1px solid rgba(0, 0, 0, .08);
    }

    .tg-stage {
        width: 100%;
        margin-top: 18px;
    }

    .tg-choices {
        grid-template-columns: 1fr;
    }

    .tg-footer {
        margin-top: 26px;
    }
}

@media (max-width: 560px) {
    .tg-brand strong {
        display: none;
    }

    .tg-icon-button {
        width: 42px;
        height: 42px;
    }

    .tg-sign {
        min-height: 42px;
        padding: 0 18px;
    }

    .cassette-label {
        height: 104px;
        font-size: 23px;
    }

    .cassette-window {
        left: 74px;
        right: 74px;
        top: 88px;
        height: 58px;
    }

    .reel {
        width: 50px;
        height: 50px;
    }

    .tape-band {
        inset: 10px 62px;
    }

    .tg-controls {
        gap: 34px;
    }

    .tg-choice {
        min-height: 64px;
    }
}
