/* Gemeinsames Aussehen der Demo-Testspiele: Waldgrün, Moos, Pergament, dezentes Gold (Konzepte/DEMOS-VISUELLE-VORGABEN.md). */
:root { --wald:#14281c; --wald-tief:#0c1811; --moos:#335f40; --pergament:#f6eed6; --text:#e8e2cc; --gedaempft:#b9b9a2; --gold:#d9c48a; --gold-hell:#efdca6; --rost:#c98b6e; --kante:#d9c48a66; --flaeche:#0f1d14e6; }
* { box-sizing:border-box; }
/* HTML hidden gilt immer, auch gegen display:flex/grid einzelner Container (Codex-Befund: AX-Baum). */
[hidden] { display:none !important; }
html, body { margin:0; height:100%; background:var(--wald-tief); color:var(--text); font:15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; overflow:hidden; overscroll-behavior:none; }
canvas#welt { position:fixed; inset:0; width:100%; height:100%; display:block; touch-action:none; }
button, a.knopf { font:inherit; color:var(--pergament); background:#1d3325; border:1px solid var(--kante); border-radius:10px; padding:8px 14px; min-height:40px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; gap:6px; }
button:hover, a.knopf:hover { border-color:var(--gold); background:#24402e; }
button:focus-visible, a.knopf:focus-visible { outline:2px solid var(--gold-hell); outline-offset:2px; }
button.haupt { background:#5f4f27; border-color:var(--gold); color:#fff7df; font-weight:600; }
button:disabled { opacity:.45; cursor:default; }

/* Kopfleiste: Kennzeichnung links, Spielstand mittig, Pause/Neustart/Zurück rechts – immer erreichbar. */
.leiste { position:fixed; left:0; right:0; top:0; z-index:5; display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:10px; padding:8px 12px; padding-top:max(8px, env(safe-area-inset-top)); background:linear-gradient(#0c1811ee, #0c181100); pointer-events:none; }
.leiste > * { pointer-events:auto; }
.marke { justify-self:start; display:flex; flex-direction:column; gap:1px; }
.marke b { font-size:13px; letter-spacing:.06em; text-transform:uppercase; color:var(--gold); }
.marke span { font-size:12px; color:var(--gedaempft); }
.werkzeuge { justify-self:end; display:flex; gap:6px; }
.werkzeuge button, .werkzeuge a.knopf { min-height:36px; padding:6px 10px; font-size:13px; }
.stand { display:flex; align-items:center; gap:10px; padding:6px 14px; background:var(--flaeche); border:1px solid var(--kante); border-radius:12px; font-variant-numeric:tabular-nums; }

/* Hinweis zum Modellstand – getrennt von Spielbarkeit und Online. */
.modellhinweis { position:fixed; left:10px; bottom:calc(10px + env(safe-area-inset-bottom)); z-index:4; max-width:min(360px, 60vw); font-size:11.5px; color:var(--gedaempft); background:#0c1811c9; border:1px solid #d9c48a33; border-radius:8px; padding:5px 8px; pointer-events:none; }

/* Dialogflächen (Auswahl, Pause, Ergebnis, Fehler). */
.ebene { position:fixed; inset:0; z-index:10; display:grid; place-items:center; padding:16px; background:#08100bcc; overflow:auto; }
.ebene[hidden] { display:none; }
.panel { width:min(760px, 100%); max-height:calc(100dvh - 32px); overflow:auto; background:linear-gradient(160deg, #183022, #0d1b13); border:1px solid var(--kante); border-radius:16px; padding:18px 20px; box-shadow:0 18px 50px #0008; }
.panel h1, .panel h2 { margin:2px 0 6px; color:var(--pergament); font-size:24px; text-wrap:balance; }
.panel .kicker { font-size:12px; letter-spacing:.12em; text-transform:uppercase; color:var(--gold); }
.panel p { margin:6px 0; color:var(--text); max-width:65ch; }
.panel .klein { font-size:12.5px; color:var(--gedaempft); }
.reihe { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
/* Hauptaktion bleibt beim Scrollen langer Listen sichtbar (Codex-Abnahme). */
.panel .reihe.fest { position:sticky; bottom:-18px; z-index:2; margin:12px -20px -18px; padding:14px 20px 16px; background:linear-gradient(#0d1b1300, #0d1b13 35%); }

/* Bodensteuerung: Joystick links (nur Touch), Aktionen rechts. */
.steuer { position:fixed; left:0; right:0; bottom:0; z-index:6; display:flex; justify-content:space-between; align-items:flex-end; padding:12px 14px calc(14px + env(safe-area-inset-bottom)); pointer-events:none; }
.joystick { --sx:0px; --sy:0px; pointer-events:auto; width:132px; height:132px; border-radius:50%; background:#0f1d14b0; border:1px solid var(--kante); position:relative; touch-action:none; display:none; }
.joystick::after { content:""; position:absolute; left:50%; top:50%; width:56px; height:56px; margin:-28px 0 0 -28px; border-radius:50%; background:#d9c48a55; border:1px solid var(--gold); transform:translate(var(--sx), var(--sy)); }
.aktionen { pointer-events:auto; display:flex; gap:10px; margin-left:auto; }
.akt { position:relative; width:76px; height:76px; border-radius:16px; flex-direction:column; gap:2px; font-size:12.5px; font-weight:600; padding:6px; touch-action:none; user-select:none; -webkit-user-select:none; overflow:hidden; }
.akt small { font-weight:400; font-size:10.5px; color:var(--gedaempft); }
.akt.gedrueckt { background:#5f4f27; border-color:var(--gold-hell); }
.akt .cd { position:absolute; inset:0; background:conic-gradient(#08100bd0 calc(var(--rest, 0) * 1turn), transparent 0); pointer-events:none; }
.akt .cdzahl { position:absolute; inset:auto 0 6px; font-size:13px; color:var(--gold-hell); }
.akt.bereit { border-color:var(--gold); }
.akt.aus { opacity:.55; }
@media (pointer:coarse) { .joystick { display:block; } .tastenhinweis { display:none; } }
/* Touch hochkant (Codex-Befund 390 px): vier Aktionen als 2×2-Raster neben dem Joystick, drei bleiben in einer Reihe. */
@media (pointer:coarse) and (max-width:620px) {
  .aktionen:has(.akt:nth-child(4)) { display:grid; grid-template-columns:repeat(2, 62px); gap:8px; }
  .akt { width:62px; height:62px; font-size:12px; }
  .joystick { width:112px; height:112px; }
  .steuer { padding-left:10px; padding-right:10px; }
}
@media (max-width:620px) {
  .leiste { grid-template-columns:1fr auto; } .marke span { display:none; } .stand { grid-column:1 / -1; grid-row:2; justify-self:center; }
  .akt { width:66px; height:66px; } .joystick { width:118px; height:118px; }
  .modellhinweis { bottom:auto; top:96px; max-width:70vw; }
}
.banner { position:fixed; left:50%; top:30%; z-index:7; transform:translate(-50%, -50%); padding:10px 22px; border-radius:14px; background:var(--flaeche); border:1px solid var(--gold); color:var(--pergament); font-size:26px; font-weight:700; letter-spacing:.04em; pointer-events:none; opacity:0; transition:opacity .25s; }
.banner.zeigen { opacity:1; }
@media (prefers-reduced-motion: reduce) { .banner { transition:none; } }
.zahl { position:fixed; z-index:6; pointer-events:none; font-weight:700; color:var(--pergament); text-shadow:0 1px 3px #000; font-size:17px; transform:translate(-50%, -50%); }
.fehler { color:#f1b9a3; }
