@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Zentrale Werte ---------- */

:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --card: #ffffff;
  --surface: #eceae4;
  --text: #17191c;
  --text-muted: #555a62;
  --line: #dddad2;
  --accent: #a8530a;
  --on-accent: #ffffff;
  --complete: #2e7048;
  --backdrop: rgba(0, 0, 0, 0.6);

  --font: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --font-size: 1.0625rem;
  --font-size-small: 1rem;
  --font-size-large: 1.25rem;
  --font-size-title: 1.5rem;
  --line-height: 1.45;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --radius-card: 16px;
  --radius-field: 12px;
  --radius-pill: 999px;
  --border: 1px;
  --border-strong: 3px;
  --touch: 44px;

  --icon: 1.5rem;
  --icon-large: 2.25rem;
  --avatar: 2.75rem;
  --avatar-large: 7rem;
  --switch-width: 3.5rem;
  --switch-height: 2rem;
  --switch-knob: 1.5rem;

  --content-narrow: 28rem;
  --content: 40rem;
  --content-wide: 70rem;
  --sidebar: 16rem;
  --attendance-column: 18rem;
  --nav-height: 4.25rem;
  --cropper: 17.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #121417;
    --card: #1e2126;
    --surface: #2a2e35;
    --text: #f3f1ec;
    --text-muted: #a9adb4;
    --line: #353a41;
    --accent: #f2a93b;
    --on-accent: #1a1200;
    --complete: #7fd19b;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #121417;
  --card: #1e2126;
  --surface: #2a2e35;
  --text: #f3f1ec;
  --text-muted: #a9adb4;
  --line: #353a41;
  --accent: #f2a93b;
  --on-accent: #1a1200;
  --complete: #7fd19b;
}

/* ---------- Grundlagen ---------- */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: var(--line-height);
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

h1 {
  font-size: var(--font-size-title);
}

h2 {
  font-size: var(--font-size-large);
}

h3 {
  font-size: var(--font-size);
}

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

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: var(--border-strong) solid var(--accent);
  outline-offset: var(--border-strong);
}

[hidden] {
  display: none !important;
}

.icon {
  width: var(--icon);
  height: var(--icon);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Aufbau ---------- */

.page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: calc(var(--space-4) + env(safe-area-inset-top)) var(--space-4) var(--space-6);
}

.page-narrow {
  max-width: var(--content-narrow);
}

.shell .main {
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  background: var(--card);
  border-top: var(--border) solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-brand {
  display: none;
}

.nav-items {
  display: flex;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--nav-height);
  color: var(--text-muted);
  font-size: var(--font-size-small);
  text-decoration: none;
}

.nav-item[aria-current='page'] {
  color: var(--accent);
  font-weight: 700;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stack-tight {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.row-between {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

.center {
  align-items: center;
  text-align: center;
}

.muted {
  color: var(--text-muted);
}

.strong {
  font-weight: 700;
}

/* ---------- Karten und Knöpfe ---------- */

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--card);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-4);
}

.card-accent {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch);
  min-width: var(--touch);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-dark {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.btn-plain {
  background: transparent;
}

.btn-block {
  width: 100%;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.badge {
  align-self: flex-start;
  padding: var(--space-1) var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-small);
  font-weight: 700;
}

.badge-accent {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- Formulare ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-label {
  font-weight: 700;
}

.hint {
  color: var(--text-muted);
  font-size: var(--font-size-small);
}

.input {
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-3);
  background: var(--card);
  border: var(--border) solid var(--text-muted);
  border-radius: var(--radius-field);
  font-size: var(--font-size);
}

textarea.input {
  resize: vertical;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--touch);
  padding: var(--space-2) 0;
  cursor: pointer;
}

.check input {
  flex: none;
  width: var(--icon);
  height: var(--icon);
  margin: 0;
  accent-color: var(--accent);
}

.error {
  padding: var(--space-3);
  border: var(--border-strong) solid var(--accent);
  border-radius: var(--radius-field);
  font-weight: 700;
}

.segmented {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface);
  border-radius: var(--radius-pill);
}

.segmented button {
  flex: 1;
  min-height: var(--touch);
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.segmented button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.switch {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--switch-width);
  height: var(--touch);
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.switch-track {
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--switch-height);
  padding: var(--space-1);
  background: var(--text-muted);
  border-radius: var(--radius-pill);
}

.switch-knob {
  width: var(--switch-knob);
  height: var(--switch-knob);
  background: var(--card);
  border-radius: var(--radius-pill);
}

.switch[aria-checked='true'] .switch-track {
  justify-content: flex-end;
  background: var(--accent);
}

