:root {
  --cyan: #4de8ff;
  --amber: #ffaa33;
  --red: #ff4d5e;
  --green: #3ee07a;
  --text: #e8ecf5;
  --muted: #8e99b5;
  --panel: rgba(8, 12, 24, 0.72);
  --line: rgba(120, 160, 255, 0.25);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #02030a; color: var(--text);
  font-family: 'Rajdhani', system-ui, sans-serif; user-select: none;
}
#game, #game canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.small { font-size: 14px; color: var(--muted); }
kbd {
  display: inline-block; min-width: 26px; padding: 1px 7px; margin: 0 2px; border-radius: 5px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-family: inherit; font-size: 14px;
  text-align: center;
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-top-left { position: absolute; top: 16px; left: 18px; width: 240px; }
.hud-top-right { position: absolute; top: 14px; right: 20px; text-align: right; }
.lives { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
#lives-icons { display: flex; gap: 4px; }
.life-icon { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-bottom: 13px solid var(--red); filter: drop-shadow(0 0 4px rgba(255, 77, 94, 0.8)); }
.life-icon.lost { opacity: 0.2; filter: none; }
.bar { position: relative; height: 10px; border-radius: 4px; background: rgba(30, 40, 70, 0.85);
  border: 1px solid var(--line); overflow: hidden; margin-top: 6px; }
.bar > div { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 3px; transition: width 0.15s ease-out; }
#health-fill { background: linear-gradient(90deg, #2fbf66, var(--green)); box-shadow: 0 0 10px rgba(62, 224, 122, 0.6); }
#health-fill.low { background: linear-gradient(90deg, #c0252f, var(--red)); animation: blink 0.5s infinite alternate; }
#score { font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 28px; letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(77, 232, 255, 0.45); }
#status-effects { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.effect { font-size: 13px; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; background: var(--panel); }
.hud-bottom { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); width: min(380px, 80vw); text-align: center; }
#weapon-name { font-family: 'Orbitron', sans-serif; font-size: 14px; letter-spacing: 1px; color: #cfe6ff; }
.bar.weapon { height: 12px; }
#weapon-fill { background: linear-gradient(90deg, #ff7a1a, var(--amber)); box-shadow: 0 0 12px rgba(255, 170, 51, 0.6); }
#weapon-fill.max { background: linear-gradient(90deg, #ff3df2, #8a5cff, var(--cyan)); width: 100% !important; }
#heat { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); }
#heat .bar { flex: 1; height: 6px; margin-top: 0; }
#heat-fill { background: linear-gradient(90deg, #ffd23a, #ff4a2e); }
#heat.over #heat-label { color: var(--red); animation: blink 0.25s infinite alternate; }
#heat.over #heat-fill { background: var(--red); }
#boss-bar { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: min(520px, 60vw); text-align: center; }
.boss-name { font-family: 'Orbitron', sans-serif; font-size: 13px; letter-spacing: 3px; color: #ffb3a1; }
.bar.boss { height: 12px; }
#boss-fill { background: linear-gradient(90deg, #a3121d, #ff5b2e); box-shadow: 0 0 12px rgba(255, 91, 46, 0.7); }
#banner { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-family: 'Orbitron', sans-serif;
  font-weight: 900; font-size: clamp(28px, 5vw, 56px); letter-spacing: 4px; opacity: 0; transition: opacity 0.35s;
  text-shadow: 0 0 22px rgba(77, 232, 255, 0.7); }
#banner.show { opacity: 1; }
#banner .sub { display: block; font-size: 0.38em; letter-spacing: 3px; color: var(--amber); margin-top: 8px; }
#banner.warn { color: #ffd0c8; text-shadow: 0 0 22px rgba(255, 60, 60, 0.85); }
#toasts { position: absolute; top: 46%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column;
  align-items: center; gap: 6px; }
.toast { font-family: 'Orbitron', sans-serif; font-size: 16px; padding: 4px 14px; border-radius: 6px;
  background: var(--panel); border: 1px solid currentColor; animation: toast 1.8s ease-out forwards; }
#damage-vignette { position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 20, 40, 0.55) 100%); }
#debug { position: absolute; bottom: 10px; left: 10px; font: 12px monospace; color: #9f9; background: rgba(0, 0, 0, 0.6);
  padding: 6px 8px; border-radius: 4px; white-space: pre; }

