/* Sport-Adventskalender – Badepark Bentheim
   Farben aus dem Logo: Purpur-Balken, Familienbad-Blau, Wasserspritzer. */

@font-face {
  font-family: "Lora";
  src: url("/static/fonts/lora-var.woff") format("woff");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --purpur: #7F1752;
  --purpur-tief: #5F0F3D;
  --purpur-zart: #F7E9F1;
  --becken: #5D80AE;
  --becken-text: #3B5E8F;
  --gischt: #B5CDE7;
  --gischt-zart: #E6EFF8;
  --fliese: #FFFFFF;
  --fuge: #D5E1EE;
  --wand: #F3F7FB;
  --tinte: #1C2026;
  --grau: #56606C;
  --grau-hell: #8D99A7;
  --rot: #A1203A;

  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r: 4px;
  --pad: 16px;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--wand);
  color: var(--tinte);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--purpur); text-underline-offset: 2px; }

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

:focus-visible {
  outline: 3px solid var(--becken);
  outline-offset: 2px;
}

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

.boot { padding: 3rem var(--pad); text-align: center; color: var(--grau); }

/* ---------- Kopf ---------- */

.top {
  background: var(--fliese);
  border-bottom: 1px solid var(--fuge);
}
.bar {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bar.wide { max-width: 1120px; }

.brand { display: block; flex: 0 0 auto; }
.brand img { height: 44px; width: auto; }

.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.navlink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--tinte);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}
.navlink:hover { background: var(--wand); }
.navlink.is-account {
  border: 1px solid var(--fuge);
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Testleiste ---------- */

.testbar {
  background: var(--becken-text);
  color: #fff;
  font-size: 0.92rem;
}
.testbar-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px var(--pad);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.testbar p { margin: 0; }
.testbar-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tb-btn, .tb-date input {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--r);
  background: transparent;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.tb-btn:hover { background: rgba(255, 255, 255, 0.14); }
.tb-date input { color-scheme: dark; }

/* ---------- Seitenrahmen ---------- */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px var(--pad) 8px;
}
main.wide { max-width: 1120px; }
main.narrow { max-width: 460px; }

.title {
  font: 600 2rem/1.15 var(--serif);
  margin: 4px 0 2px;
  letter-spacing: -0.01em;
}
.title.small { font-size: 1.6rem; }
.sub, .lead { margin: 0 0 18px; color: var(--grau); }
.lead { font-size: 1.05rem; }

/* Überschrift mit Linie und Endstrich – wie die Rahmung von „Bentheim“ im Logo */
.rule {
  position: relative;
  font: 600 1.3rem/1.25 var(--serif);
  margin: 0 0 14px;
  padding: 0 10px 6px 0;
  border-bottom: 1px solid var(--tinte);
}
.rule::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  width: 1px;
  height: 1.35em;
  background: var(--tinte);
}

.sec { margin: 36px 0 0; }

.hint { color: var(--grau); font-size: 0.92rem; margin: 10px 0 0; }

.foot {
  max-width: 640px;
  margin: 40px auto 0;
  padding: 18px var(--pad) 40px;
  color: var(--grau);
  font-size: 0.88rem;
}
.foot.wide { max-width: 1120px; }
.foot p { margin: 0; max-width: 40rem; }

/* ---------- Heute ---------- */

.today { margin: 0; }

.today-main {
  background: var(--purpur);
  color: #fff;
  border-radius: var(--r) var(--r) 0 0;
  padding: 18px 18px 22px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  align-items: start;
}
.today-main:last-child { border-radius: var(--r); }

.today-num {
  margin: 0;
  font: 700 clamp(4.25rem, 19vw, 6.75rem)/0.82 var(--serif);
  color: var(--gischt);
  font-variant-numeric: lining-nums;
  letter-spacing: -0.03em;
  padding-top: 4px;
}

