/* =========================================
   GAMES.CODECHO.DE — Main Stylesheet
   Palette: Deep space + neon purple/cyan
   "Gaming, focused, clear"
   ========================================= */

:root {
  --bg:           #0e0e1a;
  --bg-card:      #16162a;
  --bg-elevated:  #1e1e36;
  --text:         #f0f0ff;
  --text-muted:   #8888aa;
  --purple:       #7c3aed;
  --purple-light: #a855f7;
  --cyan:         #06b6d4;
  --cyan-light:   #22d3ee;
  --amber:        #fbbf24;
  --green:        #10b981;
  --border:       #2a2a45;
  --border-glow:  rgba(124, 58, 237, 0.4);

  --font: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --pad-h: clamp(1.25rem, 5vw, 4rem);
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── Nav ──────────────────────────────── */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem var(--pad-h);
  border-bottom: 1px solid var(--border);
}

.nav-home {
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: color 0.2s;
}
.nav-home:hover { color: var(--text); }

.nav-teacher {
  font-size: 0.875rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.375rem 0.875rem;
  border-radius: 6px;
  transition: border-color 0.2s, color 0.2s;
}
.nav-teacher:hover {
  border-color: var(--purple-light);
  color: var(--purple-light);
}

/* ── Hero ─────────────────────────────── */

.hero {
  text-align: center;
  padding: 4rem var(--pad-h) 3rem;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero h1 span {
  color: var(--purple-light);
}

.hero p {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 480px;
  margin-inline: auto;
}

/* ── Games Grid ───────────────────────── */

.games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 0 var(--pad-h) 5rem;
  max-width: 900px;
  margin-inline: auto;
}

/* ── Card ─────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.card:hover {
  border-color: var(--border-glow);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.2);
}

.card__preview {
  aspect-ratio: 16/9;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card__num {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--purple-light);
}

.card__title {
  font-size: 1.25rem;
  font-weight: 700;
}

.card__desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
}

.card__play {
  display: inline-block;
  margin-top: 1rem;
  background: var(--purple);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  align-self: flex-start;
  transition: background 0.2s;
}

.card:hover .card__play {
  background: var(--purple-light);
}

/* ── Name screen (before game) ────────── */

.name-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-h);
}

.name-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.name-box__num {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--purple-light);
  margin-bottom: 0.5rem;
}

.name-box h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.name-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.name-box input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.name-box input:focus {
  border-color: var(--purple-light);
}

.name-box input::placeholder {
  color: var(--text-muted);
}

.btn {
  display: block;
  width: 100%;
  background: var(--purple);
  color: white;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover { background: var(--purple-light); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Game frame ───────────────────────── */

.game-frame {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
}

.game-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Score screen ─────────────────────── */

.score-screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: var(--pad-h);
  text-align: center;
}

.score-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  max-width: 400px;
  width: 100%;
}

.score-box__emoji { font-size: 3rem; margin-bottom: 1rem; }
.score-box h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.score-box p { color: var(--text-muted); margin-bottom: 0.25rem; }

.score-big {
  font-size: 4rem;
  font-weight: 700;
  color: var(--amber);
  margin: 1rem 0;
}

.score-saved {
  font-size: 0.85rem;
  color: var(--green);
  margin-top: 1.5rem;
}

.score-error {
  font-size: 0.85rem;
  color: #f87171;
  margin-top: 1.5rem;
}

/* ── Teacher dashboard ────────────────── */

.teacher-wrap {
  max-width: 900px;
  margin-inline: auto;
  padding: 2rem var(--pad-h);
}

.teacher-wrap h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.teacher-wrap .sub {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.login-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
}

.login-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.login-form input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.625rem 0.875rem;
  margin-bottom: 1.25rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-form input:focus { border-color: var(--purple-light); }

.scores-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn-sm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-sm:hover { border-color: var(--purple-light); color: var(--text); }

.scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.scores-table th {
  text-align: left;
  padding: 0.625rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.scores-table td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
}

.scores-table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.badge--neon { background: rgba(6, 182, 212, 0.15); color: var(--cyan-light); }
.badge--bruch { background: rgba(124, 58, 237, 0.15); color: var(--purple-light); }

.empty-state {
  text-align: center;
  padding: 4rem;
  color: var(--text-muted);
}

/* ── Footer ───────────────────────────── */

.footer {
  text-align: center;
  padding: 2rem var(--pad-h);
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.footer a { color: var(--purple-light); }
.footer a:hover { text-decoration: underline; }
