/* ── HANGMAN: spielspezifisch ── */
main {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 40px;
}

/* Setup Screen */
.setup-screen {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.setup-screen.hidden { display: none; }

.setup-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.setup-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--neon1), var(--neon3));
  opacity: 0.5;
}
.setup-card h2 {
  font-family: 'Orbitron', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--neon1);
  margin-bottom: 14px;
}

/* Player selector */
.player-btns { display: flex; gap: 8px; }
.player-btn {
  flex: 1;
  padding: 12px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.player-btn:hover { border-color: var(--neon1); color: var(--neon1); }
.player-btn.active {
  background: rgba(0,245,255,0.08);
  border-color: var(--neon1);
  color: var(--neon1);
  box-shadow: 0 0 16px rgba(0,245,255,0.2);
}

/* Difficulty */
.diff-btns { display: flex; gap: 8px; }
.diff-btn {
  flex: 1;
  padding: 12px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Orbitron', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 1px;
}
.diff-btn span {
  display: block;
  font-family: 'Exo 2', sans-serif;
  font-size: 0.62rem;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 3px;
  letter-spacing: 0.5px;
}
.diff-btn:hover { border-color: var(--neon4); color: var(--neon4); }
.diff-btn.active {
  background: rgba(0,255,136,0.08);
  border-color: var(--neon4);
  color: var(--neon4);
  box-shadow: 0 0 16px rgba(0,255,136,0.15);
}

/* Player names */
.player-names { display: flex; flex-direction: column; gap: 10px; }
.player-name-row { display: flex; align-items: center; gap: 12px; }
.player-name-row label {
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #7a9abf;
  width: 80px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.player-name-row input {
  flex: 1;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Exo 2', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.player-name-row input:focus { border-color: var(--neon1); box-shadow: 0 0 8px rgba(0,245,255,0.15); }

.btn-start-game {
  align-self: center;
  width: 100%;
  max-width: 280px;
}

/* ── SETUP CANVAS-WRAP ── */
#setupCanvas { width: 520px; height: 580px; display: block; }
.canvas-wrap#setupScreen { max-width: 520px; }
/* Overlay transparent damit Canvas sichtbar */
.canvas-wrap#setupScreen .overlay {
  background: rgba(6,8,18,0.82) !important;
  gap: 8px;
  padding: 24px 20px;
}
.setup-inline {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px; width: 100%;
}
.setup-inline .player-names { width: 100%; max-width: 340px; }
.setup-inline .player-btns { gap: 6px; }
.setup-inline .player-btn  { padding: 8px 6px; font-size: 0.9rem; }
.setup-inline .diff-btns {
  gap: 10px;
  justify-content: center;
}
.setup-inline .diff-btn {
  flex: 0 0 auto;
  width: 108px;
  padding: 12px 8px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-align: center;
  border-radius: 6px;
}
.setup-inline .diff-btn span { display: none; }
/* Farben je Schwierigkeit */
.setup-inline .diff-btn[data-diff="1"] { border-color: var(--neon4); color: var(--neon4); }
.setup-inline .diff-btn[data-diff="1"]:hover,
.setup-inline .diff-btn[data-diff="1"].active {
  background: rgba(0,255,136,0.12);
  box-shadow: 0 0 18px rgba(0,255,136,0.4);
  color: var(--neon4); border-color: var(--neon4);
}
.setup-inline .diff-btn[data-diff="2"] { border-color: var(--neon1); color: var(--neon1); }
.setup-inline .diff-btn[data-diff="2"]:hover,
.setup-inline .diff-btn[data-diff="2"].active {
  background: rgba(0,245,255,0.12);
  box-shadow: 0 0 18px rgba(0,245,255,0.4);
  color: var(--neon1); border-color: var(--neon1);
}
.setup-inline .diff-btn[data-diff="3"] { border-color: var(--neon2); color: var(--neon2); }
.setup-inline .diff-btn[data-diff="3"]:hover,
.setup-inline .diff-btn[data-diff="3"].active {
  background: rgba(255,0,110,0.12);
  box-shadow: 0 0 18px rgba(255,0,110,0.4);
  color: var(--neon2); border-color: var(--neon2);
}

/* Game Screen */
.game-screen { display: none; width: 100%; max-width: 620px; flex-direction: column; align-items: center; }
.game-screen.active { display: flex; }

/* Turn banner */
.turn-banner {
  width: 100%;
  background: linear-gradient(90deg, rgba(0,245,255,0.06) 0%, var(--card) 40%);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.turn-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--neon1), var(--neon3), var(--neon2));
  box-shadow: 0 0 8px rgba(0,245,255,0.5);
}
.turn-name {
  font-family: 'Orbitron', monospace;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--neon1);
  text-shadow: 0 0 20px rgba(0,245,255,0.7), 0 0 40px rgba(0,245,255,0.3);
  animation: namePulse 2s ease-in-out infinite;
}
@keyframes namePulse {
  0%, 100% { text-shadow: 0 0 20px rgba(0,245,255,0.7), 0 0 40px rgba(0,245,255,0.3); }
  50%       { text-shadow: 0 0 28px rgba(0,245,255,1.0), 0 0 55px rgba(0,245,255,0.5); }
}
.turn-info { font-size: 0.72rem; letter-spacing: 2px; color: #7a9abf; text-transform: uppercase; }
.btn-abort {
  background: transparent;
  border: 1px solid var(--border);
  color: #7a9abf;
  border-radius: 4px;
  padding: 5px 14px;
  font-family: 'Orbitron', monospace;
  font-size: 0.62rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.btn-abort:hover { border-color: var(--neon2); color: var(--neon2); }

/* Score pills */
.scores-row {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 12px 0 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.score-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 8px 6px 16px;
  font-family: 'Exo 2', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #7a9abf;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s;
}
.score-pill .pill-pts {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--bg);
  background: var(--muted);
  border-radius: 14px;
  padding: 2px 10px;
  min-width: 36px;
  text-align: center;
  transition: all 0.3s;
}
.score-pill.active-player {
  border-color: var(--neon1);
  background: rgba(0,245,255,0.08);
  box-shadow: 0 0 20px rgba(0,245,255,0.25), inset 0 0 20px rgba(0,245,255,0.04);
  color: #fff;
  font-size: 1rem;
}
.score-pill.active-player .pill-pts {
  background: var(--neon1);
  color: var(--bg);
  box-shadow: 0 0 10px rgba(0,245,255,0.5);
}
.score-pill.active-player::before {
  content: '▶';
  font-size: 0.5rem;
  color: var(--neon1);
  margin-left: -8px;
  margin-right: -2px;
  animation: arrowBlink 1s ease-in-out infinite;
}
@keyframes arrowBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Game area */
.game-area {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  padding: 20px 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
}
.game-area::before, .game-area::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  pointer-events: none;
}
.game-area::before { bottom: 0; left: 0; border-bottom: 2px solid var(--neon3); border-left: 2px solid var(--neon3); }
.game-area::after  { bottom: 0; right: 0; border-bottom: 2px solid var(--neon2); border-right: 2px solid var(--neon2); }

