/* ROTORSTURM — HUD im Stil eines militärischen Bordcomputers.
   Wichtig: alles über dem Canvas ist halbtransparent / pointer-events:none,
   weil das Spiel während der Upgrade-Auswahl WEITERLÄUFT und sichtbar
   bleiben muss. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e0c;
  --ink: #d8e6dc;
  --dim: #7f9488;
  --accent: #8dd35f;
  --amber: #f5b642;
  --red: #ef4444;
  --blue: #38bdf8;
  --panel: rgba(9, 16, 13, 0.86);
  --line: rgba(141, 211, 95, 0.28);
  --mono: "Consolas", "SF Mono", "Roboto Mono", ui-monospace, monospace;
}

html, body { height: 100%; overflow: hidden; background: var(--bg); }

body {
  font-family: var(--mono);
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}

#app { position: fixed; inset: 0; }

#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Scanline-/Vignetten-Overlay für die Bordmonitor-Optik */
#app::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.13) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
  z-index: 5;
}

/* ============ HUD ============ */
#hud {
  position: absolute; inset: 0;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-content: start;
  gap: 12px;
  pointer-events: none;
  z-index: 10;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.hud-left { justify-self: start; width: min(280px, 28vw); }
.hud-center { justify-self: center; text-align: center; }
.hud-right { justify-self: end; text-align: right; }

.hud-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.hud-row-center { justify-content: center; }
.hud-row-right { justify-content: flex-end; align-items: center; }

.chip {
  background: rgba(9, 16, 13, 0.7);
  border: 1px solid var(--line);
  padding: 3px 8px;
  color: var(--dim);
  white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 700; }
.chip-lvl b { color: var(--accent); }
.chip-dim { opacity: 0.55; font-size: 10px; }

