:root {
  --bg: #0f0d0b;
  --panel: rgba(28, 22, 17, 0.94);
  --panel-solid: #1c1611;
  --line: #4a3a2a;
  --text: #f3ead8;
  --muted: #b7aa92;
  --gold: #ffcf5a;
  --chips: #4aa8ff;
  --mult: #ff5a4a;
  --ok: #6fdc8c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

#board {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: default;
}

button {
  font: inherit;
  color: var(--text);
  background: #2a2019;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #3a2c21; border-color: #7a6246; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: #6b4a1c; border-color: var(--gold); color: #fff6e0; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #85601f; border-color: #ffe08a; }

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 5px;
  font: 600 0.8em system-ui, sans-serif;
  text-align: center;
  color: var(--text);
  border: 1px solid #6a5842;
  border-radius: 4px;
  background: #241b14;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 18px;
  background: linear-gradient(#17120e, rgba(23, 18, 14, 0.85));
  border-bottom: 1px solid #2c231b;
  z-index: 5;
}
.hud-title { font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.hud-title small { display: block; font-weight: 500; font-size: 13px; color: var(--muted); }
.hud-score { flex: 1; min-width: 200px; max-width: 460px; }
.hud-score .line { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.hud-score .line b { font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.hud-score .line .target b { color: var(--gold); }
.progress {
  height: 10px;
  margin-top: 4px;
  border: 1px solid #5a4632;
  border-radius: 6px;
  background: #120e0b;
  overflow: hidden;
}
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, #c98a2b, var(--gold)); }
.progress.done > div { background: linear-gradient(90deg, #3fae63, var(--ok)); }
.hud-stat { font-size: 14px; color: var(--muted); white-space: nowrap; }
.hud-stat b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.pips { display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 4px; }
.pip { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--gold); }
.pip.on { background: var(--gold); }
.money b { color: var(--gold); }
.hud-buttons { display: flex; gap: 8px; margin-left: auto; }
.hud-buttons button { padding: 6px 10px; }

/* ---------- Fußzeile ---------- */
#footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 18px;
  font-size: 14px;
  color: var(--muted);
  background: linear-gradient(rgba(23, 18, 14, 0.85), #17120e);
  border-top: 1px solid #2c231b;
  z-index: 5;
}
#bagStrip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1d1611;
  cursor: pointer;
}
#bagStrip:hover { border-color: #7a6246; }
#bagStrip span { display: inline-flex; align-items: center; gap: 3px; color: var(--text); font-variant-numeric: tabular-nums; }
#bagStrip img { width: 20px; height: 20px; }
#hint { flex: 1; text-align: center; color: var(--text); }
#bossInfo { text-align: right; max-width: 40%; }
#bossInfo b { color: #9fd8ff; }

/* ---------- Laden ---------- */
#shop {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 370px;
  padding: 76px 16px 60px;
  overflow-y: auto;
  background: var(--panel-solid);
  border-left: 1px solid #3a2d21;
  z-index: 4;
}
#shop[hidden] { display: none; }
#shop h2 { margin: 6px 0 2px; font-size: 22px; }
#shop h3 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
#shop .reward { font-size: 13px; color: var(--muted); }
#shop .wallet { margin: 6px 0; font-size: 18px; }
#shop .wallet b { color: var(--gold); font-size: 24px; }
.card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #241c15;
}
.card img { width: 40px; height: 40px; }
.card .name { font-weight: 600; }
.card .rule { font-size: 13px; color: var(--muted); line-height: 1.3; }
.card.sold { opacity: 0.4; }
.card.selected { border-color: var(--gold); background: #31261a; }
.card button { white-space: nowrap; }
.shop-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.shop-row button { flex: 1; }
#shop .next { width: 100%; margin-top: 16px; padding: 10px; font-size: 16px; }
#shop .placing {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: #33271a;
  color: var(--text);
}
#shop .msg { min-height: 1.3em; margin-top: 8px; font-size: 13px; color: #ffb09a; }

/* ---------- Modale Fenster ---------- */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 4, 0.72);
  z-index: 10;
}
#overlay[hidden] { display: none; }
#modal {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 22px 26px;
  border: 1px solid #6a5238;
  border-radius: 14px;
  background: var(--panel-solid);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
#modal h2 { margin: 0 0 12px; font-size: 26px; }
#modal h2.win { color: var(--ok); }
#modal h2.lose { color: #ff8a70; }
#modal h2.boss { color: #9fd8ff; }
#modal p { line-height: 1.45; }
#modal ol { padding-left: 22px; line-height: 1.45; }
#modal ol li { margin-bottom: 6px; }
#modal .keys { color: var(--muted); font-size: 14px; }
#modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
#modal .small { font-size: 12px; color: var(--muted); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 12px 0; }
.legend div { display: flex; gap: 8px; align-items: center; font-size: 14px; line-height: 1.3; }
.legend img { width: 28px; height: 28px; flex: none; }
.legend span { color: var(--muted); }
.legend b { color: var(--text); }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 12px 0; }
.stats b { color: var(--gold); font-variant-numeric: tabular-nums; }
.bag-list .card { grid-template-columns: 36px 1fr auto auto; }
.bag-list .card img { width: 36px; height: 36px; }
.bag-list .count { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
