/* =========================================================
   Farbcode knacken – "Tresorknacker" Theme
   ========================================================= */

:root {
  --bg: #14111f;
  --bg-glow: radial-gradient(circle at 20% -10%, #2c2247 0%, #14111f 55%);
  --panel: #1c1830;
  --panel-2: #241f3d;
  --border: #382f57;
  --text: #ece8f7;
  --muted: #9d94bd;
  --gold: #e0b054;
  --gold-soft: #f3d38a;
  --teal: #2fd9c2;
  --danger: #ff6b6b;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding: 24px 16px 60px;
  margin: 0 auto;
  max-width: 1040px;
  background: var(--bg-glow);
  color: var(--text);
  min-height: 100vh;
}

/* -------- Kopfbereich -------- */

.logo-text-container {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.logo-text-container img {
  max-width: 100%;
  height: auto;
}

.headline-text {
  font-size: 2em;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.3px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.headline-text img {
  height: 90px;
  width: auto;
  border-radius: 8px;
}

/* -------- Layout: Spiel + Sidebar -------- */

.spiel-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 22px;
  flex-wrap: nowrap;
}

@media (max-width: 760px) {
  .spiel-layout {
    flex-direction: column;
    align-items: center;
  }
}

.spielbereich {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px 20px 26px;
  width: 420px;
  max-width: 100%;
  position: relative;
}

.sidebar {
  width: 280px;
  max-width: 100%;
  flex-shrink: 0;
}

@media (min-width: 760px) {
  .sidebar {
    position: sticky;
    top: 20px;
  }
}

/* -------- Farbauswahl (Tresor-Dial) -------- */

.farbenwahl {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0 0 18px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #211c38, #1a1730);
  position: sticky;
  top: 0;
  z-index: 10;
}

.farbe {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.35),
    inset 0 -4px 6px rgba(0, 0, 0, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.farbe:hover {
  transform: translateY(-3px) scale(1.08);
  filter: brightness(1.1);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.4),
    inset 0 -4px 6px rgba(0, 0, 0, 0.35),
    0 6px 14px rgba(0, 0, 0, 0.5);
}

.farbe:active {
  transform: scale(0.94);
}

.farbenwahl .farbe {
  width: 46px;
  height: 46px;
}

/* Aktueller Tipp */

#aktuellerTipp {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
  min-height: 60px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed var(--border);
}

#aktuellerTipp .farbe {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

#aktuellerTipp .farbe:hover {
  border-color: var(--danger);
  cursor: pointer;
}

#statusBar {
  text-align: center;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gold-soft);
  letter-spacing: 0.3px;
}

.versuch-leiste {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 16px;
}

.versuch-leiste span {
  width: 16px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
}

.versuch-leiste span.belegt {
  background: var(--gold);
}

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

.button-reihe {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}

button {
  font-family: inherit;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease;
}

button:active { transform: scale(0.96); }

#tippenButton {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #23180a;
  box-shadow: 0 4px 12px rgba(224, 176, 84, 0.35);
}

#tippenButton:disabled {
  background: #3a3552;
  color: #75708f;
  box-shadow: none;
  cursor: default;
}

#tippenButton:hover:not(:disabled) {
  filter: brightness(1.08);
}

#undoButton, #neuButton {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

#undoButton:hover, #neuButton:hover {
  background: #2c2648;
}

#hilfeButton {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: bold;
  background: var(--teal);
  color: #08201c;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  box-shadow: 0 4px 10px rgba(47, 217, 194, 0.3);
}

/* -------- Spielverlauf -------- */

#spielverlauf {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zug {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  animation: einblenden 0.25s ease;
}

.zug:nth-child(even) {
  background: rgba(255, 255, 255, 0.06);
}

@keyframes einblenden {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.zug .farbe {
  width: 26px;
  height: 26px;
  min-width: 26px;
  cursor: default;
}

.farben {
  display: flex;
  gap: 7px;
}

.auswertung {
  display: flex;
  gap: 5px;
  margin-left: 14px;
}

.punkt {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.punkt.schwarz {
  background: #17151f;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15), 0 0 3px rgba(0, 0, 0, 0.5);
}

.punkt.weiss {
  background: #f4f4f4;
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
}

.hilfe-punkt {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

/* -------- Ergebnis-Modal -------- */

.spiel-ende-box {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 8, 18, 0.72);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.spiel-ende-karte {
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 26px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  animation: karte-rein 0.3s ease;
}

@keyframes karte-rein {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.spiel-ende-karte strong { color: var(--gold-soft); }

.spiel-ende-karte input[type="text"] {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #100d1c;
  color: var(--text);
  margin-top: 6px;
}

.spiel-ende-box button {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #23180a;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 14px;
}

#submitHighscoreBtn {
  background: var(--teal);
  color: #08201c;
}

/* -------- Bestenliste (Sidebar) -------- */

.highscore-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.highscore-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--gold-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.highscore-liste {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rang;
}

.highscore-liste li {
  counter-increment: rang;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.highscore-liste li:last-child { border-bottom: none; }

.highscore-liste li::before {
  content: counter(rang);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.highscore-liste li:nth-child(1)::before { background: var(--gold); color: #23180a; }
.highscore-liste li:nth-child(2)::before { background: #c7c7d6; color: #23180a; }
.highscore-liste li:nth-child(3)::before { background: #b97a4e; color: #23180a; }

.highscore-name { font-weight: 600; flex: 1; }
.highscore-details { color: var(--muted); font-size: 0.8rem; }

.highscore-fehler { color: var(--danger); font-size: 0.85rem; }

/* -------- Hilfe-Dialog (jQuery UI) -------- */

.ui-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  font-family: inherit;
  overflow: hidden;
  background: var(--panel);
}

.ui-dialog-titlebar { display: none; }

.ui-dialog-content {
  padding: 20px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.95rem;
  border-radius: 14px;
}

.ui-widget-overlay {
  background: #08060f;
  opacity: 0.75;
}

.ui-dialog .ui-widget-content {
  background: var(--panel);
  color: var(--text);
  border: none;
}

.ui-dialog .ui-accordion .ui-accordion-header {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 5px;
}

.ui-dialog .ui-accordion .ui-accordion-content {
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  margin-bottom: 10px;
}

.hilfe-schliessen-btn {
  display: block;
  margin: 14px auto 4px;
  padding: 8px 18px;
  font-size: 0.95rem;
  background: var(--teal);
  color: #08201c;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* -------- Mobile -------- */

@media (max-width: 480px) {
  .headline-text { font-size: 1.5em; }
  .spielbereich { width: 100%; padding: 14px 12px 20px; }
  .farbe { width: 36px; height: 36px; min-width: 36px; }
  .farbenwahl .farbe { width: 40px; height: 40px; }
  #aktuellerTipp .farbe { width: 42px; height: 42px; min-width: 42px; }
  .sidebar { width: 100%; }
}