/* Breslack · Gestaltung der Startseite (auch fuer impressum.html und datenschutz.html).
   Bildsprache: Birke, Sumpfgruen, Holz. Nur Systemschriften, keine fremden Hosts. */

:root {
  color-scheme: light dark;
  --bg: #f4f6f0;          /* Birkenrinde, hell */
  --surface: #e6ebdf;     /* Moosschleier */
  --text: #1e2a21;        /* Torf */
  --muted: #4b5a4e;
  --moss: #3d5e36;        /* Sumpfgruen */
  --link: #2f5d2a;
  --timber: #8a5a32;      /* Holz, fuer Linien */
  --head-bg: #2f4a2a;     /* Kopf: Bruchwald */
  --head-text: #f4f6f0;
  --head-small: #cfdcc6;
  --bark: #f2f1ea;        /* Birkenstamm */
  --foot-bg: #2b1d13;     /* Stubenholz */
  --foot-text: #f1e6cf;
  --gold: #e8b64c;
  --focus: #2f5d2a;

  /* Spielbereich, unabhaengig vom Seitenschema */
  --wood: #2b1d13;
  --cream: #fff3d6;
  --ok: #7fae5b;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141c16;
    --surface: #1d2820;
    --text: #e6ebde;
    --muted: #aeb9aa;
    --moss: #9cc28a;
    --link: #a9d196;
    --timber: #b58456;
    --head-bg: #1c2e1b;
    --head-text: #eef2e8;
    --head-small: #bfd0b4;
    --bark: #d9d8cf;
    --focus: #e8b64c;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.55 var(--sans);
}

a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; }

.wrap { max-width: 44rem; margin: 0 auto; padding: 0 16px; }

/* Kopf ------------------------------------------------------------------- */

.site-head {
  position: relative;
  overflow: hidden;
  background: var(--head-bg);
  color: var(--head-text);
}

.site-head .wrap {
  display: grid;
  grid-template-columns: 1fr 5.5rem;
  gap: 16px;
  min-height: 15rem;
}

.head-text { padding: 40px 0 32px; align-self: end; }

.site-head h1 { font-size: clamp(2.6rem, 11vw, 4.6rem); letter-spacing: -0.01em; }
.site-head h1 .name-dsb { font-style: italic; font-weight: 400; font-size: 0.5em; letter-spacing: 0; }

.head-sub { margin: 10px 0 0; font-family: var(--serif); font-size: 1.3rem; }
.head-note { margin: 18px 0 0; font-size: 0.9rem; color: var(--head-small); max-width: 32ch; }

@media (max-width: 39.99em) {
  .site-head h1 .name-dsb { display: block; margin-top: 4px; font-size: 0.48em; }
  .site-head h1 .sep { display: none; }
}

