:root {
    color-scheme: light;
    --bg-window: #f9f5ff;
    --bg-card: #ffffff;
    --accent: #7c5cf9;
    --accent-light: #d9ccff;
    --success: #44c767;
    --error: #f76c6c;
    --text: #2f246b;
    --hint-bg: #ffd966;
    --hint-active: #ffc107;
    --button-shadow: 0 8px 16px rgba(124, 92, 249, 0.24);
    --font-heading: "Comic Neue", "Comic Sans MS", "Trebuchet MS", cursive;
    --font-body: "Comic Neue", "Comic Sans MS", "Trebuchet MS", cursive;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-window);
    color: var(--text);
    font-family: var(--font-body);
    display: flex;
    justify-content: center;
    padding: 22px 12px;
}

.app {
    width: min(840px, 100%);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hero {
    text-align: center;
}

.hero__title {
    margin: 0 0 12px;
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-family: var(--font-heading);
}

.hero__subtitle {
    margin: 0;
    font-size: clamp(1rem, 2.1vw, 1.3rem);
    line-height: 1.5;
}

.control-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    background: rgba(255, 255, 255, 0.72);
    padding: 16px;
    border-radius: 18px;
    box-shadow: 0 8px 16px rgba(47, 36, 107, 0.12);
}

.control-panel__label {
    font-weight: 700;
}

.control-panel__slider {
    display: flex;
    align-items: center;
    gap: 14px;
}

.control-panel input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}

.slider-value {
    min-width: 42px;
    text-align: center;
    font-weight: 700;
    background: var(--accent-light);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 999px;
}

.button {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    background: #efefef;
    color: var(--text);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.button:active {
    transform: scale(0.96);
}

.button--primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: var(--button-shadow);
}

.button--primary:hover,
.button--primary:focus-visible {
    background: #6d4cf3;
}

.button--hint {
    background: var(--hint-bg);
    color: var(--text);
}

.button--hint:hover,
.button--hint:focus-visible {
    background: var(--hint-active);
}

.game-card {
    position: relative;
    background: var(--bg-card);
    border-radius: 24px;
    padding: clamp(18px, 4vw, 32px);
    box-shadow: 0 18px 36px rgba(47, 36, 107, 0.18);
    overflow: hidden;
}

.game-card__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.game-card__content {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 18px;
    text-align: center;
}

.target {
    font-size: clamp(1.8rem, 4.6vw, 2.6rem);
    font-weight: 700;
    color: var(--accent);
}

.expression {
    font-size: clamp(2.4rem, 6vw, 3.6rem);
}

.feedback {
    font-size: clamp(1.2rem, 2.6vw, 1.6rem);
    min-height: 1.6rem;
}

.choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.choice {
    font-size: clamp(1.6rem, 3.8vw, 2.3rem);
    padding: 18px;
    border-radius: 18px;
    background: var(--accent-light);
    color: var(--text);
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.choice:active {
    transform: scale(0.95);
}

.choice:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.scoreboard {
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: clamp(1rem, 2.4vw, 1.2rem);
}

.scoreboard__item {
    font-weight: 700;
}

.helper-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 10;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(47, 36, 107, 0.38);
}

.modal__dialog {
    position: relative;
    z-index: 1;
    width: min(90vw, 360px);
    background: var(--bg-window);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 16px 32px rgba(47, 36, 107, 0.24);
    text-align: center;
}

.modal__title {
    margin: 0 0 12px;
    font-size: 1.4rem;
}

.modal__body {
    margin: 0 0 18px;
    white-space: pre-wrap;
    font-size: 1rem;
}

@media (min-width: 720px) {
    .control-panel {
        grid-template-columns: auto 1fr auto;
        align-items: center;
    }

    .control-panel__label {
        grid-column: 1 / 2;
    }

    .control-panel__slider {
        grid-column: 2 / 3;
    }

    #startButton {
        justify-self: end;
        grid-column: 3 / 4;
    }

    .choices {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