.today-title {
  font: 600 1.45rem/1.2 var(--serif);
  margin: 2px 0 8px;
}
.today .desc { margin: 0 0 10px; white-space: pre-line; }
.today-main .desc { color: rgba(255, 255, 255, 0.92); }
.today-main a { color: #fff; }

.today-act { margin-top: 14px; }

.btn-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--r);
  background: #fff;
  color: var(--purpur);
  font: 700 1.1rem var(--sans);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--purpur-tief);
}
.btn-hero:hover { background: var(--gischt-zart); }
.btn-hero:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--purpur-tief); }
.btn-hero .ic { width: 22px; height: 22px; }

.hero-note { margin: 0; color: rgba(255, 255, 255, 0.92); font-weight: 600; }

.done { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.done-text { margin: 0; flex: 1 1 12rem; }
.done-text strong { font: 600 1.25rem var(--serif); display: block; }
.done-mark {
  position: relative;
  flex: 0 0 auto;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--gischt);
  color: var(--purpur-tief);
  display: grid;
  place-items: center;
}
.done-mark .ic { width: 28px; height: 28px; }

/* Der eine Moment Bewegung: Wellenringe, wenn gerade abgehakt wurde */
.done.is-new .done-mark::before,
.done.is-new .done-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gischt);
  animation: ripple 1.1s ease-out forwards;
}
.done.is-new .done-mark::after { animation-delay: 0.25s; }
.done.is-new .done-mark { animation: pop 0.45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ripple {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(2.6); opacity: 0; }
}
@keyframes pop {
  from { transform: scale(0.6); }
  to { transform: scale(1); }
}

.btn-link {
  border: 0;
  background: none;
  padding: 8px 0;
  min-height: 44px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  color: var(--purpur);
}
.btn-link.light { color: #fff; }

.today-alt {
  background: var(--fliese);
  border: 1px solid var(--fuge);
  border-top: 0;
  border-radius: 0 0 var(--r) var(--r);
  padding: 16px 18px 18px;
  box-shadow: inset 4px 0 0 var(--gischt);
}
.alt-lead { margin: 0 0 2px; color: var(--grau); font-size: 0.92rem; }
.alt-title { font: 600 1.15rem/1.3 var(--serif); margin: 0 0 6px; }
.today-alt .btn { margin-top: 4px; }

.rules-list { margin: 0; padding-left: 1.2em; }
.rules-list li { margin: 0 0 6px; }

/* ---------- Fliesenwand (Kalender) ---------- */

.wall {
  list-style: none;
  margin: 0;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--fuge);
  border-radius: var(--r);
}
@media (min-width: 560px) {
  .wall { grid-template-columns: repeat(6, 1fr); }
}
.wall li { margin: 0; }

