:root {
  color-scheme: light;
  --bg: #d9f6ff;
  --surface: #fffef2;
  --text: #183542;
  --muted: #53707a;
  --line: #2f8aa7;
  --primary: #0077a3;
  --primary-strong: #00506f;
  --accent: #ffd447;
  --danger: #d64b47;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: var(--bg); color: var(--text); }
body {
  background:
    url("../assets/sponge/seestern.svg") left 24px top 128px / 86px 86px no-repeat,
    url("../assets/sponge/quallenlampe.svg") right 42px top 202px / 96px 96px no-repeat,
    url("../assets/sponge/koralle.svg") left 7% bottom 38px / 106px 106px no-repeat,
    linear-gradient(180deg, rgba(70, 192, 222, .22), transparent 230px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .3) 0 14px, transparent 14px 34px),
    linear-gradient(180deg, #d9f6ff, #f8f0b8);
  background-attachment: fixed, fixed, fixed, scroll, scroll, scroll;
}
a { color: var(--primary-strong); text-decoration: none; font-weight: 700; }
.topbar { position: relative; min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(16px, 4vw, 48px); background: #00a6d6; color: white; border-bottom: 6px solid #ffe06d; overflow: hidden; }
.topbar::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .2) 0 18px, transparent 18px 46px); pointer-events: none; }
.topbar::after { content: ""; position: absolute; right: clamp(14px, 5vw, 72px); bottom: -18px; width: 150px; height: 86px; background: url("../assets/sponge/anker.svg") center / contain no-repeat; opacity: .9; pointer-events: none; }
.brand, .topbar nav { position: relative; z-index: 1; }
.brand { color: #4b3300; display: inline-flex; align-items: center; gap: 10px; font-size: 1.6rem; letter-spacing: 0; text-shadow: 0 2px 0 rgba(255, 255, 255, .45); }
.brand::before { content: ""; width: 42px; height: 42px; display: inline-block; border-radius: 8px; background: url("../assets/sponge/muschel.svg") center / contain no-repeat #fff6a8; border: 3px solid #4b3300; }
.topbar nav { display: flex; gap: 10px; flex-wrap: wrap; }
.topbar nav a { color: #082f3c; padding: 8px 10px; border-radius: 6px; background: rgba(255, 255, 255, .72); box-shadow: inset 0 -2px 0 rgba(8, 47, 60, .18); }
.page { width: min(1120px, calc(100% - 32px)); margin: 28px auto 56px; }
.page::before {
  content: "";
  position: fixed;
  inset: 96px 0 auto auto;
  width: 176px;
  height: 176px;
  pointer-events: none;
  background: url("../assets/sponge/sandburg.svg") center / contain no-repeat;
  opacity: .2;
}
section { margin: 0 0 32px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 14px; letter-spacing: 0; }
h1 { font-size: clamp(2rem, 6vw, 3.3rem); color: #4b3300; text-shadow: 0 3px 0 #fff1a6; }
h2 { font-size: 1.45rem; }
.kicker { color: var(--primary-strong); font-weight: 800; text-transform: uppercase; font-size: .8rem; }
.hero, .profile-layout, .split { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; }
.hero {
  min-height: 210px;
  padding: 28px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 254, 242, .98), rgba(255, 254, 242, .72)),
    url("../assets/sponge/schatztruhe.svg") right 24px center / 150px 150px no-repeat,
    url("../assets/sponge/seestern.svg") right 154px bottom 18px / 66px 66px no-repeat,
    #fff7bf;
  box-shadow: 0 12px 0 rgba(0, 119, 163, .2);
}
.admin-hero {
  background:
    linear-gradient(90deg, rgba(255, 254, 242, .98), rgba(255, 254, 242, .74)),
    url("../assets/sponge/blasenhelm.svg") right 26px center / 150px 150px no-repeat,
    #dff9ff;
}
.auth-panel, .quiz-panel, .result-panel { max-width: 720px; margin-inline: auto; background: var(--surface); border: 3px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 12px 0 rgba(0, 119, 163, .2); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: 8px; padding: 18px; }
.subject { position: relative; display: grid; gap: 8px; min-height: 160px; color: var(--text); overflow: hidden; transition: transform .16s ease, box-shadow .16s ease; }
.subject:hover { transform: translateY(-4px); box-shadow: 0 12px 0 rgba(0, 119, 163, .18); }
.subject:hover .subject-icon { transform: rotate(5deg) scale(1.08); }
.subject::after { content: ""; position: absolute; inset: auto -12px -16px auto; width: 112px; height: 112px; background: var(--subject-image) center / contain no-repeat; opacity: .95; }
.subject-englisch { --subject-image: url("../assets/sponge/muschel.svg"); background: #e3fbff; }
.subject-mathematik { --subject-image: url("../assets/sponge/schatztruhe.svg"); background: #fff4ba; }
.subject-deutsch { --subject-image: url("../assets/sponge/koralle.svg"); background: #ffe3df; }
.subject-icon { width: 46px; height: 46px; border-radius: 8px; background: var(--subject-image) center / contain no-repeat #fff; border: 2px solid var(--line); transition: transform .16s ease; }
.subject strong, .metric strong { font-size: 1.6rem; }
.subject span, .metric span { color: var(--muted); }
.form { display: grid; gap: 16px; }
.inline-form { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.compact-form { gap: 8px; }
.checkbox-list { display: grid; gap: 8px; border: 2px solid var(--line); border-radius: 8px; padding: 10px; background: rgba(255,255,255,.78); }
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.checkbox-list input { width: auto; }
.teacher-subjects-field { grid-column: 1 / -1; min-width: 0; }
.teacher-subjects-field legend { font-weight: 800; }
.teacher-subjects-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 8px; align-items: start; min-width: 440px; }
.teacher-subjects-horizontal { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; min-width: 0; max-width: 100%; overflow-x: auto; }
.checkbox-list .subject-chip { display: inline-flex; width: auto; padding: 7px 10px; border: 2px solid var(--line); border-radius: 999px; background: #fffef2; white-space: nowrap; }
.subject-chip input:checked + span { color: var(--primary-strong); }
.teacher-subjects-horizontal .subject-chip { flex: 0 0 auto; }
label { display: grid; gap: 7px; font-weight: 700; }
input, select, textarea { width: 100%; border: 2px solid var(--line); border-radius: 6px; padding: 11px 12px; font: inherit; background: white; color: var(--text); }
textarea { min-height: 110px; resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; padding: 11px 16px; background: var(--primary); color: white; font: inherit; font-weight: 800; cursor: pointer; box-shadow: inset 0 -3px 0 var(--primary-strong); }
.danger-button { background: var(--danger); box-shadow: inset 0 -3px 0 #9f2424; }
.choices { display: grid; gap: 10px; }
.choices label { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: 8px; background: white; }
.choices input { width: auto; }
.notice { padding: 12px 14px; border-radius: 8px; background: #fff2a8; border: 2px solid var(--accent); }
.error { background: #ffe0dd; border-color: var(--danger); }
.avatar { width: 92px; height: 92px; object-fit: contain; border-radius: 8px; background: white; border: 3px solid var(--accent); padding: 6px; }
.avatar.large { width: 148px; height: 148px; }
.avatar.tiny { width: 48px; height: 48px; }
.avatar-placeholder { display: grid; place-items: center; font-weight: 900; color: var(--muted); }
.collection { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
figure { margin: 0; text-align: center; background: var(--surface); border: 2px solid var(--line); border-radius: 8px; padding: 12px; }
figure img, .reward-pop img { width: 96px; height: 96px; object-fit: contain; }
figcaption { font-size: .9rem; font-weight: 700; }
.reward-pop { display: flex; align-items: center; gap: 18px; padding: 18px; background: #fff2a8; border: 3px solid var(--accent); border-radius: 8px; animation: pop .45s ease-out; }
.score { font-size: 1.4rem; font-weight: 900; }
.hero-badge { width: 120px; height: 120px; display: grid; place-items: center; border-radius: 8px; background: #fff2a8; border: 3px solid var(--accent); font-size: 2.6rem; font-weight: 900; box-shadow: 0 12px 0 rgba(0, 119, 163, .2); }
.student-cell { display: inline-flex; align-items: center; gap: 10px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 2px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #c7f0f9; }
.answers { display: grid; gap: 12px; }
.right { border-color: #2f9e44; }
.wrong { border-color: var(--danger); }
.admin-nav, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@keyframes pop { from { transform: translateY(12px) scale(.9); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@media (max-width: 720px) {
  .hero, .profile-layout, .split { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar::after { width: 96px; height: 58px; opacity: .35; }
  .teacher-subjects-form { grid-template-columns: 1fr; min-width: 320px; }
  body { background-image: linear-gradient(180deg, rgba(70, 192, 222, .22), transparent 230px), repeating-linear-gradient(135deg, rgba(255, 255, 255, .3) 0 14px, transparent 14px 34px), linear-gradient(180deg, #d9f6ff, #f8f0b8); }
  .page::before { display: none; }
}
