:root {
  color-scheme: light;
  --ink: #1d1d1b;
  --muted: #55544e;
  --faint: #8a8981;
  --page: #ffffff;
  --surface: #f5f4f0;
  --line: #eae8e2;
  --wald: #3d5229;
  --wald-tint: #f1f3ea;
  --rost: #b44a24;
  --rost-tint: #fbeee6;
  --stahl: #34507a;
  --stahl-tint: #eef1f6;
  --quiet: rgba(0, 0, 0, .07);
  --pill: rgba(0, 0, 0, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --gutter: 16px;
  --tabs-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.4 var(--font);
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--wald); outline-offset: 2px; }
a { color: var(--wald); }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) calc(var(--gutter) + env(safe-area-inset-right)) calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px) calc(var(--gutter) + env(safe-area-inset-left));
}

/* Header: the date is the one big thing on the screen */
.top { display: flex; align-items: flex-start; gap: 12px; }
.top__text { flex: 1; min-width: 0; }
.top__date { margin: 0; font-size: clamp(22px, 6.2vw, 32px); line-height: 1.12; font-weight: 750; letter-spacing: -0.02em; color: var(--wald); }
.top__count { margin: 6px 0 0; color: var(--muted); }
.top__tools { display: flex; gap: 6px; padding-top: 2px; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--quiet); display: grid; place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }

.sort { display: inline-flex; margin: 18px 0 2px; padding: 3px; border-radius: 999px; background: var(--surface); }
.sort button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 13.5px; color: var(--muted); }
.sort button[aria-pressed="true"] { background: var(--page); color: var(--ink); font-weight: 600; }

/* Groups and cards: approved look, kept 1:1 */
.group__title { margin: 22px 2px 9px; font-size: 15px; font-weight: 700; color: #2f3b23; }
.card {
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 9px;
  background: var(--wald-tint);
  --cta: var(--wald);
  transition: opacity .2s ease, transform .2s ease;
}
.card--urgent { background: var(--rost-tint); --cta: var(--rost); }
.card--daily { background: var(--stahl-tint); --cta: var(--stahl); }
.card.is-leaving { opacity: 0; transform: translateX(24px); }

.card__open {
  display: flex; gap: 12px; width: 100%;
  padding: 0; border: 0; background: none; text-align: left;
}
.card__head { display: flex; flex-direction: column; min-width: 0; }
.card__prize { font-weight: 700; font-size: 15px; line-height: 1.3; }
.card__meta, .card__end { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card--urgent .card__end { color: var(--rost); font-weight: 600; }
.card__todo { margin: 8px 0 0; font-size: 13px; }
.card__chance { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

.thumb, .hero {
  position: relative; flex-shrink: 0; overflow: hidden;
  background: var(--page); border-radius: var(--radius-sm);
  display: grid; place-items: center;
}
.thumb { width: 84px; height: 84px; }
.hero { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); }
.thumb img, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--page); }
.thumb__initials, .hero__initials { font-weight: 700; color: var(--faint); font-size: 20px; }
.hero__initials { font-size: 40px; }
.thumb img.is-broken, .hero img.is-broken { display: none; }

.pills { margin: 7px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--pill); color: #3a3a36; }

