/* MSD Weihnachtsgruß – Farben und Schrift nach m-s-d.de */
:root {
    --navy: #00203e;
    --navy-deep: #001b3c;
    --navy-soft: #25557e;
    --gold: #c09718;
    --gold-light: #d4a71c;
    --gold-dark: #927210;
    --white: #fff;
    --grey: #e7e7e7;
    --red: #c8102e;
    --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --radius: 14px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--navy);
    color: var(--white);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

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

/* ---------- Kopfzeile ---------- */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(14px + var(--safe-top)) 20px 14px;
    background: linear-gradient(to bottom, rgba(0, 32, 62, .85), rgba(0, 32, 62, 0));
    pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar__logo img { display: block; height: 28px; width: auto; }
.topbar__controls { display: flex; gap: 8px; }

.chip {
    font: 500 14px/1 var(--font);
    color: var(--white);
    background: rgba(0, 32, 62, .6);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    padding: 9px 14px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background .2s, border-color .2s;
}
.chip:hover, .chip:focus-visible { border-color: var(--gold); background: rgba(0, 32, 62, .85); }
.chip--icon { padding: 7px; width: 38px; height: 38px; }
.chip--icon svg { width: 22px; height: 22px; fill: none; stroke: var(--white); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip--icon .ico-speaker { fill: var(--white); }
.chip--icon[aria-pressed="true"] .ico-off,
.chip--icon[aria-pressed="false"] .ico-on { display: none; }

/* ---------- Overlays & Karten ---------- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(72px + var(--safe-top)) 16px calc(52px + var(--safe-bottom));
    overflow-y: auto;
    animation: fade-in .45s ease-out both;
}
.overlay--static { background: radial-gradient(ellipse at center, var(--navy-soft), var(--navy) 70%); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
    from { opacity: 0; transform: translateY(18px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

.card {
    width: min(520px, 100%);
    margin: auto;
    padding: 30px 30px 26px;
    background: rgba(0, 32, 62, .88);
    border: 2px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    backdrop-filter: blur(6px);
    animation: pop-in .5s cubic-bezier(.2, .9, .3, 1.2) both;
}
.card--center { text-align: center; }

.card__ram { display: block; height: 64px; width: auto; margin: 0 auto 10px; }
.card__salutation { margin: 0 0 6px; font-size: 18px; color: var(--gold-light); font-weight: 500; }
.card__title { margin: 0 0 10px; font-size: clamp(26px, 5vw, 34px); font-weight: 700; line-height: 1.15; }
.card__title--gold { color: var(--gold-light); }
.card__subtitle { margin: 22px 0 8px; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-light); }
.card__lead { margin: 0 0 22px; font-size: 18px; color: var(--grey); }
.card__text { margin: 0 0 12px; font-size: 17px; line-height: 1.5; color: var(--grey); }
.card__text--small { font-size: 15px; }
.card__signature { margin: 8px 0 0; font-weight: 500; color: var(--white); }
.card__note { margin: 14px 0 0; font-size: 13px; color: rgba(255, 255, 255, .6); }
.card__rule { border: 0; height: 1px; background: rgba(192, 151, 24, .5); margin: 22px 0 18px; }
.card__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.card--center .card__actions { justify-content: center; }

kbd {
    display: inline-block;
    min-width: 26px;
    padding: 2px 6px;
    font: 700 14px/1.3 var(--font);
    text-align: center;
    color: var(--navy);
    background: var(--white);
    border-radius: 5px;
    box-shadow: 0 2px 0 var(--gold-dark);
}
.touch-only { display: none; }
@media (hover: none) and (pointer: coarse) { .touch-only { display: inline; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 12px 24px;
    font: 700 16px/1 var(--font);
    text-decoration: none;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .12s, background .2s, border-color .2s, color .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn--gold { background: var(--gold); color: var(--navy); }
.btn--gold:hover:not(:disabled), .btn--gold:focus-visible { background: var(--gold-light); }
.btn--ghost { background: transparent; color: var(--white); border-color: rgba(255, 255, 255, .45); }
.btn--ghost:hover, .btn--ghost:focus-visible { border-color: var(--gold); color: var(--gold-light); }
.btn--big { min-height: 58px; padding: 16px 40px; font-size: 20px; }
.btn--small { min-height: 42px; padding: 10px 18px; font-size: 15px; }
.btn:focus-visible, .chip:focus-visible, input:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }

/* ---------- HUD ---------- */
.hud {
    position: fixed;
    z-index: 15;
    top: calc(64px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(0, 32, 62, .7);
    border: 1px solid rgba(192, 151, 24, .6);
    border-radius: 12px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}
.hud__item { min-width: 86px; padding: 4px 12px; text-align: center; }
.hud__label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold-light); }
.hud__value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud__unit { margin-left: 3px; font-size: 12px; color: var(--grey); }
.hud__value.bump { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: scale(1.35); color: var(--gold-light); } }

