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

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

body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #4a0d18;
  color: #2a2024;
}

button,
input {
  font: inherit;
}

/* ───────── Kopf ───────── */
.top {
  padding: 22px 16px 18px;
  text-align: center;
  color: #fdf3df;
  background:
    radial-gradient(circle at 12% 30%, rgba(255, 220, 150, 0.16) 0 2px, transparent 3px) 0 0 / 90px 70px,
    radial-gradient(circle at 70% 75%, rgba(255, 220, 150, 0.12) 0 1.5px, transparent 2.5px) 0 0 / 130px 90px,
    linear-gradient(#5d1120, #4a0d18);
}
.top h1 {
  margin: 0;
  font: 700 clamp(1.6rem, 3.4vw, 2.4rem) / 1.1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
  text-wrap: balance;
}
.top h1 span {
  display: block;
  margin-top: 6px;
  font: 600 0.8rem/1 system-ui, sans-serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f0c56b;
}
.top p {
  margin: 10px auto 0;
  max-width: 56ch;
  font-size: 0.95rem;
  color: #f3dcc4;
  text-wrap: pretty;
}

/* ───────── Reiter (nur schmal) ───────── */
.tabs {
  display: none;
}

/* ───────── Drei Bahnen ───────── */
.lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 100vh;
}

.lane {
  position: relative;
  padding: 0 clamp(12px, 1.6vw, 24px) 48px;
  color: var(--ink);
  background: var(--bg);
  isolation: isolate;
}
.lane + .lane {
  border-left: 6px solid var(--edge, rgba(0, 0, 0, 0.25));
}

.lane-deco {
  position: absolute;
  inset: 0 0 auto 0;
  height: 190px;
  z-index: -1;
  pointer-events: none;
}

.lane-head {
  padding: 34px 0 20px;
  text-align: center;
}
.lane-emblem {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 34px;
  background: var(--emblem-bg);
  box-shadow: var(--emblem-shadow);
}
.lane-head h2 {
  margin: 10px 0 2px;
  font: var(--name-font);
  letter-spacing: var(--name-track, 0);
  text-transform: var(--name-case, none);
  color: var(--name);
  text-shadow: var(--name-shadow, none);
}
.lane-count {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--soft);
}

.cards {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.empty {
  grid-column: 1 / -1;
  margin: 10px 0;
  padding: 28px 18px;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--soft);
}

/* ───────── Karte ───────── */
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--card);
  color: var(--card-ink);
  border: var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.card.big {
  grid-column: 1 / -1;
}
.card.big .pic {
  aspect-ratio: 16 / 7;
}
.pic {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--pic);
}
.pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.pic .icon {
  font-size: clamp(52px, 28cqi, 84px);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.18));
}
.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--on-accent);
}
.body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  padding: 14px;
}
.card h3 {
  margin: 0;
  font: var(--title-font);
  overflow-wrap: anywhere;
}
.price {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
}
.note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--card-soft);
}
.shop {
  align-self: flex-start;
  font-size: 0.88rem;
  color: var(--link);
  text-underline-offset: 3px;
}
.card .btn,
.card .givers.bought,
.card .share {
  margin-top: auto;
}

@container (min-width: 460px) {
  .card.big {
    flex-direction: row;
  }
  .card.big .pic {
    flex: 0 0 38%;
    aspect-ratio: auto;
    min-height: 200px;
  }
}

.card.done {
  box-shadow: none;
}
.card.done .pic img,
.card.done .pic .icon {
  opacity: 0.45;
  filter: grayscale(0.6);
}
.card.done h3 {
  opacity: 0.75;
}

