/* =========================================================
   Othello – gleiches Theme wie "Farbcode knacken" / Memory
   ========================================================= */

: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);
  --cell: 50px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* --- Grundlegendes Layout --- */

body {
  background: var(--bg-glow);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  margin: 0;
  padding: 20px;
  overflow-x: hidden;
}

.fade-in {
  opacity: 0;
  animation: fadeInAnimation ease 2s forwards;
  will-change: opacity;
}

@keyframes fadeInAnimation {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.logo-text-container {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.headline-text,
h1 {
  font-size: 2rem;
  color: var(--gold-soft);
  text-shadow: none;
  font-weight: 700;
  margin-top: 5px;
}

/* --- Wrapper für Spiel und Steuerung --- */

#game-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  margin: 20px auto;
  max-width: 1200px;
  flex-wrap: nowrap;
}

/* Steuerbereich */
#game-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#game-controls label {
  color: var(--gold-soft);
}

/* Select und Button volle Breite */
#game-controls select,
#game-controls button {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background-color 0.2s ease;
}

#game-controls select {
  background: #100d1c;
  color: var(--gold-soft);
  border: 1px solid var(--gold);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

#game-controls select:hover {
  background: #17131f;
}

#game-controls button {
  border: none;
}

#game-controls button:active {
  transform: scale(0.97);
}

#restart-btn,
.startseite-button {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold)) !important;
  color: #23180a !important;
  box-shadow: 0 4px 12px rgba(224, 176, 84, 0.3);
}

#restart-btn:hover,
.startseite-button:hover {
  filter: brightness(1.08);
}

/* Trennlinie */
#difficulty-separator {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin-bottom: 15px;
  border-radius: 2px;
}

/* Score-Anzeige */
#score {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
}

#score strong {
  color: var(--gold-soft);
}

#info {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Spielbrett-Grid */
#board {
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(8, var(--cell));
  gap: 3px;
  margin: 0 auto;
  width: fit-content;
  border: 4px solid var(--gold);
  border-radius: 12px;
  background-color: #2f7a3d;
  box-shadow: var(--shadow);
}

/* Einzelne Zellen */
.cell {
  width: var(--cell);
  height: var(--cell);
  background-color: #1f5c2a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.cell:hover {
  background-color: #2c7a3a;
}

/* Steine */
.stone.black,
.stone.white {
  width: calc(var(--cell) - 10px);
  height: calc(var(--cell) - 10px);
  border-radius: 50%;
  transition: transform 0.2s ease;
  z-index: 10;
  position: relative;
}

.stone.black {
  background: radial-gradient(circle at 35% 30%, #3a3a3a, #050505 70%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.stone.white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #d8d8d8 70%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

.stone.black:hover,
.stone.white:hover {
  transform: scale(1.08);
}

/* Button-Reihe */
.button-row {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  width: 100%;
}

.button-row button {
  margin: 0 !important;
}

/* Hilfe-Button (rund) */
#hilfeBtn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50% !important;
  background: var(--teal) !important;
  color: #08201c !important;
  border: none;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(47, 217, 194, 0.3);
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0 !important;
}

#hilfeBtn:hover {
  filter: brightness(1.08);
  transform: scale(1.05);
}

/* Hilfebereich */
#hilfePopover {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 380px;
  margin-top: 15px;
  font-size: 0.95rem;
  color: var(--text);
  animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

#hilfeAccordion h3 {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-soft);
  padding: 9px 10px;
  margin: 0 0 5px;
  cursor: pointer;
  user-select: none;
}

#hilfeAccordion div {
  padding: 5px 4px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

#hilfePopover ul {
  list-style-type: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#hilfePopover li {
  margin: 4px 0;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 16px;
    padding-top: 10px;
  }

  #game-wrapper {
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    gap: 16px;
    width: 100%;
  }

  #game-controls {
    width: 100%;
    max-width: 400px;
    align-items: center;
    text-align: center;
  }

  #board {
    margin-top: 6px;
  }

  .logo-text-container {
    margin-bottom: 10px;
  }

  .headline-text, h1 {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  :root {
    --cell: 38px;
  }
}

@media (max-width: 380px) {
  :root {
    --cell: 33px;
  }
}