/* Reversi – Neon-Arcade-Variante (Cyan/Strategie-Akzent). */

:root {
  --bg:       #0a0a14;
  --bg-2:     #07232a;
  --fg:       #e7f4f6;
  --muted:    #8fb3b9;
  --accent:   #29b6c8;
  --accent-2: #5fe6e0;
  --felt:     #0e3b3f;
  --felt-2:   #0a2e31;
  --line:     rgba(95, 230, 224, 0.18);
  --you:      #1b2030;
  --cpu:      #eef3ee;
  --board-bg: rgba(255, 255, 255, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: radial-gradient(900px 500px at 50% -10%, var(--bg-2), var(--bg) 60%);
  color: var(--fg); font: 16px/1.5 ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; align-items: center;
  overscroll-behavior: none;
}
.bg-grid {
  position: fixed; inset: 0; z-index: -1;
  background-image: linear-gradient(rgba(41, 182, 200, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(95, 230, 224, 0.05) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(800px 460px at 50% 0%, #000 30%, transparent 80%);
}

.top { width: 100%; max-width: 520px; padding: 1rem 1.1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.back { color: var(--muted); text-decoration: none; font-weight: 600; letter-spacing: 0.03em; }
.back:hover { color: var(--accent); }
.wrap { width: 100%; max-width: 520px; padding: 0.4rem 1.1rem 2.5rem; display: flex; flex-direction: column; align-items: center; }
.game-title {
  margin: 0.3rem 0 0.6rem; font-size: clamp(1.8rem, 7vw, 2.5rem); font-weight: 900; letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(41, 182, 200, 0.4));
}
.btn {
  font: inherit; font-weight: 700; color: var(--fg); background: var(--board-bg);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; padding: 0.5rem 1rem; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: transparent; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #04181b; box-shadow: 0 8px 24px -10px var(--accent); }

/* Stufen */
.levels { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; }
.lvl { font: inherit; font-weight: 700; font-size: 0.85rem; color: var(--muted); background: var(--board-bg); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 0.35rem 0.9rem; cursor: pointer; transition: all 0.15s ease; }
.lvl:hover { border-color: var(--accent); color: var(--fg); }
.lvl--on { color: #04181b; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 6px 18px -8px var(--accent); }

/* Punktestand */
.scoreboard { width: 100%; max-width: 460px; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.7rem; }
.sb-chip { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.7rem; border-radius: 10px; background: var(--board-bg); border: 1px solid rgba(255, 255, 255, 0.08); }
.sb-chip.sb--turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px -6px var(--accent); }
.sb-chip .disc { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.sb-name { font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.sb-n { margin-left: auto; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Brett */
.board {
  width: min(92vw, 460px); aspect-ratio: 1; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  gap: 2px; padding: 6px; border-radius: 12px;
  background: linear-gradient(160deg, var(--felt), var(--felt-2));
  border: 1px solid var(--line); box-shadow: 0 18px 50px -20px #000, 0 0 40px -18px var(--accent);
}
.cell { position: relative; display: flex; align-items: center; justify-content: center; background: rgba(95, 230, 224, 0.04); border-radius: 4px; }
.cell--ok { cursor: pointer; }
.cell--ok:hover { background: rgba(95, 230, 224, 0.14); }

.disc {
  width: 78%; height: 78%; border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25), inset 0 -3px 6px rgba(0, 0, 0, 0.5), 0 2px 5px -1px rgba(0, 0, 0, 0.6);
}
.d-you { background: radial-gradient(circle at 35% 30%, #2b3450, var(--you) 70%); border: 1px solid rgba(95, 230, 224, 0.5); }
.d-cpu { background: radial-gradient(circle at 35% 30%, #ffffff, var(--cpu) 75%); border: 1px solid rgba(0, 0, 0, 0.25); }
.disc.place { animation: rev-place 0.28s ease; }
.disc.flip { animation: rev-flip 0.45s ease; }
.hintdot { width: 26%; height: 26%; border-radius: 50%; background: rgba(95, 230, 224, 0.35); box-shadow: 0 0 10px -1px var(--accent); }

@keyframes rev-place { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rev-flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg) scale(0.9); } 100% { transform: rotateY(0); } }

.msg { width: 100%; text-align: center; color: var(--muted); font-size: 0.9rem; min-height: 1.3em; margin: 0.7rem 0 0.2rem; }

/* Overlay / Ergebnis */
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(8, 8, 16, 0.78); backdrop-filter: blur(4px); animation: fade-in 0.2s ease; }
.overlay[hidden] { display: none; }
.overlay-card { position: relative; width: 100%; max-width: 360px; text-align: center; background: linear-gradient(180deg, var(--bg-2), var(--bg)); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 16px; padding: 1.4rem 1.3rem; box-shadow: 0 24px 70px -20px #000, 0 0 50px -22px var(--accent); }
.overlay-close { position: absolute; top: 0.6rem; right: 0.6rem; width: 1.9rem; height: 1.9rem; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05); color: var(--muted); font-size: 0.9rem; font-weight: 800; cursor: pointer; line-height: 1; }
.overlay-close:hover { color: var(--fg); border-color: var(--accent); }
.overlay-title { margin: 0 0 0.3rem; font-size: clamp(1.5rem, 7vw, 2rem); font-weight: 900; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.overlay-sub { margin: 0 0 0.9rem; color: var(--muted); }
.result { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin: 0.4rem 0 1rem; font-size: 1.05rem; }
.res-side { display: inline-flex; align-items: center; gap: 0.4rem; }
.res-side b { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.res-side .disc { width: 1.2rem; height: 1.2rem; }
.res-vs { color: var(--muted); font-weight: 800; }
.lb-form { margin: 0.3rem 0 1rem; }
.lb-form-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--accent); margin-bottom: 0.4rem; }
.lb-form-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
#rev-name { flex: 1; min-width: 7rem; font: inherit; font-weight: 700; color: var(--fg); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px; padding: 0.55rem 0.7rem; }
#rev-name:focus { outline: none; border-color: var(--accent); }
.lb-result { margin: 0 0 0.8rem; font-weight: 800; color: var(--accent); }
.overlay-actions { display: flex; gap: 0.7rem; justify-content: center; }

/* Bestenliste */
.leaderboard { width: 100%; max-width: 520px; margin-top: 1.4rem; }
.lb-title { margin: 0 0 0.2rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.lb-sub { margin: 0 0 0.7rem; font-size: 0.8rem; color: var(--muted); }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-empty { color: var(--muted); font-size: 0.9rem; padding: 0.4rem 0; }
.lb-row { display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; margin-bottom: 0.35rem; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 10px; background: var(--board-bg); }
.lb-rank { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-row--me { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 22px -10px var(--accent); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .overlay { animation: none; } .disc.flip, .disc.place { animation: none; } }
