/* ============================================================
   WOLFCASTLE ARCADE — "Schellen-Simulator"
   Retro Arcade / Pixel-Art Styling (Arcane / Hextech)
   ============================================================ */

:root {
  --bg0: #1a1030;
  --bg1: #2a1a4a;
  --ink: #fdf6e3;
  --hextech: #3fd0e8;
  --gold: #f0c14b;
  --pink: #ff4d9d;
  --purple: #8a4fff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  font-family: '"Press Start 2P"', monospace;
  color: var(--ink);
  background-color: var(--bg0);
  background-image:
    radial-gradient(circle at 20% 8%, rgba(138, 79, 255, 0.35), transparent 45%),
    radial-gradient(circle at 80% 92%, rgba(63, 208, 232, 0.30), transparent 45%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  -webkit-font-smoothing: none;
  font-smooth: never;
  letter-spacing: 0.5px;
}

/* CRT-Scanlines */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.16) 3px,
    rgba(0, 0, 0, 0.16) 3px);
  mix-blend-mode: multiply;
}

/* ---------- App-Rahmen ---------- */
#app {
  position: relative;
  z-index: 1;
  width: min(480px, 100vw);
  height: 100%;
  max-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.25);
}

/* ---------- HUD (oben) ---------- */
#hud {
  flex: 0 0 auto;
  padding: 8px 10px 6px;
  display: none;
  gap: 6px;
  flex-direction: column;
  font-size: 9px;
}
#hud.show { display: flex; }

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.nerves-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nerves-bar {
  flex: 1;
  height: 14px;
  border: 2px solid #000;
  background: #20143f;
  box-shadow: 2px 2px 0 0 #000;
  position: relative;
  overflow: hidden;
}
.nerves-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  transition: transform 0.12s linear;
}
.mute-btn {
  font-family: inherit;
  font-size: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.hud-label { color: var(--hextech); }
.hud-score { color: var(--gold); }
.hud-wave { color: var(--purple); }
#comboTag {
  color: var(--pink);
  font-size: 10px;
  min-height: 12px;
}

/* ---------- Spielfeld ---------- */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game {
  display: block;
  image-rendering: pixelated;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 480 / 720;
  background: #120a26;
  border-left: 3px solid #000;
  border-right: 3px solid #000;
}

/* Banner (Ability-Namen / Events) liegt mittig ueber dem Feld */
#banner {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  text-align: center;
  width: 92%;
  z-index: 50;
}
#banner .line {
  display: inline-block;
  font-size: clamp(12px, 4.6vw, 22px);
  color: var(--gold);
  text-shadow: 3px 3px 0 #000, 0 0 12px rgba(240, 193, 75, 0.6);
  padding: 4px 6px;
  animation: bannerPop 0.18s ease-out;
}
@keyframes bannerPop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Steuerung (unten) ---------- */
#controls {
  flex: 0 0 auto;
  display: none;
  padding: 8px 10px 12px;
  gap: 10px;
  align-items: stretch;
  background: rgba(0, 0, 0, 0.35);
  border-top: 3px solid #000;
}
#controls.show { display: flex; }

.pad {
  display: flex;
  gap: 8px;
}
.move-pad { flex: 0 0 auto; }
.action-pad {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr) 1.25fr;
  gap: 8px;
}

.btn {
  position: relative;
  font-family: inherit;
  color: var(--ink);
  background: #2a1a4a;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 0 #000;
  border-radius: 0;
  cursor: pointer;
  padding: 0;
  touch-action: none;
  transition: transform 0.05s, box-shadow 0.05s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active, .btn.held {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 0 #000;
}
.btn .ico { font-size: 18px; line-height: 1; }
.btn .lbl { font-size: 7px; line-height: 1.2; color: var(--hextech); text-align: center; }

.btn-move { width: 58px; height: 100%; min-height: 64px; }
.btn-move .ico { font-size: 22px; }

.btn-hit {
  background: #3a1d2e;
  border-color: #000;
}
.btn-hit .ico { font-size: 24px; }
.btn-hit .lbl { color: var(--pink); }

.btn-ability { background: #1f2a4a; }
.btn-ability .lbl { color: var(--hextech); }

/* Cooldown-Overlay */
.cd {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--gold);
  transform-origin: bottom;
  transform: scaleY(0);
}
.btn.cooling .cd { transform: scaleY(1); }
.btn.cooling { filter: grayscale(0.6) brightness(0.7); }

/* ---------- Overlays (Titel / Game Over) ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  background: rgba(15, 8, 30, 0.92);
  overflow-y: auto;
}
.overlay.show { display: flex; }

.title {
  font-size: clamp(18px, 6vw, 30px);
  color: var(--gold);
  text-shadow: 3px 3px 0 #000;
  line-height: 1.3;
  margin-bottom: 4px;
}
.subtitle {
  font-size: 9px;
  color: var(--hextech);
  margin-bottom: 16px;
}
.blink { animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.dedication {
  font-size: 8px;
  color: var(--pink);
  margin: 2px 0 14px;
  line-height: 1.6;
}

/* Highscore-Board */
.board {
  width: 100%;
  max-width: 250px;
  margin: 10px auto 4px;
  font-size: 9px;
}
.board-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  color: var(--ink);
}
.board-row span:last-child { color: var(--hextech); }
.board-row.me {
  background: rgba(255, 77, 157, 0.25);
  color: var(--gold);
  outline: 2px solid var(--pink);
}
.board-row.me span:last-child { color: var(--gold); }