/* ---------- Bildschirme ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 16px; text-align: center; }
.screen.dim { background: rgba(2, 4, 12, 0.62); backdrop-filter: blur(2px); }
#loading { background: #02030a; }
.title { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(36px, 8vw, 86px); margin: 0;
  letter-spacing: 6px; background: linear-gradient(180deg, #ffffff 0%, #9fe8ff 45%, #3a7dff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(77, 180, 255, 0.55)); }
.subtitle { margin: 0; color: #b8c7e6; font-size: 20px; letter-spacing: 1px; }
h2 { font-family: 'Orbitron', sans-serif; font-size: 40px; letter-spacing: 5px; margin: 0; }
.bar.loading { width: min(420px, 80vw); height: 8px; }
#loading-fill { background: linear-gradient(90deg, #3a7dff, var(--cyan)); }
#loading-text { color: var(--muted); }
.menu-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
button { font-family: 'Orbitron', sans-serif; font-size: 16px; letter-spacing: 1px; color: var(--text); cursor: pointer;
  padding: 10px 22px; border-radius: 8px; border: 1px solid var(--line); background: rgba(14, 22, 44, 0.85);
  transition: background 0.15s, border-color 0.15s; }
button:hover, button:focus-visible { background: rgba(30, 50, 96, 0.95); border-color: var(--cyan); outline: none; }
button.primary { border-color: var(--cyan); box-shadow: 0 0 16px rgba(77, 232, 255, 0.35); }
.settings { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; color: var(--muted); }
.settings label { display: flex; align-items: center; gap: 8px; }
.controls { color: #b8c7e6; line-height: 2; margin-top: 6px; }
#highscore { font-family: 'Orbitron', sans-serif; color: var(--amber); }
#go-stats { font-size: 20px; line-height: 1.7; }
#go-stats b { font-family: 'Orbitron', sans-serif; color: var(--cyan); }
#error { background: #02030a; color: #ffb3a1; font-size: 18px; max-width: 760px; margin: auto; }

@keyframes blink { from { opacity: 1; } to { opacity: 0.45; } }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 12% { opacity: 1; transform: none; }
  75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* ---------- Erweiterungen: Rolle, Sektor, Menü, Upgrades, Erfolge, Treffer-Feedback ---------- */
#roll-box { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); }
#roll-box .bar { flex: 1; height: 5px; margin-top: 0; }
#roll-fill { background: linear-gradient(90deg, #3a7dff, var(--cyan)); }
#roll-box.ready #roll-label { color: var(--cyan); }
#sector-label { color: #b8c7e6; margin-top: 2px; }
#float-layer, #hit-arrows { position: absolute; inset: 0; overflow: hidden; }
.float { position: absolute; transform: translate(-50%, -50%); font-family: 'Orbitron', sans-serif; font-weight: 700;
  font-size: 15px; color: #ffe9a8; text-shadow: 0 0 8px rgba(255, 170, 51, 0.8); animation: floatUp 1s ease-out forwards;
  white-space: nowrap; }
.float.elite { color: #ffd54a; font-size: 19px; }
.float.graze { color: #9fefff; font-size: 13px; text-shadow: 0 0 8px rgba(77, 232, 255, 0.8); }
.hit-arrow { position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-left: 16px solid transparent;
  border-right: 16px solid transparent; border-bottom: 30px solid rgba(255, 50, 60, 0.85);
  filter: drop-shadow(0 0 8px rgba(255, 40, 40, 0.9)); animation: arrowFade 0.8s ease-out forwards; }
.menu-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; justify-content: center; }
.name-field { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.name-field input { font-family: 'Orbitron', sans-serif; font-size: 15px; color: var(--text); width: 170px;
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(14, 22, 44, 0.85); }
.name-field input:focus { outline: none; border-color: var(--cyan); }
.segmented { display: flex; }
.segmented button { border-radius: 0; padding: 8px 14px; font-size: 14px; }
.segmented button:first-child { border-radius: 8px 0 0 8px; }
.segmented button:last-child { border-radius: 0 8px 8px 0; }
.segmented button.active { background: rgba(40, 90, 160, 0.95); border-color: var(--cyan); }
.menu-columns { display: flex; gap: 40px; flex-wrap: wrap; justify-content: center; align-items: flex-start; margin-top: 4px; }
.scores { min-width: 260px; text-align: left; }
.scores-title { font-family: 'Orbitron', sans-serif; color: var(--amber); margin-bottom: 4px; }
#score-list { margin: 0; padding-left: 22px; color: #cdd6ea; line-height: 1.6; font-size: 15px; }
#score-list li span { color: var(--muted); font-size: 13px; }
#score-list .empty { list-style: none; margin-left: -22px; color: var(--muted); }
#ach-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; width: min(820px, 92vw);
  max-height: 60vh; overflow-y: auto; }
.ach { text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(10, 16, 32, 0.8);
  opacity: 0.45; }
.ach.done { opacity: 1; border-color: rgba(255, 200, 80, 0.6); }
.ach b { font-family: 'Orbitron', sans-serif; font-size: 14px; color: #ffd27a; display: block; }
.ach span { font-size: 14px; color: var(--muted); }
#upgrade-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.card { width: 210px; padding: 18px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(12, 20, 40, 0.92);
  cursor: pointer; transition: transform 0.12s, border-color 0.12s; text-align: center; }
.card .icon { font-size: 34px; }
.card b { display: block; font-family: 'Orbitron', sans-serif; font-size: 16px; margin: 8px 0 6px; }
.card span { color: var(--muted); font-size: 15px; }
.card .lvl { display: block; margin-top: 8px; font-size: 13px; color: var(--amber); }
.card .key { display: block; margin-top: 10px; }
.card.sel, .card:hover { border-color: var(--cyan); transform: translateY(-4px); box-shadow: 0 0 18px rgba(77, 232, 255, 0.35); }
@keyframes floatUp { 0% { opacity: 0; margin-top: 6px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -46px; } }
@keyframes arrowFade { 0% { opacity: 1; } 100% { opacity: 0; } }
