/* Börde-Sticker – mobile first, helles und dunkles Thema */
:root {
  color-scheme: light;
  --bg: #f4f6f1;
  --surface: #ffffff;
  --surface-2: #eef1ea;
  --border: #dde3d6;
  --text: #121512;
  --text-2: #4d544b;
  --muted: #767d73;
  --accent: #1f7a3d;
  --accent-text: #ffffff;
  --accent-soft: rgba(31, 122, 61, .12);
  --have: #2f9e52;
  --dbl: #f2a900;
  --dbl-text: #3d2a00;
  --miss: #ffffff;
  --danger: #c93a3a;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --tabs-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101310;
    --surface: #191d19;
    --surface-2: #222722;
    --border: #2d332c;
    --text: #eef1ea;
    --text-2: #c3c9bf;
    --muted: #8f978b;
    --accent: #3fa65e;
    --accent-text: #08110a;
    --accent-soft: rgba(63, 166, 94, .18);
    --have: #3fa65e;
    --dbl: #e6a419;
    --miss: #191d19;
    --danger: #e26a6a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101310; --surface: #191d19; --surface-2: #222722; --border: #2d332c;
  --text: #eef1ea; --text-2: #c3c9bf; --muted: #8f978b; --accent: #3fa65e; --accent-text: #08110a;
  --accent-soft: rgba(63, 166, 94, .18); --have: #3fa65e; --dbl: #e6a419; --miss: #191d19; --danger: #e26a6a; --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: .88rem; margin: .4rem 0 .7rem; }
.msg { color: var(--danger); font-size: .9rem; min-height: 0; }
.msg:empty { display: none; }

/* Kopf */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--accent); color: var(--accent-text);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}
.top-row { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; flex: none; }
.top-text { min-width: 0; }
.top-title { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sub { font-size: .8rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { max-width: 640px; margin: 8px auto 0; height: 5px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; }
.bar { height: 100%; width: 0; background: #ffd23f; transition: width .3s; }

main { max-width: 640px; margin: 0 auto; padding: 12px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px); }
body[data-page="start"] main, body[data-page="static"] main { padding-bottom: 24px; }
.foot { text-align: center; padding: 0 16px 24px; font-size: .85rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin: 0 0 12px; box-shadow: var(--shadow); }
.notice { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; font-size: .92rem; }
.notice.warn { background: rgba(201, 58, 58, .12); }

/* Formulare */
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
.field .hint { font-weight: 400; margin: 0; }
input[type=text], input[type=email], input:not([type]), textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.check { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; font-size: .95rem; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--danger); }
.btn.big { min-height: 52px; font-size: 1.05rem; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.round { width: 52px; height: 52px; border-radius: 50%; padding: 0; font-size: 1.6rem; }
.btn:disabled { opacity: .6; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.row .btn { flex: 1 1 0; }

/* Filter */
.chips { display: flex; gap: 8px; margin: 2px 0 6px; }
.chip {
  font: inherit; font-size: .92rem; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* Album-Raster */
.sec { margin: 0 0 14px; }
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  position: sticky; top: calc(env(safe-area-inset-top) + 67px); z-index: 2;
  background: var(--bg); padding: 6px 0; margin: 0; font-size: .95rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.tile {
  position: relative; aspect-ratio: 1; min-height: 48px; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums;
  border: 2px dashed var(--border); background: var(--miss); color: var(--muted);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.tile.have { border: 2px solid var(--have); background: var(--have); color: #fff; }
.tile.dbl { border: 2px solid var(--dbl); background: var(--dbl); color: var(--dbl-text); }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-size: .72rem; line-height: 20px;
}
.dot { position: absolute; bottom: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--dbl); }
.dot.inline { position: static; display: inline-block; vertical-align: middle; }

/* Tauschen */
.trade-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill { font-size: .8rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); }
.pill.good { background: var(--accent-soft); color: var(--accent); }
.lbl { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 10px 0 5px; }
.nums { display: flex; flex-wrap: wrap; gap: 5px; }
.num { min-width: 38px; text-align: center; padding: 4px 7px; border-radius: 8px; font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; }
.num.get { background: var(--accent-soft); color: var(--accent); }
.num.give { background: rgba(242, 169, 0, .2); color: var(--text); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.check-num { display: flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 9px; background: var(--surface-2); font-weight: 700; }
.check-num input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Untere Leiste */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.tabs[hidden] { display: none; }
.tabs button {
  flex: 1 1 0; max-width: 160px; height: var(--tabs-h); border: 0; background: none; color: var(--muted); cursor: pointer;
  font: inherit; font-size: .75rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tabs .ti { font-size: 1.35rem; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabs button.active { color: var(--accent); }
.tabs button.active .ti { filter: none; opacity: 1; }

/* Sheet (Dialog von unten) */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px; max-height: 88vh;
  border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text);
}
.sheet::backdrop { background: rgba(0,0,0,.45); }
#sheet-body { padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.big-no { font-size: 2.2rem; font-weight: 800; min-width: 72px; text-align: center; background: var(--surface-2); border-radius: 12px; padding: 4px 8px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 12px 0; }
.count { font-size: 2rem; font-weight: 800; min-width: 48px; text-align: center; }
.linkbox { font-family: ui-monospace, monospace; font-size: .85rem; word-break: break-all; background: var(--surface-2); border-radius: 10px; padding: 10px; margin: 10px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 641px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}