.bar {
  position: relative;
  height: 17px;
  background: rgba(9, 16, 13, 0.75);
  border: 1px solid var(--line);
  margin-bottom: 5px;
  overflow: hidden;
}
.bar-fill { position: absolute; inset: 0; width: 100%; transform-origin: left; transition: width 0.12s linear; }
.bar-hp .bar-fill { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.bar-xp { height: 10px; }
.bar-xp .bar-fill { background: linear-gradient(90deg, #0e7490, #38bdf8); }
.bar-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; letter-spacing: 0.1em;
  text-shadow: 0 1px 2px #000;
}

.timer { font-size: 30px; font-weight: 700; letter-spacing: 0.1em; text-shadow: 0 2px 8px #000; line-height: 1; }

.boss-bar { margin-top: 10px; width: min(420px, 45vw); }
.boss-name { font-size: 11px; color: var(--red); letter-spacing: 0.18em; margin-bottom: 3px; text-shadow: 0 1px 3px #000; }
.boss-track { height: 9px; background: rgba(9,16,13,0.8); border: 1px solid rgba(239,68,68,0.5); }
.boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #7f1d1d, #ef4444, #fb923c); transition: width 0.1s linear; }

.mod-list { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.mod-item {
  background: rgba(9, 16, 13, 0.7);
  border: 1px solid var(--line);
  border-right-width: 3px;
  padding: 2px 7px;
  font-size: 11px;
  display: flex; gap: 7px; align-items: center;
}
.mod-item .mod-lv { color: var(--amber); font-weight: 700; }
.mod-item .mod-ico { font-size: 12px; }

.icon-btn {
  pointer-events: auto;
  background: rgba(9,16,13,0.7);
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  cursor: pointer;
  padding: 2px 8px;
  font-size: 12px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--accent); }
.icon-btn.off { opacity: 0.4; text-decoration: line-through; }

/* ============ Toast ============ */
.toast {
  position: absolute;
  top: 27%; left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--red);
  text-shadow: 0 0 18px rgba(239,68,68,0.7), 0 2px 6px #000;
  pointer-events: none;
  animation: toastIn 0.35s ease-out;
}
.toast.info { color: var(--amber); text-shadow: 0 0 18px rgba(245,182,66,0.6), 0 2px 6px #000; font-size: 20px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) scale(0.85); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

/* ============ Upgrade-Karten ============ */
.cards {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(1020px, 96vw);
  pointer-events: none;
}
.cards-head {
  display: flex; align-items: baseline; gap: 14px;
  justify-content: center;
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-shadow: 0 1px 4px #000;
}
.cards-title { color: var(--amber); font-weight: 700; }
.cards-hint { color: var(--dim); letter-spacing: 0.06em; }
.cards-queue { color: var(--blue); }

.cards-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.card {
  pointer-events: auto;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rc, var(--line));
  border-top-width: 3px;
  padding: 10px 12px 11px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: transform 0.09s ease, box-shadow 0.09s ease, background 0.09s ease;
  animation: cardIn 0.22s cubic-bezier(0.2, 1.1, 0.4, 1) backwards;
}
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

.card:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px var(--rc), 0 8px 26px rgba(0,0,0,0.6); background: rgba(14, 24, 19, 0.92); }

.card-key {
  position: absolute; top: -3px; right: 8px;
  font-size: 10px; color: var(--rc); opacity: 0.85; font-weight: 700;
}
.card-rarity { font-size: 9.5px; letter-spacing: 0.2em; color: var(--rc); margin-bottom: 2px; }
.card-name { font-size: 14px; font-weight: 700; line-height: 1.25; margin-bottom: 2px; }
.card-type { font-size: 10px; color: var(--dim); margin-bottom: 7px; letter-spacing: 0.08em; }
.card-affixes { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.card-affixes li { font-size: 11.5px; color: var(--ink); padding-left: 11px; position: relative; line-height: 1.35; }
.card-affixes li::before { content: "▸"; position: absolute; left: 0; color: var(--rc); font-size: 9px; top: 2px; }
.card-affixes li.curse { color: #f87171; }
.card-affixes li.curse::before { content: "▾"; color: #f87171; }

/* ============ Overlays ============ */
.overlay {
  position: absolute; inset: 0;
  z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 6, 0.82);
  backdrop-filter: blur(2px);
}
.overlay.hidden, .hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  padding: 30px 38px 28px;
  text-align: center;
  max-width: 560px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.7);
}
.panel h1 { font-size: 40px; letter-spacing: 0.24em; margin-bottom: 4px; text-shadow: 0 0 26px rgba(141,211,95,0.28); }
.panel h1.dead { color: var(--red); text-shadow: 0 0 26px rgba(239,68,68,0.35); }
.panel .sub { color: var(--dim); font-size: 12px; letter-spacing: 0.14em; margin-bottom: 18px; }
.panel .sub.small { margin: 12px 0 0; font-size: 10px; }

.how { list-style: none; text-align: left; font-size: 12px; color: var(--dim); line-height: 1.85; margin-bottom: 18px; }
.how b { color: var(--accent); }

.seed-row { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 16px; font-size: 11px; color: var(--dim); }
.seed-row input {
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 9px;
  width: 190px;
  text-align: center;
}
.seed-row input:focus { outline: none; border-color: var(--accent); }

.btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.2em;
  padding: 11px 30px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn:hover { background: var(--accent); color: #08120a; }

.stats { display: grid; grid-template-columns: auto auto; gap: 5px 26px; font-size: 13px; margin-bottom: 22px; text-align: left; }
.stats .k { color: var(--dim); }
.stats .v { text-align: right; font-weight: 700; }
.stats .v.hi { color: var(--amber); }

.best { margin-top: 15px; font-size: 11px; color: var(--dim); letter-spacing: 0.1em; }

@media (max-width: 700px) {
  .hud-left { width: 46vw; }
  .mod-list { display: none; }
  .cards-row { grid-template-columns: 1fr; }
  .cards-hint { display: none; }
  .panel { padding: 22px; }
  .panel h1 { font-size: 28px; }
}
