:root {
    color-scheme: dark;
    --bg: #10110e;
    --panel: #1b1f18;
    --panel-2: #252b21;
    --ink: #f7f4e8;
    --muted: #aeb7a4;
    --line: #3a4435;
    --gold: #f3bf4c;
    --green: #62c77e;
    --red: #ee6966;
    --blue: #69a9ec;
    --violet: #b58af0;
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(243, 191, 76, 0.07) 1px, transparent 1px),
        linear-gradient(rgba(105, 169, 236, 0.05) 1px, transparent 1px),
        var(--bg);
    background-size: 40px 40px;
}

button {
    color: inherit;
    font: inherit;
}

.seo-content {
    display: grid;
    gap: 12px;
    width: min(880px, calc(100% - 36px));
    margin: 0 auto 32px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(27, 31, 24, 0.82);
    color: var(--muted);
    line-height: 1.55;
}

.seo-content h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.seo-content p,
.seo-content ul {
    margin: 0;
}

.seo-content ul {
    padding-left: 1.2rem;
}

.game-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 14px;
    width: min(980px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px;
}

.hud,
.relic-tray {
    display: grid;
    gap: 10px;
}

.hud {
    grid-template-columns: 1fr repeat(3, minmax(90px, 120px)) 46px;
    align-items: stretch;
}


.sound-button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(27, 31, 24, 0.92);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.brand {
    display: grid;
    align-content: center;
    padding: 12px 14px;
}

.brand span,
.hud-stat small,
.relic-group small {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand strong {
    font-size: 1.5rem;
    line-height: 1;
}

.hud-stat {
    display: grid;
    align-content: center;
    padding: 10px 12px;
}

.hud-stat span {
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1;
}

.sound-button {
    cursor: pointer;
    font-size: 1.35rem;
}

.arena {
    position: relative;
    display: grid;
    grid-template-rows: 12px minmax(250px, 1fr) minmax(260px, 330px);
    gap: 18px;
    min-height: 650px;
    padding: 18px;
    overflow: hidden;
    border-radius: 8px;
    background:rgb(0 0 0 / 50%);
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.34);
}

.timer {
    overflow: hidden;
    border-radius: 999px;
    background: #31382e;
}

#timerFill {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), var(--gold), var(--red));
    transform-origin: left center;
}

.phrase-zone {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 16px;
    min-width: 0;
    text-align: center;
}



h1,
p {
    margin: 0;
}

#englishPhrase {
    min-height: 86px;
    margin: 0;
    font-size: clamp(2.1rem, 7vw, 5rem);
    line-height: 1.02;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.target-phrase {
    min-height: 92px;
    font-family:
        "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
        system-ui, sans-serif;
    font-size: clamp(2.6rem, 9vw, 6.8rem);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    justify-items: center;
}

.blank {
    display: inline-block;
    min-width: 1.35em;
    border-bottom: 0.08em solid var(--gold);
    color: var(--gold);
}

.mistake-recap,
.info-panel {
    display: grid;
    gap: 10px;
    width: min(640px, 100%);
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(16, 17, 14, 0.45);
    font-family: inherit;
    font-size: clamp(0.95rem, 2.4vw, 1.2rem);
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
}

.mistake-recap {
    max-height: min(34vh, 280px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.info-panel {
    justify-items: center;
    max-height: min(34vh, 280px);
    padding: 0 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    background: transparent;
    text-align: center;
}

.mistake-recap h2,
.info-panel h2 {
    margin: 0;
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mistake-recap p,
.mistake-recap ul,
.info-panel p {
    margin: 0;
}

.mistake-recap ul {
    display: grid;
    gap: 8px;
    padding: 0;
    list-style: none;
}

.mistake-recap li {
    display: grid;
    grid-template-columns: auto minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.review-sentence {
    color: var(--green);
    font-family:
        "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.review-word {
    color: var(--gold);
    font-size: 1.35em;
}

.review-english,
.info-panel p {
    color: var(--ink);
}

.review-english {
    color: var(--muted);
    font-size: 0.95em;
}

.speak-review-button {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--gold);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 900;
}

.speak-review-button:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.feedback {
    min-height: 28px;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    white-space: pre-line;
}

.feedback.good {
    color: var(--green);
}

.feedback.bad {
    color: var(--red);
}

.feedback.event {
    color: var(--violet);
}

.arrow-pad {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(84px, 1fr));
    grid-template-rows: repeat(3, minmax(72px, 1fr));
    gap: 10px;
    width: min(620px, 100%);
    margin: 0 auto;
}

.arrow-pad.is-reading .choice {
    visibility: hidden;
    pointer-events: none;
}

.choice {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 72px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel-2);
    cursor: pointer;
    transition:
        transform 110ms ease,
        border-color 110ms ease,
        background 110ms ease;
}

.choice.up {
    grid-column: 2;
    grid-row: 1;
}

.choice.left {
    grid-column: 1;
    grid-row: 2;
}

.choice.right {
    grid-column: 3;
    grid-row: 2;
}

.choice.down {
    grid-column: 2;
    grid-row: 2;
}

.choice:focus-visible,
.sound-button:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.choice.active {
    border-color: var(--gold);
    background: rgba(243, 191, 76, 0.14);
    transform: translateY(-2px);
}

.choice.good {
    border-color: var(--green);
    background: rgba(98, 199, 126, 0.16);
}

.choice.bad {
    border-color: var(--red);
    background: rgba(238, 105, 102, 0.15);
}

.choice.event {
    border-color: var(--violet);
    background: rgba(181, 138, 240, 0.15);
}

kbd {
    display: none;
}

.choice-icon {
    position: relative;
    z-index: 1;
    display: none;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    font-size: 1.25rem;
}

.choice.has-icon .choice-icon {
    display: grid;
}

.choice strong {
    position: relative;
    z-index: 1;
    min-width: 0;
    font-family:
        "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    font-size: clamp(1.35rem, 3.5vw, 2.55rem);
    line-height: 1.05;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.choice:not(.has-icon) strong {
    grid-column: 1 / -1;
    justify-self: center;
}

.choice.event strong,
.choice.menu strong {
    font-family: inherit;
    font-size: clamp(1rem, 2.4vw, 1.55rem);
}

.relic-tray {
    grid-template-columns: 1fr 1fr;
}

.relic-group {
    display: grid;
    gap: 8px;
    min-height: 74px;
    padding: 12px 14px;
}

.relic-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
    align-items: center;
}

.relic-icon {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    font-size: 1.15rem;
}

.relic-icon.empty {
    width: auto;
    color: var(--muted);
    border: 0;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 700;
}

.cookie-banner {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    width: min(620px, calc(100vw - 36px));
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(27, 31, 24, 0.98);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.cookie-banner[hidden] {
    display: none;
}

.cookie-banner strong {
    color: var(--gold);
}

.cookie-banner p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.35;
}

.cookie-actions {
    display: flex;
    gap: 8px;
}

.cookie-actions button {
    min-width: 84px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    cursor: pointer;
    font-weight: 800;
}

.cookie-actions button:last-child {
    border-color: var(--gold);
    color: var(--gold);
}

.pop {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--gold);
    pointer-events: none;
    animation: pop 620ms ease-out forwards;
}

