/* Sleigh Run — reuses the site's glass-and-gold tokens from /css/styles.css. */

body.sleigh-run {
    overflow: hidden;
    background: #0b1026;
}

body.sleigh-run::after {
    display: none;
}

#srCanvas {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

body.sleigh-run.is-playing .sr-header {
    display: none;
}

.sr-header .season-link {
    font-size: 16px;
}

/* --------------------------------------------------------------- Panels */

.sr-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 5;
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: 28px 28px 24px;
    color: #ffffff;
    background: var(--glass);
    border: 2px solid var(--gold-soft);
    border-radius: 20px;
    box-shadow: var(--panel-glow);
    text-align: center;
    transform: translate(-50%, -44%);
}

.sr-panel.snowcap::before {
    top: 0;
}

.sr-panel--small {
    width: min(380px, calc(100vw - 32px));
}

.sr-panel h1,
.sr-panel h2 {
    margin: 0 0 10px;
    font-size: clamp(30px, 5vw, 52px);
    font-weight: 900;
    line-height: 1.05;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.sr-panel h2 {
    font-size: clamp(26px, 4vw, 40px);
}

.sr-panel .lead {
    margin: 0 auto 16px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}

.sr-panel .lead strong {
    color: #ffffff;
}

.sr-legend,
.sr-controls {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
    padding: 12px 14px;
    color: var(--muted);
    background: var(--row);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
}

.sr-legend strong {
    color: #ffffff;
}

.sr-legend__swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    border-radius: 4px;
}

