/* ==========================================================================
   Alpakalypse — norbert-wielage.de/alpakalypse/
   Eingepasst in das helle Design der Hauptseite (Raleway, NW-Blau, weisse
   Flächen). Der Spieltisch und die Karten behalten bewusst ihren Filz —
   ein Kartentisch in einem hellen Raum. Keine externen Ressourcen.
   ========================================================================== */

@font-face {
  font-family: "raleway";
  font-display: swap;
  font-weight: 100 900;
  font-style: normal;
  src: url("/fonts/raleway/raleway-variable.woff2") format("woff2"),
       url("/fonts/raleway/raleway-variable.woff") format("woff");
}

:root {
  /* Seitengeruest — Tokens der Hauptseite (nw-home.css) */
  --bg:          #f5f8fc;
  --flaeche:     #ffffff;
  --linie:       #e6edf6;
  --tinte:       #0f1b2d;
  --text:        #3c4a5e;
  --nebel:       #6b7a8d;   /* gedaempfter Text auf hellem Grund */
  --blau:        #2ea3f2;
  --blau-tief:   #127ed1;
  --ring:        rgba(46, 163, 242, .35);

  /* Spieltisch — bleibt Filz */
  --filz:        #14322c;
  --filz-tief:   #0d211d;
  --filz-hell:   #1c463d;
  --nebel-filz:  rgba(246, 239, 226, .66);   /* gedaempfter Text AUF dem Filz */

  /* Karten und Alpaka-Wolle */
  --creme:       #f6efe2;
  --creme-tief:  #e6dcc8;
  --wolle:       #e9d5a8;
  --wolle-tief:  #c9ad74;
  --akzent:      #f0a03c;
  --akzent-tief: #d4832a;
  --rot:         #c24736;
  --gruen:       #3a8256;

  /* Kartenfarben — jede Zahl hat ihren eigenen Ton, damit man die Hand
     auch mit einem Blick erfasst und nicht erst Ziffern lesen muss. */
  --k1: #d0503c;
  --k2: #e08036;
  --k3: #d8b13c;
  --k4: #4f9d69;
  --k5: #3d87a8;
  --k6: #7a5ea8;
  --k7: #8a6b3f;

  --radius:  14px;
  --radius-s: 9px;
  --schatten: 0 6px 18px -6px rgba(15, 27, 45, .28);
  --font: "raleway", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; font-weight: 800; letter-spacing: -.02em; color: var(--tinte); }
h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 3.4vw, 1.8rem); margin-top: 1.8em; }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
p  { margin: 0 0 1em; }
a  { color: var(--blau-tief); text-underline-offset: .18em; }
a:hover { color: var(--tinte); }

.container { width: min(1080px, 100% - 2.4rem); margin-inline: auto; }
.schmal    { width: min(720px, 100% - 2.4rem); margin-inline: auto; }

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

.kopf {
  /* Sitzt unter der eingeblendeten Domain-Leiste (nwbar setzt --nwb-h). */
  position: sticky; top: var(--nwb-h, 0px); z-index: 40;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--linie);
}
.kopf-innen {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 0; flex-wrap: wrap;
}
.marke {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em;
  color: var(--tinte); text-decoration: none;
}
.marke:hover { color: var(--tinte); }
.marke svg { width: 30px; height: 34px; flex: none; }
.marke b { color: var(--akzent-tief); font-weight: 800; }

.hauptnav { margin-left: auto; display: flex; gap: .3rem; flex-wrap: wrap; }
.hauptnav a {
  padding: .38rem .7rem; border-radius: 999px;
  color: var(--nebel); text-decoration: none; font-size: .93rem; font-weight: 600;
}
.hauptnav a:hover, .hauptnav a[aria-current="page"] {
  background: rgba(46, 163, 242, .10); color: var(--blau-tief);
}

