/* Inf-Einf-B Selbstkontrolle
   Motif: the pseudonym slip. Cool paper, ink-blue type, a perforation as the only ornament.
   Type scale 1.25 (major third): 0.8 / 1 / 1.25 / 1.563 / 1.953 rem. Spacing on a 0.25rem grid. */

:root {
  --bg: #eceff3;          /* paper, cool */
  --surface: #ffffff;
  --ink: #18212f;         /* ink */
  --muted: #4f5b6b;
  --line: #d3d9e1;
  --field-line: #a9b3c0;
  --accent: #0b5c6b;      /* petrol (teal) */
  --accent-strong: #074652;
  --on-accent: #ffffff;
  --focus: #c25e00;
  --ok: #1d6b3f;
  --ok-bg: #e1f1e7;
  --open: #874f00;
  --open-bg: #fbeed6;
  --none: #566273;
  --none-bg: #e6eaf0;
  --code-bg: #f4f6f9;
  --chart-open: #8cbcc6;   /* "nicht gelöst" in charts */

  --font: "Avenir Next", Avenir, "Segoe UI Variable Text", "Segoe UI", Ubuntu, "Noto Sans", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --radius: 14px;
  --radius-sm: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d;
    --surface: #1a212b;
    --ink: #e7ebf1;
    --muted: #a3aebd;
    --line: #2e3845;
    --field-line: #4a5666;
    --accent: #6cc4d4;
    --accent-strong: #93d6e2;
    --on-accent: #0b1c21;
    --focus: #ffb366;
    --ok: #7fd4a0;
    --ok-bg: #173325;
    --open: #f2bd6b;
    --open-bg: #3a2a12;
    --none: #a8b3c2;
    --none-bg: #232c38;
    --code-bg: #141a22;
    --chart-open: #386a75;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-bottom: 9rem; } /* focus never hidden under the save bar (~120px at 390px width) */

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  width: 100%;
  max-width: 38rem;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* ---------- Header and footer ---------- */

header.site {
  width: 100%;
  max-width: 38rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 1rem;
}
.site-mark { font-size: .8rem; letter-spacing: .01em; color: var(--muted); }
.site-course { font-weight: 700; color: var(--ink); }

footer.site {
  width: calc(100% - 2rem);
  max-width: 36rem;
  margin: 0 auto;
  padding: 1rem 0 2rem;
  border-top: 1px solid var(--line);
  font-size: .8rem;
}
footer.site a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
footer.site a + a { margin-left: 1.25rem; }

/* ---------- Typography ---------- */

h1, h2 { line-height: 1.2; letter-spacing: -.012em; margin: 0; text-wrap: balance; }
h1 { font-size: 1.953rem; font-weight: 700; margin-bottom: .75rem; }
h2 { font-size: 1.25rem; font-weight: 650; }
p { margin: 0 0 1rem; }
.lead { font-size: 1.0625rem; color: var(--muted); max-width: 34em; }
.muted { color: var(--muted); }
.prewrap { white-space: pre-wrap; }

a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, .button:focus-visible { border-radius: 999px; }

/* ---------- Controls ---------- */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .625rem 1.25rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.primary { background: var(--accent); color: var(--on-accent); }
.primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.secondary:hover { border-color: var(--muted); }

.field { display: block; margin: 0 0 1rem; font-weight: 600; font-size: .9375rem; }
.field input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: .375rem;
  padding: .625rem .875rem;
  font: inherit;
  font-weight: 500;
  font-size: 1.0625rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--field-line);
  border-radius: var(--radius-sm);
}
.field input::placeholder { color: var(--muted); opacity: .55; }
.field input:focus-visible { outline-offset: 0; border-color: var(--accent); border-radius: var(--radius-sm); }

/* Code as three fields in a row (login.js: space jumps to the next field, a pasted code is spread over all three) */
.code-field { border: 0; padding: 0; min-width: 0; }
.code-field legend { padding: 0; }
.code-inputs { display: flex; gap: .5rem; }
.code-inputs input { flex: 1 1 0; min-width: 0; text-align: center; padding-left: .375rem; padding-right: .375rem; }

.flash {
  margin: 0 0 1.25rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
}

/* ---------- Login: the slip ---------- */

