/* =====================================================================
   Minigame-Maniac – „Geisterbahn bei Nacht“
   Moorgrün statt Schwarz, Knochen-Tafeln mit harten Schatten, Kürbis für
   Aktionen, Schleimgrün nur für „läuft gerade“. Schilder in Jolly Lodger,
   Text in Spectral. Das eine Bewegte: der Geist fährt auf dem Gleis mit.
   ===================================================================== */

@font-face {
  font-family: 'Jolly Lodger';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/jolly/jolly-lodger-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/spectral/spectral-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-style: italic;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/spectral/spectral-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../fonts/spectral/spectral-latin-700-normal.woff2') format('woff2');
}

:root {
  --moor: #17241f;       /* Nacht über dem Moor */
  --moos: #23352d;       /* Flächen */
  --moos-2: #34493e;     /* Kanten, Gleis */
  --knochen: #ece2c6;    /* Tafeln, Schrift auf dunkel */
  --knochen-2: #c9bf9f;
  --nebel: #a7b5a3;      /* leise Schrift */
  --kuerbis: #e8772e;    /* Aktionen */
  --schleim: #b8c94a;    /* läuft gerade */
  --blut: #8f2318;
  --flieder: #b7a3dc;    /* Gäste */
  --stein: #b9b4a3;      /* Grabsteine */
  --schatten: #0d1612;
  --ink: #17241f;
  --sign: 'Jolly Lodger', 'Georgia', serif;
  --text: 'Spectral', 'Georgia', serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--moor);
  color: var(--knochen);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--sign); font-weight: 400; line-height: 0.95; letter-spacing: 0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--schleim); outline-offset: 3px; }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--nebel); }

/* ---------- Kopf ---------- */
.top { display: flex; justify-content: space-between; gap: 1rem; padding: 0.9rem clamp(1rem, 4vw, 2.5rem); font-size: 0.95rem; }
.top-link { color: var(--nebel); text-decoration: none; }
.top-link:hover { color: var(--knochen); text-decoration: underline; }
.view { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem; }
.boot { padding: 4rem 0; font-style: italic; color: var(--nebel); }

/* ---------- Schild ---------- */
.sign { display: inline-block; transform: rotate(-2deg); margin: 0.6rem 0 0.4rem; }
.sign h1 {
  font-size: clamp(3.6rem, 11vw, 7.5rem);
  color: var(--kuerbis);
  text-shadow: 4px 4px 0 var(--knochen), 7px 7px 0 var(--schatten);
}
.sign-sub { font-style: italic; color: var(--knochen-2); margin-top: 0.4rem; max-width: 34rem; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-bottom: 1.8rem; }

/* ---------- Tafeln & Knöpfe ---------- */
.board {
  background: var(--knochen); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: 6px 6px 0 var(--schatten);
  padding: 1.3rem 1.4rem;
}
.board h2 { font-size: 2.2rem; margin-bottom: 0.6rem; }
.board .muted { color: #55635a; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 46px; padding: 0.45rem 1.2rem;
  border: 3px solid var(--ink); border-radius: 6px; background: var(--knochen); color: var(--ink);
  font-weight: 700; text-decoration: none; cursor: pointer;
  box-shadow: 3px 3px 0 var(--schatten);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--schatten); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--schatten); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-go { background: var(--kuerbis); font-size: 1.15rem; }