.fuss {
  margin-top: 4rem; padding: 2rem 0 2.4rem;
  border-top: 1px solid var(--linie);
  font-size: .9rem; color: var(--nebel);
  background: var(--flaeche);
}
.fuss-innen { display: flex; gap: 1rem 2rem; flex-wrap: wrap; align-items: center; }
.fuss a { color: var(--nebel); }
.fuss a:hover { color: var(--blau-tief); }
.fuss nav { margin-left: auto; display: flex; gap: 1.1rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------- Bausteine */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.35rem; border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; line-height: 1.2;
  background: var(--akzent); color: #2a1a06;
  cursor: pointer; text-decoration: none;
  transition: transform .1s ease, background .15s ease, box-shadow .15s ease;
  box-shadow: 0 3px 0 var(--akzent-tief);
}
.knopf:hover  { background: #f7b055; color: #2a1a06; }
.knopf:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--akzent-tief); }
.knopf:disabled { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }
.knopf.geist {
  background: transparent; color: var(--tinte);
  border: 1.5px solid rgba(15, 27, 45, .22); box-shadow: none;
}
.knopf.geist:hover { background: rgba(15, 27, 45, .06); color: var(--tinte); }
.knopf.warnend { background: var(--rot); color: #fff; box-shadow: 0 3px 0 #a63c2c; }
.knopf.warnend:hover { background: #dd6250; color: #fff; }
.knopf.klein { padding: .42rem .9rem; font-size: .88rem; box-shadow: none; }

.feld {
  width: 100%; padding: .78rem 1rem;
  border: 1.5px solid #d7e1ef; border-radius: var(--radius-s);
  background: var(--flaeche); color: var(--tinte);
  font: inherit;
}
.feld:focus { outline: 3px solid var(--ring); outline-offset: 0; border-color: var(--blau); }
.feld::placeholder { color: #a4b1c2; }
.feld.code {
  font-size: 1.6rem; font-weight: 800; letter-spacing: .3em;
  text-align: center; text-transform: uppercase;
}
label { display: block; font-size: .88rem; color: var(--nebel); margin-bottom: .3rem; font-weight: 600; }

.tafel {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: 0 2px 10px -4px rgba(15, 27, 45, .18);
}

.hinweis {
  border-left: 3px solid var(--akzent);
  background: rgba(240, 160, 60, .09);
  padding: .85rem 1.1rem; border-radius: 0 var(--radius-s) var(--radius-s) 0;
  margin: 1.2rem 0; font-size: .95rem;
}
.fehler {
  background: rgba(194, 71, 54, .08);
  border: 1px solid rgba(194, 71, 54, .4);
  color: #8f2f20;
  padding: .7rem 1rem; border-radius: var(--radius-s);
  margin: 0 0 1rem; font-size: .93rem;
}
.fehler:empty { display: none; }

/* ---------------------------------------------------------------- Spielkarten */

.karte {
  position: relative;
  width: var(--kb, 74px); height: calc(var(--kb, 74px) * 1.45);
  border-radius: var(--radius-s);
  background: var(--creme);
  border: 2px solid var(--creme-tief);
  box-shadow: var(--schatten);
  display: grid; place-items: center;
  flex: none; user-select: none;
  font-variant-numeric: tabular-nums;
}
.karte .zahl {
  font-size: calc(var(--kb, 74px) * .58);
  font-weight: 800; line-height: 1;
  color: var(--kf, var(--tinte));
}
/* Kleine Eckzahlen wie auf echten Spielkarten. */
.karte .ecke {
  position: absolute; font-size: calc(var(--kb, 74px) * .19);
  font-weight: 800; color: var(--kf, var(--tinte)); line-height: 1;
}
.karte .ecke.o { top: .3em; left: .42em; }
.karte .ecke.u { bottom: .3em; right: .42em; transform: rotate(180deg); }
.karte .alpaka { width: 66%; height: 66%; }

.karte[data-k="1"] { --kf: var(--k1); }
.karte[data-k="2"] { --kf: var(--k2); }
.karte[data-k="3"] { --kf: var(--k3); }
.karte[data-k="4"] { --kf: var(--k4); }
.karte[data-k="5"] { --kf: var(--k5); }
.karte[data-k="6"] { --kf: var(--k6); }
.karte[data-k="7"] { --kf: var(--k7); background: #fbf4e4; }

/* Kartenruecken: Wollmuster in zwei Tönen — bleibt Filz. */
.karte.ruecken {
  background:
    repeating-linear-gradient(45deg, var(--filz-hell) 0 7px, #23544a 7px 14px);
  border-color: var(--filz);
  color: var(--wolle);
}
.karte.ruecken .stapelzahl {
  font-size: calc(var(--kb, 74px) * .3); font-weight: 800;
  background: rgba(13, 33, 29, .82); color: var(--wolle);
  border-radius: 999px; padding: .12em .55em;
}
/* Leerer Platz — liegt auf dem Filztisch. */
.karte.leer {
  background: transparent; border: 2px dashed rgba(246, 239, 226, .35);
  box-shadow: none; color: rgba(246, 239, 226, .35);
}

/* -------------------------------------------------------------------- Spieltisch */

.spiel { padding: 1rem 0 7.5rem; }

.raumleiste {
  display: flex; align-items: center; gap: .6rem 1.1rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; font-size: .92rem; color: var(--nebel);
}
.raumcode {
  font-weight: 800; font-size: 1.05rem; letter-spacing: .18em;
  color: var(--wolle); background: var(--filz);
  padding: .22rem .7rem; border-radius: 999px;
}

.mitspieler {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  margin-bottom: 1.4rem;
}
.spielerkachel {
  background: var(--flaeche);
  border: 1.5px solid var(--linie);
  border-radius: var(--radius-s);
  padding: .6rem .7rem;
  position: relative;
  box-shadow: 0 2px 10px -4px rgba(15, 27, 45, .14);
  transition: border-color .2s ease, background .2s ease;
}
.spielerkachel.dran {
  border-color: var(--akzent);
  background: rgba(240, 160, 60, .1);
  box-shadow: 0 0 0 3px rgba(240, 160, 60, .18);
}
.spielerkachel.raus  { opacity: .5; }
.spielerkachel.selbst .sk-name::after { content: " (du)"; color: var(--nebel); font-weight: 400; }
.sk-name {
  font-weight: 700; font-size: .95rem; color: var(--tinte);
  display: flex; align-items: center; gap: .35rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sk-zeile {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-size: .82rem; color: var(--nebel); margin-top: .18rem;
}
.punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--gruen); flex: none; }
.punkt.weg { background: #c9d4e4; }
.chip {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid rgba(15, 27, 45, .35); vertical-align: -2px;
}
.chip.schwarz { background: #26221c; border-color: #26221c; }
.chip.weiss   { background: var(--creme); }
.sk-marke {
  position: absolute; top: -8px; right: 8px;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  background: var(--wolle-tief); color: #2a1f0c;
  padding: .06rem .45rem; border-radius: 999px;
}

/* Der Tisch selbst bleibt gruener Filz — das Herz des Spiels. */
.tisch {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(1.5rem, 7vw, 4rem);
  padding: 1.8rem 1rem;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, var(--filz-hell) 0%, transparent 65%),
    var(--filz-tief);
  border: 1px solid #0b1d19;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: inset 0 1px 0 rgba(246, 239, 226, .08), 0 14px 34px -18px rgba(15, 27, 45, .45);
}
.stapel { text-align: center; }
.stapel .beschriftung {
  font-size: .78rem; color: var(--nebel-filz); margin-top: .5rem;
  text-transform: uppercase; letter-spacing: .08em;
}
.stapel .karte { --kb: 92px; margin-inline: auto; }
/* Angedeuteter Kartenstoss unter der obersten Karte. */
.stapel.gestapelt { position: relative; }
.stapel.gestapelt .karte::before,
.stapel.gestapelt .karte::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; border: inherit; background: inherit;
  z-index: -1;
}
.stapel.gestapelt .karte::before { transform: rotate(-4deg) translate(-3px, 2px); }
.stapel.gestapelt .karte::after  { transform: rotate(3deg) translate(3px, 3px); }

.zugbalken {
  height: 4px; border-radius: 999px; background: rgba(15, 27, 45, .12);
  overflow: hidden; margin: .8rem auto 0; max-width: 320px;
}
.zugbalken i { display: block; height: 100%; background: var(--akzent); transition: width 1s linear; }

.ansage {
  text-align: center; font-size: 1.05rem; font-weight: 600; color: var(--tinte);
  min-height: 1.6em; margin-bottom: 1rem;
}
.ansage .du { color: var(--akzent-tief); }

/* Eigene Hand — bleibt am unteren Rand griffbereit. */
.handleiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: linear-gradient(to top, var(--bg) 62%, rgba(245, 248, 252, 0));
  padding: 1.4rem 0 .9rem;
}
.hand {
  display: flex; gap: .5rem; justify-content: center;
  flex-wrap: wrap;
  /* Oben Platz fuer das Anheben beim Ueberfahren; nach unten begrenzt, damit
     eine grosse Hand auf dem Handy nicht den ganzen Tisch verdeckt. */
  padding: 14px 1rem .8rem;
  max-height: 46vh; overflow-y: auto;
  --kb: 68px;              /* Vorgabe; app.js passt sie an die Handgroesse an */
}
.hand .karte {
  cursor: default; border: 0; padding: 0;
  transition: transform .13s ease, box-shadow .13s ease, opacity .13s ease;
}
.hand .karte.spielbar { cursor: pointer; box-shadow: 0 0 0 3px var(--akzent), var(--schatten); }
.hand .karte.spielbar:hover,
.hand .karte.spielbar:focus-visible { transform: translateY(-12px); outline: none; }
.hand .karte.tot { opacity: .48; }
.handaktionen { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; padding: 0 1rem; }

/* ---------------------------------------------------------------- Overlays */

.buehne {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 27, 45, .45);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 1.2rem;
  overflow-y: auto;
}
.buehne[hidden] { display: none; }
.buehne-inhalt {
  width: min(560px, 100%);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: 0 40px 80px -40px rgba(15, 27, 45, .45);
  padding: 1.6rem;
}

.wertung { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
.wertung th, .wertung td { padding: .5rem .4rem; text-align: left; }
.wertung th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nebel); font-weight: 700; }
.wertung tbody tr { border-top: 1px solid var(--linie); }
.wertung td.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.wertung .plus  { color: var(--rot); font-weight: 700; }
.wertung .minus { color: var(--gruen); font-weight: 700; }
.wertung .sieger td { color: var(--akzent-tief); font-weight: 700; }

.protokoll {
  margin-top: 1.2rem; font-size: .86rem; color: var(--nebel);
  max-height: 8.5rem; overflow-y: auto;
}
.protokoll li { list-style: none; padding: .12rem 0; }
.protokoll ul { margin: 0; padding: 0; }

/* --------------------------------------------------------------- Startseite */

.buehne-start { padding: 2.6rem 0 1rem; text-align: center; }
.buehne-start .claim { font-size: 1.12rem; color: var(--nebel); max-width: 34em; margin-inline: auto; }
.faecher {
  display: flex; justify-content: center; margin: 2rem 0 2.4rem;
  padding-left: 34px;
}
.faecher .karte {
  --kb: 82px; margin-left: -34px;
  transform: rotate(var(--dreh)) translateY(var(--hoch, 0));
  transition: transform .2s ease;
}
.faecher .karte:hover { transform: rotate(var(--dreh)) translateY(-14px); }

.tabellenkarten { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.regelliste { padding-left: 1.15rem; }
.regelliste li { margin-bottom: .5rem; }

.rechtstabelle { width: 100%; border-collapse: collapse; font-size: .93rem; margin: 1rem 0; }
.rechtstabelle th, .rechtstabelle td { padding: .55rem .5rem; text-align: left; border-bottom: 1px solid var(--linie); }
.rechtstabelle th { color: var(--nebel); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --------------------------------------------------------------- Kleine Geraete */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .stapel .karte { --kb: 76px; }
  .hand         { --kb: 58px; }
  .hand { gap: .35rem; }
  .tisch { padding: 1.2rem .6rem; }
  .mitspieler { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .faecher .karte { --kb: 58px; margin-left: -24px; }
  .faecher { padding-left: 24px; }
}

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