/* ============================================================
   ZOMBIE BLAST 3D — Comic-Look
   Dicke Tusche-Konturen, Halbton-Punkte, schiefe Panels.
   ============================================================ */

:root {
  --ink: #26203b;
  --paper: #fff7e0;
  --sky: #8ee7ff;
  --green: #76c93e;
  --green-dark: #4e9a26;
  --red: #ff4757;
  --yellow: #ffc930;
  --cyan: #29c5ff;
  --pink: #ff6b9d;
  --shadow: 8px 8px 0 var(--ink);
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  color: var(--ink);
  background: var(--sky);
  user-select: none;
}

canvas { display: block; }

.hidden { display: none !important; }

/* ---------- Vollbild-Screens ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 15%, #aef0ff 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, #5fd8ff 0%, transparent 50%),
    var(--sky);
  overflow: auto;
  padding: 24px;
}

/* margin:auto statt reiner Flex-Zentrierung: zentriert, wenn Platz ist,
   und scrollt sauber ab dem oberen Rand, wenn der Inhalt höher ist */
.screen > .start-layout,
.screen > .panel {
  margin: auto;
}

.halftone-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--ink) 1.4px, transparent 1.5px);
  background-size: 18px 18px;
  opacity: 0.08;
  pointer-events: none;
}

.start-layout {
  position: relative;
  display: flex;
  gap: 40px;
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1100px;
}

/* ---------- Panels ---------- */

.panel {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px 42px;
  position: relative;
}

.panel-title {
  transform: rotate(-1.5deg);
  max-width: 520px;
  text-align: center;
}

.panel-board {
  transform: rotate(1.2deg);
  min-width: 320px;
  max-width: 380px;
}

.panel-center { text-align: center; max-width: 480px; }
.panel-go { transform: rotate(-1.5deg); }

/* ---------- Titel ---------- */

.game-title {
  font-family: 'Bangers', cursive;
  font-size: clamp(3rem, 8vw, 5.2rem);
  letter-spacing: 4px;
  line-height: 0.9;
  color: var(--green);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
  margin-bottom: 8px;
}

.title-blast {
  display: block;
  color: var(--red);
  font-size: 1.15em;
  transform: rotate(-2deg);
}

.title-3d {
  display: inline-block;
  color: var(--yellow);
  font-size: 0.6em;
  transform: rotate(6deg) translateY(-8px);
  margin-left: 10px;
}

.tagline {
  font-size: 1.05rem;
  margin-bottom: 28px;
  color: #5a5278;
}

/* ---------- Formular ---------- */

.name-label {
  display: block;
  font-family: 'Bangers', cursive;
  font-size: 1.5rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

#name-input {
  display: block;
  width: 100%;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  text-align: center;
  padding: 12px;
  border: 4px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  outline: none;
  margin-bottom: 20px;
  transition: transform 0.1s;
}

#name-input:focus {
  transform: scale(1.02) rotate(0.5deg);
  border-color: var(--cyan);
}

/* ---------- Buttons ---------- */

.btn {
  font-family: 'Bangers', cursive;
  letter-spacing: 3px;
  border: 4px solid var(--ink);
  border-radius: 12px;
  background: var(--yellow);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:hover {
  transform: translate(-2px, -2px) rotate(-1deg);
  box-shadow: 8px 8px 0 var(--ink);
  background: #ffd95e;
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn-big {
  font-size: 2rem;
  padding: 12px 48px;
  background: var(--red);
  color: #fff;
  -webkit-text-stroke: 1px var(--ink);
}

.btn-big:hover { background: #ff5e6c; }

.btn-small {
  font-size: 1.1rem;
  padding: 8px 22px;
  margin-top: 14px;
  display: inline-block;
}

.controls-hint {
  margin-top: 26px;
  font-size: 0.85rem;
  line-height: 2.2;
  color: #5a5278;
}

/* ---------- Account & Level ---------- */

#profile-box {
  margin: -6px 0 14px;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
  text-align: left;
}

.profile-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.level-badge {
  font-family: 'Bangers', cursive;
  font-size: 1rem;
  letter-spacing: 1px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 2px 10px;
  box-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}

.xp-bar {
  flex: 1;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #e8e0c8;
  overflow: hidden;
}

#xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), #5fd2ff);
  transition: width 0.4s ease;
}

.xp-text {
  font-size: 0.75rem;
  color: #8a82a8;
  margin-top: 4px;
  white-space: pre-line;
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-tiny {
  font-size: 0.85rem;
  padding: 3px 12px;
  margin: 0;
}

#login-row { margin-bottom: 14px; }

.link-btn {
  display: block;
  margin: -4px auto 12px;
  background: none;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--cyan);
  text-decoration: underline;
  cursor: pointer;
}

.link-btn:hover { color: var(--ink); }

.pass-hint {
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 4px;
}

#password-input, #new-pass-input {
  flex: 1;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  text-align: center;
  padding: 8px;
  border: 4px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  outline: none;
}