.card__acts, .detail__acts { display: flex; gap: 7px; margin-top: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 9px 14px; border: 0; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.btn--primary { flex: 1.6; background: var(--cta, var(--wald)); color: #fff; }
.btn--quiet { flex: 1; background: var(--quiet); color: #2b2b28; font-size: 13.5px; }
.btn.is-disabled { background: var(--quiet); color: var(--faint); }

.foot {
  display: block; width: 100%; margin: 16px 0 0; padding: 10px 2px;
  border: 0; background: none; text-align: left; font-size: 12.5px; color: var(--faint);
}
.empty { margin: 32px 2px; color: var(--muted); }
.empty .btn { margin-top: 12px; }

/* Eingetragen and Gesperrt rows */
.rows { list-style: none; margin: 18px 0 0; padding: 4px 14px; border-radius: var(--radius); background: var(--surface); }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row--stack { flex-direction: column; align-items: stretch; gap: 2px; }
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0; border: 0; background: none; text-align: left; }
.row__prize { font-size: 14px; font-weight: 600; }
.row__meta { font-size: 12.5px; color: var(--muted); }
.row__status { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.row__status--ziehung_laeuft { color: var(--stahl); }
.row__status--nichts_gekommen { color: var(--faint); }
.row__undo { border: 0; background: none; padding: 6px 0 6px 6px; font-size: 12.5px; color: var(--wald); }
blockquote { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--page); font-size: 13px; color: #3a3a36; }

/* Bottom tabs in thumb reach */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 8px;
  padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.tabs button {
  flex: 1; max-width: 260px; min-height: 44px; border: 0; border-radius: var(--radius-sm);
  background: transparent; font-weight: 600; color: var(--muted);
}
.tabs button[aria-current="page"] { background: var(--wald-tint); color: var(--wald); }

/* Sheet: detail, add, settings, gesperrt */
.sheet {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto;
  background: var(--page);
  animation: sheet-in .22s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet__bar {
  position: sticky; top: 0; z-index: 1;
  padding: calc(env(safe-area-inset-top) + 8px) var(--gutter) 8px;
  background: rgba(255, 255, 255, .94);
}
.sheet__back { border: 0; background: none; padding: 8px 0; color: var(--wald); font-weight: 600; }
.sheet__body { max-width: 560px; margin: 0 auto; padding: 4px var(--gutter) calc(env(safe-area-inset-bottom) + 32px); }
.sheet__title { margin: 4px 0 6px; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
.sheet__lead { margin: 0 0 4px; color: var(--muted); font-size: 14px; }

.detail__prize { margin: 16px 0 2px; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
.detail__meta, .detail__end { margin: 2px 0 0; color: var(--muted); }
.detail__sec { margin-top: 22px; }
.detail__sec h3 { margin: 0 0 6px; font-size: 15px; color: #2f3b23; }
.detail__sec p { margin: 4px 0; }
.detail__sec ol, .detail__sec ul { margin: 4px 0; padding-left: 20px; }
.detail__sec li { margin: 3px 0; }
.detail__warn { font-weight: 600; color: var(--rost); }
.detail__links { display: flex; flex-direction: column; gap: 6px; }
.detail__acts {
  position: sticky; bottom: 0; margin: 24px calc(-1 * var(--gutter)) 0;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.field label { font-weight: 600; font-size: 14px; }
.input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid #d8d5cc; border-radius: var(--radius-sm); background: var(--page); font-size: 16px;
}
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--wald); }
.form-acts { display: flex; gap: 8px; margin-top: 20px; }
.note { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.note--ok { color: var(--wald); }
.note--bad { color: var(--rost); }
.times { display: flex; gap: 12px; }
.times .field { flex: 1; }

/* Gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); }
.gate__form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.gate__icon { border-radius: 16px; }
.gate__title { margin: 6px 0 14px; font-size: 26px; letter-spacing: -0.02em; color: var(--wald); }
.gate__label { font-weight: 600; }
.gate__input {
  min-height: 52px; padding: 10px 14px; border: 1px solid #d8d5cc; border-radius: var(--radius-sm);
  font-size: 18px; letter-spacing: .08em; text-align: center; text-transform: uppercase;
}
.gate__error { margin: 0; color: var(--rost); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px); z-index: 20;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  margin: 0; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  .card { transition: none; }
}

.hero--empty { background: var(--surface); }

.card__answer { margin: 4px 0 0; font-size: 13px; font-weight: 600; }
.detail__quiz { padding: 12px; border-radius: var(--radius); background: var(--wald-tint); }
.detail__answer { font-size: 18px; font-weight: 700; margin: 6px 0 2px; }
.detail__origin { font-size: 12.5px; color: var(--wald); }
.detail__origin--wissen, .detail__origin--entwurf { color: var(--rost); }
.detail__copy { margin-top: 10px; width: 100%; }

.btn--primary { flex-direction: column; line-height: 1.2; }
.btn small { display: block; font-size: 11px; font-weight: 500; opacity: .85; margin-top: 1px; }

/* Jagdzeiten */
.jz-hero {
  margin-top: 18px; padding: 18px; border-radius: 18px;
  background: var(--wald); color: #fff;
}
.jz-hero__num { margin: 0; font-size: 56px; line-height: 1; font-weight: 800; letter-spacing: -0.03em; }
.jz-hero__text { margin: 6px 0 14px; font-size: 15px; line-height: 1.35; color: rgba(255, 255, 255, .92); }
.jz-bezirk {
  border: 0; border-radius: 999px; padding: 7px 14px;
  background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; font-size: 13.5px;
}
.jz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.jz-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; width: 100%;
  padding: 12px 14px; border: 0; border-radius: var(--radius); background: var(--wald-tint); text-align: left;
}
.jz-row__name { display: flex; flex-direction: column; min-width: 0; }
.jz-art { font-weight: 700; font-size: 15px; }
.jz-klasse { font-size: 13px; color: var(--muted); }
.jz-row__when { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.jz-days { font-weight: 700; font-size: 15px; color: var(--wald); white-space: nowrap; }
.jz-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.jz-bar { grid-column: 1 / -1; height: 5px; margin-top: 6px; border-radius: 99px; background: rgba(61, 82, 41, .14); overflow: hidden; }
.jz-bar span { display: block; height: 100%; border-radius: 99px; background: var(--wald); }
.jz-row--ending { background: var(--rost-tint); }
.jz-row--ending .jz-days { color: var(--rost); }
.jz-row--ending .jz-bar { background: rgba(180, 74, 36, .16); }
.jz-row--ending .jz-bar span { background: var(--rost); }
.jz-row--soon { background: var(--stahl-tint); }
.jz-row--soon .jz-days { color: var(--stahl); }
.jz-chips { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.jz-chip { padding: 6px 11px; border: 0; border-radius: 999px; background: var(--wald-tint); font-size: 13px; }
.jz-lines { list-style: none; margin: 0; padding: 4px 14px; border-radius: var(--radius); background: var(--surface); }
.jz-line { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 13.5px; text-align: left; }
.jz-lines li:last-child .jz-line { border-bottom: 0; }
.jz-line span:last-child { color: var(--muted); white-space: nowrap; }
.jz-source { margin: 22px 2px 0; font-size: 12px; color: var(--faint); line-height: 1.45; }
.jz-source a { color: var(--muted); }
.jz-empty { margin-top: 18px; }
.jz-picker { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jz-pick {
  width: 100%; min-height: 48px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: var(--surface); text-align: left; font-weight: 600; font-size: 13.5px;
}
.jz-pick.is-current { background: var(--wald); color: #fff; }

/* Familie */
.feed { list-style: none; margin: 0; padding: 4px 14px; border-radius: var(--radius); background: var(--surface); }
.feed__item { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed__item:last-child { border-bottom: 0; }
.feed__item--gewonnen .feed__text { font-weight: 700; color: var(--wald); }
.feed__time { flex-shrink: 0; font-size: 12.5px; color: var(--muted); }
.row__won { border: 0; background: var(--wald-tint); color: var(--wald); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; font-weight: 600; }
.row__remove { border: 0; background: none; padding: 6px 0 6px 6px; font-size: 12.5px; color: var(--rost); }
.row__status--gewonnen { color: var(--wald); font-weight: 700; }
.invite { margin-top: 6px; }
.tabs { gap: 2px; padding-left: 8px; padding-right: 8px; }
.tabs button { font-size: 13.5px; padding: 0 2px; }
.jz-pacht { margin-top: 8px; padding: 2px 2px 0; }
.jz-pacht__line { margin: 0; font-size: 13.5px; color: var(--muted); }
.jz-pacht__line b { color: var(--ink); }
.jz-bar--slim { height: 3px; margin: 8px 0 6px; }
.jz-pacht__note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.jz-pacht__note a { color: var(--muted); }

.wz { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.wz li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); font-size: 13.5px; }
.wz b { font-size: 14px; }
.wz span { color: #3a3a36; }

/* Revierkarte */
.karte { margin-top: 14px; }
.karte__bar { display: flex; gap: 8px; margin-bottom: 10px; }
.karte__select { flex: 1; min-width: 0; }
.karte__small { flex: 0 0 auto; }
/* z-index 0 gives Leaflet's panes (z 400+) their own stacking context, so sheet and tabs stay on top. */
.karte__map {
  position: relative; z-index: 0;
  height: calc(100dvh - 330px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 300px;
  border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.karte__map.is-picking { cursor: crosshair; outline: 3px solid var(--rost); outline-offset: -3px; }
.karte__actions { margin-top: 10px; }
.karte__drawbar { margin-top: 10px; padding: 12px; border-radius: var(--radius); background: var(--rost-tint); --cta: var(--rost); }
.karte__drawbar .form-acts { margin-top: 10px; }
.karte__drawtext { margin: 0; font-size: 14px; font-weight: 600; color: var(--rost); }
.karte-pin { background: none; border: 0; }
.karte-pin span {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #fff; color: #fff; font-weight: 750; font-size: 13px; line-height: 1;
}
.karte .leaflet-container { font: 13px/1.4 var(--font); }
.karte-pin--pending span { opacity: .55; border-style: dashed; }
.leaflet-control-layers-expanded { font-size: 14px; }

.karte-typen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.karte-typ input { position: absolute; opacity: 0; pointer-events: none; }
.karte-typ span {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px;
  background: var(--surface); font-size: 13.5px; font-weight: 600;
}
.karte-typ span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--typ); }
.karte-typ input:checked + span { background: var(--typ); color: #fff; }
.karte-typ input:checked + span::before { background: #fff; }
.karte-typ input:focus-visible + span { outline: 2px solid var(--wald); outline-offset: 2px; }
.karte-textarea { min-height: 92px; resize: vertical; font: inherit; font-size: 16px; }
select.input { -webkit-appearance: none; appearance: none; font: inherit; font-size: 16px; }
.karte-foto { margin-top: 14px; border-radius: var(--radius); overflow: hidden; background: var(--surface); min-height: 60px; display: grid; place-items: center; }
.karte-foto img { display: block; width: 100%; height: auto; }
.karte-foto .note { margin: 18px; }
.karte-notiz { white-space: pre-line; }
.karte-danger { color: var(--rost); }
.btn--primary[href] { flex-direction: row; }

/* Per-member hide */
.card { position: relative; }
.card__open { padding-right: 30px; }
.card__hide {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; display: grid; place-items: center; color: var(--muted);
}
.card__hide svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.card__hide:active { background: var(--quiet); }