.btn-big { min-height: 58px; font-size: 1.3rem; padding-inline: 1.8rem; }
.btn-quiet { background: transparent; color: var(--knochen); border-color: var(--moos-2); box-shadow: none; }
.btn-quiet:hover { border-color: var(--knochen-2); box-shadow: none; }
.board .btn-quiet { color: var(--ink); border-color: #9a9277; }
.input {
  width: 100%; min-height: 46px; padding: 0.4rem 0.8rem;
  background: #fbf6e6; color: var(--ink); border: 3px solid var(--ink); border-radius: 6px;
}
.input:focus { outline: none; box-shadow: 3px 3px 0 var(--kuerbis); }
.code-input { text-transform: uppercase; letter-spacing: 0.35em; font-weight: 700; text-align: center; }
.field { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.95rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* ---------- Start ---------- */
.start { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.start .sign-sub { font-size: 1.15rem; }
.start-boards { display: grid; gap: 1.4rem; }
.start-boards .board:nth-child(2) { transform: rotate(0.8deg); }
.start-boards form { display: grid; gap: 0.8rem; margin-top: 0.4rem; }
.rules { margin-top: 2rem; max-width: 34rem; }
.rules h2 { font-size: 1.9rem; color: var(--knochen); margin-bottom: 0.5rem; }
.rules ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.35rem; }
.points { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }
.points span { display: grid; place-items: center; min-width: 3.4rem; padding: 0.3rem 0.5rem; border: 2px solid var(--moos-2); border-radius: 6px; font-size: 0.85rem; color: var(--nebel); }
.points b { font-family: var(--sign); font-weight: 400; font-size: 1.8rem; line-height: 1; color: var(--knochen); }

/* ---------- Ticket mit Code ---------- */
.ticket {
  position: relative; display: grid; grid-template-columns: auto auto; gap: 0.2rem 1.2rem; align-items: center;
  padding: 0.8rem 1.2rem 0.8rem 1.6rem; background: var(--kuerbis); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 6px; box-shadow: 5px 5px 0 var(--schatten); transform: rotate(1.5deg);
}
.ticket::before { content: ''; position: absolute; left: 0.55rem; top: 0.5rem; bottom: 0.5rem; border-left: 3px dotted var(--ink); }
.ticket .label { grid-column: 1 / -1; font-size: 0.85rem; font-weight: 700; }
.ticket .code { font-family: var(--sign); font-size: 3rem; line-height: 0.9; letter-spacing: 0.12em; }
.ticket .btn { min-height: 38px; padding: 0.2rem 0.8rem; font-size: 0.9rem; }

/* ---------- Gleis mit Stationen ---------- */
.track-wrap { position: relative; margin: 0 0 2rem; overflow-x: auto; padding-bottom: 0.4rem; }
.track {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(8.5rem, 1fr); gap: 1rem;
  padding: 2.6rem 0.4rem 2.1rem; min-width: min-content;
}
.track::after { /* Schienen und Schwellen */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0.7rem; height: 12px;
  border-top: 3px solid var(--knochen-2); border-bottom: 3px solid var(--knochen-2);
  background: repeating-linear-gradient(90deg, transparent 0 16px, var(--moos-2) 16px 24px);
}
.station {
  position: relative; z-index: 1; display: grid; align-content: start; gap: 0.15rem; min-height: 6.4rem;
  padding: 0.6rem 0.7rem 0.9rem; border: 3px solid var(--ink); border-radius: 18px 18px 6px 6px;
  background: var(--moos); color: var(--knochen); box-shadow: 4px 4px 0 var(--schatten);
}
.station::before, .station::after { /* Räder */
  content: ''; position: absolute; bottom: -1.05rem; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--knochen-2); border: 3px solid var(--ink);
}
.station::before { left: 1rem; }
.station::after { right: 1rem; }
.station .no { font-size: 0.8rem; color: var(--nebel); }
.station .name { font-family: var(--sign); font-size: 1.9rem; line-height: 0.95; }
.station .note { font-size: 0.8rem; font-style: italic; color: var(--nebel); }
.station.mystery .name { color: var(--nebel); }
.station.now { background: var(--schleim); color: var(--ink); }
.station.now .no, .station.now .note { color: #33402a; }
.station.done { background: var(--knochen); color: var(--ink); }
.station.done .no, .station.done .note { color: #55635a; }
.station.skipped .name { text-decoration: line-through; text-decoration-thickness: 3px; }
.rider { /* der Geist fährt mit */
  position: absolute; z-index: 2; top: 0; width: 2.6rem; height: 2.6rem; margin-left: -1.3rem;
  transition: left 0.9s cubic-bezier(0.5, 0, 0.2, 1.3);
}
.rider svg { width: 100%; height: 100%; }

/* ---------- Lobby / Party ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(1.2rem, 3vw, 2.2rem); align-items: start; }
.panel-title { font-size: 2.1rem; color: var(--knochen); margin-bottom: 0.9rem; }
.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; margin-bottom: 1.1rem; }
.game { position: relative; cursor: pointer; }
.game input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.game span {
  display: grid; gap: 0.2rem; height: 100%; padding: 0.7rem 0.8rem; border: 3px solid var(--ink); border-radius: 6px;
  background: #d9cfb0; color: #55635a; transition: transform 0.1s;
}
.game b { font-family: var(--sign); font-weight: 400; font-size: 1.9rem; line-height: 0.95; }
.game small { font-size: 0.82rem; line-height: 1.3; }
.game input:checked + span { background: var(--game); color: var(--ink); box-shadow: 3px 3px 0 var(--schatten); transform: rotate(-1deg); }
.game input:focus-visible + span { outline: 3px solid var(--schleim); outline-offset: 2px; }
.game input:disabled { cursor: default; }
.game.paused { cursor: not-allowed; opacity: 0.45; filter: grayscale(1); }
.game.paused input { cursor: not-allowed; }
.game[data-game='kritzel'] { --game: #ffd23f; }
.game[data-game='klecks'] { --game: #ff7cc4; }
.game[data-game='galgenfrist'] { --game: #e0a35a; }
.game[data-game='schollenschubsen'] { --game: #6bb8e6; }
.game[data-game='wurstsalat'] { --game: #f2b200; }
.game[data-game='wackelturm'] { --game: #ef6a1c; }
.game[data-game='zwergengolf'] { --game: #6cb04a; }
.game[data-game='flunkerfritze'] { --game: #ff8a7a; }
.game[data-game='klugschnacker'] { --game: #f0d9a0; }
.game[data-game='siebhirn'] { --game: #e0712b; }
.game[data-game='kutterkrawall'] { --game: #4f9de0; }
.game[data-game='kuckuck'] { --game: #c8412d; }
.settings-row { display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-items: center; margin-bottom: 1.2rem; }
.switch { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; cursor: pointer; }
.switch input { width: 2.8rem; height: 1.5rem; appearance: none; margin: 0; border: 3px solid var(--ink); border-radius: 999px; background: #d9cfb0; position: relative; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 0.95rem; height: 0.95rem; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.switch input:checked { background: var(--kuerbis); }
.switch input:checked::after { transform: translateX(1.25rem); }
.stepper { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.stepper button { width: 2.4rem; height: 2.4rem; padding: 0; border: 3px solid var(--ink); border-radius: 6px; background: var(--knochen); cursor: pointer; font-weight: 700; font-size: 1.2rem; line-height: 1; }
.stepper output { font-family: var(--sign); font-size: 2.2rem; min-width: 1.6rem; text-align: center; line-height: 1; }
.wait-note { font-style: italic; }

/* ---------- Fahrgäste ---------- */
.riders { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.riders li {
  display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: 0.7rem; align-items: center;
  padding: 0.45rem 0.7rem 0.45rem 0.5rem; border: 2px solid var(--moos-2); border-radius: 6px; background: var(--moos);
}
.riders li.me { border-color: var(--knochen-2); }
.riders li.off { opacity: 0.5; }
.face { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--knochen); border: 2px solid var(--ink); overflow: hidden; display: grid; place-items: center; }
.face img { width: 100%; height: 100%; }
.face.ghost { background: var(--moor); border-color: var(--flieder); }
.face.ghost svg { width: 74%; height: 74%; }
.riders .who { display: grid; line-height: 1.25; min-width: 0; }
.riders .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.riders .who small { color: var(--nebel); font-size: 0.82rem; }
.riders .who small.guest { color: var(--flieder); }
.riders .total { font-family: var(--sign); font-size: 2rem; line-height: 1; text-align: right; }
.riders .kick { border: 0; background: none; color: var(--nebel); cursor: pointer; font-size: 1.3rem; padding: 0 0.2rem; }
.riders .kick:hover { color: var(--kuerbis); }

/* ---------- Unterwegs ---------- */
.ride { text-align: left; }
.ride .now-label { font-size: 1.05rem; font-style: italic; }
.ride h2 { font-size: clamp(3.4rem, 9vw, 6rem); margin: 0.2rem 0 0.4rem; }
.count { font-family: var(--sign); font-size: clamp(5rem, 16vw, 9rem); line-height: 0.85; color: var(--kuerbis); }
.ride .row { margin-top: 1.2rem; }

/* ---------- Zwischenwertung ---------- */
.scores { width: 100%; border-collapse: collapse; margin: 0.4rem 0 0.8rem; }
.scores th { text-align: left; font-weight: 400; font-style: italic; font-size: 0.9rem; color: #55635a; padding: 0 0.4rem 0.3rem; }
.scores td { padding: 0.45rem 0.4rem; border-top: 2px dashed #b6ac8c; }
.scores .num { font-family: var(--sign); font-size: 1.7rem; line-height: 1; width: 2.6rem; }
.scores .plus { font-family: var(--sign); font-size: 1.7rem; color: #5b6b1a; text-align: right; }
.scores .sum { font-family: var(--sign); font-size: 1.9rem; text-align: right; width: 4rem; }
.scores tr.me td { background: #e2d6b3; }
.scores .zero { color: #9a9277; }

/* ---------- Ende: Grabstein-Podium ---------- */
.final h2 { font-size: clamp(3rem, 8vw, 5rem); color: var(--kuerbis); text-shadow: 3px 3px 0 var(--knochen); margin-bottom: 0.4rem; }
.graves { display: grid; grid-template-columns: repeat(3, minmax(0, 13rem)); justify-content: center; align-items: end; gap: clamp(0.6rem, 2vw, 1.4rem); margin: 2.4rem 0 1.2rem; }
.grave { display: grid; justify-items: center; gap: 0.3rem; }
.grave .face { width: 4.4rem; height: 4.4rem; border-width: 3px; }
.grave .nm { font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.stone {
  width: 100%; display: grid; align-content: start; justify-items: center; gap: 0.1rem; padding-top: 1rem;
  background: var(--stein); color: var(--ink); border: 3px solid var(--ink); border-bottom-width: 0;
  border-radius: 48% 48% 4px 4px / 34% 34% 4px 4px; box-shadow: 5px 0 0 var(--schatten);
}
.stone .roman { font-family: var(--sign); font-size: 3rem; line-height: 1; }
.stone .pts { font-weight: 700; font-size: 0.95rem; }
.grave.p1 .stone { height: 13rem; background: var(--knochen); }
.grave.p2 .stone { height: 10rem; }
.grave.p3 .stone { height: 7.5rem; }
.ground { height: 14px; background: var(--moos-2); border-top: 3px solid var(--ink); border-radius: 2px; margin: 0 auto 1.6rem; max-width: 44rem; }
.final-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; margin-top: 1.4rem; }

/* ---------- Meldungen ---------- */
.toasts { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: grid; gap: 0.5rem; z-index: 50; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--knochen); color: var(--ink); border: 3px solid var(--ink); border-radius: 6px; padding: 0.6rem 0.9rem; box-shadow: 4px 4px 0 var(--kuerbis); font-weight: 700; }
.toast.error { box-shadow: 4px 4px 0 var(--blut); }

@media (max-width: 820px) {
  .start, .grid { grid-template-columns: 1fr; }
  .games { grid-template-columns: 1fr; }
  .graves { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grave .face { width: 3.2rem; height: 3.2rem; }
  .grave.p1 .stone { height: 10rem; }
  .grave.p2 .stone { height: 8rem; }
  .grave.p3 .stone { height: 6rem; }
  .stone .roman { font-size: 2.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
