/* ============================================================================
   PIXEL BRAWLER — Stylesheet
   Dark-Theme · Card-based UI · 60:30:10 Farbregeln
   ============================================================================ */

/* ── Reset & Basis ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:     #0a0a14;
  --card:   #141424;
  --border: #2a2a40;
  --txt:    #e0e0e8;
  --sub:    #888898;
  --acc:    #FFD700;
  --pri:    #3A7BD5;
  --green:  #4CAF50;
  --red:    #E74C3C;
  --orange: #FF9800;
  --radius: 10px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: 'Segoe UI', 'Inter', -apple-system, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Canvas ── */
#gameCanvas {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  image-rendering: auto;
  border-radius: 6px;
  max-width: 100vw;
  max-height: 100vh;
}

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.screen.active { display: flex; }

#screen-game {
  z-index: 2;
  pointer-events: none;
}

/* ── Menü ── */
.menu-wrap {
  text-align: center;
  animation: fadeSlideIn 0.6s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(25px); }
  to   { opacity: 1; transform: translateY(0); }
}

.game-title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--txt);
  text-shadow: 0 0 40px rgba(58,123,213,0.25);
}
.title-acc { color: var(--acc); }
.game-sub {
  font-size: 1rem;
  color: var(--sub);
  margin-top: 6px;
  margin-bottom: 30px;
  letter-spacing: 1px;
}

.menu-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 36px;
}

/* ── Buttons ── */
.btn {
  padding: 14px 34px;
  font-size: 1.05rem;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
  font-family: inherit;
}
.btn-primary {
  background: var(--acc);
  color: #111;
  border-color: var(--acc);
}
.btn-primary:hover {
  background: #ffe44d;
  box-shadow: 0 0 20px rgba(255,215,0,0.25);
  transform: translateY(-2px);
}
.btn-secondary {
  background: transparent;
  color: var(--txt);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--acc);
  color: var(--acc);
  transform: translateY(-2px);
}
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--sub);
  padding: 8px 20px;
  font-size: 0.85rem;
}
.btn-ghost:hover {
  border-color: var(--txt);
  color: var(--txt);
}

/* ── Steuerung-Info ── */
.controls-info {
  display: flex;
  gap: 40px;
  justify-content: center;
  text-align: left;
  background: rgba(20,20,36,0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 32px;
}
.controls-info h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--acc);
  margin-bottom: 8px;
}
.ctrl-row {
  font-size: 0.85rem;
  color: var(--sub);
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
kbd {
  display: inline-block;
  background: var(--border);
  color: var(--txt);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: monospace;
  min-width: 22px;
  text-align: center;
  border: 1px solid #444;
}

/* ── Charakter-Auswahl ── */
.select-wrap {
  text-align: center;
  max-height: 94vh;
  overflow-y: auto;
  padding: 15px 30px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  animation: fadeSlideIn 0.5s ease;
}
.sel-title {
  font-size: 1.6rem;
  color: var(--acc);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 760px;
  margin: 0 auto 18px;
}

.char-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  gap: 10px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.char-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.char-card.selected {
  box-shadow: 0 0 15px rgba(255,215,0,0.35);
}
.char-card.selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 1.1rem;
  color: var(--acc);
  font-weight: bold;
}

.char-preview {
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(0,0,0,0.25);
}

.char-info { flex: 1; min-width: 0; }
.char-name { font-size: 1.05rem; font-weight: 800; margin-bottom: 1px; }
.char-title { font-size: 0.7rem; color: var(--sub); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1.5px; }
.char-special { font-size: 0.7rem; color: var(--pri); margin-top: 5px; }
.char-super { font-size: 0.7rem; color: var(--acc); margin-top: 3px; }

.char-stats { display: flex; flex-direction: column; gap: 3px; }
.stat { display: flex; align-items: center; gap: 5px; font-size: 0.65rem; color: var(--sub); }
.stat span { width: 28px; text-align: right; font-weight: 600; }
.stat-bar {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.stat-bar div {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  background: var(--acc);
}

/* ── Level-Auswahl ── */
.diff-legend {
  display: flex;
  gap: 22px;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 0.82rem;
}
.diff-tag { font-weight: 600; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  max-width: 720px;
  margin: 0 auto 18px;
}

.level-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
}
.level-card.unlocked:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.level-card.locked {
  opacity: 0.32;
  cursor: not-allowed;
}
.level-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.7rem;
}

.level-num { font-size: 1.6rem; font-weight: 900; }
.level-name { font-size: 0.65rem; color: var(--sub); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-diff { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

.level-preview {
  margin-top: 6px;
  height: 14px;
  border-radius: 3px;
  display: flex;
  overflow: hidden;
}
.lp-sec { width: 30%; opacity: 0.7; }
.lp-acc { width: 10%; opacity: 0.9; }

/* ── Ergebnis ── */
.result-wrap {
  text-align: center;
  animation: fadeSlideIn 0.6s ease;
  background: rgba(10,10,20,0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 50px 60px;
}
.result-title {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.result-sub {
  font-size: 1.1rem;
  color: var(--sub);
  margin-bottom: 30px;
}
.result-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.back-btn {
  margin-top: 10px;
}

/* ── Scrollbar ── */
.select-wrap::-webkit-scrollbar { width: 6px; }
.select-wrap::-webkit-scrollbar-track { background: transparent; }
.select-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Game Toolbar ── */
.game-toolbar {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 25;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.toolbar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(10, 10, 20, 0.65);
  backdrop-filter: blur(6px);
  color: #e0e0e8;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.toolbar-btn:hover {
  border-color: var(--acc);
  background: rgba(20, 20, 40, 0.9);
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(255,215,0,0.25);
}

/* ── Light Theme ── */
body.light-theme {
  --bg: #eeeef4;
  --card: #ffffff;
  --border: #c8c8d8;
  --txt: #1a1a2e;
  --sub: #55556a;
  --acc: #C49B00;
  --pri: #2a5db0;
}
body.light-theme .toolbar-btn {
  background: rgba(255,255,255,0.75);
  border-color: rgba(0,0,0,0.15);
  color: #222;
}
body.light-theme .toolbar-btn:hover {
  background: rgba(255,255,255,0.95);
  border-color: var(--acc);
}
body.light-theme .controls-info {
  background: rgba(255,255,255,0.7);
}

/* ── Responsive ── */
@media (max-width: 800px) {
  .char-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .level-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .game-title { font-size: 2.6rem; }
  .controls-info { flex-direction: column; gap: 16px; padding: 16px 20px; }
  .result-wrap { padding: 30px 35px; }
  .result-title { font-size: 2.2rem; }
}

@media (max-width: 520px) {
  .char-grid { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: repeat(4, 1fr); }
  .menu-buttons { flex-direction: column; align-items: center; }
}
