/* Kuh auf dem Gleis – Webspiel. Farben wie auf dem Spielbrett. */
:root {
  --creme: #f6eed8;
  --creme-2: #fbf6e8;
  --papier: #fffdf7;
  --holz: #c0905c;
  --holz-dunkel: #6e4b2a;
  --text: #3c2f1e;
  --text-leise: #7a6a52;
  --linie: #e2d4b4;
  --express: #c8483a;
  --express-dunkel: #93392c;
  --bummel: #3f8a4f;
  --bummel-dunkel: #2f6a3c;
  --blau: #3f6fae;
  --gold: #c1922c;
  --wiese: #8cba68;
  --schatten: 0 2px 8px rgba(58, 44, 24, .18);
  --rund: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--creme);
  color: var(--text);
  font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
.laedt { text-align: center; padding: 30vh 16px; color: var(--text-leise); }

/* ---------------------------------------------------------------- Bausteine */
.schild {
  background: linear-gradient(#cf9f68, #a97b48);
  border: 4px solid var(--holz-dunkel);
  border-radius: 14px;
  box-shadow: var(--schatten), inset 0 0 0 3px #e8c890;
  padding: 14px 18px 12px;
  text-align: center;
  line-height: 1.05;
}
.schild .t1, .schild .t2 {
  display: block; font-weight: 900; letter-spacing: 1px;
  -webkit-text-stroke: 1px #f9edd2; paint-order: stroke fill;
}
.schild .t1 { color: #d95232; font-size: clamp(26px, 8vw, 44px); }
.schild .t2 { color: #4e9a4e; font-size: clamp(28px, 8.5vw, 48px); letter-spacing: .35em; margin-left: .35em; }
.schild.klein { padding: 6px 12px 5px; border-width: 3px; border-radius: 10px; }
.schild.klein .t1 { font-size: 15px; }
.schild.klein .t2 { font-size: 16px; }

.box {
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: var(--rund);
  box-shadow: var(--schatten);
  padding: 16px;
}
.box h2 { margin: 0 0 10px; font-size: 18px; color: var(--holz-dunkel); }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  border: 0; border-radius: 10px; cursor: pointer;
  font-weight: 800; letter-spacing: .2px;
  background: var(--holz-dunkel); color: #fdf3dd;
  box-shadow: 0 3px 0 #4a3119;
  transition: transform .08s, filter .15s;
}
.knopf:active { transform: translateY(2px); box-shadow: 0 1px 0 #4a3119; }
.knopf:disabled { filter: grayscale(.6) opacity(.55); cursor: default; }
.knopf.rot { background: var(--express); box-shadow: 0 3px 0 var(--express-dunkel); }
.knopf.gruen { background: var(--bummel); box-shadow: 0 3px 0 var(--bummel-dunkel); }
.knopf.hell { background: #efe3c6; color: var(--text); box-shadow: 0 3px 0 #cbb98f; }
.knopf.breit { width: 100%; }
.knopf.gross { min-height: 56px; font-size: 19px; }

label.feld { display: block; margin: 0 0 12px; font-weight: 600; font-size: 14px; color: var(--text-leise); }
label.feld input {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px;
  border: 1px solid #cdbb94; border-radius: 9px; background: #fff; font-size: 17px; color: var(--text);
}
label.feld input:focus { outline: 3px solid #e8c890; border-color: var(--holz); }
input.code { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; }

.farbwahl { display: flex; gap: 10px; margin: 4px 0 16px; flex-wrap: wrap; }
.farbwahl button {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 2px var(--linie);
}
.farbwahl button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--holz-dunkel); }
.farbwahl button:disabled { opacity: .25; cursor: not-allowed; }

.fehler {
  background: #fdecea; color: #8c2a1f; border: 1px solid #f2b8b0; border-radius: 9px;
  padding: 10px 12px; margin: 10px 0 0; font-weight: 600;
}
.leise { color: var(--text-leise); font-size: 14px; }

/* ---------------------------------------------------------------- Start/Lobby */
.startseite { max-width: 520px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 18px; }
.startseite .unter { text-align: center; margin: -4px 0 0; color: var(--text-leise); font-weight: 600; }

/* Startbild (Variante B): randlos, unten weicher Uebergang, die erste Karte ragt hinein */
.startseite.mit-bild { padding-top: 0; }
.titelbild { display: block; margin: 0 -16px; }
.titelbild img {
  display: block; width: 100%; height: auto;
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
          mask-image: linear-gradient(#000 70%, transparent);
}
.titelbild + * { margin-top: -64px; position: relative; }
@media (min-width: 552px) {
  /* Breiter als das Bild: Seiten nicht abschneiden, oben runde Ecken */
  .titelbild { margin: 12px 0 0; }
  .titelbild img { border-radius: 16px 16px 0 0; }
}
.raumcode {
  font-size: 40px; font-weight: 900; letter-spacing: .25em; text-align: center;
  color: var(--holz-dunkel); margin: 4px 0 8px;
}
.reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.reihe > * { flex: 1 1 140px; }
.mitspieler { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.mitspieler li { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.punkt {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); flex: 0 0 auto;
}
.punkt.rot { background: #d64545; } .punkt.blau { background: #3f6fae; }
.punkt.gruen { background: #3f8a4f; } .punkt.gelb { background: #e0a52e; }

/* ---------------------------------------------------------------- Spiel */
.spiel {
  display: grid; gap: 12px; padding: 12px; max-width: 1500px; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "kopf" "aktion" "brett" "hand" "spieler" "log";
}
.spiel > * { min-width: 0; }
.kopfzeile { grid-area: kopf; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.kopfzeile .schriftzug { display: block; height: 40px; width: auto; max-width: 62%; object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(58, 44, 24, .3)); }
.kopfzeile .info { text-align: right; font-size: 14px; color: var(--text-leise); line-height: 1.3; }
.kopfzeile .info b { color: var(--text); }
.aktion { grid-area: aktion; }
.brettbereich { grid-area: brett; }
.handbereich { grid-area: hand; }
.spielerbereich { grid-area: spieler; }
.logbereich { grid-area: log; }

@media (min-width: 980px) {
  .spiel {
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-areas: "brett kopf" "brett aktion" "brett hand" "brett spieler" "brett log" "brett .";
    grid-template-rows: auto auto auto auto auto 1fr;
    align-items: start;
  }
  .brettbereich { position: sticky; top: 12px; }
  .brett { max-height: calc(100vh - 24px); }
}

.brett {
  position: relative; width: 100%; aspect-ratio: 1 / 1; margin: 0 auto;
  border-radius: 10px; overflow: hidden; box-shadow: var(--schatten); background: #8cba68;
}
@media (min-width: 980px) { .brett { width: min(100%, calc(100vh - 24px)); } }
.brett img, .brett svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.zug { transition: transform .7s cubic-bezier(.45, .05, .3, 1); }
.zug .puls { transform-box: fill-box; transform-origin: center; animation: puls 1.4s ease-out infinite; }
@keyframes puls { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }

/* Aktionsfeld */
.aktion .box { padding: 14px; }
.aktion h3 { margin: 0 0 6px; font-size: 17px; }
.aktion p { margin: 0 0 10px; }
.aktion .knoepfe { display: grid; gap: 8px; }
.aktion .knoepfe.zwei { grid-template-columns: 1fr 1fr; }
.dran { border: 2px solid var(--holz); background: #fffaf0; }
.warte { display: flex; align-items: center; gap: 10px; color: var(--text-leise); font-weight: 600; }
.warte .punkt { width: 20px; height: 20px; }
.schalter {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 10px;
  background: #f4ead2; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 15px;
}
.schalter input { width: 22px; height: 22px; accent-color: var(--holz-dunkel); flex: 0 0 auto; }
.hinweis { font-size: 14px; color: var(--text-leise); margin: 8px 0 0 !important; }
.marken { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.marke {
  display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 800;
  background: #efe3c6; color: var(--holz-dunkel);
}
.marke.E { background: #f6dcd6; color: var(--express-dunkel); }
.marke.B { background: #d9ecd9; color: var(--bummel-dunkel); }
.marke.warn { background: #fde6c8; color: #8a4d0c; }

/* Wuerfel */
.wuerfel { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; min-height: 52px; }
.wuerfel .w {
  width: 48px; height: 48px; background: #fff; border-radius: 10px; border: 2px solid #5b6068;
  box-shadow: 0 2px 0 #c9cdd3; display: grid; place-items: center;
}
.wuerfel .w svg { width: 40px; height: 40px; }
.wuerfel.rollt .w { animation: rollen .55s ease-out; }
@keyframes rollen {
  0% { transform: rotate(0) translateY(0); } 30% { transform: rotate(-25deg) translateY(-8px); }
  60% { transform: rotate(18deg) translateY(2px); } 100% { transform: rotate(0) translateY(0); }
}
.wuerfel .wer { font-size: 14px; color: var(--text-leise); font-weight: 600; }

/* Spielerliste */
.spielerliste { display: grid; gap: 8px; }
.spielerzeile {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center;
  padding: 10px 12px; border-radius: 10px; background: var(--creme-2); border: 1px solid var(--linie);
}
.spielerzeile.amzug { border-color: var(--holz); box-shadow: 0 0 0 2px #e8c890; }
.spielerzeile .name { font-weight: 800; }
.spielerzeile .ort { grid-column: 2 / 4; font-size: 13px; color: var(--text-leise); }
.spielerzeile .karten { font-size: 13px; font-weight: 700; color: var(--holz-dunkel); white-space: nowrap; }

/* Hand */
.hand { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
.hand:empty::before { content: "Noch keine Karten auf der Hand."; color: var(--text-leise); font-size: 14px; }
.handkarte {
  flex: 0 0 auto; width: 92px; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 8px; scroll-snap-align: start; position: relative; transition: transform .12s;
}
.handkarte img { width: 100%; display: block; border-radius: 7px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.handkarte.spielbar { transform: translateY(-4px); }
.handkarte.spielbar::after {
  content: "spielbar"; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  background: var(--bummel); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 99px;
}

/* Log */
.log { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; font-size: 14px; }
.log li { padding: 6px 0; border-bottom: 1px dashed var(--linie); }
.log li:first-child { font-weight: 700; }

details.regeln summary { cursor: pointer; font-weight: 800; color: var(--holz-dunkel); }
details.regeln ul { padding-left: 18px; margin: 8px 0 0; font-size: 14px; }
details.regeln li { margin-bottom: 4px; }

/* Modal (Kartenanzeige) */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(40, 30, 16, .55);
  display: grid; place-items: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal .inhalt {
  background: var(--papier); border-radius: 16px; padding: 16px; max-width: 360px; width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,.35); text-align: center; animation: herein .25s ease-out;
}
@keyframes herein { from { transform: scale(.85) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .grosskarte { width: min(260px, 70vw); border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.modal .titel { font-weight: 800; margin: 0 0 10px; }
.modal .knoepfe { display: grid; gap: 8px; margin-top: 12px; }

.ende { text-align: center; }
.ende .pokal { font-size: 46px; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  .zug, .handkarte { transition: none; }
  .zug .puls, .wuerfel.rollt .w, .modal .inhalt { animation: none; }
}
