:root {
    color-scheme: dark;
    font-family: "Arial", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    background: #111416;
    color: #f8fbff;
}

* {
    box-sizing: border-box;
}

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

body {
    overflow-x: hidden;
    background:
        radial-gradient(circle at 20% 12%, rgba(10, 202, 139, 0.24), transparent 28%),
        radial-gradient(circle at 86% 26%, rgba(255, 209, 63, 0.22), transparent 24%),
        linear-gradient(145deg, #101316 0%, #202326 46%, #14171a 100%);
}

button,
input {
    font: inherit;
}

.page-shell {
    width: 100%;
    min-height: 100svh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0 0 24px;
}

.game-frame {
    position: relative;
    width: min(100vw, 640px);
    height: min(100vw, 640px);
    max-width: 640px;
    max-height: 640px;
    overflow: hidden;
    background: #0e1113;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
    isolation: isolate;
}

#arena {
    width: 100%;
    height: 100%;
    display: block;
    background: #101315;
    touch-action: manipulation;
}

.panel {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    padding: 34px;
    text-align: center;
    background: linear-gradient(180deg, rgba(8, 10, 12, 0.72), rgba(8, 10, 12, 0.5));
    backdrop-filter: blur(6px);
}

.start-panel h1,
.finish-panel h2 {
    width: min(100%, 520px);
    margin: 0;
    font-size: clamp(38px, 10vw, 72px);
    line-height: 0.94;
    letter-spacing: 0;
    text-wrap: balance;
    text-shadow: 0 5px 0 rgba(0, 0, 0, 0.35);
}

.kicker {
    margin: 0;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffd13f;
    font-size: 13px;
    font-weight: 800;
}

.lead {
    width: min(100%, 440px);
    margin: 0;
    color: #d9edf2;
    font-size: 16px;
    line-height: 1.7;
}

.primary-button {
    min-width: 152px;
    min-height: 54px;
    border: 0;
    border-radius: 8px;
    color: #111416;
    background: linear-gradient(135deg, #fff45f, #10d88c 54%, #34c6ff);
    font-weight: 900;
    font-size: 19px;
    cursor: pointer;
    box-shadow: 0 10px 0 #045542, 0 22px 32px rgba(0, 0, 0, 0.28);
}

.primary-button:active {
    transform: translateY(5px);
    box-shadow: 0 5px 0 #045542, 0 14px 24px rgba(0, 0, 0, 0.24);
}

.copyright {
    position: absolute;
    bottom: 17px;
    left: 0;
    width: 100%;
    margin: 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.hud {
    position: absolute;
    z-index: 3;
    top: 12px;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.meter {
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(10, 13, 16, 0.68);
    box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.08);
}

.meter span {
    display: block;
    color: #b9ccd0;
    font-size: 10px;
    font-weight: 800;
}

.meter strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(18px, 5vw, 27px);
    line-height: 1;
}

.word-card {
    position: absolute;
    z-index: 3;
    left: 18px;
    right: 18px;
    bottom: 20px;
    min-height: 148px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 16px;
    background: rgba(8, 10, 12, 0.74);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.meaning {
    margin: 0 0 8px;
    color: #ffd13f;
    font-size: 15px;
    font-weight: 800;
}

.word-card h2 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(36px, 11vw, 66px);
    text-transform: lowercase;
    line-height: 1;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.34);
}

.status-text {
    margin: 9px 0 0;
    color: #c4ff9a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.2em;
    opacity: 0.84;
}

.input-mirror {
    min-height: 28px;
    margin: 10px 0 0;
    color: #78ecff;
    font-size: clamp(21px, 6vw, 33px);
    font-weight: 900;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.typing-input {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 8px;
    width: 1px;
    height: 1px;
    opacity: 0.01;
    border: 0;
    padding: 0;
    transform: translateX(-50%);
}

.finish-panel[hidden],
.hud[hidden],
.word-card[hidden],
.start-panel[hidden] {
    display: none;
}

.result-score {
    margin: 0;
    font-size: clamp(54px, 15vw, 98px);
    line-height: 1;
    font-weight: 900;
    color: #78ecff;
    text-shadow: 0 5px 0 rgba(0, 0, 0, 0.34);
}

.high-score {
    min-height: 28px;
    margin: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
}

.result-summary,
.learning-hint {
    margin: 4px 0;
    min-height: 26px;
    color: #d8f2ff;
    font-size: 18px;
    font-weight: 800;
}

.learning-hint {
    color: #ffd13f;
    font-size: 16px;
}

.premium-note {
    margin: 6px 0 0;
    max-width: 520px;
    color: #a4f6ff;
    font-size: 12px;
    line-height: 1.6;
    opacity: 0.9;
}

@media (min-width: 641px) {
    .page-shell {
        padding-top: 20px;
    }

    .game-frame {
        border-radius: 8px;
    }
}

@media (max-width: 420px) {
    .panel {
        padding: 22px;
        gap: 14px;
    }

    .word-card {
        left: 10px;
        right: 10px;
        bottom: 12px;
        min-height: 128px;
        padding: 13px;
    }

    .hud {
        top: 8px;
        left: 8px;
        right: 8px;
        gap: 6px;
    }

    .meter {
        padding: 7px 8px;
    }
}
