/* Allianz-Kalender. Dunkel zuerst (passend zum Spiel), helles Thema per Systemeinstellung.
   Bewusst nur Systemschriften: keine Google-Fonts, keine externen Anfragen (DSGVO). */
:root {
  --bg: #0f1714;
  --bg-2: #15201c;
  --surface: #1a2722;
  --surface-2: #213029;
  --line: #2d3f37;
  --fg: #e6ece8;
  --muted: #94a69d;
  --brand: #e7b04a;      /* Messing, wie die Ingame-Banner */
  --brand-ink: #1a1305;
  --ok: #3fbf7f;
  --warn: #e7b04a;
  --bad: #ef6b57;
  --note-bg: #2b2412;
  --note-line: #e7b04a;
  --focus: #8fd3ff;
  --display: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1ec; --bg-2: #e3e8e1; --surface: #ffffff; --surface-2: #f4f6f2; --line: #d2d9d0;
    --fg: #17201c; --muted: #5a6a62; --brand: #a06a00; --brand-ink: #ffffff;
    --ok: #1d8a52; --warn: #a06a00; --bad: #c4402c; --note-bg: #fff4dc; --note-line: #c88a12; --focus: #0b6bcb;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); }
a { color: inherit; }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Kopf ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg-2); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); }
.top-inner, .tabs { max-width: 1100px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-block: 10px 6px; }
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand .tag { font-family: var(--display); font-weight: 700; color: var(--brand); letter-spacing: .04em; }
.brand .name { font-family: var(--display); font-weight: 700; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.clock b { color: var(--fg); font-weight: 600; font-family: var(--mono); }
.clock .reset b { color: var(--brand); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.top-actions select { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; max-width: 9.5rem; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a { text-decoration: none; padding: 8px 14px; color: var(--muted); font-family: var(--display); font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--brand); }

/* ---------- Grundlayout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding-block: 20px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.view { display: grid; gap: 18px; }
h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 1.25rem; margin: 0; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 7px 14px; cursor: pointer; font-weight: 500; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 14px 0; }
.error { color: var(--bad); margin: 0; }

/* ---------- Filter ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { border-color: var(--fg); background: var(--surface-2); }
.dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--cc, var(--muted)); flex: none; }

/* ---------- Eventkarten ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; align-items: start; }
.days { display: grid; gap: 18px; }
.day > h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.day > h3 b { color: var(--fg); }
.ev { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--cc, var(--line)); border-radius: 6px;
  min-width: 0; display: grid; scroll-margin-top: 130px; }
.ev > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; gap: 4px; }
.ev > summary::-webkit-details-marker { display: none; }
.ev-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ev-title { font-weight: 600; font-size: 16px; margin: 0; }
.ev-cat { font-size: 12px; color: var(--muted); }
.pill { font-family: var(--mono); font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.pill.run { color: var(--ok); } .pill.end { color: var(--bad); } .pill.soon { color: var(--muted); } .pill.over { color: var(--muted); opacity: .6; }
.times { display: grid; gap: 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; font-family: var(--mono); }
.times b { color: var(--fg); font-weight: 500; }
.ev-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.ev-body p { margin: 0; }
.rewards { font-size: 13.5px; color: var(--muted); } .rewards b { color: var(--fg); font-weight: 600; }
.note { background: var(--note-bg); border-left: 3px solid var(--note-line); padding: 8px 12px; border-radius: 4px; }
.note strong.lbl { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--note-line); margin-bottom: 2px; }
.note p { margin: 0 0 4px; } .note p:last-child { margin: 0; }
.ev > .note { margin: 0 14px 12px; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; }
.flag { font-size: 11.5px; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 0 6px; }
.tutlink { font-weight: 600; color: var(--brand); text-decoration: none; }
.tutlink:hover { text-decoration: underline; }

/* Zusagen */
.rsvp { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.rsvp-q { font-size: 13px; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.seg button[aria-pressed="true"].yes { background: var(--ok); color: #fff; border-color: var(--ok); }
.seg button[aria-pressed="true"].maybe { background: var(--warn); color: var(--brand-ink); border-color: var(--warn); }
.seg button[aria-pressed="true"].no { background: var(--bad); color: #fff; border-color: var(--bad); }
.counts { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.rsvp input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }

/* ---------- Zeitstrahl ---------- */
.timeline-box { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.timeline-box > summary { cursor: pointer; padding: 10px 14px; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.gscroll { overflow-x: auto; border-top: 1px solid var(--line); }
.gantt { min-width: 1000px; position: relative; font-size: 12.5px; }
.grow { display: grid; grid-template-columns: 170px 1fr; align-items: center; min-height: 28px; border-bottom: 1px solid var(--line); }
.grow:last-child { border-bottom: 0; }
.glabel { padding: 3px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtrack { position: relative; height: 28px; }
.ghead .gtrack { height: 36px; }
.gday { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-family: var(--mono); font-size: 10.5px; color: var(--muted); padding: 3px 0 0 3px; line-height: 1.2; }
.gcat { background: var(--surface-2); font-weight: 600; }
.bar { position: absolute; top: 6px; height: 16px; border-radius: 3px; background: var(--cc); opacity: .85; border: 0; padding: 0; cursor: pointer; }
.bar:hover { opacity: 1; }
.nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); pointer-events: none; z-index: 2; }

/* ---------- Tutorials ---------- */
.tut-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tut-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px; text-decoration: none; display: grid; gap: 4px; }
.tut-card:hover { border-color: var(--brand); }
.tut-card b { font-size: 16px; }
.tut-detail { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; max-width: 760px; }
.prose { line-height: 1.65; }
.prose h2, .prose h3, .prose h4 { font-family: var(--display); text-transform: none; letter-spacing: .01em; margin: 1.3em 0 .4em; }
.prose h2 { font-size: 1.6rem; margin-top: .2em; }
.prose p, .prose ul, .prose ol { margin: 0 0 .8em; max-width: 68ch; }
.prose code { font-family: var(--mono); background: var(--surface-2); padding: 0 4px; border-radius: 3px; }
.prose .callout { background: var(--note-bg); border-left: 3px solid var(--note-line); padding: 8px 12px; border-radius: 4px; margin: 0 0 .8em; }
.prose .callout p { margin: 0; }
.prose a { color: var(--brand); }
.backlink { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; margin-bottom: 10px; font-weight: 600; }
.mt { font-size: 12px; color: var(--muted); font-style: italic; }

/* ---------- Tipp-Module und R4/R5-Teil ---------- */
.module { border: 1px solid var(--line); border-left: 3px solid var(--ok); background: var(--surface-2); border-radius: 6px; padding: 10px 14px; margin: 0 0 .9em; }
.module-lead { border-left-color: var(--brand); }
.module-missing { border-left-color: var(--bad); color: var(--bad); font-family: var(--mono); font-size: 13px; }
.module-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.module-badge { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ok); font-weight: 700; }
.module-lead .module-badge { color: var(--brand); }
.module p:last-child, .module ul:last-child, .module ol:last-child { margin-bottom: 0; }
.note .module { margin: 8px 0 0; }
.lead-part { margin-top: 22px; padding-top: 14px; border-top: 2px dashed var(--brand); }
.lead-head { color: var(--brand); }

/* ---------- Umfragen ---------- */
.poll { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; display: grid; gap: 10px; min-width: 0; }
.poll h3 { margin: 0; font-size: 16px; }
.opt { display: grid; gap: 3px; }
.opt label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.opt .barbg { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.opt .barfg { height: 100%; background: var(--brand); }
.opt .num { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto; }

/* ---------- Dialog ---------- */
.dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); padding: 0; width: min(420px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog form { padding: 18px; display: grid; gap: 8px; }
.dialog input, .dialog select { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.dialog label { font-size: 13px; color: var(--muted); margin-top: 4px; }

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .top-actions { margin-left: 0; width: 100%; }
  .top-actions select { flex: 1; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
