/* Königreich - «Tusche auf Papier»: Vollbild-Karte mit Leisten oben und unten, für den Daumen gebaut.
   Die Leisten sind Papierkarten mit Tuschrand (aussen ein kräftiger Strich, innen eine Haarlinie, Ecken ungleich rund wie von
   Hand geschnitten). Rot (Siegellack) nur für das Wichtigste: «Weiter» im Pause-Band und die roten Punkte an den Knöpfen
   (Zahl der Untätigen, Späher wartet); auf der Karte gehört Rot der eigenen Seite. Alles andere ist schwarze Tinte.
   papa.css liefert den Look der anderen Papa-Spiele; diese Datei lädt nur reich.html und überschreibt ihn hier. */
:root { color-scheme: light; }
html, body { height: 100%; min-height: 0; overflow: hidden; overscroll-behavior: none; }
html { background: #f2e9d4; }
body.reich { --papier: #f2e9d4; --karte: #f8f2e3; --karte-tief: #ece2c9; --tinte: #241e19; --tinte-2: #5a5047; --rot: #b22e1c; --rot-tief: #86200f;
  --haar: rgba(36,30,25,.5); --serif: Georgia, "Noto Serif", "Droid Serif", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --schatten: 0 1.5px 0 rgba(36,30,25,.22), 0 7px 16px -6px rgba(60,40,20,.38);
  background: var(--papier); color: var(--tinte); font: 500 16px/1.42 var(--sans);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#welt { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#welt.zieht { cursor: grabbing; }

/* Grundformen. Papierkarte mit Tuschrand; Siegel: flaches Rot mit eingeprägtem Ring; Stempel: dasselbe in Tinte (gefüllt, das
   Zeichen in Papierfarbe) - für Knöpfe, die gerade «an» sind. Keine Verläufe, kein Weichzeichner. */
.blatt { background: var(--karte); border: 2px solid var(--tinte); color: var(--tinte);
  box-shadow: inset 0 0 0 2px var(--karte), inset 0 0 0 3px var(--haar), var(--schatten); }
.siegel { background: var(--rot); color: var(--karte); border-color: var(--rot-tief);
  box-shadow: inset 0 0 0 2px var(--rot), inset 0 0 0 3px rgba(248,242,227,.42), 0 1.5px 0 var(--rot-tief), 0 6px 14px -6px rgba(90,25,10,.5); }
.stempel { background: var(--tinte); color: var(--karte); border-color: var(--tinte);
  box-shadow: inset 0 0 0 2px var(--tinte), inset 0 0 0 3px rgba(248,242,227,.4), 0 1.5px 0 rgba(36,30,25,.5), 0 6px 14px -6px rgba(36,30,25,.45); }

/* Kopfzeile: Haus und Zurück links, Pause rechts, darunter (oder dazwischen) die Vorräte */
.oben { position: fixed; z-index: 5; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; pointer-events: none; }
.oben > * { pointer-events: auto; }
.oben .platz { flex: 1; pointer-events: none; }
.oben .zurueck { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  cursor: pointer; padding: 0; appearance: none; font: inherit; }
.oben .zurueck svg { display: block; }
.oben .zurueck:active { transform: translateY(1px); }
.vorrat { order: 5; width: 100%; display: flex; gap: 8px; pointer-events: none; }
.chip { display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 6px; min-width: 84px; height: 38px;
  border-radius: 14px 11px 13px 10px / 11px 14px 10px 13px; font: 800 1.08rem/1 var(--sans); font-variant-numeric: tabular-nums; }
.chip canvas { flex: 0 0 auto; }
.chip.puls { animation: puls .45s ease-out; }
@keyframes puls { 0% { transform: scale(1); } 35% { transform: scale(1.1); background: var(--karte-tief); } 100% { transform: scale(1); } }
@media (min-width: 640px) {
  .oben .platz { display: none; }
  .vorrat { order: 1; flex: 1; width: auto; justify-content: center; }
  #pause { order: 2; }
}

/* Pause-Knopf: in der Pause ein Tinten-Stempel mit dem Weiter-Dreieck in Papierfarbe */
#pause .ic-weiter { display: none; }
#pause.an .ic-pause { display: none; }
#pause.an .ic-weiter { display: block; }
#pause.an { background: var(--tinte); color: var(--karte); border-color: var(--tinte);
  box-shadow: inset 0 0 0 2px var(--tinte), inset 0 0 0 3px rgba(248,242,227,.4), 0 1.5px 0 rgba(36,30,25,.5), 0 6px 14px -6px rgba(36,30,25,.45); }

/* Knöpfe mit Text (Weiter, Zur Anmeldung) */
.knopf { appearance: none; border: 2px solid var(--tinte); border-radius: 13px 11px 12px 10px; min-height: 52px; font: 700 1.05rem var(--serif); cursor: pointer; }
.knopf:active { transform: translateY(1px); }
.knopf.siegel:active { box-shadow: inset 0 0 0 2px var(--rot), inset 0 0 0 3px rgba(248,242,227,.42); }
.knopf.stempel:active { box-shadow: inset 0 0 0 2px var(--tinte), inset 0 0 0 3px rgba(248,242,227,.4); }

/* Aktive Pause: ein schmales Band unter der Kopfzeile; quer auf dem Handy sitzt es kompakt in der Kopfzeile selbst (unten
   im Querformat-Block). Es steckt in #oben, damit leisten() es mitmisst. Die volle Zeile lässt keine Fingertipps durch, nur
   das Band selbst. */
.oben > .pause-band { order: 6; flex: 0 0 100%; display: flex; justify-content: center; pointer-events: none; }
.band { pointer-events: auto; width: 100%; max-width: 520px; display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 8px;
  border-radius: 18px 15px 17px 14px / 15px 18px 14px 17px; animation: band-rein .28s ease-out; }
@keyframes band-rein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.band-zeichen { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--tinte); }
.band-text { flex: 1; min-width: 0; margin: 0; line-height: 1.25; }
.band-text b { font: 700 1.08rem/1.2 var(--serif); }
.band-text .rest { color: var(--tinte-2); text-wrap: balance; }
.band .knopf { flex: 0 0 auto; min-height: 48px; padding: 0 18px 0 14px; display: flex; align-items: center; gap: 7px; border-color: var(--rot-tief); }