.sr-legend__swatch--nice {
    background: radial-gradient(circle, #fff3b0, #ffb347);
    box-shadow: 0 0 8px rgba(255, 190, 90, 0.8);
}

.sr-legend__swatch--naughty {
    background: #2b3346;
    border: 1px solid #6b7a99;
}

.sr-controls kbd {
    margin-right: 2px;
    font-size: 12px;
}

.sr-difficulty {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

.sr-difficulty legend {
    width: 100%;
    margin-bottom: 8px;
    color: var(--gold-text);
    font-weight: 900;
}

.sr-difficulty label {
    position: relative;
    flex: 1;
    cursor: pointer;
}

.sr-difficulty input {
    position: absolute;
    opacity: 0;
}

.sr-difficulty span {
    display: block;
    padding: 10px 8px;
    background: var(--row);
    border: 2px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    font-weight: 900;
}

.sr-difficulty small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.sr-difficulty input:checked + span {
    background: linear-gradient(180deg, rgba(80, 52, 20, 0.6), rgba(40, 26, 12, 0.6));
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(246, 196, 83, 0.35);
}

.sr-difficulty input:focus-visible + span {
    outline: 3px solid #fff0b8;
    outline-offset: 2px;
}

.sr-best {
    margin: 0 0 14px;
    color: var(--gold-text);
    font-weight: 800;
}

.sr-start,
.sr-secondary {
    position: relative;
    min-width: 200px;
    padding: 14px 28px;
    color: #ffffff;
    border-radius: 16px;
    cursor: pointer;
    font: inherit;
    font-size: 20px;
    font-weight: 900;
}

.sr-start {
    background: var(--button-red);
    border: 2px solid rgba(255, 214, 150, 0.85);
    box-shadow: 0 0 22px rgba(255, 120, 90, 0.4), 0 12px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.sr-secondary {
    min-width: 140px;
    background: var(--glass);
    border: 2px solid var(--gold-soft);
    font-size: 17px;
}

.sr-start:hover,
.sr-secondary:hover {
    filter: brightness(1.12);
}

.sr-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.sr-stars {
    margin: 0 0 12px;
    color: #ffd36b;
    font-size: 42px;
    letter-spacing: 6px;
    text-shadow: 0 0 14px rgba(255, 200, 90, 0.6);
}

.sr-stats {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 16px;
    margin: 0 auto 16px;
    max-width: 360px;
    text-align: left;
}

.sr-stats dt {
    color: var(--muted);
}

.sr-stats dd {
    margin: 0;
    font-weight: 900;
    text-align: right;
}

/* ------------------------------------------------------------------ HUD */

.sr-hud {
    position: fixed;
    top: 10px;
    right: 10px;
    left: 10px;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--glass);
    border: 2px solid var(--gold-soft);
    border-radius: 16px;
    box-shadow: var(--panel-glow);
    font-weight: 900;
}

.sr-hud__group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sr-hearts {
    color: #ff5a6e;
    font-size: 22px;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(255, 90, 110, 0.5);
}

.sr-hearts .is-lost {
    color: rgba(255, 255, 255, 0.2);
    text-shadow: none;
}

.sr-pill {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 4px 10px;
    background: var(--row);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.sr-pill--score {
    color: var(--gold-text);
    font-size: 18px;
}

.sr-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: center / contain no-repeat;
}

.sr-icon--gift {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='9' width='18' height='12' rx='2' fill='%23d7263d'/%3E%3Crect x='2' y='6' width='20' height='5' rx='1.5' fill='%23e5303f'/%3E%3Crect x='10.5' y='6' width='3' height='15' fill='%23f6c453'/%3E%3Cpath d='M12 6C9 2 5 3 7 6M12 6c3-4 7-3 5 0' stroke='%23f6c453' stroke-width='2' fill='none'/%3E%3C/svg%3E");
}

.sr-icon--coal {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l6-5 8 3 2 8-6 6-9-2-3-6z' fill='%23262a33' stroke='%236b7a99' stroke-width='1.2'/%3E%3Cpath d='M9 9l4 2' stroke='%238a96b2' stroke-width='1.2'/%3E%3C/svg%3E");
}

.sr-icon--house {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 11 12 3l9 8v10H3z' fill='%23ffd36b'/%3E%3Crect x='10' y='14' width='4' height='7' fill='%23b3132a'/%3E%3C/svg%3E");
}

.sr-dawn {
    display: flex;
    flex: 1 1 160px;
    gap: 8px;
    align-items: center;
    max-width: 320px;
}

.sr-dawn__track {
    position: relative;
    flex: 1;
    height: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.sr-dawn__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: linear-gradient(90deg, #6d5bd0, #f08a7a, #ffcf6b);
    border-radius: 999px;
}

.sr-dawn__moon,
.sr-dawn__sun {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.sr-dawn__moon {
    background: radial-gradient(circle at 35% 35%, #ffffff, #cfd8ff);
    box-shadow: 0 0 8px rgba(200, 210, 255, 0.7);
}

.sr-dawn__sun {
    background: radial-gradient(circle, #fff3b0, #ffb347);
    box-shadow: 0 0 10px rgba(255, 180, 70, 0.8);
}

.sr-small-button {
    width: 38px;
    height: 38px;
    color: #ffffff;
    background: var(--row);
    border: 2px solid var(--gold-soft);
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
}

.sr-mute {
    z-index: 6;
}

/* --------------------------------------------------------- Touch controls */

.sr-touch {
    position: fixed;
    right: 16px;
    bottom: 76px;
    left: 16px;
    z-index: 4;
    display: none;
    align-items: flex-end;
    justify-content: space-between;
    pointer-events: none;
}

@media (pointer: coarse) {
    body.sleigh-run.is-playing .sr-touch {
        display: flex;
    }
}

.sr-stick {
    position: relative;
    width: 124px;
    height: 124px;
    background: radial-gradient(circle at 50% 40%, rgba(40, 56, 96, 0.75), rgba(12, 18, 36, 0.8));
    border: 2px solid var(--gold-soft);
    border-radius: 50%;
    box-shadow: var(--panel-glow);
    pointer-events: auto;
    touch-action: none;
}

.sr-stick span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle at 35% 30%, #ffffff 0 8%, #cc1228 45%, #6e0816 100%);
    border: 2px solid rgba(255, 214, 150, 0.8);
    border-radius: 50%;
}

.sr-touch__buttons {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    pointer-events: auto;
}

.sr-touch__buttons button {
    width: 84px;
    height: 84px;
    color: #ffffff;
    border: 2px solid rgba(255, 214, 150, 0.85);
    border-radius: 50%;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
    font: inherit;
    font-size: 17px;
    font-weight: 900;
    touch-action: manipulation;
}

#srGiftButton {
    width: 96px;
    height: 96px;
    background: var(--button-red);
}

#srCoalButton {
    background: radial-gradient(circle at 40% 35%, #4a5266, #1a1e27);
}

@media (max-width: 720px) {
    .sr-panel {
        top: auto;
        bottom: 12px;
        max-height: calc(100vh - 150px);
        padding: 20px 16px 18px;
        transform: translateX(-50%);
    }

    .sr-difficulty {
        flex-direction: column;
    }

    .sr-pill {
        padding: 3px 8px;
        font-size: 14px;
    }

    .sr-dawn {
        order: 5;
        flex-basis: 100%;
        max-width: none;
    }

    .sr-mute {
        top: auto;
    }
}

/* Promo inside the results card (reuses .round-promo from styles.css). */
.sr-panel .sr-promo {
    position: static;
    display: inline-flex;
    margin: 0 auto 16px;
    transform: none;
}

.sr-small-print {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.sr-small-print a {
    color: var(--gold-text);
}