.go-xp {
  font-family: 'Bangers', cursive;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  color: var(--cyan);
  min-height: 1.4em;
  margin-bottom: 10px;
  white-space: pre-line;
}

/* ---------- Bestenlisten-Tabs ---------- */

.board-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 10px;
}

.board-tab {
  font-family: 'Bangers', cursive;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  padding: 3px 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #e8e0c8;
  color: #8a82a8;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

.board-tab.active {
  background: var(--cyan);
  color: #fff;
}

.board-tab:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- Multiplayer-Menü ---------- */

.btn-mid {
  font-size: 1.4rem;
  padding: 10px 30px;
  margin-top: 12px;
  background: var(--cyan);
  color: #fff;
  -webkit-text-stroke: 1px var(--ink);
}

.btn-mid:hover { background: #4fd2ff; }

.join-hint {
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 12px;
}

.mp-divider {
  margin: 22px 0 12px;
  font-family: 'Bangers', cursive;
  letter-spacing: 2px;
  color: #8a82a8;
}

.mp-join-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
}

#mp-code-input {
  width: 140px;
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
  padding: 8px;
  border: 4px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  outline: none;
}

.mp-error {
  min-height: 1.4em;
  color: var(--red);
  font-weight: 900;
  margin: 12px 0 4px;
}

/* ---------- Lobby ---------- */

.panel-lobby {
  transform: rotate(-1deg);
  min-width: 380px;
  max-width: 440px;
}

.panel-editor {
  transform: rotate(1deg);
  min-width: 330px;
  text-align: center;
}

.lobby-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}

.lobby-code {
  font-family: 'Bangers', cursive;
  font-size: 2.4rem;
  letter-spacing: 6px;
  color: var(--red);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
}

#lobby-players { margin-bottom: 16px; }

.lobby-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 6px 0;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
}

.lobby-player.empty {
  opacity: 0.35;
  border-style: dashed;
  box-shadow: none;
}

.lobby-player .lp-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.lobby-player .lp-name {
  flex: 1;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player .lp-host {
  font-size: 0.95rem;
}

.lobby-player .lp-ready {
  font-family: 'Bangers', cursive;
  font-size: 0.85rem;
  letter-spacing: 1px;
  padding: 2px 10px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: #e8e0c8;
  color: #8a82a8;
}

.lobby-player .lp-ready.on {
  background: var(--green);
  color: #fff;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

#ready-btn.on {
  background: var(--green);
  color: #fff;
}

#start-mp-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.lobby-hint {
  min-height: 1.4em;
  margin: 10px 0 4px;
  font-size: 0.9rem;
  color: #8a82a8;
  text-align: center;
}

/* ---------- Charakter-Creator ---------- */

#avatar-canvas {
  width: 240px;
  height: 280px;
  margin: 0 auto 6px;
  display: block;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: linear-gradient(180deg, #aef0ff, #d8f7ff);
  box-shadow: 4px 4px 0 var(--ink);
}

/* Lobby (schmal): Charakter oben, Kategorien darunter.
   Hero-Screen (breit): Liste links, Charakter rechts — siehe unten. */
