/* Team-Wetter. Keine externen Schriften, keine Inline-Styles (CSP). Handy zuerst. */
:root {
  color-scheme: light dark;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #e6eaf0;
  --text: #141a22;
  --muted: #465162;
  --border: #7d8796;
  --accent: #1a52c2;
  --on-accent: #ffffff;
  --accent-soft: #e2ebfd;
  --danger: #b3261e;
  --on-danger: #ffffff;
  --focus: #1a52c2;
  --error: #a4160e;
  --error-bg: #fdecea;
  --banner-bg: #fff3cd;
  --banner-text: #4a3600;
  --w-gewitter: #6a3fc4;
  --w-regen: #1f68b0;
  --w-bewoelkt: #5b6572;
  --w-sonne: #a85a00;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1218;
    --surface: #182029;
    --surface-2: #2a3542;
    --text: #edf1f6;
    --muted: #a9b3c1;
    --border: #7f8b9b;
    --accent: #7aa8ff;
    --on-accent: #0b1220;
    --accent-soft: #21324f;
    --danger: #ff8f86;
    --on-danger: #2a0805;
    --focus: #9dbfff;
    --error: #ffb4ab;
    --error-bg: #3b1613;
    --banner-bg: #3a2f0a;
    --banner-text: #ffe9a6;
    --w-gewitter: #b59cff;
    --w-regen: #6db4ff;
    --w-bewoelkt: #aab4c1;
    --w-sonne: #f5b33d;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.45;
}

main {
  max-width: 32rem;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
p { margin: 0; }
h1:focus, h2:focus, main:focus { outline: none; }

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

.lead { color: var(--muted); }
.me { color: var(--muted); font-size: 0.95rem; overflow-wrap: anywhere; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.card-title { font-size: 0.95rem; font-weight: 700; color: var(--muted); text-transform: none; }

/* Knöpfe */
button, input { font: inherit; color: inherit; }

.btn {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 600; }
.btn.small { width: auto; min-height: 44px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn:disabled {
  cursor: not-allowed;
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
}

:where(button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Formular */
label { font-weight: 600; display: block; margin-bottom: 8px; }
.field {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
}
.error {
  color: var(--error);
  background: var(--error-bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}
.stack { display: grid; gap: 12px; }

/* Links kopieren */
.linkrow { display: grid; gap: 8px; }
.linkrow .field { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; min-width: 0; }
.linkrow .row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.copied { color: var(--muted); font-size: 0.95rem; min-height: 1.4em; }

/* Hinweise */
.banner {
  background: var(--banner-bg);
  color: var(--banner-text);
  border: 2px solid var(--banner-text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
}
.hint { color: var(--muted); font-size: 0.95rem; }

/* Kacheln: 2x2, feste Reihenfolge */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tile {
  position: relative;
  min-height: 116px;
  padding: 12px 8px;
  border: 3px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  text-align: center;
  overflow-wrap: anywhere;
}
.tile .tile-icon { color: var(--wc); display: block; }
.tile .tile-name { font-weight: 700; }
.tile .tile-line { color: var(--muted); font-size: 0.95rem; }
.tile[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tile .tile-check {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  display: none; place-items: center;
}
.tile[aria-checked="true"] .tile-check { display: grid; }

[data-w="gewitter"] { --wc: var(--w-gewitter); }
[data-w="regen"] { --wc: var(--w-regen); }
[data-w="bewoelkt"] { --wc: var(--w-bewoelkt); }
[data-w="sonne"] { --wc: var(--w-sonne); }

/* Chips: "hat gewählt" (gefüllt, Haken) oder noch nicht (gestrichelt) */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 4px 10px;
  border-radius: 16px;
  border: 2px solid var(--accent);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.chip.voted { background: var(--accent-soft); font-weight: 600; }
.chip.open { border-style: dashed; border-color: var(--border); color: var(--muted); }
.chip svg { flex: none; }

/* Ergebnis */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bar { display: grid; gap: 6px; }
.bar-head { display: flex; align-items: center; gap: 8px; }
.bar-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.bar-label svg { color: var(--wc); flex: none; }
.bar-count { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.you {
  font-size: 0.85rem; font-weight: 700;
  padding: 1px 8px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
}
.bar-track { height: 16px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.bar-fill {
  display: block; height: 100%;
  width: calc(var(--w, 0) * 1%);
  background: var(--wc);
  border-radius: 8px;
  transition: width 0.5s ease;
}

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