@keyframes pop {
    to {
        opacity: 0;
        transform: translate(var(--x), var(--y)) rotate(180deg) scale(0.2);
    }
}

@media (max-width: 720px) {
    body {
        height: 100dvh;
        overflow: hidden;
    }

    .game-shell {
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 8px;
        height: 100dvh;
        min-height: 0;
        padding: 8px;
    }

    .hud {
        grid-template-columns: minmax(62px, 1fr) repeat(3, minmax(48px, 0.72fr)) 40px;
        gap: 6px;
    }

    .brand,
    .hud-stat {
        min-height: 44px;
        padding: 6px 7px;
    }

    .brand strong {
        font-size: 1.05rem;
    }

    .brand span,
    .hud-stat small,
    .relic-group small {
        font-size: 0.58rem;
        letter-spacing: 0.04em;
    }

    .hud-stat span {
        font-size: 1.15rem;
    }

    .sound-button {
        min-height: 44px;
        font-size: 1.05rem;
    }

    .arena {
        grid-template-rows: 8px minmax(0, 1fr) auto;
        gap: 8px;
        min-height: 0;
        padding: 10px;
    }

    .phrase-zone {
        gap: 8px;
        min-height: 0;
        overflow: hidden;
    }

    #englishPhrase {
        min-height: 0;
        font-size: clamp(1.55rem, 8vw, 2.45rem);
    }

    .target-phrase {
        min-height: 0;
        font-size: clamp(2rem, 12vw, 3.35rem);
    }

    .feedback,
    .info-panel,
    .mistake-recap {
        max-height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .feedback {
        min-height: 0;
        font-size: 0.9rem;
    }

    .info-panel,
    .mistake-recap {
        gap: 8px;
        padding: 8px;
        font-size: 0.9rem;
    }

    .mistake-recap li {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .review-english {
        grid-column: 2;
    }

    .arrow-pad {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(54px, 1fr));
        gap: 8px;
        width: 100%;
    }

    .arrow-pad.is-reading {
        display: none;
    }

    .choice.up,
    .choice.left,
    .choice.right,
    .choice.down {
        grid-column: auto;
        grid-row: auto;
    }

    .choice.menu.right {
        grid-column: 2;
        grid-row: 2;
    }

    .choice.menu.down {
        grid-column: 1;
        grid-row: 2;
    }

    .choice {
        min-height: 54px;
        padding: 8px;
    }

    .choice strong {
        font-size: clamp(1.15rem, 7vw, 1.9rem);
    }

    .choice.event strong,
    .choice.menu strong {
        font-size: clamp(0.85rem, 4.2vw, 1.15rem);
    }

    .relic-tray {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .relic-group {
        gap: 5px;
        min-height: 54px;
        padding: 7px 8px;
    }

    .relic-icons {
        gap: 5px;
        min-height: 24px;
    }

    .relic-icon {
        width: 26px;
        height: 26px;
        font-size: 0.95rem;
    }

    .relic-icon.empty {
        font-size: 0.78rem;
    }

    .cookie-banner {
        grid-template-columns: 1fr;
    }

    .cookie-actions {
        justify-content: stretch;
    }

    .cookie-actions button {
        flex: 1;
    }
}