/* Birkenstaemme: reine Dekoration, Rinde als eingebettetes SVG (keine Anfrage). */
.birches { position: relative; align-self: stretch; }
.birch {
  position: absolute;
  top: -8px;
  bottom: -8px;
  border-radius: 3px;
  background-color: var(--bark);
  background-image:
    linear-gradient(90deg, transparent 55%, rgba(0, 0, 0, 0.13)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='160' preserveAspectRatio='none'%3E%3Cg fill='%23272622'%3E%3Crect x='0' y='14' width='16' height='3' rx='1.5'/%3E%3Crect x='22' y='31' width='18' height='2' rx='1'/%3E%3Crect x='6' y='52' width='12' height='4' rx='2'/%3E%3Crect x='0' y='78' width='26' height='2' rx='1'/%3E%3Crect x='28' y='96' width='12' height='3' rx='1.5'/%3E%3Crect x='10' y='118' width='14' height='2' rx='1'/%3E%3Crect x='0' y='140' width='9' height='3' rx='1.5'/%3E%3Crect x='30' y='146' width='10' height='2' rx='1'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%, 100% 160px;
}
.birch:nth-child(1) { left: 0; width: 22px; background-position: 0 0, 0 -40px; }
.birch:nth-child(2) { left: 34px; width: 12px; top: 22px; background-position: 0 0, 0 -95px; }
.birch:nth-child(3) { left: 56px; width: 28px; transform: rotate(1.5deg); background-position: 0 0, 0 -10px; }
.birch:nth-child(4) { display: none; left: 150px; width: 18px; top: 40px; background-position: 0 0, 0 -70px; }

@media (min-width: 40em) {
  .site-head .wrap { grid-template-columns: 1fr 8.5rem; min-height: 19rem; }
  .site-head h1 { font-size: 3.6rem; }
  .birch:nth-child(1) { left: 6px; width: 30px; }
  .birch:nth-child(2) { left: 56px; width: 14px; }
  .birch:nth-child(3) { left: 92px; width: 38px; }
  .birch:nth-child(4) { display: block; }
}

/* Abschnitte ---------------------------------------------------------------- */

main > section { padding: 48px 0 0; }
main > section:last-child { padding-bottom: 64px; }

.section-title { font-size: 1.85rem; margin-bottom: 8px; }
.lead { margin: 0 0 20px; max-width: 60ch; color: var(--muted); }

/* Spiel -------------------------------------------------------------------- */

main > .game { padding-top: 32px; }
.game { font-family: Georgia, "Times New Roman", serif; max-width: 480px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.game-stage { position: relative; width: min(100%, calc(75vh * 3 / 4)); aspect-ratio: 3 / 4;
  margin: 0 auto; background: var(--wood); border-radius: 10px; overflow: hidden; }
.game-stage canvas { display: block; width: 100%; height: 100%; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center;
  background: rgba(34, 22, 14, 0.84); color: var(--cream); font: inherit; border: 0; }
.overlay[hidden] { display: none; }
.overlay h2 { margin: 0; font-size: 1.6rem; }
.overlay p { margin: 0; max-width: 30ch; line-height: 1.4; }
/* Hinweis fuer Browser ohne passende Module; main.js blendet ihn beim Start aus. */
.overlay .fallback { font-weight: bold; }
.fallback[hidden] { display: none; }
#ov-quiz { z-index: 2; }
#ov-pause { z-index: 3; cursor: pointer; font-size: 1.2rem; font-weight: bold; }
.btn { font: bold 1.05rem/1.2 Georgia, "Times New Roman", serif; min-height: 44px; padding: 10px 22px;
  border-radius: 999px; border: 2px solid var(--gold); background: var(--gold); color: var(--wood); cursor: pointer; }
.btn-ghost { background: transparent; color: var(--cream); }
.overlay .btn:focus-visible, .overlay:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
.btn:disabled { cursor: default; }
.quiz-kicker { font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.quiz-text { font-size: 1.15rem; font-weight: bold; }
.quiz-timer { width: 80%; height: 6px; border-radius: 3px; background: rgba(255, 243, 214, 0.2); overflow: hidden; }
#quiz-bar { height: 100%; background: var(--gold); transform-origin: left center; }
.quiz-buttons { display: flex; gap: 12px; }
.quiz-buttons .btn[data-result="right"] { background: var(--ok); border-color: var(--ok); color: var(--wood); }
.quiz-buttons .btn[data-result="wrong"] { opacity: 0.45; }

/* Tonschalter unter dem Spielfeld liegt auf dem Seitenhintergrund. */
.game-bar { display: flex; justify-content: flex-end; width: min(100%, calc(75vh * 3 / 4)); margin: 8px auto 0; }
.game-bar .btn-ghost { color: var(--text); border-color: var(--timber); font-size: 0.95rem; min-height: 44px; padding: 8px 18px; }
.game-bar .btn-ghost[aria-pressed="true"] { background: var(--surface); }

/* Eintragsformular im Game-over-Overlay */
.submit { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.submit[hidden] { display: none; }
.submit label { font-size: 0.95rem; }
.submit-row { display: flex; gap: 8px; }
.submit input { font: inherit; min-height: 44px; width: 11em; max-width: 100%; padding: 0 12px;
  border-radius: 8px; border: 2px solid var(--gold); background: var(--cream); color: var(--wood); }
.overlay .name-hint, .name-hint { margin: 0; max-width: 28rem; padding: 8px 14px; border: 1px solid var(--gold); border-radius: 12px;
  background: rgba(232, 182, 76, 0.2); color: var(--cream); font-size: 0.9rem; font-weight: 700; line-height: 1.35; text-align: center; }
.submit-consent { margin: 0; max-width: 28rem; font-size: 0.8rem; line-height: 1.4; text-align: center; }
.submit-msg { min-height: 1.4em; font-size: 0.95rem; }

/* Bestenliste ---------------------------------------------------------------- */

.board { max-width: 480px; margin: 0 auto; padding: 40px 16px 0; }
.board h2 { font-size: 1.5rem; margin-bottom: 12px; }
.board-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.board-tabs button { font: inherit; min-height: 44px; padding: 0 18px; cursor: pointer; border-radius: 999px;
  border: 2px solid var(--timber); background: transparent; color: var(--text); }
.board-tabs button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--wood); font-weight: bold; }
.board-list { list-style: none; margin: 12px 0 0; padding: 0; font-variant-numeric: tabular-nums; }
.board-list li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(127, 127, 127, 0.3); border-bottom: 1px solid color-mix(in srgb, var(--timber) 40%, transparent); }
.board-rank { width: 2em; text-align: right; color: var(--muted); }
.board-name { flex: 1; overflow-wrap: anywhere; }
.board-score { font-weight: bold; }
.board-empty { display: block !important; color: var(--muted); }
.board-note { margin: 12px 0 0; }

/* Countdown -------------------------------------------------------------------- */

.countdown-box {
  border-top: 3px solid var(--timber);
  border-bottom: 3px solid var(--timber);
  padding: 20px 0 24px;
}
.countdown { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; margin: 12px 0 16px;
  font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.countdown[hidden] { display: none; }
.countdown .cd-part { display: inline-flex; align-items: baseline; gap: 6px; }
.countdown .cd-num { font-size: 1.6rem; font-weight: 700; color: var(--moss); }
.countdown .cd-part:first-child .cd-num { font-size: clamp(3.4rem, 16vw, 5.5rem); line-height: 1; }
.countdown .cd-unit { font-size: 1.1rem; }
.countdown-done { font-family: var(--serif); font-size: 1.8rem; margin: 12px 0 16px; color: var(--moss); }
.countdown-box p { margin: 0 0 8px; max-width: 60ch; }
.countdown-box p:last-child { margin-bottom: 0; }

/* Breslack in Zahlen ------------------------------------------------------------ */

.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); }
.tile { border-top: 3px solid var(--timber); padding-top: 10px; font-size: 0.95rem; }
.tile-num { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; color: var(--moss);
  font-variant-numeric: lining-nums; margin-bottom: 4px; }