.creator {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.creator-right {
  order: -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.drag-hint {
  font-size: 0.72rem;
  font-weight: 800;
  color: #8a82a8;
  margin: 0;
}

.creator-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-bottom: 8px;
}

.creator-tab {
  font-family: 'Bangers', cursive;
  font-size: 0.82rem;
  letter-spacing: 1px;
  padding: 3px 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

.creator-tab.active { background: var(--cyan); color: #fff; }
.creator-tab:active { transform: translate(2px, 2px); box-shadow: none; }

.creator-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
  text-align: left;
}

.creator-section-label {
  font-family: 'Bangers', cursive;
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: #5a5278;
  margin: 8px 0 4px;
}

.ctile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 6px;
}

.ctile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 4px 3px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 900;
  font-size: 0.72rem;
  line-height: 1.1;
  text-align: center;
}

.ctile:active { transform: translate(2px, 2px); box-shadow: none; }
.ctile.sel { background: var(--yellow); border-color: var(--ink); outline: 3px solid var(--green); outline-offset: -1px; }
.ctile.locked { background: #d8d2c0; color: #6a6488; }
.ctile.peek { outline: 3px dashed var(--cyan); outline-offset: -1px; }
.ctile.confirm { background: var(--green); color: #fff; }

.ctile .cswatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.ctile .cswatch.duo { border-radius: 7px; }

.ctile .csub {
  font-size: 0.62rem;
  font-weight: 800;
  color: #8a6210;
  white-space: nowrap;
}

.ctile.locked .csub { color: #6a6488; }

/* Hero-Screen: großes zweispaltiges Creator-Layout */
#hero-panel-slot .panel-editor {
  min-width: min(920px, 94vw);
  max-width: 94vw;
  transform: none;
}

#hero-panel-slot .creator { flex-direction: row; align-items: flex-start; }
#hero-panel-slot .creator-left { flex: 1; min-width: 0; }
#hero-panel-slot .creator-right { order: 1; flex-shrink: 0; }
#hero-panel-slot .creator-list { max-height: min(440px, 56vh); }
#hero-panel-slot #avatar-canvas { width: 300px; height: 360px; }

/* ---------- Team-Status im HUD ---------- */

#mp-status {
  left: 18px;
  top: 18px;
  transform: rotate(-0.5deg);
  min-width: 160px;
}

.mp-mate {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.mp-mate .mm-name {
  font-weight: 900;
  font-size: 0.85rem;
  width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-mate .mm-bar {
  flex: 1;
  height: 9px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: #e8e0c8;
  overflow: hidden;
}

.mp-mate .mm-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.25s;
}

.mp-mate.dead .mm-name { color: var(--red); text-decoration: line-through; }

/* ---------- Down-Overlay ---------- */

#down-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 30%, rgba(40, 10, 20, 0.55) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 18vh;
  pointer-events: none;
}

#down-text {
  font-family: 'Bangers', cursive;
  font-size: 3rem;
  letter-spacing: 4px;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
  animation: blink 1s infinite;
}

#down-sub {
  font-family: 'Bangers', cursive;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--paper);
  -webkit-text-stroke: 1px var(--ink);
}

/* Mode-Badge in der Bestenliste */
.board-list .b-mode {
  font-size: 0.7rem;
  background: var(--cyan);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0 6px;
  font-weight: 900;
}

/* ---------- Steuerungs-Modal ---------- */

.modal { z-index: 60; }

.controls-panel { max-width: 560px; }

.controls-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  align-items: center;
  text-align: left;
  margin: 10px 0 26px;
}

.controls-grid .key {
  justify-self: start;
  font-size: 0.95rem;
}

.key {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  padding: 2px 10px;
  font-weight: 900;
  box-shadow: 2px 2px 0 rgba(38, 32, 59, 0.35);
}

/* ---------- Bestenliste ---------- */

.board-title {
  font-family: 'Bangers', cursive;
  font-size: 1.9rem;
  letter-spacing: 2px;
  text-align: center;
  color: var(--cyan);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 18px;
}

.board-list { list-style: none; counter-reset: rank; }

.board-list li {
  counter-increment: rank;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 2px dashed rgba(38, 32, 59, 0.2);
  font-size: 1.05rem;
}