/* Sieg-/Belohnungsscreen */
.vic-sub { font-size: 10px; color: var(--hextech); margin: 10px 0 6px; }
.reward {
  font-size: 11px;
  color: var(--ink);
  line-height: 2.2;
  margin: 6px auto 4px;
  display: inline-block;
  text-align: left;
}
.vic-ded {
  font-size: 9px;
  color: var(--pink);
  line-height: 1.9;
  margin: 14px auto 6px;
  max-width: 340px;
}

.char-row {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin-bottom: 16px;
}
.char-card {
  flex: 1;
  background: #241546;
  border: 4px solid #000;
  box-shadow: 5px 5px 0 0 #000;
  padding: 10px 8px 12px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.char-card:hover, .char-card.sel {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 0 #000;
}
.char-card.jayce { border-color: var(--hextech); }
.char-card.vi { border-color: var(--pink); }
.char-card canvas {
  width: 72px;
  height: 96px;
  image-rendering: pixelated;
  margin: 0 auto 6px;
  display: block;
}
.char-name { font-size: 13px; margin-bottom: 2px; }
.char-card.jayce .char-name { color: var(--hextech); }
.char-card.vi .char-name { color: var(--pink); }
.char-sub { font-size: 7px; color: rgba(253, 246, 227, 0.6); margin-bottom: 8px; }
.ability-list { font-size: 6.5px; line-height: 1.9; color: rgba(253, 246, 227, 0.85); text-align: left; }
.ability-list b { color: var(--gold); }

.cta {
  font-family: inherit;
  font-size: 12px;
  color: #120a26;
  background: var(--gold);
  border: 4px solid #000;
  box-shadow: 5px 5px 0 0 #000;
  padding: 12px 22px;
  cursor: pointer;
  margin-top: 4px;
}
.cta:active { transform: translate(3px, 3px); box-shadow: 0 0 0 0 #000; }
.cta:disabled { filter: grayscale(0.8) opacity(0.5); cursor: not-allowed; }

.score-big { font-size: clamp(20px, 7vw, 34px); color: var(--gold); text-shadow: 3px 3px 0 #000; margin: 6px 0; }
.score-line { font-size: 10px; color: var(--ink); margin: 3px 0; }
.score-line .v { color: var(--hextech); }
.new-best { color: var(--pink); font-size: 11px; margin: 8px 0; }

/* Initialen-Eingabe (Arcade) */
.initials {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 10px 0 14px;
}
.ini-slot {
  width: 40px;
  text-align: center;
}
.ini-char {
  font-size: 26px;
  color: var(--gold);
  border-bottom: 3px solid var(--hextech);
  padding: 4px 0;
}
.ini-btns { display: flex; flex-direction: column; gap: 2px; }
.ini-arrow {
  font-family: inherit;
  font-size: 10px;
  color: var(--hextech);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
}

.hint { font-size: 7.5px; color: rgba(253, 246, 227, 0.5); margin-top: 14px; line-height: 1.8; }

.toast {
  position: absolute;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  z-index: 150;
  background: rgba(0, 0, 0, 0.8);
  border: 3px solid var(--gold);
  color: var(--gold);
  font-size: 10px;
  padding: 8px 14px;
  pointer-events: none;
  display: none;
  text-align: center;
}
.toast.show { display: block; animation: bannerPop 0.2s ease-out; }