/* Schmales Handy: zwei Zeilen statt eines Umbruchs mitten im Satz */
@media (max-width: 479px) {
  .band-text b, .band-text .rest { display: block; }
  .band-text .trenn { display: none; }
  .band-text .rest { font-size: .92rem; }
  .band-text .rest::first-letter { text-transform: uppercase; }
}
/* Unter 400 px fehlt dem Satz neben dem Weiter-Knopf der Platz («geben» stünde allein in der zweiten Zeile). Das Pause-Zeichen
   ist entbehrlich: «Pause» steht fett daneben, und oben rechts steht der Weiter-Stempel. */
@media (max-width: 399px) {
  .band-zeichen { display: none; }
  .band { padding-left: 14px; }
}
/* Unter 360 px auch das Dreieck im Knopf weglassen (es steht ja oben rechts): so bleibt der Satz in einer Zeile. */
@media (max-width: 359px) {
  .band .knopf svg { display: none; }
  .band .knopf { padding: 0 17px; }
}

/* Fund-Meldung («Schafe entdeckt!»): direkt unter der Kopfzeile samt Pause-Band. Absolut, damit #oben nicht höher wird -
   leisten() misst #oben für die Kameragrenzen, sonst spränge die Karte bei jeder Meldung. Papierkarte mit Tinten-Stempel
   (Fernrohr), Serifenschrift; die ganze Fläche ist ein Knopf für den Daumen (Antippen fährt zum Fund), der Pfeil im
   Tuschkreis sagt: hier geht es hin. */
.oben > .entdeckt { position: absolute; top: calc(100% + 8px); left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: min(420px, 100%);
  min-height: 54px; display: flex; align-items: center; gap: 11px; padding: 6px 10px 6px 7px; border-radius: 20px 16px 19px 15px / 16px 20px 15px 19px; appearance: none;
  font: 700 1.16rem/1.2 var(--serif); text-align: left; cursor: pointer; animation: band-rein .28s ease-out; }
.entdeckt-zeichen { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50% 47% 52% 48%; display: grid; place-items: center; border: 1.5px solid var(--tinte); }
.entdeckt-text { flex: 1 1 auto; min-width: 0; }
.entdeckt-pfeil { flex: 0 0 auto; width: 30px; height: 30px; margin-left: 2px; border-radius: 50%; display: grid; place-items: center; color: var(--tinte); border: 2px solid var(--tinte); }
.oben > .entdeckt:active { transform: translateY(1px); background: var(--karte-tief); }
.entdeckt:focus-visible { outline: 3px solid var(--tinte); outline-offset: 3px; }

