/* ── SuperiorGerman — Main Stylesheet ────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:      #0d0d0d;
  --surface:    #161616;
  --surface2:   #1f1f1f;
  --border:     #2a2a2a;
  --white:      #f5f5f5;
  --muted:      #888;
  --accent:     #4f8ef7;
  --accent-dim: #1e3a6e;
  --green:      #22c55e;
  --amber:      #f59e0b;
  --red:        #ef4444;
  --radius:     12px;
  --radius-lg:  20px;
  --font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", var(--font);
}

html, body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
p  { color: #ccc; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,13,13,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  font-family: var(--font-display);
  font-size: 1.25rem; font-weight: 700;
  color: var(--white); text-decoration: none;
}
.navbar-brand span { color: var(--accent); }
.navbar-links { display: flex; align-items: center; gap: 1rem; }
.navbar-links a { color: var(--muted); font-size: .9rem; }
.navbar-links a:hover { color: var(--white); text-decoration: none; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; padding: .65rem 1.4rem;
  border-radius: var(--radius); border: none; cursor: pointer;
  font-size: .95rem; font-weight: 500; transition: opacity .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { opacity: .88; text-decoration: none; color: #fff; }
.btn-outline  { background: transparent; color: var(--white); border: 1px solid var(--border); }
.btn-outline:hover  { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-success  { background: var(--green); color: #fff; }
.btn-sm { padding: .4rem .9rem; font-size: .85rem; }
.btn-lg { padding: .9rem 2rem; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* ── Cards / Surfaces ───────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.form-control {
  width: 100%; padding: .7rem 1rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--white); font-size: .95rem;
  transition: border-color .15s; outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: #555; }
.form-error { color: var(--red); font-size: .85rem; margin-top: .3rem; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .6rem;
  border-radius: 99px; font-size: .75rem; font-weight: 600;
}
.badge-blue   { background: var(--accent-dim); color: var(--accent); }
.badge-green  { background: #14532d; color: #4ade80; }
.badge-amber  { background: #451a03; color: #fbbf24; }

/* ── Progress Bar ───────────────────────────────────────── */
.progress { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }

/* ── XP Pill ────────────────────────────────────────────── */
.xp-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--accent-dim); color: var(--accent);
  padding: .2rem .7rem; border-radius: 99px; font-size: .82rem; font-weight: 600;
}

/* ── Flashcard ──────────────────────────────────────────── */
.flashcard-scene {
  perspective: 1200px;
  width: 100%; max-width: 380px; margin: 0 auto;
  aspect-ratio: 3/4; cursor: pointer;
}
.flashcard-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
  transform-style: preserve-3d;
}
.flashcard-scene.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-front,
.flashcard-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border);
}
.flashcard-front {
  background: var(--surface);
}
.flashcard-back {
  transform: rotateY(180deg);
  background: var(--surface);
}
.flashcard-back .card-image {
  position: absolute; inset: 0;
  object-fit: cover; width: 100%; height: 100%;
  opacity: .35;
}
.flashcard-back .card-content {
  position: relative; z-index: 1;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  width: 100%;
}
.card-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .5rem; }
.card-translation { font-size: 1.1rem; color: var(--muted); margin-bottom: 1rem; }
.card-word { font-size: clamp(2rem, 8vw, 3rem); font-weight: 700; font-family: var(--font-display); }
.card-example { font-size: .9rem; color: var(--muted); margin-top: .6rem; font-style: italic; }
.tap-hint { font-size: .78rem; color: #444; margin-top: 1.2rem; }

/* ── Grade Buttons ──────────────────────────────────────── */
.grade-buttons {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem;
  margin-top: 1.25rem;
}
.grade-btn {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .15rem;
  padding: .75rem .5rem; border-radius: var(--radius);
  border: none; cursor: pointer; transition: opacity .15s, transform .1s;
  font-size: .8rem; font-weight: 600;
}
.grade-btn:active { transform: scale(.95); }
.grade-btn .interval { font-size: .7rem; font-weight: 400; opacity: .75; }
.grade-btn.again  { background: #7f1d1d; color: #fca5a5; }
.grade-btn.hard   { background: #451a03; color: #fcd34d; }
.grade-btn.good   { background: var(--accent-dim); color: var(--accent); }
.grade-btn.easy   { background: #14532d; color: #86efac; }

/* ── World Cards ────────────────────────────────────────── */
.worlds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}
.world-card {
  min-height: 220px; border-radius: var(--radius-lg);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1.5rem; position: relative; overflow: hidden;
  text-decoration: none; transition: transform .2s;
  border: 1px solid rgba(255,255,255,.06);
}
.world-card:hover { transform: scale(1.02); text-decoration: none; }
.world-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.2) 100%);
}
.world-card-content { position: relative; z-index: 1; }
.world-emoji { font-size: 2rem; margin-bottom: .4rem; }
.world-name  { font-size: 1.2rem; font-weight: 700; color: #fff; }
.world-tagline { font-size: .82rem; color: rgba(255,255,255,.65); margin: .25rem 0 .75rem; }

/* ── Stats Bar ──────────────────────────────────────────── */
.stats-bar {
  display: flex; gap: 1.5rem; align-items: center;
  padding: .75rem 0; border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem; font-size: .88rem; color: var(--muted);
}
.stats-bar strong { color: var(--white); }

/* ── Admin Table ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .65rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; background: var(--surface); }
tr:hover td { background: var(--surface2); }

/* ── Auth Pages ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-box { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 2rem; font-size: 1.5rem; font-weight: 700; }
.auth-logo span { color: var(--accent); }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { padding: .8rem 1rem; border-radius: var(--radius); font-size: .9rem; margin-bottom: 1rem; }
.alert-error   { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.alert-success { background: #052e16; color: #86efac; border: 1px solid #166534; }

/* ── Utilities ──────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-muted   { color: var(--muted); }
.text-sm      { font-size: .85rem; }
.flex         { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.hidden { display: none; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .grade-buttons { grid-template-columns: repeat(2, 1fr); }
  .worlds-grid   { grid-template-columns: 1fr; }
  .stats-bar     { flex-wrap: wrap; gap: .75rem; }
}
