/* Plattform-Stil (Login, Spieleübersicht, Dashboard). Kein Build, einfach diese Datei bearbeiten. */

/* ---------- Schriften (lokal) ---------- */

@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/baloo-2-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 800; font-display: swap; src: url("../vendor/fonts/baloo-2-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/nunito-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 800; font-display: swap; src: url("../vendor/fonts/nunito-latin-800-normal.woff2") format("woff2"); }

/* ---------- Tokens (Hell/Dunkel) ---------- */

:root {
  color-scheme: light dark;
  --bg: #EDF0F4;
  --surface: #FFFFFF;
  --ink: #1C2432;
  --muted: #5B6677;
  --line: #D3D9E2;
  --accent: #2F6FDB;
  --accent-ink: #FFFFFF;
  --ok: #1F8A4C;
  --ok-bg: #E4F5EA;
  --warn: #B7791F;
  --warn-bg: #FDF3DC;
  --danger: #C53030;
  --danger-bg: #FDE8E8;
  --radius: 14px;
  --f-display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --f-body: "Nunito", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141A23;
    --surface: #1E2633;
    --ink: #E8ECF2;
    --muted: #A3AEBF;
    --line: #344052;
    --accent: #6EA0F5;
    --accent-ink: #0F1520;
    --ok: #5FD08E;
    --ok-bg: #16301F;
    --warn: #F0B54A;
    --warn-bg: #352A12;
    --danger: #F07878;
    --danger-bg: #3A1A1A;
  }
}

/* ---------- Grundlayout ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 .5em;
}

a { color: var(--accent); }

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.muted { color: var(--muted); }
.center { text-align: center; }
.quietlink { color: var(--muted); }
.quietlink:hover { color: var(--ink); }

.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.narrow { max-width: 440px; margin-inline: auto; }

/* ---------- Kopfzeile ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .container { padding-block: 10px; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.topbar .brand { font-family: var(--f-display); font-weight: 800; font-size: 1.35rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.topbar nav a { color: var(--ink); text-decoration: none; font-weight: 700; }
.topbar nav a[aria-current="page"] { color: var(--accent); }

/* ---------- Formulare (Touch: mind. 48 px hoch) ---------- */

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
label { display: block; font-weight: 700; margin-bottom: 6px; }
.hint { display: block; color: var(--muted); font-size: .9rem; margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
}
input:focus-visible, button:focus-visible, a:focus-visible, .btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
input.code { font-family: var(--f-display); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 1.4rem; }
input[aria-invalid="true"] { border-color: var(--danger); }

.check { display: flex; gap: 12px; align-items: center; min-height: 48px; font-weight: 600; margin: 0; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }

.error { color: var(--danger); font-weight: 700; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px;
  font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; line-height: 1.2;
  color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
}
.btn.secondary { color: var(--ink); background: transparent; border: 2px solid var(--line); }
.btn.danger { color: #fff; background: var(--danger); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn.icon { min-width: 44px; padding: 6px; }
.btn[disabled] { opacity: .4; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 44px; }

/* ---------- Meldungen ---------- */

.alert { border-radius: var(--radius); padding: 14px 16px; border: 2px solid; font-weight: 600; }
.alert.ok { border-color: var(--ok); background: var(--ok-bg); }
.alert.warn { border-color: var(--warn); background: var(--warn-bg); }
.alert.bad { border-color: var(--danger); background: var(--danger-bg); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { border-color: var(--ok); color: var(--ok); }
.badge.bad { border-color: var(--danger); color: var(--danger); }

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); font-weight: 700; }

.badge.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); text-decoration: none; }
.small { font-size: .85rem; }
.warn-text { color: var(--warn); font-weight: 700; }
label.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
select {
  min-height: 40px; padding: 6px 10px; font: inherit; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: 10px;
}

/* ---------- Dashboard ---------- */

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { color: var(--muted); font-weight: 700; font-size: .9rem; }
.tile-value { font-family: var(--f-display); font-weight: 800; font-size: 2.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-warn { border: 2px solid var(--warn); background: var(--warn-bg); }

.trouble { margin: 0; padding-left: 1.2em; }
.trouble li + li { margin-top: 6px; }

/* Balken: eine Größe (gelöst / gesamt), ein Farbton, Zahl steht daneben als Text */
.cellnum { display: block; font-variant-numeric: tabular-nums; font-weight: 700; }
.meter { display: block; width: 100%; min-width: 64px; max-width: 160px; height: 8px; margin-top: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
/* Tabellen nicht Buchstabe für Buchstabe umbrechen; bei wenig Platz scrollt .table-wrap */
table th, table td { overflow-wrap: normal; }
.matrix { min-width: 560px; }
.matrix tbody th[scope="row"], .matrix .badge { white-space: nowrap; }
.levels-table { min-width: 640px; }
tbody th[scope="row"] { font-size: 1rem; color: var(--ink); font-weight: 700; }
tbody th[scope="row"] .hint { font-weight: 400; }
.row-idle { background: var(--warn-bg); }
.row-problem { background: var(--warn-bg); }
.danger-zone { border: 2px solid var(--danger); }
.big-password { font-size: 2rem; }

/* ---------- Gruppencode ---------- */

.joincode { font-family: var(--f-display); font-weight: 800; letter-spacing: .08em; white-space: nowrap; }

/* ---------- Spieleübersicht SuS ---------- */

.games { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.game { display: flex; flex-direction: column; gap: 10px; }
.game h2 { font-size: 1.5rem; margin: 0; }
.game p { margin: 0; flex: 1; }
.progress { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.bar { display: block; height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }

/* ---------- Spiele sortieren (Lehrkraft) ---------- */

.sortlist { list-style: none; margin: 0; padding: 0; }
.sortlist li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.sortlist li .check { flex: 1; }

/* ---------- Beamer ---------- */

.beamer { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.beamer .joincode { font-size: clamp(3rem, 14vw, 10rem); line-height: 1; }
.beamer .qr-box { background: #fff; padding: 12px; border-radius: var(--radius); display: inline-block; }
.beamer .qr-box svg { width: min(60vh, 80vw); height: auto; display: block; }
.beamer .count { font-family: var(--f-display); font-size: clamp(1.5rem, 4vw, 3rem); font-weight: 800; }
.beamer .url { font-size: clamp(1.1rem, 2.5vw, 2rem); }

/* ---------- Rechtliches ---------- */

.sitefooter { padding-top: 0; font-size: .9rem; color: var(--muted); }
.sitefooter a { color: var(--muted); }
.legal { max-width: 760px; }
.legal h3 { font-size: 1.1rem; margin-top: .5em; }
.legal ul { margin: 0; padding-left: 1.2em; }
mark.placeholder { background: var(--warn-bg); color: var(--warn); border: 1px dashed var(--warn); border-radius: 4px; padding: 0 4px; font-weight: 700; }

/* ---------- Fehlerseiten ---------- */

.errorpage { text-align: center; }
.errorpage .code { font-family: var(--f-display); font-weight: 800; font-size: 4rem; color: var(--muted); line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