/* Hinweis über der unteren Leiste: Papier mit kräftigem Tusche-Doppelrand, damit er sich von der Karte abhebt.
   max-content: mit left 50% stünde sonst nur die halbe Breite zur Verfügung, und der kurze Satz bräche mitten durch. Lange
   Sätze brechen auf dem Handy in zwei gleich lange Zeilen (balance); auf dem Tablet und quer passt der Satz in eine Zeile.
   Unter 360 px reichen 84vw nicht mehr für zwei Zeilen: dort fast volle Breite und etwas kleinere Schrift.
   Die Höhe: fest über einer einzeiligen Auswahlleiste, damit die Blase nicht bei jeder Auswahl hüpft. Wird die Leiste höher
   (der Status bricht um), weicht sie aus: --unten-h ist die gemessene Höhe von #unten (setzt reich-spiel.js). */
.hinweis { position: fixed; z-index: 4; left: 50%; transform: translateX(-50%);
  bottom: max(calc(max(10px, env(safe-area-inset-bottom)) + 156px), calc(var(--unten-h, 0px) + 10px)); transition: bottom .2s ease-out;
  width: max-content; max-width: min(84vw, 600px); padding: 10px 16px; border-radius: 15px 12px 14px 11px / 12px 15px 11px 14px;
  box-shadow: inset 0 0 0 2px var(--karte), inset 0 0 0 3.2px var(--tinte-2), var(--schatten);
  font-weight: 700; text-align: center; line-height: 1.3; text-wrap: balance; pointer-events: none; animation: erscheint .35s ease-out; }
@keyframes erscheint { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 359px) {
  .hinweis { max-width: calc(100vw - 24px); padding: 9px 14px; font-size: .94rem; }
}