/* ---------- Gruppenbild ---------- */

.avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--avatar);
  height: var(--avatar);
  overflow: hidden;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-pill);
  font-weight: 700;
  object-fit: cover;
}

.avatar-large {
  width: var(--avatar-large);
  height: var(--avatar-large);
  font-size: var(--font-size-title);
}

.group-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}

/* ---------- Termine ---------- */

.rehearsal.needs-answer {
  border: var(--border-strong) solid var(--accent);
}

.rehearsal.is-deleted .rehearsal-info {
  text-decoration: line-through;
  color: var(--text-muted);
}

.rehearsal-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--touch);
  color: var(--text);
  text-decoration: none;
}

.rehearsal-date {
  font-size: var(--font-size-large);
  font-weight: 700;
}

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.absence {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border) solid var(--line);
}

.lock-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-size-small);
}

.savebar {
  position: sticky;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  background: var(--bg);
  border-top: var(--border) solid var(--line);
}

/* ---------- Anwesenheit und Szenen ---------- */

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-3) var(--space-4);
  background: var(--card);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-card);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.people {
  list-style: none;
  padding: 0;
}

.people li {
  padding: var(--space-1) 0;
}

.scene-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.scene-card {
  width: 100%;
  text-align: left;
}

button.scene-card {
  cursor: pointer;
}

.scene-card.is-selected,
.scene-card.is-mine {
  border: var(--border-strong) solid var(--accent);
  padding: calc(var(--space-4) - var(--border-strong) + var(--border));
}

.scene-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  font-weight: 700;
  font-size: var(--font-size-large);
}

.scene-title .icon {
  width: var(--icon-large);
  height: var(--icon-large);
  color: var(--accent);
  stroke-width: 3;
}

.status-complete {
  color: var(--complete);
  font-weight: 700;
}

.status-missing {
  color: var(--accent);
  font-weight: 700;
}

.status-open {
  color: var(--text-muted);
}

.own {
  padding: var(--space-1) var(--space-2);
  background: var(--surface);
  border-radius: var(--radius-field);
  font-weight: 700;
}

.attendance-side {
  display: none;
}

.detail-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* ---------- Fenster und Meldungen ---------- */

.dialog {
  width: calc(100% - var(--space-5));
  max-width: var(--content-narrow);
  max-height: calc(100% - var(--space-5));
  padding: var(--space-4);
  background: var(--card);
  color: var(--text);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-card);
}

.dialog::backdrop {
  background: var(--backdrop);
}

.toast {
  position: fixed;
  left: var(--space-4);
  right: var(--space-4);
  bottom: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: var(--content-narrow);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-card);
  text-align: center;
}

.cropper {
  display: block;
  align-self: center;
  width: var(--cropper);
  height: var(--cropper);
  max-width: 100%;
  background: var(--surface);
  border-radius: var(--radius-field);
  cursor: grab;
  touch-action: none;
}

.range {
  width: 100%;
  min-height: var(--touch);
  accent-color: var(--accent);
}

.check-list {
  display: flex;
  flex-direction: column;
}

.member {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: var(--border) solid var(--line);
}

.member:last-child {
  border-bottom: 0;
}

.disclosure summary {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  cursor: pointer;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-5);
}

.footer-links a,
.back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--touch);
}

.back {
  align-self: flex-start;
}

.prose {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.prose h2 {
  margin-top: var(--space-3);
}

.prose ul {
  padding-left: var(--space-5);
}

/* ---------- PC ---------- */

@media (min-width: 1024px) {
  .shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
  }

  .shell .main {
    padding-bottom: 0;
  }

  .nav {
    position: sticky;
    top: 0;
    inset-inline: auto;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    height: 100vh;
    padding: var(--space-5) var(--space-3);
    border-top: 0;
    border-right: var(--border) solid var(--line);
  }

  .nav-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    text-align: center;
  }

  .nav-items {
    flex-direction: column;
    gap: var(--space-1);
  }

  .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    min-height: var(--touch);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-pill);
    font-size: var(--font-size);
  }

  .nav-item[aria-current='page'] {
    background: var(--surface);
  }

  .shell .group-head {
    display: none;
  }

  .savebar {
    bottom: 0;
  }

  .toast {
    bottom: var(--space-5);
  }

  .page-wide {
    max-width: var(--content-wide);
  }

  .page-wide .detail-layout {
    display: grid;
    grid-template-columns: var(--attendance-column) minmax(0, 1fr);
    align-items: start;
  }

  .page-wide .attendance-side {
    display: flex;
  }

  .page-wide .attendance-toggle {
    display: none;
  }

  .page-wide .scene-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
