:root {
  --blue: #1a56db;
  --green: #0d9d58;
  --red: #dc2626;
  --yellow: #d97706;
  --bg: #f5f7ff;
  --surface: #fff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --radius: 16px;
}

body {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #e5e7eb;
  --border: #334155;
  --muted: #94a3b8;
}

header {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav {
  max-width: 1200px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  color: var(--blue);
  font-size: 22px;
}

.nav button {
  border: none;
  background: none;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
}

.nav button.active,
.nav button:hover {
  background: var(--blue);
  color: #fff;
}

.page {
  display: none;
  max-width: 1200px;
  margin: auto;
  padding: 2.5rem;
  animation: fade 0.35s;
}

.page.active {
  display: block;
}

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

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem;
  margin-bottom: 1.7rem;
  transition: 0.25s;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.btn {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
}

.btn.alt {
  background: none;
  color: var(--blue);
  border: 2px solid var(--blue);
}

input,
select {
  padding: 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.feedback.ok {
  color: var(--green);
  font-weight: 700;
}

.feedback.err {
  color: var(--red);
  font-weight: 700;
}

canvas {
  background: #fff;
  border-radius: 12px;
}

.progress {
  height: 10px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.6rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: 0.4s;
}

/* ── Kein horizontales Scrollen ── */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

canvas {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* ════════════════════════════════════════
   TABLET  (≤ 900px)
════════════════════════════════════════ */
@media (max-width: 900px) {
  .page { padding: 1.6rem 1.2rem; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
  .card { padding: 1.2rem; margin-bottom: 1.1rem; }
  .nav  { gap: 0.3rem; padding: 0.7rem 0.9rem; }
  .logo { font-size: 19px; }
  .nav button { padding: 0.4rem 0.8rem; font-size: 0.875rem; }
}

/* ════════════════════════════════════════
   MOBIL  (≤ 600px)
════════════════════════════════════════ */
@media (max-width: 600px) {

  body { font-size: 14px; line-height: 1.5; }

  /* Nav scrollt horizontal, kein Umbruch */
  .nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0.5rem;
    gap: 0.25rem;
    height: 52px;
    align-items: center;
  }
  .nav::-webkit-scrollbar { display: none; }

  .logo {
    font-size: 15px;
    flex-shrink: 0;
    padding-right: 0.5rem;
    border-right: 2px solid var(--border);
    margin-right: 0.2rem;
  }

  .nav button {
    flex-shrink: 0;
    padding: 0 0.85rem;
    height: 36px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 18px;
    white-space: nowrap;
    line-height: 1;
  }

  .page { padding: 1rem 0.85rem 2rem; }

  .card {
    padding: 1.1rem 1rem;
    margin-bottom: 0.85rem;
    border-radius: 14px;
    border-width: 1px;
  }
  .card:hover { transform: none; box-shadow: none; }

  h1 { font-size: 1.25rem; line-height: 1.25; margin-top: 0; }
  h2 { font-size: 1.05rem; line-height: 1.3;  margin-top: 0; }
  h3 { font-size: 0.95rem; margin-top: 0; }
  p  { font-size: 0.875rem; }

  .grid { grid-template-columns: 1fr; gap: 0.75rem; }

  .btn {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 12px;
    min-height: 48px;
    box-sizing: border-box;
  }

  .btn.alt {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 12px;
    box-sizing: border-box;
  }

  input, select {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.95rem;
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    margin-bottom: 0.6rem;
  }

  #ch-game > div:first-child { flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
  #ch-aufg   { font-size: 0.78rem; }
  #ch-punkte { font-size: 0.85rem; }
  #ch-timer  { font-size: 1.1rem; font-weight: 800; }
  #ch-frage  { font-size: 0.95rem; line-height: 1.4; }

  canvas { display: block; width: 100% !important; height: auto !important; }

  .progress { height: 10px; border-radius: 8px; margin-bottom: 0.8rem; }
}


/* ════════════════════════════════════════
   IMPRESSUM
════════════════════════════════════════ */
.page-header {
  margin-bottom: 1.8rem;
}

.page-header h1 {
  margin-bottom: 0.3rem;
}

.page-header p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.imprint-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem;
  margin-bottom: 1.4rem;
}

.imprint-card h2 {
  margin-top: 0;
  margin-bottom: 1.1rem;
  font-size: 1.05rem;
  color: var(--blue);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.6rem;
}

.imprint-row {
  display: flex;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  align-items: flex-start;
}

.imprint-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.imprint-label {
  flex: 0 0 160px;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 0.1rem;
}

.imprint-val {
  flex: 1;
  color: var(--text);
  line-height: 1.6;
}

.imprint-val a {
  color: var(--blue);
  text-decoration: none;
}

.imprint-val a:hover {
  text-decoration: underline;
}

.ki-block {
  background: color-mix(in srgb, var(--blue) 6%, transparent);
  border-radius: 10px;
  padding: 0.2rem 0.8rem;
}

/* ════════════════════════════════════════
   FOOTER
════════════════════════════════════════ */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1.5px solid var(--border);
  margin-top: 2rem;
  background: var(--surface);
}

/* Impressum Mobil */
@media (max-width: 600px) {
  .imprint-label { flex: 0 0 110px; font-size: 0.78rem; }
  .imprint-row   { gap: 0.6rem; font-size: 0.85rem; }
  .imprint-card  { padding: 1rem; }
  .imprint-card h2 { font-size: 0.95rem; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex: 1;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}

/* Hamburger: nur mobil sichtbar */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
  transform-origin: center;
}

/* X-Animation beim Öffnen */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Dropdown Mobil-Menü */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.75rem 0.75rem;
  gap: 0.3rem;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.mobile-menu button:hover,
.mobile-menu button:active {
  background: var(--blue);
  color: #fff;
}

/* Klickbare Home-Cards */
.card-link {
  cursor: pointer;
  user-select: none;
}

.card-link:active {
  transform: scale(0.97);
}

/* ════════════════════════════════════════
   MOBIL: Hamburger einblenden, Nav ausblenden
════════════════════════════════════════ */
@media (max-width: 600px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }

  .nav {
    justify-content: space-between;
    flex-wrap: nowrap;
    height: 52px;
    padding: 0 0.75rem;
    gap: 0;
  }

  .nav-right {
    margin-left: auto;
    gap: 0.2rem;
  }

  .logo {
    font-size: 15px;
    flex-shrink: 0;
  }
}
