/* ── Grundwerte ──────────────────────────────────────────────────────────
   Die Akzentfarbe kommt aus config.php (accent_color). Hintergrund,
   Schrift- und Linienfarben werden daraus abgeleitet, damit alles zusammenpasst. */

:root {
  --accent: #0a7d5a;
  --on-accent: #fff;

  --bg: #eef3f1;
  --ink: #16211e;
  --muted: #56645f;
  --line: #d3dcd8;
  --paper: #fff;
  --tint: #e3efea;
  --accent-ink: #075c43;
  --danger: #b3261e;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-code: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --radius: 22px;
  --notch: 13px;
}

@supports (color: color-mix(in oklab, red 50%, blue)) {
  :root {
    --bg: color-mix(in oklab, var(--accent) 10%, #f6f7f6);
    --ink: color-mix(in oklab, var(--accent) 18%, #121a17);
    --muted: color-mix(in oklab, var(--accent) 14%, #5b6461);
    --line: color-mix(in oklab, var(--accent) 22%, #d9dedc);
    --tint: color-mix(in oklab, var(--accent) 12%, #fff);
    --accent-ink: color-mix(in oklab, var(--accent) 78%, #000);
  }
}

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

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

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

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

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

code { font-family: var(--font-code); font-size: .9em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Rahmen ─────────────────────────────────────────────────────────── */

.top,
.page,
.foot {
  width: 100%;
  max-width: 31rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
}

.page {
  flex: 1;
  padding-top: 2.25rem;
  padding-bottom: 3rem;
}

.page-wide,
.admin .top,
.admin .foot { max-width: 60rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}
.brand img,
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 750;
}

h1 {
  margin: 0 0 .7rem;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 1.35rem + 2.6vw, 2.5rem);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -.018em;
  text-wrap: balance;
}

h2 {
  margin: 2.5rem 0 .75rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.25;
  font-weight: 700;
}

h3 { margin: 0 0 .25rem; font-size: 1rem; }

.lead {
  margin: 0 0 2rem;
  color: var(--muted);
  max-width: 34em;
}

.fine { margin: .9rem 0 0; font-size: .875rem; color: var(--muted); }

.note {
  margin: 1.5rem 0 0;
  font-size: .85rem;
  line-height: 1.5;
  color: var(--muted);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  padding-bottom: 2rem;
  font-size: .875rem;
}
.foot a { color: var(--muted); }

/* ── Sprachauswahl ─────────────────────────────────────────────────── */

.lang { position: relative; }
.lang summary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.5rem;
  padding: 0 .85rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: .9rem;
  font-weight: 550;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary svg { fill: none; stroke: currentColor; stroke-width: 1.5; }
.lang[open] summary { background: var(--ink); color: var(--bg); }
.lang ul {
  position: absolute;
  right: 0;
  top: calc(100% + .4rem);
  z-index: 10;
  min-width: 11rem;
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: var(--paper);
  border-radius: 14px;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .28), 0 0 0 1px var(--line);
}
.lang li a {
  display: block;
  padding: .55rem .75rem;
  border-radius: 9px;
  color: var(--ink);
  text-decoration: none;
}
.lang li a:hover { background: var(--tint); }
.lang li a[aria-current] { font-weight: 700; color: var(--accent-ink); }

/* ── Das Ticket ────────────────────────────────────────────────────────
   Der Code als Gutschein: Kopfteil, Perforation mit zwei Kerben, Code darunter. */

.ticket {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 22px 40px -30px rgba(0, 0, 0, .45);
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.05rem 1.4rem .95rem;
  font-size: .9rem;
  color: var(--muted);
}
.ticket-label { color: var(--ink); font-weight: 650; }

.ticket-body {
  position: relative;
  padding: 1.6rem 1.4rem 1.4rem;
  border-top: 2px dashed var(--line);
}
.ticket-body::before,
.ticket-body::after {
  content: "";
  position: absolute;
  top: calc(-1 * var(--notch) - 1px);
  width: calc(2 * var(--notch));
  height: calc(2 * var(--notch));
  border-radius: 50%;
  background: var(--bg);
}
.ticket-body::before { left: calc(-1 * var(--notch)); }
.ticket-body::after  { right: calc(-1 * var(--notch)); }

/* Verdeckter Code vor dem Abholen */
.seal {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: 1.4rem;
}
.seal span {
  height: 2.5rem;
  border-radius: 8px;
  background: repeating-linear-gradient(-45deg, var(--tint) 0 7px, var(--paper) 7px 12px);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* Der Code */
.code {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem .55rem;
  margin: 0 0 1.4rem;
  font-family: var(--font-code);
  font-size: clamp(1.3rem, 1rem + 2.2vw, 1.7rem);
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.3;
  color: var(--ink);
  user-select: all;
  -webkit-user-select: all;
}
.code span { white-space: nowrap; }

/* Der eine bewusste Effekt: Der Code wird nach dem Abholen aufgedeckt. */
@media (prefers-reduced-motion: no-preference) {
  .state-new .code span { animation: reveal .55s cubic-bezier(.2, .7, .2, 1) both; }
  .state-new .code span:nth-child(2) { animation-delay: .07s; }
  .state-new .code span:nth-child(3) { animation-delay: .14s; }
  .state-new .code span:nth-child(4) { animation-delay: .21s; }
  .state-new .code span:nth-child(5) { animation-delay: .28s; }
  .state-new .code span:nth-child(6) { animation-delay: .35s; }
  .state-new .code span:nth-child(n+7) { animation-delay: .42s; }
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(.35em); filter: blur(5px); }
  to   { opacity: 1; transform: none; filter: none; }
}

.actions { display: grid; gap: .6rem; }
@media (min-width: 30rem) {
  .actions { grid-template-columns: 1fr 1fr; }
}

.copy-status { margin: .75rem 0 0; font-size: .875rem; color: var(--muted); }
.copy-status:empty { margin: 0; }

/* Leeres Ticket: ausverkauft oder gesperrt */
.ticket-void {
  padding: 1.5rem 1.4rem;
  background: transparent;
  border: 2px dashed var(--line);
  box-shadow: none;
}
.ticket-void p { margin: 0; }
.ticket-void .fine { margin-top: .9rem; }

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  min-height: 3.25rem;
  padding: .7rem 1.4rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.btn:active { transform: scale(.985); }
.btn-inline { width: auto; }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-primary.is-done { background: var(--ink); color: var(--bg); }

.btn-secondary { background: var(--tint); color: var(--accent-ink); }
.btn-secondary:hover { background: var(--line); }

.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 2px currentColor; }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn[disabled] { opacity: .7; cursor: progress; }

.linklike {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .18em;
  cursor: pointer;
}
.linklike.danger { color: var(--danger); }

/* ── Anleitung ─────────────────────────────────────────────────────── */

.guide details {
  border-top: 1px solid var(--line);
}
.guide details:last-of-type { border-bottom: 1px solid var(--line); }
.guide summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .95rem 0;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after {
  content: "";
  flex: none;
  width: .55rem;
  height: .55rem;
  margin-right: .3rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-25%);
  transition: transform .2s;
}
.guide details[open] summary::after { transform: rotate(-135deg) translateY(-25%); }

.guide ol {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.guide li {
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: .8rem;
  counter-increment: step;
}
.guide li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: .05rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent-ink);
  font-size: .85rem;
  font-weight: 700;
}
.guide-note { margin: 1.25rem 0 0; font-size: .9rem; color: var(--muted); }

/* ── Hinweise ──────────────────────────────────────────────────────── */

.alert,
.notice {
  margin: 0 0 1.5rem;
  padding: .85rem 1rem;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: inset 4px 0 0 var(--danger);
}
.alert-ok, .alert-info, .notice { box-shadow: inset 4px 0 0 var(--accent); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.cf-turnstile { margin-bottom: 1rem; }

/* ── Rechtliche Seiten ─────────────────────────────────────────────── */

.legal .page { max-width: 42rem; }
.legal .top, .legal .foot { max-width: 42rem; }
.legal h1 { margin-bottom: .3rem; }
.legal h2 { font-size: 1.15rem; margin-top: 2rem; }
.legal p, .legal li { max-width: 40em; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .4rem; }
.legal address { font-style: normal; margin: 1.5rem 0; }
.back { margin: 0 0 1.5rem; font-size: .9rem; }

.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .25rem 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
@media (max-width: 30rem) {
  .facts div { grid-template-columns: 1fr; }
}

/* ── Admin ─────────────────────────────────────────────────────────── */

.admin-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem 1.5rem;
  margin-bottom: 1.5rem;
}
.admin-head h1 { margin: 0; }
.admin-nav { display: flex; gap: 1.25rem; align-items: baseline; font-size: .95rem; }
.admin-nav form { margin: 0; }

.login { display: grid; gap: .6rem; max-width: 22rem; }
.login .btn { margin-top: .4rem; }

label { font-weight: 600; font-size: .95rem; }

input[type="password"],
textarea {
  width: 100%;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
textarea { font-family: var(--font-code); font-size: .95rem; resize: vertical; }
input[type="file"] { font: inherit; font-size: .95rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin: 0 0 .75rem;
}
.stats div { padding: 1rem 1.1rem; border-radius: 16px; background: var(--paper); }
.stats dt { font-size: .875rem; color: var(--muted); }
.stats dd { margin: .15rem 0 0; font-family: var(--font-display); font-size: 2rem; font-weight: 750; line-height: 1.1; }
.stats .is-empty dd { color: var(--danger); }
.status-line { margin: 0 0 2rem; font-size: .95rem; color: var(--muted); }

.panel {
  margin-bottom: 1.25rem;
  padding: 1.4rem;
  border-radius: 20px;
  background: var(--paper);
}
.panel h2 { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.hint { margin: 0 0 1rem; font-size: .925rem; color: var(--muted); }
.stack { display: grid; gap: .5rem; }
.stack label:not(:first-of-type) { margin-top: .5rem; }
.stack .btn { margin-top: .75rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.tabs a {
  padding: .4rem .85rem;
  border-radius: 999px;
  color: var(--ink);
  font-size: .9rem;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--line);
}
.tabs a[aria-current] { background: var(--ink); color: var(--bg); box-shadow: none; }

.table-wrap { overflow-x: auto; margin: 0 -1.4rem; padding: 0 1.4rem; }
table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; padding: .5rem .75rem .5rem 0; }
td { padding: .6rem .75rem .6rem 0; border-top: 1px solid var(--line); white-space: nowrap; }
td form { margin: 0; }
.mono { font-family: var(--font-code); letter-spacing: .03em; }
.muted { color: var(--muted); }
.right { text-align: right; padding-right: 0; }

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.row:first-of-type { border-top: 0; padding-top: 0; }
.row > div { flex: 1 1 22rem; }
.row .hint { margin: 0; }
.row form { margin: 0; }

@media (max-width: 34rem) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:last-child { grid-column: span 2; }
}
