/* AMEISEN - eigenes Blatt.
   Wie bei Revier und Wurm fehlt die gemeinsame Lobby-Basis mit Absicht: es
   gibt keine Lobby, keinen Raumcode und keine vier Bildschirme. Uebernommen
   ist nur der Aufbau der Farben, damit die Seite zu den anderen gehoert -
   hier ins Erdige gedreht. Das Spiel schaut in einen Sandhang. */

:root {
  --bg: #1a1208;
  --bg2: #241a0d;
  --panel: rgba(38, 27, 14, .93);
  --line: rgba(226, 176, 92, .22);
  --ink: #f6ecd9;
  --muted: #b79a71;
  --akzent: #e8a13a;
  --akzent2: #8fc46a;
  --gold: #ffd447;
  --bad: #e2624a;
  --r: 14px;
  --shadow: 0 12px 34px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

#feld { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ── Meldungsstreifen ───────────────────────────────────────────────────── */
#status {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70; text-align: center;
  font-size: 13px; color: #2a1c08; background: var(--gold); padding: 3px 0;
}
#status:empty { display: none; }

.klein { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }

/* ── Zahlen oben ────────────────────────────────────────────────────────── */
#kopf {
  position: fixed; z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 8px); left: 8px; right: 8px;
  display: flex; flex-wrap: wrap; gap: 6px;
  pointer-events: none;
}
#kopf[hidden] { display: none; }
.wert {
  display: flex; align-items: baseline; gap: 5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.wert strong { font-size: 17px; letter-spacing: -.01em; }
.wert .sym { font-size: 14px; }
.wert.breit { margin-left: auto; }

/* ── Beutel und Knoepfe unten ───────────────────────────────────────────── */
#fuss {
  position: fixed; z-index: 20;
  left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
}
#fuss[hidden] { display: none; }
#beutel {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; box-shadow: var(--shadow); max-width: 62vw;
}
#beutelPunkte { letter-spacing: 2px; color: var(--gold); font-size: 13px; }
#knoepfe { margin-left: auto; display: flex; gap: 8px; pointer-events: auto; }

.btn {
  font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; box-shadow: var(--shadow);
}
.btn:active { transform: translateY(1px); }
.btn.rund { width: 42px; height: 42px; padding: 0; font-size: 18px; }
.btn.primaer { background: var(--akzent); border-color: var(--akzent); color: #241a0d; }
.btn.gefahr { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn[disabled] { opacity: .42; cursor: default; }

/* ── Ueberlagerungen ────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 7, 3, .66);
  backdrop-filter: blur(3px);
}
.overlay[hidden] { display: none; }
.blatt {
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r) var(--r) 0 0;
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
.blatt.schmal { width: min(420px, 100%); border-radius: var(--r); margin: auto; }
.overlay:has(.schmal) { align-items: center; }
.blatt header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  position: sticky; top: -16px; background: var(--bg2); padding: 4px 0 8px; z-index: 2;
}
.blatt h2 { margin: 0; font-size: 20px; }
.blatt h3 { margin: 0 0 4px; font-size: 16px; }
.kasse {
  margin-left: auto; font-variant-numeric: tabular-nums; color: var(--gold);
  font-size: 17px;
}
.blatt header .btn.rund { margin-left: 4px; }

/* ── Der Laden ──────────────────────────────────────────────────────────── */
#ladenListe { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#ladenListe li {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center;
  background: rgba(0, 0, 0, .22); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 11px;
}
#ladenListe .ico { font-size: 24px; text-align: center; }
#ladenListe .name { font-weight: 700; }
#ladenListe .stufe { color: var(--akzent2); font-weight: 700; font-size: 13px; }
#ladenListe .was { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
#ladenListe .kauf {
  font: inherit; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 82px; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  color: #241a0d; background: var(--akzent); border: 1px solid var(--akzent);
}
#ladenListe .kauf[disabled] { background: transparent; color: var(--muted); border-color: var(--line); cursor: default; }
#ladenListe li.reich { border-color: rgba(232, 161, 58, .5); }

#umzug {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
#umzug .btn { margin-top: 8px; }

.regeln { margin: 0; padding-left: 20px; display: grid; gap: 9px; font-size: 14.5px; }
.regeln b { color: var(--akzent); font-weight: 700; }

.bilanz { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.bilanz li {
  display: flex; justify-content: space-between; gap: 12px;
  background: rgba(0, 0, 0, .22); border-radius: 10px; padding: 8px 12px;
  font-variant-numeric: tabular-nums;
}
.bilanz b { color: var(--gold); }
#weg .btn { width: 100%; margin-top: 4px; }

.zurueck {
  display: inline-block; margin-top: 14px; color: var(--muted);
  text-decoration: none; font-size: 14px;
}
.zurueck:hover { color: var(--ink); }

/* ── Schmale Bildschirme ────────────────────────────────────────────────── */
/* Auf 390 px passen vier Pillen nicht in eine Zeile. Sie duerfen umbrechen -
   aber dann links weiter, nicht nach rechts abgedraengt, sonst steht die
   Ertragszahl allein in einer zweiten Zeile ueber der halben Breite. */
@media (max-width: 560px) {
  .wert { padding: 3px 9px; }
  .wert strong { font-size: 15px; }
  .wert.breit { margin-left: 0; }
  #beutel { padding: 4px 11px; }
}

/* ── Fliegende Zahl beim Abliefern ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
}