/* Unten: Auswahl und vier grosse Knöpfe */
.unten { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
  padding: 0 max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.unten > * { pointer-events: auto; }
.info { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 9px 10px 9px 16px; border-radius: 17px 14px 16px 13px / 14px 17px 13px 16px;
  max-width: 640px; width: 100%; margin: 0 auto; }
.info-text { flex: 1; min-width: 0; }
.info-text b { display: block; font: 700 1.12rem/1.25 var(--serif); }
.info-text span { display: block; color: var(--tinte-2); font-size: .92rem; margin-top: 1px; }
.zu { appearance: none; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; font: 400 1.15rem/1 var(--sans); cursor: pointer;
  display: grid; place-items: center; padding: 0; }
.info-knoepfe { display: flex; gap: 8px; flex: 0 0 auto; }
.zu:active { transform: translateY(1px); }

/* Stecknadel: aus liegt sie schräg auf dem Papier, an steckt sie gerade im Tinten-Stempel. Dann bleibt die Auswahl nach Befehlen;
   die Karte selbst bekommt dazu einen kräftigeren Innenrand. */
.pin svg { transform: rotate(40deg); transition: transform .22s cubic-bezier(.3, 1.5, .5, 1); }
.pin.an svg { transform: rotate(0deg) translateY(1px); }
.zu.pin.an { background: var(--tinte); color: var(--karte); border-color: var(--tinte);
  box-shadow: inset 0 0 0 2px var(--tinte), inset 0 0 0 3px rgba(248,242,227,.4), 0 1.5px 0 rgba(36,30,25,.5), 0 6px 14px -6px rgba(36,30,25,.45); }
.info.blatt.gepinnt { box-shadow: inset 0 0 0 2px var(--karte), inset 0 0 0 3.2px var(--tinte-2), var(--schatten); }

/* Vier gleich breite Knöpfe: Untätig, Alle Bauern, Späher, Zum Dorf. minmax(0, 1fr), damit ein langes Wort die Spalten
   nicht ungleich macht. Die Schrift wird erst unter 390 px etwas kleiner: so bleibt «Alle Bauern» auch auf 360 px in einer
   Zeile, und alle vier Knöpfe behalten dieselbe Höhe (die Hinweis-Blase rechnet mit ihr). */
.leiste { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 640px; width: 100%; margin: 0 auto; }
/* Sind eigene Kämpfer da, kommt ein fünfter Knopf dazu */
.leiste.fuenf { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.leiste.fuenf .werk { font-size: clamp(.62rem, 2.9vw, .74rem); }
.werk.hidden { display: none; }
#ende .knopf { min-height: 50px; }
.karte-box { padding: 14px; gap: 10px; max-width: min(92vw, 420px); }
#karte-cv { width: min(86vw, 62vh, 400px); height: min(86vw, 62vh, 400px); border-radius: 8px; background: var(--karte-tief, #efe5cc); touch-action: manipulation; cursor: crosshair; display: block; margin: 0 auto; }
.karte-legende { margin: 0; font-size: .85rem; }
.pkt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin: 0 2px 0 6px; }
.pkt.eigen { background: #b3281f; } .pkt.feind { background: #24487c; } .pkt.gold { background: #c8a02a; }
.werk { position: relative; appearance: none; min-height: 62px; padding: 6px 3px 6px; border-radius: 15px 12px 14px 11px / 12px 15px 11px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 700 clamp(.7rem, 3.28vw, .8rem)/1.15 var(--sans); cursor: pointer; }
.werk span { max-width: 100%; text-align: center; }
.werk.blatt:active { transform: translateY(2px); background: var(--karte-tief); }
.werk.leer { opacity: .55; }
/* Zahl der Untätigen: ein rotes Siegel an der Ecke */
.marke { position: absolute; top: -8px; right: -5px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%; border: 1.5px solid var(--rot-tief);
  font: 700 .9rem/23px var(--serif); font-style: normal; text-align: center; }
/* Der Späher ist angekommen und wartet: ein roter Punkt wie die Untätig-Marke, aber ohne Zahl (er ist ja nur einer). Einmal
   sanft herein, danach ruhig. */
.werk.wartet::after { content: ''; position: absolute; top: -3px; right: 0; width: 15px; height: 15px; border-radius: 50%; background: var(--rot);
  box-shadow: 0 0 0 2px var(--karte), 0 0 0 3px var(--rot-tief); animation: punkt-rein .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes punkt-rein { from { transform: scale(0); } to { transform: scale(1); } }

/* Kein Zugang */
.schirm { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(242,233,212,.72); }
.karte-mitte { border-radius: 22px 18px 21px 17px / 18px 22px 17px 21px; padding: 24px 22px; display: flex; flex-direction: column; gap: 14px; text-align: center;
  max-width: 360px; width: 100%; }
.karte-mitte h2 { margin: 0; font: 700 1.5rem/1.2 var(--serif); }
body.reich .leise { color: var(--tinte-2); }
a.knopf { text-decoration: none; display: grid; place-items: center; }

/* Querformat auf dem Handy: wenig Höhe. Auswahl links, Knöpfe rechts auf einer Zeile, damit die Karte Platz behält. */
@media (max-height: 520px) and (min-width: 640px) {
  .unten { flex-direction: row; align-items: flex-end; gap: 10px; }
  .info { flex: 1; max-width: none; margin: 0; padding: 6px 6px 6px 14px; }
  .info-text span { font-size: .86rem; }
  /* Mit vier Knöpfen bleibt der Auswahl weniger Breite: eine Zeile, notfalls mit «…», statt höher zu werden und unter
     die Hinweis-Blase zu wachsen */
  .info-text b, .info-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .leiste { width: min(50vw, 440px); margin: 0 0 0 auto; }
  .werk { min-height: 52px; padding: 4px 4px 4px; font-size: .74rem; }
  .hinweis { bottom: max(calc(max(10px, env(safe-area-inset-bottom)) + 74px), calc(var(--unten-h, 0px) + 10px)); }
  /* Pause: quer bleiben der Karte nur gut 250 px Höhe, eine zweite Zeile für das Band nähme ihr fast ein Drittel. Darum rückt
     das Band in die Kopfzeile zwischen Vorräte und Pause-Knopf, so hoch wie die runden Knöpfe: nur «Pause» und «Weiter»
     (das Dreieck trägt schon der runde Knopf gleich daneben). Die Kopfzeile wird in der Pause nicht höher, die Karte springt
     nicht, und die Meldung steht gleich darunter. Etwas engere Abstände, damit das auch auf 640 px und mit vierstelligen
     Vorräten in eine Zeile passt - sonst rutschte der Pause-Knopf in eine zweite Zeile. */
  .oben { column-gap: 8px; }
  .vorrat { gap: 6px; }
  .chip { min-width: 0; padding: 3px 11px 3px 5px; gap: 5px; }
  .oben > .pause-band { order: 1; flex: 0 1 auto; }
  .band { height: 46px; padding: 2px 2px 2px 16px; gap: 12px; border-radius: 23px; }
  .band-zeichen, .band-text .trenn, .band-text .rest, .band .knopf svg { display: none; }
  .band-text { white-space: nowrap; }
  .band .knopf { min-height: 0; height: 40px; padding: 0 17px; border-radius: 20px; font-size: 1rem; }
}

/* Bauen: Knopfzeile unter der Auswahl (Dorfzentrum mit Schlange, Bauern mit «Haus bauen», Baumodus mit ✓ und ✕). Sie
   steht als eigene Zeile unter Text und Knöpfen; gesperrte Knöpfe sind grau (Tinte, nicht Rot). */
#info-aktion { flex: 0 0 100%; order: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 2px; }
#info-aktion.hidden { display: none; }
#info-aktion .knopf { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 4px 16px 4px 12px; }
#info-aktion .knopf.team { flex: 1 1 0; min-width: 0; gap: 5px; padding: 4px 6px; justify-content: center; }
#info-aktion .knopf.team .knopf-titel { font-size: .9rem; }
@media (max-width: 480px) { #info-aktion .knopf.team canvas { display: none; } #info-aktion .knopf.team .knopf-text { align-items: center; } }
#info-aktion .knopf.ja { width: 56px; min-height: 52px; padding: 0; justify-content: center; }
#info-aktion .knopf canvas { display: block; flex: 0 0 auto; }
.knopf-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.knopf-titel { font: 700 1.02rem/1.15 var(--serif); }
.knopf-zusatz { font: 600 .8rem/1.2 var(--sans); opacity: .92; }
.knopf:disabled, .knopf:disabled:active { background: var(--karte-tief); color: var(--tinte-2); border-color: var(--tinte-2);
  box-shadow: inset 0 0 0 2px var(--karte-tief), inset 0 0 0 3px var(--haar); transform: none; cursor: default; }
/* die Schlange: Bauern-Bildchen in Papierkreisen; das erste trägt einen Fortschrittsbalken */
.schlange { display: flex; gap: 6px; flex: 0 0 auto; }
.schlange-platz { position: relative; width: 48px; height: 48px; padding: 0; border-radius: 50%; display: grid; place-items: center; appearance: none; cursor: pointer; }
.schlange-platz:active { transform: translateY(1px); }
.schlange-platz canvas { display: block; }
.fort-spur { position: absolute; left: 7px; right: 7px; bottom: 3px; height: 6px; border: 1.5px solid var(--tinte); border-radius: 3px; overflow: hidden; }
.fort-spur i { display: block; height: 100%; width: 0; background: var(--tinte); }
.aktion-grund { flex: 0 0 100%; margin: 0; color: var(--tinte-2); font-size: .9rem; line-height: 1.3; }
/* voll: die Zahl unterstrichen (Tinte) */
.chip.voll b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
/* Schmales Handy: vier Vorrats-Chips nebeneinander, jeder gleich breit und knapp */
@media (max-width: 399px) {
  .vorrat .chip { flex: 1 1 0; min-width: 0; padding: 3px 6px 3px 4px; gap: 3px; font-size: .95rem; }
}

/* «Haus bauen» in der Knopfzeile des Infofelds (neben Stecknadel und ✕): kompakt, auf dem Handy nur das Hauszeichen */
.info-haus { display: flex; }
.info-haus .knopf { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 3px 14px 3px 10px; }   /* so hoch wie Stecknadel und ✕: das Infofeld wird nicht höher */
.info-haus canvas { display: block; flex: 0 0 auto; }
/* Handy quer: zwei Bau-Knöpfe nebeneinander (Haus, Kaserne) wären zu breit, nur die Zeichen */
@media (max-height: 520px) and (min-width: 640px) {
  .info-haus .knopf { width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .info-haus .knopf-text { display: none; }
}
@media (max-width: 479px) {
  .info-haus .knopf { width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .info-haus .knopf-text { display: none; }
}