.tile {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 2px;
  background: var(--fliese);
  box-shadow: inset 0 -3px 0 rgba(28, 32, 38, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  cursor: pointer;
  color: var(--tinte);
}
.tile:disabled { cursor: default; }
.tile .tn { font: 600 1.55rem/1 var(--serif); font-variant-numeric: lining-nums; }
.tile .tm { font: 700 0.72rem/1 var(--sans); letter-spacing: 0.01em; }
.tile .ic { width: 20px; height: 20px; }

.tile.is-locked { color: var(--grau-hell); }
.tile.is-locked .tn { font-weight: 500; }

.tile.is-today { background: var(--purpur); color: #fff; box-shadow: inset 0 -3px 0 var(--purpur-tief); }

.tile.is-done { background: var(--gischt-zart); color: var(--becken-text); }

.tile.is-missed { background: var(--purpur-zart); color: var(--purpur); }

.tile.is-free { background: #EEF1F4; color: var(--grau); }

.tile.is-none { background: #F1F4F7; color: var(--grau-hell); }

.tile:not(:disabled):hover { filter: brightness(0.97); }

.legend {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--grau);
  font-size: 0.86rem;
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 2px;
  border: 1px solid var(--fuge);
}
.sw.is-today { background: var(--purpur); border-color: var(--purpur); }
.sw.is-done { background: var(--gischt-zart); }
.sw.is-missed { background: var(--purpur-zart); }
.sw.is-free { background: #EEF1F4; }

/* ---------- Strafkasse ---------- */

.kasse-sum { margin: 0 0 4px; font-size: 1.05rem; }
.kasse-sum .amount { font: 700 2.2rem/1 var(--serif); color: var(--purpur); margin-right: 4px; }
.kasse p { margin: 0 0 4px; }
.kasse .hint { margin-top: 12px; }

.cal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.url { font-weight: 600; color: var(--tinte); overflow-wrap: anywhere; }

/* ---------- Bausteine ---------- */

.card {
  background: var(--fliese);
  border: 1px solid var(--fuge);
  border-radius: var(--r);
  padding: 18px;
  margin: 0 0 18px;
}

.form label { display: block; margin: 0 0 14px; font-weight: 600; font-size: 0.95rem; }
.form input:not([type="checkbox"]):not([type="radio"]),
.form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #AEBCCC;
  border-radius: var(--r);
  background: #fff;
  font-weight: 400;
  font-size: 1rem;
}
.form textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.form input[type="date"], .form input[name="penalty"], .form input[name="paid"],
.form input[name="start_day"], .form input[name="pin"] { max-width: 16rem; }
.form input:focus, .form textarea:focus { border-color: var(--becken); }
.form .check, .form .radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  margin: 0 0 12px;
  cursor: pointer;
}
.form .check input, .form .radio input {
  width: 20px; height: 20px;
  margin: 2px 0 0;
  accent-color: var(--purpur);
  flex: 0 0 auto;
}
.form-title { font: 600 1.2rem/1.3 var(--serif); margin: 0 0 14px; }
.form-err { color: var(--rot); font-weight: 600; margin: 0 0 10px; min-height: 0; }
.form-err:empty { display: none; }
.form .row { display: grid; gap: 0 14px; }
@media (min-width: 560px) { .form .row { grid-template-columns: 1fr 1fr; } }
.radios { border: 0; padding: 0; margin: 0 0 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1.5px solid transparent;
  border-radius: var(--r);
  font: 600 1rem var(--sans);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--purpur); color: #fff; }
.btn-primary:hover { background: var(--purpur-tief); }
.btn-secondary { background: #fff; color: var(--becken-text); border-color: var(--becken-text); }
.btn-secondary:hover { background: var(--gischt-zart); }
.btn-quiet { color: var(--tinte); }
.btn-quiet:hover { background: var(--wand); }
.btn-danger { background: #fff; color: var(--rot); border-color: var(--rot); }
.btn-danger:hover { background: #FBEFF1; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 0.92rem; }

.notice {
  background: var(--fliese);
  border: 1px solid var(--fuge);
  box-shadow: inset 4px 0 0 var(--purpur);
  border-radius: var(--r);
  padding: 12px 14px;
  margin: 0 0 16px;
}
.notice.ok { box-shadow: inset 4px 0 0 var(--becken); }

.facts { margin: 0 0 16px; }
.facts div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--fuge); }
.facts dt { color: var(--grau); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

hr { border: 0; border-top: 1px solid var(--fuge); margin: 18px 0; }

/* ---------- Dialog ---------- */

.dlg {
  border: 0;
  padding: 0;
  border-radius: 6px;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  color: var(--tinte);
  background: var(--fliese);
  box-shadow: 0 18px 50px rgba(28, 32, 38, 0.28);
}
.dlg::backdrop { background: rgba(28, 32, 38, 0.5); }
.dlg-in { padding: 20px 20px 18px; }
.dlg-title { font: 600 1.35rem/1.25 var(--serif); margin: 0 0 10px; padding-right: 8px; }
.dlg .desc { white-space: pre-line; margin: 0 0 12px; }
.dlg .ch-title { font: 600 1.15rem/1.3 var(--serif); margin: 14px 0 6px; }
.dlg .alt-title { margin-top: 16px; }
.dlg-status { display: inline-block; margin: 0 0 6px; padding: 4px 10px; border-radius: var(--r); font-weight: 600; font-size: 0.92rem; background: var(--wand); }
.dlg-status.st-main, .dlg-status.st-alt { background: var(--gischt-zart); color: var(--becken-text); }
.dlg-status.st-missed { background: var(--purpur-zart); color: var(--purpur); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dlg-actions.split { justify-content: space-between; }
.dlg-confirm { width: min(420px, calc(100vw - 24px)); }
.confirm-text { margin: 0; font-size: 1.05rem; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: min(520px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--tinte);
  color: #fff;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--rot); }

/* ---------- Verwaltung ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2px;
  margin: 10px 0 20px;
  border-bottom: 1px solid var(--fuge);
}
.tab {
  flex: 0 0 auto;
  padding: 12px 14px 10px;
  color: var(--grau);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--tinte); }
.tab.is-active { color: var(--purpur); border-bottom-color: var(--purpur); }

.loading { color: var(--grau); }

.ov-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin: 0 0 6px; }
.stat { margin: 0; color: var(--grau); }
.stat-n { font: 700 1.6rem/1 var(--serif); color: var(--tinte); margin-right: 4px; }
.ov-top .btn { margin-left: auto; }

.table-wrap {
  overflow-x: auto;
  margin: 14px 0 0;
  border: 1px solid var(--fuge);
  border-radius: var(--r);
  background: var(--fliese);
}
.matrix { border-collapse: collapse; font-size: 0.88rem; min-width: 100%; }
.matrix th, .matrix td { padding: 0; text-align: center; border-bottom: 1px solid var(--fuge); }
.matrix thead th { font-weight: 600; color: var(--grau); padding: 8px 2px; font-variant-numeric: tabular-nums; }
.matrix thead th.is-cur { color: var(--purpur); }
.matrix th[scope="row"], .matrix thead th:first-child {
  position: sticky;
  left: 0;
  background: var(--fliese);
  text-align: left;
  z-index: 1;
  box-shadow: 1px 0 0 var(--fuge);
}
.matrix th[scope="row"] button {
  border: 0;
  background: none;
  padding: 8px 12px;
  min-height: 40px;
  font-weight: 600;
  color: var(--purpur);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.matrix td.num { padding: 0 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.matrix td.num.owe { color: var(--purpur); font-weight: 700; }
.cell {
  width: 32px; height: 34px;
  margin: 2px 1px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font: 700 0.9rem/1 var(--sans);
  cursor: pointer;
}
.cell.c-main, .cell.c-alt { background: var(--gischt-zart); color: var(--becken-text); }
.cell.c-excused { background: #EEF1F4; color: var(--grau); }
.cell.c-missed { background: var(--purpur-zart); color: var(--purpur); }
.cell.c-open { box-shadow: inset 0 0 0 2px var(--purpur); color: var(--purpur); }
.cell.c-none { color: var(--grau-hell); }
.cell.c-locked { color: var(--grau-hell); }
.cell:hover { filter: brightness(0.95); background-color: var(--wand); }
.matrix .legend { justify-content: flex-start; }

.ch-list { list-style: none; margin: 0; padding: 0; }
.ch-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--fuge);
}
.ch-num { font: 600 1.7rem/1 var(--serif); color: var(--grau-hell); text-align: center; }
.ch-row.is-open .ch-num { color: var(--purpur); }
.ch-txt p { margin: 0; }
.ch-date { color: var(--grau); font-size: 0.85rem; }
.ch-t { font-weight: 600; }
.ch-a { color: var(--grau); font-size: 0.92rem; }
.ch-link { margin: 0 0 10px; }

.user-list { list-style: none; margin: 0; padding: 0; }
.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--fuge);
}
.user-row p { margin: 0; }
.u-name { font-weight: 600; }
.u-meta { color: var(--grau); font-size: 0.9rem; }

.test-card { box-shadow: inset 4px 0 0 var(--becken); }

.err-screen { text-align: left; }

@media (min-width: 720px) {
  .brand img { height: 54px; }
  .title { font-size: 2.3rem; }
  .today-main { padding: 22px 26px 26px; gap: 4px 26px; }
  .today-alt { padding: 18px 26px 20px; }
  .today-title { font-size: 1.7rem; }
}

@media (max-width: 380px) {
  .brand img { height: 38px; }
  .today-main { grid-template-columns: 1fr; }
  .today-num { font-size: 4rem; }
}

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