/* Attempts */
.game-meta { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.attempts-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #7a9abf;
}
.attempts-display { display: flex; align-items: center; gap: 7px; }
.attempt-dot { width: 12px; height: 12px; border-radius: 50%; transition: all 0.3s; }
.attempt-dot.remaining { background: var(--neon4); box-shadow: 0 0 6px rgba(0,255,136,0.5); }
.attempt-dot.used { background: var(--neon2); box-shadow: 0 0 6px rgba(255,0,110,0.4); }

/* Category */
.cat-display {
  width: 100%;
  text-align: center;
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--neon3);
  background: rgba(123,47,255,0.08);
  border: 1px solid rgba(123,47,255,0.3);
  border-radius: 4px;
  padding: 10px 16px;
  text-shadow: 0 0 12px rgba(123,47,255,0.5);
}

/* Canvas */
canvas#gallows {
  display: block;
  border-radius: 6px;
  background: var(--bg2);
  border: 1px solid var(--border);
}

/* Word row */
.word-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
.letter-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.letter-char {
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--neon1);
  width: 36px;
  text-align: center;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 14px rgba(0,245,255,0.8);
}
.letter-char.wrong-reveal { color: var(--neon2); text-shadow: 0 0 14px rgba(255,0,110,0.7); }
.letter-line { width: 36px; height: 2px; background: var(--muted); border-radius: 1px; }
.letter-line.active { background: var(--neon1); box-shadow: 0 0 6px rgba(0,245,255,0.5); }
.letter-slot.space .letter-line { background: transparent; }

/* Wrong letters */
.wrong-letters {
  width: 100%;
  min-height: 38px;
  background: rgba(255,0,110,0.04);
  border: 1px solid rgba(255,0,110,0.2);
  border-radius: 4px;
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.wrong-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--neon2);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-right: 4px;
  flex-shrink: 0;
}
.wrong-letter {
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon2);
  background: rgba(255,0,110,0.1);
  border: 1px solid rgba(255,0,110,0.3);
  border-radius: 3px;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Keyboard */