/* Zeitstrahl ------------------------------------------------------------------ */

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--moss); }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 0.35em; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--moss); }
.timeline .year { display: block; font-family: var(--serif); font-weight: 700; font-size: 1.15rem;
  font-variant-numeric: lining-nums; }
.timeline p { margin: 2px 0 0; max-width: 58ch; }

/* Wusstest du? ---------------------------------------------------------------- */

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
@media (min-width: 40em) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border-radius: 6px; padding: 16px 16px 12px; display: flex; flex-direction: column; }
.card h3 { font-size: 1.15rem; margin-bottom: 6px; }
.card p { margin: 0 0 10px; flex: 1; }
.card .source { align-self: flex-start; font-size: 0.85rem; color: var(--muted); }

/* Fuss ------------------------------------------------------------------------ */

.site-foot { background: var(--foot-bg); color: var(--foot-text); padding: 28px 0 32px; font-size: 0.95rem; }
.site-foot p { margin: 0 0 8px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; }
.site-foot a { color: var(--gold); }
.site-foot a:focus-visible { outline-color: var(--gold); }

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

/* Rechtliche Seiten (impressum.html, datenschutz.html) ------------------------ */

.legal { padding: 40px 0 64px; }
.legal h2 { font-size: 1.85rem; margin-bottom: 16px; }
.legal h3 { font-size: 1.2rem; margin: 28px 0 8px; }
.legal p, .legal ul, .legal dl { max-width: 62ch; margin: 0 0 12px; }
.legal ul { padding-left: 1.3em; }
.legal li { margin-bottom: 4px; }
.legal dt { font-weight: 700; margin-top: 14px; }
.legal dd { margin: 2px 0 0; }
.legal .back { margin-top: 32px; }