/* ───────── Knöpfe ───────── */
.btn {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--btn-radius, 12px);
  border: 2px solid transparent;
  font-weight: 700;
  cursor: pointer;
}
.btn.solid {
  background: var(--accent, #a3122b);
  color: var(--on-accent, #fff);
}
.btn.solid:hover {
  filter: brightness(1.08);
}
.btn.ghost {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
:focus-visible {
  outline: 3px solid #f0c56b;
  outline-offset: 2px;
}

/* ───────── Mitmachen-Balken ───────── */
.share {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar {
  display: flex;
  gap: 4px;
}
.seg {
  flex: 1 1 0;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  border-radius: 8px;
  border: 2px dashed var(--seg-line);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seg.full {
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.share-info {
  margin: 0;
  font-size: 0.85rem;
  color: var(--card-soft);
}
.givers {
  margin: 0;
  font-size: 0.9rem;
}
.givers.bought {
  font-weight: 600;
}
.check {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
}
.giver {
  font-weight: 700;
}
.giver + .giver::before {
  content: ", ";
  font-weight: 400;
}
.undo {
  margin-left: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}

/* ═════════ Julian: Winternacht ═════════ */
.lane-julian {
  --bg:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='none' stroke='%23bfe3ff' stroke-opacity='.22' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M30 18v24M18 30h24M21.500 21.500l17 17M38.500 21.500l-17 17'/%3E%3Cpath d='M118 92v18M109 101h18M111.600 94.600l12.800 12.800M124.400 94.600l-12.800 12.800'/%3E%3C/g%3E%3Cg fill='%23fff' fill-opacity='.35'%3E%3Ccircle cx='92' cy='30' r='1.6'/%3E%3Ccircle cx='140' cy='52' r='1.200'/%3E%3Ccircle cx='52' cy='108' r='1.800'/%3E%3Ccircle cx='20' cy='140' r='1.200'/%3E%3Ccircle cx='86' cy='146' r='1.400'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(#0a1533, #14295c 55%, #0d1c44);
  --edge: #06102a;
  --ink: #e8f2ff;
  --soft: #a9c2e6;
  --line: #3b5796;
  --name: #ffffff;
  --name-font: 800 clamp(2rem, 3.6vw, 3rem) / 1 "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --name-case: uppercase;
  --name-track: 0.14em;
  --name-shadow: 0 0 18px rgba(130, 195, 255, 0.7);
  --emblem-bg: radial-gradient(circle at 35% 30%, #fff7c9, #f0c56b 60%, #c9972f);
  --emblem-shadow: 0 0 0 6px rgba(240, 197, 107, 0.15), 0 0 34px rgba(240, 197, 107, 0.55);
  --card: rgba(20, 38, 84, 0.86);
  --card-ink: #eef5ff;
  --card-soft: #b3c8ea;
  --card-border: 1px solid #40609f;
  --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  --radius: 6px;
  --btn-radius: 4px;
  --pic: linear-gradient(135deg, #1b3a7c, #0f2250);
  --accent: #7cc4ff;
  --on-accent: #06163a;
  --accent-ink: #9fd3ff;
  --link: #bfe3ff;
  --seg-line: #5578b8;
  --title-font: 700 1rem/1.25 system-ui, sans-serif;
}
.lane-julian .lane-deco {
  background: radial-gradient(ellipse 70% 100% at 50% 0, rgba(124, 196, 255, 0.28), transparent 70%);
}

/* ═════════ Antonia: Zuckerstangen ═════════ */
.lane-antonia {
  --bg:
    radial-gradient(circle, #ffc9dc 0 5px, transparent 6px) 0 0 / 46px 46px,
    radial-gradient(circle, #ffe1ea 0 3px, transparent 4px) 23px 23px / 46px 46px,
    #fff6f0;
  --edge: #c81e55;
  --ink: #5b1630;
  --soft: #9a4c68;
  --line: #f29bb8;
  --name: #d61f5c;
  --name-font: 800 clamp(2.1rem, 3.8vw, 3.1rem) / 1 ui-rounded, "Arial Rounded MT Bold", "Nunito", "Comic Sans MS", system-ui, sans-serif;
  --name-shadow: 3px 3px 0 #fff, 5px 5px 0 #ffc2d6;
  --emblem-bg: #fff;
  --emblem-shadow: 0 0 0 5px #ff8fb3, 0 8px 0 5px rgba(214, 31, 92, 0.18);
  --card: #ffffff;
  --card-ink: #45122a;
  --card-soft: #8a4a62;
  --card-border: 3px solid #ffd0df;
  --card-shadow: 0 6px 0 #ffb3ca;
  --radius: 24px;
  --btn-radius: 999px;
  --pic: repeating-linear-gradient(135deg, #ffe4ec 0 14px, #fff 14px 28px);
  --accent: #d61f5c;
  --on-accent: #fff;
  --accent-ink: #c2185b;
  --link: #a3134a;
  --seg-line: #f29bb8;
  --title-font: 700 1rem/1.25 ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
}
.lane-antonia .lane-deco {
  height: 22px;
  background: repeating-linear-gradient(135deg, #d61f5c 0 16px, #fff 16px 32px);
  box-shadow: 0 4px 0 rgba(214, 31, 92, 0.2);
}

/* ═════════ Johanna: Tannenwald ═════════ */
.lane-johanna {
  --bg:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='130'%3E%3Cg fill='%23ffffff' fill-opacity='.055'%3E%3Cpath d='M30 14l16 26h-9l13 22H10l13-22h-9z'/%3E%3Cpath d='M90 74l14 22h-8l11 19H73l11-19h-8z'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(#0f3526, #16482f 60%, #0e3023);
  --edge: #0a241a;
  --ink: #f4ecd6;
  --soft: #c9d8b9;
  --line: #5d8a63;
  --name: #f3d27a;
  --name-font: italic 700 clamp(2.2rem, 4vw, 3.2rem) / 1 Georgia, "Palatino Linotype", "Times New Roman", serif;
  --name-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  --emblem-bg: #f8f0dc;
  --emblem-shadow: 0 0 0 3px #d4aa4c, 0 0 0 7px rgba(212, 170, 76, 0.25);
  --card: #fbf5e6;
  --card-ink: #23331f;
  --card-soft: #5c6a4e;
  --card-border: 1px solid #d4aa4c;
  --card-shadow: 0 0 0 4px rgba(212, 170, 76, 0.18), 0 12px 22px rgba(0, 0, 0, 0.35);
  --radius: 14px 14px 4px 4px;
  --btn-radius: 8px;
  --pic: radial-gradient(circle at 50% 40%, #fffdf5, #eadfc2);
  --accent: #1f6a42;
  --on-accent: #fff8e1;
  --accent-ink: #8a5a00;
  --link: #1f6a42;
  --seg-line: #b9a878;
  --title-font: 700 1.05rem/1.25 Georgia, "Times New Roman", serif;
}
/* Lichterkette */
.lane-johanna .lane-deco {
  height: 34px;
  background:
    radial-gradient(circle at 50% 70%, #ffd76a 0 5px, rgba(255, 215, 106, 0.35) 6px 11px, transparent 12px) 0 0 / 96px 34px,
    radial-gradient(circle at 50% 70%, #ff7b6b 0 5px, rgba(255, 123, 107, 0.3) 6px 11px, transparent 12px) 32px 0 / 96px 34px,
    radial-gradient(circle at 50% 70%, #8fe0ff 0 5px, rgba(143, 224, 255, 0.3) 6px 11px, transparent 12px) 64px 0 / 96px 34px,
    linear-gradient(#0a241a 0 3px, transparent 3px);
}

/* ───────── Dialog ───────── */
dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fffaf2;
  color: #2a2024;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
dialog::backdrop {
  background: rgba(20, 6, 10, 0.6);
}
#dlg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
}
#dlg-form h2 {
  margin: 0;
  font: 700 1.4rem/1.2 Georgia, serif;
  color: #7a1426;
}
#dlg-form p {
  margin: 0;
}
#dlg-form label {
  font-weight: 700;
  font-size: 0.9rem;
}
#dlg-name {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid #d9c7b0;
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6ead8;
}
.stepper span {
  margin-right: auto;
  font-weight: 700;
}
.stepper button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #7a1426;
  background: #fff;
  color: #7a1426;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.stepper button:disabled {
  opacity: 0.35;
  cursor: default;
}
.stepper output {
  min-width: 1.5ch;
  text-align: center;
  font-weight: 800;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}
.stepper strong {
  min-width: 8ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dlg-error {
  padding: 8px 10px;
  border-radius: 8px;
  background: #ffe3e3;
  color: #8a1020;
  font-size: 0.9rem;
}
.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.dlg-actions .btn.solid {
  background: #a3122b;
  color: #fff;
}
.dlg-actions .btn.ghost {
  color: #6b5a4a;
}

/* ───────── Hinweis und Sperre ───────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: #1d1418;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.locked {
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 24px 16px;
  text-align: center;
  color: #fdf3df;
}
.locked-icon {
  font-size: 64px;
}
.locked h2 {
  margin: 8px 0;
  font: 700 1.5rem/1.2 Georgia, serif;
  text-wrap: balance;
}
[hidden] {
  display: none !important;
}

/* ───────── Schmal: Bahnen zum Wischen ───────── */
@media (max-width: 899px) {
  body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }
  .top {
    padding: 12px 16px 10px;
  }
  .top h1 {
    font-size: 1.35rem;
  }
  .top h1 span {
    display: inline;
    margin-left: 8px;
    font-size: 0.65rem;
  }
  .top p {
    display: none;
  }
  .tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 0 8px 8px;
    background: #4a0d18;
  }
  .tab {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    font-weight: 800;
    color: #fff;
    opacity: 0.6;
    cursor: pointer;
  }
  .tab.on {
    opacity: 1;
    box-shadow: inset 0 0 0 3px #f0c56b;
  }
  .tab-julian {
    background: #14295c;
  }
  .tab-antonia {
    background: #d61f5c;
  }
  .tab-johanna {
    background: #16482f;
  }
  .lanes {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .lanes::-webkit-scrollbar {
    display: none;
  }
  .lane {
    flex: 0 0 100%;
    padding: 0 16px 90px;
    overflow-y: auto;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
  .lane + .lane {
    border-left: 0;
  }
  .lane-head {
    padding-top: 30px;
  }
  .cards {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