.slip {
  position: relative;
  overflow: hidden;
  margin-top: .5rem;
  padding: 1.5rem 1.25rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
}
.slip h1 { margin-bottom: .5rem; }
.slip .lead { margin-bottom: 1.5rem; }
/* Perforation with punched holes along both edges */
.slip form {
  position: relative;
  margin: 0 -1.25rem;
  padding: 1.75rem 1.25rem 0;
  border-top: 2px dashed var(--line);
}
.slip form::before, .slip form::after {
  content: "";
  position: absolute;
  top: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
}
.slip form::before { left: -11px; }
.slip form::after { right: -11px; }
.slip .primary { width: 100%; margin-top: .5rem; }
.notice { padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--ok-bg); }
.notice a { color: var(--ok); font-weight: 650; }
/* QR link while someone is logged in: ask before switching accounts (login.js) */
.qr-confirm {
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.qr-confirm .button, .qr-confirm button { width: 100%; margin-top: .5rem; }
.qr-confirm .code-chip { white-space: normal; }
.aside { margin: 1.25rem .25rem 0; font-size: .875rem; color: var(--muted); }

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

.whoami { margin-bottom: 1.5rem; }
.code-chip {
  display: inline-block;
  padding: .05rem .5rem;
  border: 1.5px dashed var(--muted);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}

.signal {
  margin: 0 0 2rem;
  padding: 1.125rem 1.25rem .25rem;
  border-radius: var(--radius);
  background: var(--none-bg);
  border: 1.5px dashed var(--line);
}
.signal h2 { font-size: .9375rem; font-weight: 650; color: var(--muted); margin-bottom: .375rem; letter-spacing: 0; }
.signal p:first-of-type { font-size: 1.0625rem; }
.signal-ok { background: var(--ok-bg); border: 0; }
.signal-ok strong { color: var(--ok); }
.signal-warn { background: var(--open-bg); border: 0; }
.signal-warn strong { color: var(--open); }
.signal .repeat-head { margin: .75rem 0 .25rem; font-size: .9375rem; font-weight: 650; }
.repeat { margin: 0 0 1rem; padding-left: 1.125rem; font-size: .9375rem; }
.repeat li { margin: .25rem 0; }
.repeat-topics { color: var(--muted); }
.practice { margin: .75rem 0 1rem; }
.practice .repeat-head { margin-top: 0; }
.practice-why { margin: 0 0 .5rem; font-size: .9375rem; }
.practice-form { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .5rem; }
.practice-form button { flex: 1 1 0; min-width: 0; padding-left: .5rem; padding-right: .5rem; }


.lecture { margin: 0 0 1.25rem; padding: 1.125rem 1.25rem .5rem; background: var(--surface); border-radius: var(--radius); }
.lecture h2 { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; margin-bottom: .5rem; }
.lecture-date { font-size: .875rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.quiz-note { margin: 0 0 .5rem; font-size: .875rem; color: var(--muted); }

.questions { list-style: none; margin: 0; padding: 0; }
.q {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
  padding: .75rem 0;
  border-top: 1px solid var(--line);
  font-size: .9375rem;
  color: var(--muted);
}
.q:first-child { border-top: 0; }
.q strong {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .125rem .625rem .125rem .5rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 650;
}
.q strong::before { content: ""; width: .625rem; height: .625rem; border-radius: 50%; flex: none; }
.q-solved strong { background: var(--ok-bg); color: var(--ok); }
.q-solved strong::before { background: var(--ok); }
.q-open strong { background: var(--open-bg); color: var(--open); }
.q-open strong::before { border: 2px solid var(--open); }
.q-none strong { background: transparent; color: var(--none); box-shadow: inset 0 0 0 1.5px var(--line); }
.q-none strong::before { border: 2px dashed var(--none); }
.q-title { flex-basis: 100%; color: var(--ink); font-size: 1rem; }

.lecture-open { box-shadow: inset 0 0 0 2px var(--accent); }
.lecture-action { margin: .5rem 0 1rem; }
.lecture-action .button { width: 100%; }
.open-forms { margin: 0 0 2rem; }
.open-forms > h2 { margin-bottom: .75rem; }
.open-form { box-shadow: inset 0 0 0 2px var(--accent); }
.open-form .lecture-action { margin-bottom: .75rem; }

.empty { padding: 1.25rem; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

.logout { margin-top: 2rem; }
.revoke-link { margin: 2rem 0 0; font-size: .9375rem; }
.revoke-link + .logout { margin-top: 1rem; }

/* ---------- Ihr Verlauf (spec 5.5) ---------- */

.progress { margin: 0 0 2rem; }
.preview-persona { margin: 2.5rem 0 .25rem; font-size: 1rem; color: var(--muted); }
.progress > h2 { margin-bottom: .25rem; }
.progress-intro { margin: 0 0 1rem; font-size: .9375rem; }
.progress-card { margin: 0 0 1rem; padding: 1rem 1.25rem; background: var(--surface); border-radius: var(--radius); }
.progress-card h3 { margin: 0 0 .25rem; font-size: 1.0625rem; font-weight: 650; line-height: 1.25; }
.progress-card h4 { margin: .875rem 0 .125rem; font-size: .9375rem; font-weight: 650; }
.card-sub { margin: 0 0 .5rem; font-size: .875rem; }
.card-sub:last-child { margin: .5rem 0 0; }
/* Two steps of the accent hue (validated: light end >= 2:1 against the surface in both schemes). */
.chart-solved { fill: var(--accent); }
.chart-open { fill: var(--chart-open); }
.chart-grid { stroke: var(--line); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.chart-tick { fill: var(--muted); font: 10px var(--font); font-variant-numeric: tabular-nums; }
.chart-value { fill: var(--ink); font: 650 11px var(--font); font-variant-numeric: tabular-nums; }
.chart-none { fill: var(--muted); font: 12px var(--font); }
.column-chart { display: block; width: 100%; height: auto; margin: .25rem 0 0; overflow: visible; }
.chart-axis { margin: 0; font-size: .8125rem; text-align: center; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin: 0; font-size: .875rem; color: var(--muted); }
.key { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; }
.chart-legend .key-open { margin-left: .5rem; }
.key-solved { background: var(--accent); }
.key-open { background: var(--chart-open); }
.share-rows { list-style: none; margin: .25rem 0 0; padding: 0; }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .9375rem; }
.share-row:first-child { border-top: 0; }
.share-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.share-bar { grid-column: 1 / -1; display: block; width: 100%; height: .625rem; border-radius: 3px; }
.share-note { grid-column: 1 / -1; font-size: .8125rem; }
.share-wait .share-count { white-space: normal; text-align: right; }
.progress-placeholder { background: transparent; border: 1px dashed var(--line); }
.progress-soon { margin: 0 0 1rem; padding: 0 .25rem; font-size: .875rem; }
.progress-note { margin: 0; font-size: .8125rem; }

/* ---------- Forms ("Ihre Bögen") ---------- */

.forms { margin: 2rem 0 0; }
.forms > h2 { margin-bottom: .375rem; }
.forms-note { font-size: .9375rem; margin-bottom: 1rem; }

.form-card { margin: 0 0 1.25rem; padding: 1.125rem 1.25rem .5rem; background: var(--surface); border-radius: var(--radius); }
.form-card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .25rem .75rem;
  margin: 0 0 .5rem;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.25;
}

.form-items { margin: 0; }
.form-item { padding: .75rem 0; border-top: 1px solid var(--line); }
.form-item:first-child { border-top: 0; }
.form-item dt { font-size: .9375rem; color: var(--muted); }
.form-item dd { margin: .25rem 0 0; font-weight: 650; overflow-wrap: anywhere; }
.form-item-none dd { font-weight: 500; color: var(--none); }
.form-item .form-text {
  white-space: pre-wrap;
  font-weight: 500;
  padding: .5rem .75rem;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
}

/* ---------- Online form ---------- */

.back { margin: 0 0 .5rem; font-size: .9375rem; }
.back a { display: inline-flex; align-items: center; min-height: 44px; }

.question {
  min-width: 0;
  margin: 0 0 1.25rem;
  padding: 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
}
.question legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: .75rem;
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.25;
}
.question legend + * { clear: both; }

pre {
  margin: 0 0 1rem;
  padding: .875rem 1rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: .8125rem;
  line-height: 1.6;
  tab-size: 4;
}
code { font-family: var(--mono); }

details { margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .5rem .875rem;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
details[open] summary::before { transform: rotate(45deg); }
details[open] summary { border-bottom: 1px solid var(--line); }
details > p { margin: 0; padding: .875rem; }

.choices { display: grid; gap: .5rem; }
.choice {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 52px;
  padding: .625rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}
.choice input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-content: center;
  cursor: pointer;
}
.choice input::before { content: ""; width: .625rem; height: .625rem; border-radius: 50%; transform: scale(0); transition: transform .12s ease; }
.choice input:checked::before { transform: scale(1); }
.choice input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 50%; }
.choice-yes input:checked { border-color: var(--ok); }
.choice-yes input:checked::before { background: var(--ok); }
.choice-no input:checked { border-color: var(--open); }
.choice-no input:checked::before { background: var(--open); }
.choice-yes:has(input:checked) { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.choice-no:has(input:checked) { border-color: var(--open); background: var(--open-bg); color: var(--open); }

/* Other items: single = round (like the pairs), multi = square; checked in the accent colour */
.choice-option input:checked { border-color: var(--accent); }
.choice-option input:checked::before { background: var(--accent); }
.choice-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.choice-multi input, .choice-multi input:focus-visible { border-radius: 5px; }
/* Checkmark: the right and bottom border of a narrow box, rotated; in the accent colour like the radio dot. */
.choice-multi input::before,
.choice-multi input:checked::before {
  width: .4375rem;
  height: .8125rem;
  margin-top: -.1875rem;
  border: solid var(--accent);
  border-width: 0 .1875rem .1875rem 0;
  border-radius: 0;
  background: none;
  transform: rotate(45deg) scale(0);
}
.choice-multi input:checked::before { transform: rotate(45deg) scale(1); }

.item-hint { margin: 0 0 .75rem; font-size: .875rem; color: var(--muted); }
.item-label { display: block; margin-bottom: .75rem; font-size: 1.25rem; font-weight: 650; line-height: 1.25; }
.item-text textarea {
  display: block;
  width: 100%;
  min-height: 8rem;
  margin: 0 0 .5rem;
  padding: .625rem .875rem;
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--field-line);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.item-text textarea:focus-visible { outline-offset: 0; border-color: var(--accent); border-radius: var(--radius-sm); }
.item-text .item-hint { margin-bottom: 0; }

.final-note { margin: 0 0 .5rem; font-size: .875rem; font-weight: 600; line-height: 1.35; text-align: center; }

.form-actions {
  position: sticky;
  bottom: 0;
  margin: 0 -1rem;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.form-actions .primary { width: 100%; }

/* ---------- Datenschutz ---------- */

.prose { padding: 1.5rem 1.25rem .5rem; background: var(--surface); border-radius: var(--radius); }
.prose h1 { font-size: 1.563rem; margin-bottom: 1.25rem; }
.prose p { max-width: 36em; }
.prose strong { color: var(--ink); }
.prose ul { max-width: 36em; margin: 0 0 1rem; padding-left: 1.25rem; }
.prose li { margin-bottom: .5rem; }
.prose .whoami { margin-bottom: 1rem; }

/* Privacy page, laid out like the PSI Pulse privacy policy: plain text column, h2 sections, 16px rhythm. */

.page-policy { background: var(--surface); }
.page-policy header.site { max-width: 44rem; }
.page-policy main { max-width: 44rem; }
.page-policy footer.site { max-width: 42rem; }
.policy {
  max-width: 42rem;
  margin: 0 auto;
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.625;
  overflow-wrap: break-word;
  color: #364153;
  color: oklch(0.373 0.034 259.733);   /* gray-700 */
}
.policy > * { margin: 0; }
.policy > * + * { margin-top: 1rem; }
.policy h1 { font-size: 1.5rem; line-height: 2rem; font-weight: 700; letter-spacing: normal; }
.policy h2 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; letter-spacing: normal; }
.policy .policy-date { font-size: .875rem; line-height: 1.25rem; color: #4a5565; color: oklch(0.446 0.03 256.802); }   /* gray-600 */
@media (prefers-color-scheme: dark) {
  .policy { color: var(--ink); }
  .policy .policy-date { color: var(--muted); }
}
.policy ul { padding-left: 1.5rem; list-style: disc; }
.policy li + li { margin-top: .25rem; }
.policy a, .policy a:hover { color: inherit; text-decoration: underline; }

/* ---------- Widerruf ---------- */

.confirm { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Wider screens ---------- */

@media (min-width: 40rem) {
  header.site { padding-top: 2.5rem; padding-bottom: 1.5rem; }
  h1 { font-size: 2.441rem; }
  .slip { padding: 2.25rem 2.25rem 2rem; margin-top: 1.5rem; }
  .slip form { margin: 0 -2.25rem; padding: 2rem 2.25rem 0; }
  .lecture, .question, .form-card, .progress-card { padding-left: 1.5rem; padding-right: 1.5rem; }
  .q { display: grid; grid-template-columns: 4.25rem 10.5rem 1fr; gap: .75rem; }
  .q strong { justify-self: start; }
  .q-title { font-size: .9375rem; }
  .lecture-action .button, .form-actions .primary { width: auto; }
  .form-actions { margin: 0; padding-left: 0; padding-right: 0; }
  .prose { padding: 2.25rem 2.25rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
