:root {
  --bg: #2f5a2c;
  --card: #fffaf0;
  --ink: #3b2f2a;
  --muted: #8a7a70;
  --accent: #e8784d;
  --accent-ink: #fff;
  --line: #eadfce;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overscroll-behavior: none; }
#app { position: fixed; inset: 0; height: 100dvh; }

/* ---------- Karten-Bildschirme ---------- */
.screen { min-height: 100%; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px 16px; overflow-y: auto;
  background: radial-gradient(circle at 50% 110%, #f59a2355, transparent 60%), var(--bg); height: 100%; }
.card { width: 100%; max-width: 380px; background: var(--card); border-radius: 22px; padding: 22px 20px; box-shadow: 0 12px 40px #0004; }
.card h1 { margin: 0 0 8px; font-size: 1.45rem; }
.card h2 { margin: 0 0 12px; }
.card p { margin: 0 0 12px; }
.logo { font-size: 2.4rem; text-align: center; }
.card .logo + h1 { text-align: center; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 12px; font: inherit; font-size: 16px; border: 2px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--accent); }
.pwrow { display: flex; gap: 6px; align-items: center; }
.pwrow input { flex: 1; }
.eye { flex: none; width: 48px; height: 48px; margin-top: 4px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 1.2rem; }
.btn { display: block; width: 100%; padding: 14px; margin-top: 8px; font: inherit; font-weight: 700; text-align: center; text-decoration: none;
  border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.err { color: #c0392b; min-height: 1.2em; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 14px !important; }

/* ---------- Maus gestalten ---------- */
.preview { display: block; width: 260px; height: 190px; margin: 0 auto 8px; border-radius: 16px;
  background: linear-gradient(#cfe6b8, #9fca85); }
.row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; margin-bottom: 10px; }
.row > span { font-weight: 600; font-size: .85rem; color: var(--muted); }
.row > div { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 3px var(--accent); }
.chip { padding: 7px 11px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: inherit; font-size: .85rem; cursor: pointer; color: var(--ink); }
.chip.on { border-color: var(--accent); background: #fdebe2; }

/* ---------- Spiel ---------- */
.playing canvas.game { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.hud-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; align-items: center; gap: 10px;
  pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.round { border: 0; border-radius: 50%; background: #fffaf0e6; color: var(--ink); font: inherit; box-shadow: 0 4px 14px #0003; cursor: pointer;
  display: grid; place-items: center; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.round:active { transform: scale(.92); }
.menu { width: 44px; height: 44px; font-size: 1.2rem; flex: none; }
.firebar { flex: 1; max-width: 260px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: #fffaf0e6; box-shadow: 0 4px 14px #0003; font-size: .9rem; }
.firebar .bar { flex: 1; height: 10px; border-radius: 99px; background: #eadfce; overflow: hidden; }
.firebar .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e8481c, #f7d046); transition: width .5s; }
.firebar.low { animation: pulse 1s infinite; }
@keyframes pulse { 50% { background: #ffd9c7; } }
.online { flex: none; padding: 8px 10px; border-radius: 999px; background: #fffaf0e6; font-size: .85rem; box-shadow: 0 4px 14px #0003; }

.hud-buttons { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 12px; align-items: end; }
.round.small { width: 54px; height: 54px; font-size: 1.4rem; }
.round.big { width: 92px; height: 92px; font-size: 2rem; grid-row: span 2; line-height: 1; display: flex; flex-direction: column; justify-content: center;
  background: #ffe9a8; }
.round.big small { font-size: .62rem; font-weight: 700; margin-top: 2px; }
.round.big:disabled { background: #fffaf0b0; opacity: .75; }
.chat, .hop, .bagbtn { grid-column: 1; }
.action { grid-column: 2; grid-row: 1 / span 3; align-self: end; }

/* ---------- Tasche + Basteln ---------- */
.panel { position: absolute; inset: 0; background: #0005; display: flex; align-items: flex-end; justify-content: center; z-index: 5; }
.panel[hidden] { display: none; }
.sheet-card { width: 100%; max-width: 480px; max-height: 78dvh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0;
  padding: 14px 16px max(16px, env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px #0004; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; padding: 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-weight: 700; color: var(--ink); }
.tabs button.on { border-color: var(--accent); background: #fdebe2; }
.tabs .x { flex: none; width: 44px; }
.sub { font-size: .8rem; font-weight: 700; color: var(--muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.worn-grid { grid-template-columns: repeat(3, 1fr); }
.slot { position: relative; aspect-ratio: 1; border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; color: var(--ink);
  display: grid; place-items: center; padding: 0; }
.slot.sel { border-color: var(--accent); box-shadow: 0 0 0 2px #e8784d55; }
.slot.worn { background: #f6f0e4; }
.slot small { position: absolute; bottom: 3px; font-size: .62rem; color: var(--muted); }
.slot b { position: absolute; right: 6px; bottom: 3px; font-size: .78rem; }
.slot:disabled { opacity: .4; }
.slot.mini { aspect-ratio: auto; height: 52px; }
.ic { position: relative; font-size: 1.7rem; line-height: 1; }
.ic i { position: absolute; right: -10px; top: -4px; font-size: .6rem; font-style: normal; font-weight: 800; background: var(--accent); color: #fff; border-radius: 6px; padding: 0 3px; }
.detail { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.detail .ic { font-size: 2.2rem; }
.detail p { margin: 2px 0 0; font-size: .88rem; color: var(--muted); }
.acts { display: flex; gap: 8px; margin-top: 8px; }
.btn.small { width: auto; flex: 1; padding: 10px 12px; margin-top: 0; font-size: .9rem; }
.btn:disabled { opacity: .45; }
.bench { display: grid; grid-template-columns: repeat(3, 1fr) auto 1fr; gap: 8px; align-items: center; margin: 6px 0 10px;
  padding: 10px; border-radius: 16px; background: #c9a77a33; border: 2px dashed #c9a77a; }
.bench .arrow { font-size: 1.3rem; color: var(--muted); }
.slot.result { background: #f6f0e4; font-size: 1.4rem; color: var(--muted); }
.slot.result.ok { background: #fff3c4; border-color: #f2c94c; animation: glow 1.2s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px #f2c94c55; } }
.book { display: grid; gap: 6px; }
.recipe { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
  font: inherit; color: var(--ink); text-align: left; opacity: .6; }
.recipe.ok { opacity: 1; border-color: #9fca85; }
.recipe span { display: flex; flex-direction: column; }
.recipe .ic { flex: none; width: 44px; text-align: center; }
.grid > p { grid-column: 1 / -1; margin: 0; }
.panel-open .tut { display: none; }
.recipe small { color: var(--muted); }

/* ---------- Tutorial ---------- */
.tut { position: absolute; left: 10px; right: 10px; top: calc(max(10px, env(safe-area-inset-top)) + 58px); z-index: 6; max-width: 440px; margin: 0 auto;
  background: #fffaf0f2; border-radius: 16px; padding: 12px 14px; box-shadow: 0 8px 24px #0004; font-size: .95rem; }
.tut[hidden] { display: none; }
.tut p { margin: 6px 0 8px; }
.tut-dots { display: flex; gap: 4px; }
.tut-dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.tut-dots i.on { background: var(--accent); }
.tut-acts { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.tut-acts .btn { flex: none; }
.link { background: none; border: 0; padding: 6px 2px; font: inherit; font-size: .85rem; color: var(--muted); text-decoration: underline; }
.tut-acts .link:first-child { margin-right: auto; }

.kicked { position: absolute; inset: 0; z-index: 9; background: #000a; display: grid; place-items: center; padding: 16px; }

.toast { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 56px); left: 50%; transform: translate(-50%, -10px); opacity: 0;
  padding: 8px 14px; border-radius: 12px; background: #000c; color: #fff; font-size: .9rem; transition: .3s; pointer-events: none; white-space: nowrap; z-index: 8; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.chatbar { position: absolute; left: 10px; right: 10px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 8px; }
.chatbar[hidden] { display: none; }
.chatbar input { margin: 0; flex: 1; border-radius: 999px; }
.chatbar button { width: 50px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.2rem; }

.sheet { position: absolute; inset: 0; background: #0006; display: grid; place-items: center; padding: 16px; }