.keyboard { width: 100%; display: flex; flex-direction: column; gap: 7px; align-items: center; }
.key-row { display: flex; gap: 6px; justify-content: center; }
.key-btn {
  width: 42px; height: 46px;
  background: linear-gradient(160deg, #1a2840 0%, #0d1828 60%, #080e1c 100%);
  border: 1px solid rgba(0,245,255,0.18);
  border-radius: 7px;
  font-family: 'Orbitron', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #a8c4e0;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 4px 0 rgba(0,0,0,0.5),
    0 4px 8px rgba(0,0,0,0.3);
  position: relative;
  top: 0;
}
.key-btn:hover:not(:disabled) {
  border-color: var(--neon1);
  color: var(--neon1);
  background: linear-gradient(160deg, #1e3050 0%, #0f1e38 60%, #0a1220 100%);
  box-shadow:
    inset 0 1px 0 rgba(0,245,255,0.15),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 4px 0 rgba(0,0,0,0.5),
    0 0 14px rgba(0,245,255,0.25),
    0 4px 8px rgba(0,0,0,0.3);
}
.key-btn:active:not(:disabled) {
  top: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 1px 0 rgba(0,0,0,0.5);
}
.key-btn:disabled { opacity: 0.12; cursor: not-allowed; box-shadow: none; top: 0; }
.key-btn.correct {
  background: linear-gradient(160deg, #0d2e1a 0%, #071a0f 100%);
  border-color: var(--neon4);
  color: var(--neon4);
  box-shadow: inset 0 1px 0 rgba(0,255,136,0.1), 0 4px 0 rgba(0,0,0,0.5), 0 0 12px rgba(0,255,136,0.3);
  cursor: default;
}
.key-btn.wrong {
  background: linear-gradient(160deg, #1a0a10 0%, #0e060c 100%);
  border-color: rgba(255,0,110,0.15);
  color: rgba(255,0,110,0.25);
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
  cursor: default;
}

/* Round Overlay */
.round-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,11,20,0.95);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 30px;
}
.round-overlay.active { display: flex; }
.round-overlay .overlay-icon { font-size: 3rem; filter: drop-shadow(0 0 16px rgba(0,255,136,0.6)); }
.round-overlay h2 {
  font-family: 'Orbitron', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 30px rgba(0,245,255,0.6);
}
.round-overlay p { font-size: 0.82rem; color: var(--muted); letter-spacing: 1px; line-height: 1.7; max-width: 300px; }
.round-overlay p strong { color: var(--neon1); }
.revealed-word {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--neon1);
  background: rgba(0,245,255,0.06);
  border: 1px solid rgba(0,245,255,0.2);
  border-radius: 4px;
  padding: 10px 24px;
  text-shadow: 0 0 12px rgba(0,245,255,0.4);
}
.btn-next {
  background: transparent;
  color: var(--neon1);
  border: 1px solid var(--neon1);
  border-radius: 4px;
  padding: 12px 28px;
  font-family: 'Orbitron', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.btn-next::before { content: ''; position: absolute; inset: 0; background: var(--neon1); opacity: 0; transition: opacity 0.2s; }
.btn-next:hover { box-shadow: 0 0 20px rgba(0,245,255,0.35); color: var(--bg); }
.btn-next:hover::before { opacity: 1; }
.btn-next span { position: relative; z-index: 1; }
.btn-next.brown { color: var(--muted); border-color: var(--border); }
.btn-next.brown::before { background: var(--border); }
.btn-next.brown:hover { color: var(--text); box-shadow: none; }

/* Final Screen */
.final-screen { display: none; width: 100%; max-width: 480px; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.final-screen.active { display: flex; }
.final-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 30px rgba(0,245,255,0.5);
}
.final-subtitle { font-size: 0.75rem; color: #7a9abf; letter-spacing: 2px; text-transform: uppercase; margin-top: -8px; }
.final-podium { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.podium-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.podium-row::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--border); }
.podium-row.first::before { background: linear-gradient(90deg, var(--neon1), var(--neon4)); }
.podium-rank { font-family: 'Orbitron', monospace; font-size: 1.4rem; font-weight: 900; width: 40px; text-align: center; }
.podium-name { flex: 1; font-family: 'Exo 2', sans-serif; font-size: 1rem; font-weight: 600; color: var(--text); text-align: left; }
.podium-score { font-family: 'Orbitron', monospace; font-size: 1rem; font-weight: 900; color: var(--neon1); text-shadow: 0 0 10px rgba(0,245,255,0.4); }
.podium-detail { font-size: 0.65rem; color: #7a9abf; margin-top: 1px; letter-spacing: 0.5px; }
.final-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.btn-restart {
  background: transparent;
  color: var(--neon1);
  border: 1px solid var(--neon1);
  border-radius: 4px;
  padding: 12px 24px;
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.btn-restart::before { content: ''; position: absolute; inset: 0; background: var(--neon1); opacity: 0; transition: opacity 0.2s; }
.btn-restart:hover { box-shadow: 0 0 20px rgba(0,245,255,0.35); color: var(--bg); }
.btn-restart:hover::before { opacity: 1; }
.btn-restart span { position: relative; z-index: 1; }
.btn-restart.secondary { color: var(--muted); border-color: var(--border); }
.btn-restart.secondary::before { background: rgba(255,255,255,0.05); }
.btn-restart.secondary:hover { color: var(--text); box-shadow: none; }

/* Responsive */
@media (max-width: 600px) {
  .key-btn { width: 32px; height: 36px; font-size: 0.62rem; }
  .key-row { gap: 3px; }
  .keyboard { gap: 4px; }
  .diff-btns { flex-direction: column; }
}
