/* ===== Snake Savvy Quiz — dark theme ===== */

:root {
    --bg: #0e1412;
    --card: #161f1b;
    --raised: #1e2a24;
    --border: rgba(255, 255, 255, 0.06);
    --text: #e8f0ec;
    --muted: #9fb3aa;
    --accent: #34d399;
    --accent-hover: #4be0ab;
    --on-accent: #06281b;
    --ok: #4ade80;
    --ok-bg: #1e3a2c;
    --bad: #f87171;
    --bad-bg: #3a2422;
    --ring-track: #2a3831;
}

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

body {
    background:
        radial-gradient(1100px 700px at 85% -10%, rgba(52, 211, 153, 0.08), transparent 60%),
        radial-gradient(800px 600px at -15% 110%, rgba(52, 211, 153, 0.05), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

/* ===== Layout ===== */

.app {
    max-width: 32rem;
    margin: 0 auto;
    padding: 0.75rem 1rem 1.5rem;
}

.banner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.banner img {
    width: auto;
    height: 32px;
}

.banner-name {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.banner-name em {
    font-style: normal;
    color: var(--accent);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    padding: 1.25rem;
}

.screen {
    animation: screen-in 0.25s ease-out;
}

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.75rem;
    margin-top: 1rem;
}

/* ===== Splash ===== */

.splash {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(900px 600px at 50% -20%, rgba(52, 211, 153, 0.14), transparent 65%),
        radial-gradient(700px 500px at 100% 110%, rgba(14, 165, 233, 0.08), transparent 60%),
        var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    padding: 1.5rem;
    overflow: hidden;
}

.splash-hero {
    max-width: 24rem;
    width: 100%;
    text-align: center;
    animation: screen-in 0.5s ease-out;
}

.splash-logo {
    width: auto;
    height: 84px;
    margin: 0 auto 0.5rem;
}

.splash-presents {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    margin-bottom: 0.25rem;
}

.splash-title {
    font-size: clamp(3rem, 15vw, 4.25rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #a7f3d0, var(--accent) 45%, #0ea5e9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.splash-snake {
    font-size: 3.25rem;
    line-height: 1;
    margin: 0.5rem 0;
    animation: float 3s ease-in-out infinite;
}

.splash-tag {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.splash-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.chip {
    background: var(--raised);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    white-space: nowrap;
}

.splash-sub {
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 0.75rem;
}

/* ===== Buttons ===== */

.btn {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(52, 211, 153, 0.25);
}

.btn-glow {
    animation: glow 2.5s ease-in-out infinite;
}

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

.btn-secondary:hover {
    border-color: var(--accent);
}

/* ===== Start screen ===== */

.intro {
    color: var(--muted);
    text-align: left;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.screen-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.field {
    display: block;
    width: 100%;
    min-height: 44px;
    background: var(--raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.6rem;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field::placeholder {
    color: var(--muted);
}

.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

.rules {
    background: var(--raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    text-align: left;
}

.rules-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.rule {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.rule + .rule {
    margin-top: 0.5rem;
}

.rule strong {
    color: var(--text);
}

.rule-ico {
    flex-shrink: 0;
    line-height: 1.4;
}

.note {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ===== Game screen — HUD ===== */

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.hud-score,
.hud-counter {
    width: 33%;
    font-weight: 600;
    font-size: 1rem;
}

.hud-score.pop {
    animation: pop 0.35s ease-out;
    color: var(--accent);
}

.hud-counter {
    text-align: right;
}

.hud-timer {
    width: 33%;
    display: flex;
    justify-content: center;
}

/* ===== Progress bar ===== */

.progress {
    height: 5px;
    background: var(--ring-track);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #0ea5e9);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ===== Circular timer ===== */

.timer-container {
    position: relative;
    width: 40px;
    height: 40px;
}

.timer-container svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-circle-bg {
    fill: none;
    stroke: var(--ring-track);
    stroke-width: 4;
}

.timer-circle-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 4;
    stroke-linecap: round;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.timer-container.low {
    animation: pulse 1s ease-in-out infinite;
}

.timer-container.low .timer-text {
    font-weight: 800;
}

/* ===== Game screen — question & options ===== */

.question-image {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.question-image img {
    max-height: 160px;
    width: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.question-text {
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    min-height: 50px;
    margin-bottom: 0.75rem;
}

.options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.btn-option {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    background: var(--raised);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-option:hover:enabled {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.btn-option:disabled {
    cursor: default;
}

.btn-option:disabled:not(.is-correct):not(.is-wrong) {
    opacity: 0.55;
}

.btn-option.is-correct {
    background: var(--ok-bg);
    border-color: var(--ok);
    color: var(--ok);
    font-weight: 700;
    animation: pop 0.35s ease-out;
}

.btn-option.is-correct::before {
    content: "\2713\00a0\00a0";
}

.btn-option.is-wrong {
    background: var(--bad-bg);
    border-color: var(--bad);
    color: var(--bad);
    font-weight: 700;
    animation: shake 0.4s ease-in-out;
}

.btn-option.is-wrong::before {
    content: "\2715\00a0\00a0";
}

/* ===== Feedback message ===== */

.msg {
    margin-top: 0.6rem;
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.35rem;
}

.msg.correct {
    color: var(--ok);
    font-weight: 700;
}

.msg.incorrect {
    color: var(--bad);
    font-weight: 700;
}

.btn-next {
    margin-top: 0.6rem;
}

.card.shake {
    animation: shake 0.4s ease-in-out;
}

/* ===== End screen ===== */

.end-card {
    text-align: center;
}

.end-card > * + * {
    margin-top: 0.75rem;
}

.final-score {
    font-size: 1.25rem;
    font-weight: 600;
}

.end-badge img {
    width: 66%;
    max-width: 225px;
    margin: 0 auto;
}

.panel {
    background: var(--raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
}

.panel-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.btn-share + .btn-share {
    margin-top: 0.5rem;
}

.stars {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
}

.star {
    font-size: 2.25rem;
    line-height: 1;
    padding: 0.15rem 0.3rem;
    color: #55645d;
    transition: color 0.2s ease, transform 0.15s ease;
}

.star:hover,
.star.selected {
    color: var(--accent);
}

.star:hover {
    transform: scale(1.15);
}

.feedback-thanks {
    color: var(--ok);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.1rem;
}

.promo-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 12px;
    padding: 0.75rem;
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: background 0.2s;
}

.promo-card:hover {
    background: rgba(52, 211, 153, 0.15);
}

.promo-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 12px;
}

.promo-text {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: left;
}

.promo-text strong {
    color: var(--text);
}

.promo-link {
    color: var(--accent);
    font-weight: 600;
}

.callout {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 12px;
    padding: 0.75rem;
}

.callout p {
    font-size: 0.9rem;
    color: var(--muted);
}

.callout .callout-title {
    font-weight: 600;
    color: var(--text);
}

.callout a {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
}

.callout a:hover {
    text-decoration: underline;
}

/* ===== Confetti ===== */

.confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 60;
    overflow: hidden;
}

.confetti span {
    position: absolute;
    top: -14px;
    width: 8px;
    height: 13px;
    border-radius: 2px;
    animation: confetti-fall 2.5s linear forwards;
}

/* ===== Animations ===== */

@keyframes screen-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.35); }
    50% { box-shadow: 0 0 24px 4px rgba(52, 211, 153, 0.35); }
}

@keyframes confetti-fall {
    to {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0.8;
    }
}

/* ===== Responsive ===== */

@media (min-width: 640px) {
    .options {
        grid-template-columns: 1fr 1fr;
    }

    .app {
        padding-top: 1.25rem;
    }
}

/* ===== Reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .confetti {
        display: none;
    }
}