.countdown {
    position: fixed;
    z-index: 15;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(90px, 22vw, 180px);
    font-weight: 700;
    color: var(--gold-light);
    text-shadow: 0 6px 0 var(--navy), 0 0 40px rgba(0, 0, 0, .5);
    pointer-events: none;
}
.countdown span { animation: count .9s ease-out both; }
@keyframes count { from { transform: scale(2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { opacity: .1; } }

.touch-zones {
    position: fixed;
    z-index: 5;
    left: 0; right: 0;
    bottom: calc(40px + var(--safe-bottom));
    display: flex;
    justify-content: space-between;
    padding: 0 18px;
    pointer-events: none;
}
.touch-zones__side {
    width: 58px; height: 58px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: rgba(255, 255, 255, .8);
    background: rgba(0, 32, 62, .45);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    transition: background .1s;
}
.touch-zones__side.is-active { background: rgba(192, 151, 24, .7); }

/* ---------- Ergebnis & Bestenliste ---------- */
.result { display: flex; gap: 10px; margin: 14px 0 18px; }
.result__item {
    flex: 1;
    padding: 12px 6px;
    text-align: center;
    background: rgba(255, 255, 255, .07);
    border-radius: 10px;
}
.result__value { display: block; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result__label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-light); }

.score-form label { display: block; margin-bottom: 14px; font-size: 15px; color: var(--grey); }
.score-form__row { display: flex; gap: 8px; }
.score-form input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    font: 500 16px var(--font);
    color: var(--navy);
    background: var(--white);
    border: 2px solid var(--gold);
    border-radius: 999px;
}
.score-form__hint { margin: 14px 0 0; font-size: 12px; line-height: 1.5; color: rgba(255, 255, 255, .55); }
.score-msg { min-height: 1.2em; margin: 8px 0 0; font-size: 15px; color: var(--gold-light); }
.score-msg.is-error { color: #ff9b8f; }

.leaderboard { list-style: none; margin: 0; padding: 0; counter-reset: rank; font-size: 15px; }
.leaderboard li {
    counter-increment: rank;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 8px;
}
.leaderboard li:nth-child(odd) { background: rgba(255, 255, 255, .05); }
.leaderboard li::before { content: counter(rank) "."; width: 24px; color: var(--gold-light); font-weight: 700; }
.leaderboard li.is-me { background: rgba(192, 151, 24, .3); }
.leaderboard__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard__score { font-weight: 700; font-variant-numeric: tabular-nums; }
.leaderboard li.leaderboard__empty { justify-content: center; color: rgba(255, 255, 255, .6); background: none; }
.leaderboard li.leaderboard__empty::before { content: none; }

/* ---------- Fußzeile ---------- */
.footer {
    position: fixed;
    z-index: 20;
    bottom: 0; right: 0;
    display: flex;
    gap: 14px;
    padding: 10px 16px calc(10px + var(--safe-bottom));
    font-size: 12px;
}
.footer a { color: rgba(255, 255, 255, .65); text-decoration: none; }
.footer a:hover, .footer a:focus-visible { color: var(--gold-light); text-decoration: underline; }
body.is-playing .footer { opacity: .35; }

@media (max-width: 560px) {
    .topbar { padding-left: 14px; padding-right: 14px; }
    .topbar__logo img { height: 22px; }
    .card { padding: 24px 20px 20px; }
    .hud__item { min-width: 70px; padding: 3px 6px; }
    .hud__value { font-size: 20px; }
    .result__value { font-size: 22px; }
}

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

/* Fußzeile auf hellem Schnee lesbar halten */
.footer { gap: 4px; padding-right: 10px; }
.footer a {
    padding: 4px 10px;
    color: rgba(255, 255, 255, .85);
    background: rgba(0, 32, 62, .55);
    border-radius: 999px;
}

/* Weihnachtliche Schrift für die Torbögen (lokal, SIL Open Font License) */
@font-face {
    font-family: "Mountains of Christmas";
    src: url("../fonts/mountains-of-christmas-700.woff2") format("woff2");
    font-weight: 700;
    font-display: block;
}

/* Lautstärkeregler neben dem Lautsprecher-Button */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.volume {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 14px;
    background: rgba(0, 32, 62, .6);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    backdrop-filter: blur(4px);
}
.volume input {
    width: 96px;
    margin: 0;
    accent-color: var(--gold);
    cursor: pointer;
}
.volume:focus-within { border-color: var(--gold); }
.volume.is-muted input { opacity: .4; }
@media (max-width: 560px) {
    .volume { display: none; }   /* Handy: Lautstärketasten am Gerät */
}
