/*
 * Weihnachts-Theme — Tannengrün, Cranberry-Rot, Creme, ein Hauch Gold.
 *
 * Wird NACH allen anderen Stylesheets geladen und überschreibt nur Farben,
 * Hintergründe und Schmuck. Layout und Größen bleiben aus app.css,
 * live.css und scorecard.css. Aktiv mit THEME=christmas in der .env.
 *
 * Hell statt dunkel: Rot auf Grün hat kaum Helligkeitskontrast, auf Creme
 * dagegen tragen beide Farben — als Text wie als Fläche. Grün bekommt die
 * Kopfzeile, Rot alles, was man antippt.
 */

:root {
  --bg: #f8f2e6;
  --surface: #fffcf5;
  --surface-hi: #f2e9d8;
  --text: #1f1b16;
  --text-dim: #6b5f50;
  --accent: #b81d34;          /* Cranberry: Knöpfe, Links, Live */
  --ok: #1d7444;
  --danger: #b42318;
  --border: #e2d4bc;

  --xm-pine: #1a4a33;         /* Kopfzeile, Überschriften */
  --xm-pine-deep: #123726;
  --xm-snow: #fbf4e6;         /* Text auf Grün und Rot */
  --xm-sage: #c4d8c9;         /* gedämpfter Text auf Grün */
  --xm-gold: #e3b84f;
  --xm-stripe: repeating-linear-gradient(-45deg,
                 var(--accent) 0 8px, var(--xm-snow) 8px 16px);

  accent-color: var(--accent);
  caret-color: var(--accent);
  scrollbar-color: #cdbb9c transparent;
}

body { background: var(--bg); }

::selection { background: var(--accent); color: var(--xm-snow); }

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

/* ── Kopfzeile: Tannengrün, leiser Schneefall, Zuckerstangen-Kante ───── */

.topbar,
.tv-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-bottom: 0;
  background: var(--xm-pine);
  color: var(--xm-snow);
}
.topbar  { padding-bottom: 16px; }               /* 10px + Streifen */
.tv-head { padding-bottom: 2.4vh; }

/* Schnee: drei Flockenraster mit 60/90/180px Periode. Verschoben wird um
   genau 180px — das Vielfache aller drei —, damit die Schleife nahtlos
   ist. Nur transform, kein background-position: das bleibt auf dem
   Compositor und kostet am Handy keine Neuberechnung. */
.topbar::before,
.tv-head::before {
  content: "";
  position: absolute;
  top: -180px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 14px 22px,  rgba(255, 255, 255, .80) 0 1.4px, transparent 2px),
    radial-gradient(circle at 41px 47px,  rgba(255, 255, 255, .45) 0 1px,   transparent 1.5px),
    radial-gradient(circle at 131px 98px, rgba(255, 255, 255, .85) 0 2px,   transparent 2.6px);
  background-size: 90px 90px, 60px 60px, 180px 180px;
  animation: xm-snow 26s linear infinite;
  will-change: transform;
}
@keyframes xm-snow {
  to { transform: translate3d(0, 180px, 0); }
}

.topbar::after,
.tv-head::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 6px;
  background: var(--xm-stripe);
}
.tv-head::after { height: .8vh; }

.topbar .brand,
.topbar .brand-title { color: var(--xm-snow); }
.topnav a,
.lang-switch a { color: var(--xm-snow); }
.topnav .muted { color: var(--xm-sage); }
.lang-switch b { color: var(--xm-gold); }

.tv-head h1,
.tv-clock { color: var(--xm-snow); }
.tv-state { color: var(--xm-gold); }

/* "PB" als Christbaumkugel: rote Kugel mit Glanzpunkt, goldene Kappe. */
.brand-mark {
  position: relative;
  overflow: visible;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #e2566a 0, var(--accent) 48%, #7a1022 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.brand-mark::before {
  content: "";
  position: absolute;
  top: -10%;
  left: 36%;
  width: 28%;
  height: 16%;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(#f3d68a, #b88a22);
}
.tv-head .brand-mark { border-radius: 50%; }

/* Nikolaus-Bowl-Logo: freigestellt, mit eigener heller Kontur — kein
   Rahmen, keine Rundung, nur ein weicher Schatten gegen das Grün. */
.brand img,
.tv-head img {
  border-radius: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3));
}
.tv-head img { height: 7vh; margin: -.6vh 0; }

/* ── Karten und Kacheln ──────────────────────────────────────────────── */

.card,
.game-tile,
.lv-tile,
.lv-feed,
.lv-list,
.lv-result,
.st-card,
.tv-col,
.sc-header {
  box-shadow: 0 1px 2px rgba(70, 45, 20, .06), 0 4px 14px rgba(70, 45, 20, .06);
}

/* Abschnittsüberschriften in Tannengrün statt Grau. */
.lv-section h2,
.st-card h2,
.tv-col h2,
.ov-section { color: var(--xm-pine); }
.st-heading { color: var(--xm-pine-deep); }

/* Laufendes Spiel: oben eine Zuckerstangen-Kante statt des roten Balkens. */
.lv-tile.is-live,
body.tv .lv-tile.is-live {
  border-color: rgba(184, 29, 52, .45);
  background-image: var(--xm-stripe);
  background-size: 100% 5px;
  background-repeat: no-repeat;
  box-shadow: 0 1px 2px rgba(70, 45, 20, .06), 0 6px 18px rgba(184, 29, 52, .10);
}
body.tv .lv-tile.is-live { background-size: 100% .8vh; }

/* Neuer Spielstand: kurz golden aufleuchten. Nur die Hintergrundfarbe,
   damit die Streifen-Kante stehen bleibt. */
@keyframes lv-flash {
  0%   { background-color: rgba(227, 184, 79, .55); }
  100% { background-color: var(--surface); }
}

.game-tile.is-turn:not(.is-live) { border-color: var(--xm-pine); }

input, select, textarea { background: #fff; }

/* ── Text auf Rot: Schneeweiß statt Schwarz ──────────────────────────── */

.btn-primary,
.btn-danger,
.brand-mark,
.game-tile.is-live .tile-field-label,
.game-tile.is-live .tile-field-number,
.st-leagues a.is-active,
.ct-btn:active,
.ev-btn:active,
.pad-btn:active,
.ov-skip:active,
.ov-run-btn.is-active,
.ov-toggle-btn.is-active,
.ov-confirm,
.ev-undo:active,
.sc-queue {
  color: var(--xm-snow);
}

.btn-primary:hover,
.ov-confirm:hover:not(:disabled) { background: #a3182d; border-color: #a3182d; }

/* ── Meldungen und Overlay ───────────────────────────────────────────── */

.error,
.sc-error { background: #fbe9e7; }
.success  { background: #e6f2ea; }

.sc-overlay { background: rgba(18, 55, 38, .62); }
.ov-sheet   { background: var(--surface); }

/* ── Wer weniger Bewegung möchte, bekommt ruhenden Schnee ────────────── */

@media (prefers-reduced-motion: reduce) {
  .topbar::before,
  .tv-head::before { animation: none; }
}
