:root {
    --bg: #f6efe4;
    --card: #fffdf8;
    --text: #1f1f1f;
    --muted: #5a5a5a;
    --accent: #cc4f2e;
    --accent-dark: #a13e24;
    --ok: #157347;
    --ko: #b02a37;
    --field-bg: #ffffff;
    --field-border: #d6d6d6;
    --panel-bg: #fff6eb;
    --panel-border: #f0dcc8;
    --divider: #f0e0d0;
    --card-border: #efd9c7;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, #ffe4c9, var(--bg) 60%);
    display: grid;
    place-items: center;
    padding: 16px;
}

body.dark {
    --bg: #11161c;
    --card: #1b232c;
    --text: #e9edf2;
    --muted: #bbc5cf;
    --accent: #e07a5f;
    --accent-dark: #c8664d;
    --ok: #67d48c;
    --ko: #ff8c97;
    --field-bg: #141b22;
    --field-border: #384452;
    --panel-bg: #222c37;
    --panel-border: #344251;
    --divider: #354252;
    --card-border: #3a4a5d;
    background: radial-gradient(circle at top left, #2b3340, var(--bg) 60%);
}

.game-wrap {
    position: relative;
    width: min(980px, 100%);
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.08);
    padding: 24px;
    display: grid;
    gap: 18px;
}

.theme-toggle {
    padding: 6px 10px;
    font-size: 0.82rem;
    border-radius: 8px;
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    color: var(--text);
}

.corner-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.back-corner {
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
}

.is-hidden {
    display: none;
}

h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding-right: 220px;
}

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

.back-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.hud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.hud p {
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
}

button {
    border-radius: 10px;
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    color: var(--text);
    padding: 10px 12px;
    font-size: 1rem;
}

button {
    background: var(--accent);
    border: none;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

button:hover {
    background: var(--accent-dark);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.arena {
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    padding: 32px 20px;
    text-align: center;
    overflow: hidden;
}

.word-shell {
    display: grid;
    gap: 10px;
    place-items: center;
}

.stroop-word {
    font-size: clamp(2.8rem, 5.8vw, 4.2rem);
    font-weight: 900;
    letter-spacing: 0.2rem;
}

.stroop-hint {
    font-size: 1.15rem;
    color: var(--muted);
    font-weight: 650;
}

.choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.color-btn {
    background: var(--field-bg);
    color: var(--text);
    border: 1px solid var(--field-border);
}

.color-btn[data-color="red"] {
    border-color: #e11d48;
    color: #e11d48;
}

.color-btn[data-color="green"] {
    border-color: #22c55e;
    color: #22c55e;
}

.color-btn[data-color="blue"] {
    border-color: #3b82f6;
    color: #3b82f6;
}

.color-btn[data-color="black"] {
    border-color: #0f172a;
    color: #0f172a;
}

.color-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.feedback-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}

.feedback-flash.ok {
    background: rgba(21, 115, 71, 0.25);
    animation: flash 260ms ease-out;
}

.feedback-flash.ko {
    background: rgba(176, 42, 55, 0.25);
    animation: flash 260ms ease-out;
}

.arena.shake {
    animation: shake 220ms linear;
}

.feedback-text {
    min-height: 1.4em;
    font-weight: 700;
}

.countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: clamp(1.4rem, 3.8vw, 2.4rem);
    font-weight: 800;
    letter-spacing: 0.12rem;
    text-transform: uppercase;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
    animation: countdown-pulse 0.7s ease-in-out infinite;
}

@keyframes flash {
    0% { opacity: 0.95; }
    100% { opacity: 0; }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

@keyframes countdown-pulse {
    0% { transform: scale(1); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18); }
    50% { transform: scale(1.05); box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25); }
    100% { transform: scale(1); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18); }
}