.board-list li::before {
  content: counter(rank) ".";
  font-family: 'Bangers', cursive;
  font-size: 1.2rem;
  width: 28px;
  color: var(--red);
}

.board-list li:nth-child(1)::before { content: "🥇"; }
.board-list li:nth-child(2)::before { content: "🥈"; }
.board-list li:nth-child(3)::before { content: "🥉"; }

.board-list .b-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-list .b-score { font-weight: 900; color: var(--green-dark); }
.board-list .b-wave { font-size: 0.78rem; color: #8a82a8; }

.board-list li.me {
  background: var(--yellow);
  border-radius: 8px;
  border: 2px solid var(--ink);
  animation: wobble 0.6s ease;
}

.board-hint {
  margin-top: 14px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--red);
}

@keyframes wobble {
  0% { transform: scale(0.8) rotate(-3deg); }
  60% { transform: scale(1.08) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ============================================================
   HUD
   ============================================================ */

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

.panel-mini {
  position: absolute;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 18px;
}

.panel-mini label {
  font-family: 'Bangers', cursive;
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: #8a82a8;
  display: block;
}

/* Oben Mitte: Welle / Score / Kills */
.hud-top {
  top: 18px;
  left: 50%;
  transform: translateX(-50%) rotate(-0.5deg);
  display: flex;
  gap: 30px;
}

.hud-stat { text-align: center; }

.hud-stat span {
  font-family: 'Bangers', cursive;
  font-size: 1.7rem;
  letter-spacing: 1px;
}

#wave-num { color: var(--red); }
#coin-num { color: #b8860b; }
#score-num { color: var(--green-dark); }
#kills-num { color: var(--cyan); }

/* Unten links: Leben */
.hud-hp {
  left: 18px;
  bottom: 18px;
  transform: rotate(-1deg);
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-hp label { margin: 0; }

.hp-bar {
  width: 200px;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #e8e0c8;
  overflow: hidden;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  transition: width 0.15s ease;
}

#hp-fill.low { background: linear-gradient(90deg, #c4232f, var(--red)); }

#hp-num {
  font-family: 'Bangers', cursive;
  font-size: 1.5rem;
  min-width: 44px;
  text-align: right;
}

/* ---------- Shop & Hero-Screen ---------- */
.menu-row { display: flex; gap: 8px; justify-content: center; }
.menu-row .btn { flex: 1; }
.panel-shop { width: min(560px, 92vw); max-height: 86vh; overflow-y: auto; }
.shop-head { display: flex; justify-content: center; align-items: center; gap: 18px; margin-bottom: 10px; }
#shop-list { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fffdf5; }
.shop-item.locked { opacity: 0.55; }
.shop-item .si-name { flex: 1; font-weight: 800; }
.shop-item .si-sub { display: block; font-size: 0.78rem; color: #8a82a8; font-weight: 700; }
.shop-item .si-price { font-family: 'Bangers', cursive; color: #b8860b; min-width: 70px; text-align: right; }

#hero-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
#hero-screen.hidden { display: none; }
#hero-panel-slot .panel-editor { position: relative; }
.hero-back { position: relative; z-index: 5; }

#perk-bar { margin-top: 8px; }
.perk-label { font-family: 'Bangers', cursive; font-size: 0.8rem; letter-spacing: 1px; color: #8a82a8; display: block; }
#perk-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.perk-chip { border: 2px solid var(--ink); border-radius: 16px; padding: 3px 10px; cursor: pointer;
  background: #fffdf5; font-weight: 800; font-size: 0.85rem; }
.perk-chip.on { background: var(--green); color: #fff; }

/* ---------- Profilbild-Badges + animierte Rahmen ---------- */
.pfp {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 3px solid var(--ink);
  box-sizing: border-box; flex: 0 0 auto;
}
.pfp-lg { width: 48px; height: 48px; font-size: 26px; }
.pfp-sm { width: 22px; height: 22px; font-size: 12px; border-width: 2px; }
.profile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.coin-badge { font-family: 'Bangers', cursive; font-size: 1.1rem; color: #b8860b; letter-spacing: 1px; }

.frame-glow    { animation: fr-glow 1.6s ease-in-out infinite; }
.frame-toxic   { border-color: #76c93e !important; animation: fr-toxic 1.2s ease-in-out infinite; }
.frame-flame   { border-color: #e8742c !important; animation: fr-flame 0.7s ease-in-out infinite alternate; }
.frame-rainbow { animation: fr-rainbow 3s linear infinite; }
.frame-blood   { border-color: #c4232f !important; animation: fr-blood 2s ease-in-out infinite; }
.frame-gold    { border-color: #ffc930 !important; animation: fr-gold 1.4s ease-in-out infinite; }

@keyframes fr-glow    { 0%,100% { box-shadow: 0 0 4px 1px #29c5ff; } 50% { box-shadow: 0 0 14px 5px #29c5ff; } }
@keyframes fr-toxic   { 0%,100% { box-shadow: 0 0 6px 2px #76c93e66; } 50% { box-shadow: 0 4px 12px 4px #76c93ecc; } }
@keyframes fr-flame   { from { box-shadow: 0 -2px 8px 2px #e8742c; } to { box-shadow: 0 -6px 16px 5px #ff4757; } }
@keyframes fr-rainbow { 0% { border-color: #ff4757; box-shadow: 0 0 8px 2px #ff4757; }
  33% { border-color: #ffc930; box-shadow: 0 0 8px 2px #ffc930; }
  66% { border-color: #29c5ff; box-shadow: 0 0 8px 2px #29c5ff; }
  100% { border-color: #ff4757; box-shadow: 0 0 8px 2px #ff4757; } }
@keyframes fr-blood   { 0%,100% { box-shadow: 0 0 4px 1px #c4232f; } 50% { box-shadow: 0 8px 14px 3px #c4232f; } }
@keyframes fr-gold    { 0%,100% { box-shadow: 0 0 6px 2px #ffc930; filter: brightness(1); } 50% { box-shadow: 0 0 18px 6px #ffc930; filter: brightness(1.25); } }

/* Boss-Leiste: oben Mitte, unter Welle/Score/Kills */
#boss-bar {
  top: 96px;
  left: 50%;
  transform: translateX(-50%) rotate(0.4deg);
  text-align: center;
}

#boss-bar label { color: var(--red); font-size: 1.05rem; }

.boss-hp {
  width: 320px;
  height: 18px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #e8e0c8;
  overflow: hidden;
}

#boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #c4232f, var(--red));
  transition: width 0.15s ease;
}

/* Unten rechts: Munition + Waffe */
.hud-ammo {
  right: 18px;
  bottom: 18px;
  transform: rotate(1deg);
  text-align: center;
  min-width: 170px;
}

.weap-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

#weap-name {
  font-family: 'Bangers', cursive;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  color: var(--ink);
}

#fire-mode {
  font-family: 'Bangers', cursive;
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  padding: 1px 8px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #e8e0c8;
  color: #8a82a8;
}

#fire-mode.auto {
  background: var(--red);
  color: #fff;
}

/* Waffen-Werte über der Munitionsanzeige */
#weapon-stats {
  right: 18px;
  bottom: 122px;
  transform: rotate(1deg);
  width: 215px;
}

.stat-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.stat-row > span {
  font-family: 'Bangers', cursive;
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: #5a5278;
  text-align: right;
}

.stat-bar {
  position: relative;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: #e8e0c8;
  overflow: hidden;
}

.stat-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--yellow);
  transition: width 0.25s ease, background 0.25s ease;
}

.stat-fill.better { background: var(--green); }
.stat-fill.worse { background: var(--red); }

/* Markierung des Grundwerts (ohne Attachments) */
.stat-tick {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: var(--ink);
  opacity: 0;
  transition: left 0.25s ease, opacity 0.25s ease;
}

.stat-tick.show { opacity: 0.7; }

/* Waffen-Slots unten Mitte */
#slots {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.slot {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px 12px;
  opacity: 0.85;
  transition: transform 0.1s;
}

.slot.active {
  background: var(--yellow);
  transform: translateY(-6px) rotate(-1deg);
  opacity: 1;
}

.slot.empty { opacity: 0.4; }

.slot-key {
  font-family: 'Bangers', cursive;
  font-size: 0.95rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 5px;
  padding: 0 7px;
}

.slot-name {
  font-family: 'Bangers', cursive;
  font-size: 1rem;
  letter-spacing: 1px;
  min-width: 64px;
  text-align: center;
}

/* ---------- Anbaumenü (E halten) ---------- */

#attach-panel {
  left: 18px;
  top: 50%;
  transform: translateY(-50%) rotate(-1deg);
  min-width: 230px;
}

.attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 2px dashed rgba(38, 32, 59, 0.15);
  font-size: 0.95rem;
}

.attach-row.none { opacity: 0.4; }

.attach-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.attach-name { flex: 1; }

.attach-count {
  font-family: 'Bangers', cursive;
  letter-spacing: 1px;
  color: var(--green-dark);
}

.attach-count.on { color: var(--cyan); }

#inspect-cursor {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid var(--paper);
  outline: 2px solid var(--ink);
  border-radius: 50%;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

#cursor-label {
  position: absolute;
  display: none;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 5px 12px;
  font-size: 0.9rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 21;
}

/* ---------- Item-Namensschilder in der Welt ---------- */

#item-labels { position: absolute; inset: 0; overflow: hidden; }

.item-label {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: 'Bangers', cursive;
  font-size: 1rem;
  letter-spacing: 1.5px;
  color: var(--paper);
  -webkit-text-stroke: 1px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}

.item-label.weapon {
  color: var(--yellow);
  font-size: 1.15rem;
}

.ammo-row {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  letter-spacing: 1px;
}

.ammo-row em { color: #8a82a8; margin: 0 6px; font-style: normal; }

#ammo-mag.empty { color: var(--red); animation: blink 0.5s infinite; }
#ammo-res { color: var(--green-dark); }

#reload-hint {
  font-family: 'Bangers', cursive;
  color: var(--red);
  letter-spacing: 2px;
  animation: blink 0.4s infinite;
}

@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- Fadenkreuz ---------- */

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
}

#crosshair span {
  position: absolute;
  background: var(--ink);
  border-radius: 2px;
  box-shadow: 0 0 0 1.5px rgba(255, 247, 224, 0.9);
}

#crosshair span:nth-child(1) { width: 4px; height: 12px; left: -2px; top: -20px; }
#crosshair span:nth-child(2) { width: 4px; height: 12px; left: -2px; top: 8px; }
#crosshair span:nth-child(3) { width: 12px; height: 4px; top: -2px; left: -20px; }
#crosshair span:nth-child(4) { width: 12px; height: 4px; top: -2px; left: 8px; }

/* ---------- Fernrohr-Overlay (4x/8x-Visier) ---------- */

#scope-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    transparent 0,
    transparent 31vmin,
    rgba(10, 8, 16, 0.55) 33vmin,
    rgba(10, 8, 16, 0.98) 36vmin
  );
  pointer-events: none;
}

.scope-line-h, .scope-line-v {
  position: absolute;
  background: rgba(38, 32, 59, 0.85);
}

.scope-line-h {
  top: 50%;
  left: 50%;
  width: 56vmin;
  height: 2px;
  transform: translate(-50%, -50%);
}

.scope-line-v {
  top: 50%;
  left: 50%;
  width: 2px;
  height: 56vmin;
  transform: translate(-50%, -50%);
}

/* ---------- Schadens-Vignette ---------- */

#vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 140px 50px rgba(255, 30, 50, 0.85);
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

/* ---------- Wellen-Banner ---------- */

#banner {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

#banner-title {
  font-family: 'Bangers', cursive;
  font-size: clamp(3rem, 9vw, 6rem);
  letter-spacing: 6px;
  color: var(--yellow);
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 6px 6px 0 var(--ink);
  animation: banner-pop 0.45s cubic-bezier(0.2, 2.2, 0.4, 1);
}

#banner-sub {
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  letter-spacing: 3px;
  color: var(--paper);
  -webkit-text-stroke: 1px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
}

@keyframes banner-pop {
  0% { transform: scale(0) rotate(-10deg); }
  70% { transform: scale(1.15) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- Comic-Popups (SPLAT! POW!) ---------- */

#popups { position: absolute; inset: 0; overflow: hidden; }

.popup {
  position: absolute;
  font-family: 'Bangers', cursive;
  letter-spacing: 2px;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 4px 4px 0 var(--ink);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: pop-float 0.9s ease-out forwards;
}

@keyframes pop-float {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(var(--tilt, -6deg)); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.2) rotate(var(--tilt, -6deg)); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1) rotate(var(--tilt, -6deg)); }
}

/* ============================================================
   Pause & Game Over
   ============================================================ */

.big-word {
  font-family: 'Bangers', cursive;
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  letter-spacing: 4px;
  color: var(--cyan);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
  margin-bottom: 12px;
}

.go-word { color: var(--red); }

.panel-center p { margin-bottom: 22px; color: #5a5278; }

.go-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 18px 0 10px;
}

.go-stat label {
  font-family: 'Bangers', cursive;
  font-size: 0.9rem;
  letter-spacing: 2px;
  color: #8a82a8;
  display: block;
}

.go-stat span {
  font-family: 'Bangers', cursive;
  font-size: 2.2rem;
  color: var(--ink);
}

.go-rank {
  font-family: 'Bangers', cursive;
  font-size: 1.4rem;
  letter-spacing: 2px;
  color: var(--green-dark);
  min-height: 1.6em;
}

/* ---------- Responsive Kleinkram ---------- */

@media (max-width: 760px) {
  .panel { padding: 24px; }
  .hud-top { gap: 16px; }
  .hp-bar { width: 120px; }
  .boss-hp { width: 200px; }
  /* Schmale Bildschirme: Creator gestapelt, Charakter oben */
  #hero-panel-slot .creator { flex-direction: column; }
  #hero-panel-slot .creator-right { order: -1; }
  #hero-panel-slot #avatar-canvas { width: 200px; height: 220px; }
}

/* ============================================================
   Kompakte Menüs für Laptop-Bildschirme (wenig Höhe) —
   alles soll OHNE Scrollen auf den Schirm passen.
   ============================================================ */

@media (max-height: 860px) {
  .screen { padding: 14px; }
  .start-layout { gap: 22px; }
  .panel { padding: 18px 26px; }

  /* Startbildschirm */
  .game-title { font-size: clamp(2rem, 5.5vw, 3.2rem); text-shadow: 3px 3px 0 var(--ink); }
  .tagline { font-size: 0.9rem; margin-bottom: 14px; }
  .name-label { font-size: 1.15rem; margin-bottom: 6px; }
  #name-input { font-size: 1.05rem; padding: 8px; margin-bottom: 12px; box-shadow: 3px 3px 0 var(--ink); }
  .btn-big { font-size: 1.45rem; padding: 8px 32px; }
  .btn-mid { font-size: 1.1rem; padding: 7px 22px; margin-top: 8px; }
  .btn-small { font-size: 0.95rem; padding: 6px 16px; margin-top: 8px; }
  .controls-hint { margin-top: 14px; }

  /* Bestenliste */
  .board-title { font-size: 1.4rem; margin-bottom: 10px; }
  .board-list { max-height: 38vh; overflow-y: auto; }
  .board-list li { padding: 4px 8px; font-size: 0.9rem; }
  .panel-board { min-width: 280px; }

  /* Multiplayer & Modals */
  .big-word { font-size: clamp(1.8rem, 5vw, 2.6rem); text-shadow: 3px 3px 0 var(--ink); }
  .panel-center p { margin-bottom: 12px; font-size: 0.9rem; }
  .mp-divider { margin: 14px 0 8px; }
  #mp-code-input { font-size: 1.25rem; padding: 6px; }
  .controls-grid { gap: 6px 14px; margin: 6px 0 16px; }
  .controls-grid .key { font-size: 0.82rem; }

  /* Lobby + Editor */
  .panel-lobby { min-width: 330px; }
  .panel-editor { min-width: 300px; }
  .lobby-code { font-size: 1.7rem; letter-spacing: 4px; }
  .lobby-code-row { margin-bottom: 10px; }
  .lobby-player { padding: 5px 10px; margin: 4px 0; font-size: 0.9rem; }
  .lobby-hint { margin: 6px 0 2px; font-size: 0.8rem; }
  #avatar-canvas { width: 170px; height: 185px; }
  .creator-list { max-height: 220px; }
  .ctile { min-height: 44px; font-size: 0.66rem; }
  /* Hero-Creator bleibt zweispaltig (spart Höhe), nur kompakter */
  #hero-panel-slot #avatar-canvas { width: 240px; height: 280px; }
  #hero-panel-slot .creator-list { max-height: 48vh; }

  /* Game Over */
  .go-stats { gap: 22px; margin: 10px 0 6px; }
  .go-stat span { font-size: 1.6rem; }
  .go-rank { font-size: 1.1rem; }
}

/* Sehr flache Fenster (kleine Laptops, eingeblendete Taskleisten) */
@media (max-height: 680px) {
  .panel { padding: 12px 20px; }
  .game-title { font-size: 1.8rem; }
  .board-list { max-height: 28vh; }
  #avatar-canvas { width: 140px; height: 150px; }
  .tagline, .lobby-hint { display: none; }
}

/* ---------- Sprachumschalter (Hauptmenü) ---------- */
#lang-ctl {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 5;
  display: flex;
  gap: 6px;
}

.lang-btn {
  font-family: 'Bangers', cursive;
  font-size: 0.95rem;
  letter-spacing: 1px;
  padding: 4px 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

.lang-btn.active { background: var(--cyan); color: #fff; }
.lang-btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- Musik-Regler (Hauptmenü) ---------- */
#music-ctl {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff8ec;
  border: 3px solid #26203b;
  border-radius: 12px;
  padding: 6px 12px;
  box-shadow: 4px 4px 0 rgba(38, 32, 59, .35);
  z-index: 5;
}
#music-mute-btn {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
#music-vol {
  width: 110px;
  accent-color: #8a4baf;
  cursor: pointer;
}

/* ---------- Interaktions-Prompt (E) ---------- */
#interact-hint {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  background: rgba(38, 32, 59, .85);
  color: #fff7e0;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 15px;
  text-align: center;
  z-index: 6;
}
#interact-bar {
  height: 7px;
  margin-top: 6px;
  background: rgba(255, 247, 224, .25);
  border-radius: 4px;
  overflow: hidden;
}
#interact-fill {
  height: 100%;
  width: 0%;
  background: #ffc930;
}

/* ---------- Kaufphase ---------- */
.buy-panel { width: min(560px, 92vw); }
.buy-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
#buy-timer { font-weight: bold; color: #ff4757; }
#buy-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
}
.buy-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid #26203b;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(38, 32, 59, .05);
}
.buy-item.locked { opacity: .55; }
.buy-item .bi-emoji { font-size: 26px; }
.buy-item .bi-info { flex: 1; text-align: left; }
.buy-item .bi-name { font-weight: bold; }
.buy-item .bi-desc { font-size: 12px; opacity: .75; }
.buy-item .bi-active { color: #4f8a3d; font-size: 13px; }
.buy-item .btn { padding: 6px 10px; font-size: 13px; }

/* ---------- Werkzeug-Panel (neben der Munitionsanzeige) ---------- */
.hud-tools {
  position: absolute;
  right: 236px;          /* .hud-ammo: right 18px + min-width 170px + padding 36px + gap 12px */
  bottom: 18px;          /* gleiche Linie wie .hud-ammo */
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  padding: 8px 14px;
}
.hud-tools .tool-off { filter: grayscale(1); opacity: .4; }

/* ---------- Lade-Wächter (Spiel-Script nicht gestartet) ---------- */
#boot-warn {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  z-index: 9999;
  background: #2b2440;
  color: #ffd66b;
  border: 3px solid #ffd66b;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 16px;
  max-width: 90vw;
  text-align: center;
}
