/* Mathea IT-Hilfe – mobil zuerst, hell/dunkel automatisch */
:root {
  --bg: #f5f4f2;
  --paper: #ffffff;
  --fg: #1d1d1f;
  --muted: #5f6368;
  --line: #e2e0dc;
  --accent: #bc1220;
  --accent-fg: #ffffff;
  --accent-soft: #fbe9ea;
  --ok: #157a3c;
  --ok-soft: #e6f4ea;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --key: #f0efec;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414; --paper: #1e1e1f; --fg: #ececec; --muted: #a5a5a8; --line: #333336;
    --accent: #ff5a5f; --accent-fg: #1a0002; --accent-soft: #3a1a1c;
    --ok: #5fd08a; --ok-soft: #173323; --warn: #f2c46d; --warn-soft: #33290f; --key: #2a2a2c;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141414; --paper: #1e1e1f; --fg: #ececec; --muted: #a5a5a8; --line: #333336;
  --accent: #ff5a5f; --accent-fg: #1a0002; --accent-soft: #3a1a1c;
  --ok: #5fd08a; --ok-soft: #173323; --warn: #f2c46d; --warn-soft: #33290f; --key: #2a2a2c;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.55 var(--font);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: var(--accent); }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
main:focus { outline: none; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); min-width: 0; }
.brand-mark {
  flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-weight: 800; font-size: 19px;
}
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { color: var(--muted); }
.lang { display: flex; background: var(--key); border-radius: 999px; padding: 3px; flex: none; }
.lang button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: 14px; color: var(--muted); min-height: 36px;
}
.lang button[aria-pressed="true"] { background: var(--paper); color: var(--fg); box-shadow: var(--shadow); }

/* Allgemein */
h1 { font-size: clamp(26px, 6vw, 38px); line-height: 1.15; margin: 28px 0 8px; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: clamp(21px, 4.6vw, 27px); line-height: 1.2; margin: 0; text-wrap: balance; }
h3 { font-size: 18px; line-height: 1.3; margin: 0; }
.lead { color: var(--muted); margin: 0 0 22px; font-size: 18px; max-width: 62ch; }
.back {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 6px 0;
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600;
}
.back:hover { color: var(--fg); }
.ui {
  font-weight: 700; background: var(--key); border: 1px solid var(--line); border-radius: 6px;
  padding: 0 6px; overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
code { font-family: var(--mono); font-size: .9em; background: var(--key); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }

/* Kacheln Geräteauswahl */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  position: relative; display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 22px 12px 18px; border-radius: var(--radius); background: var(--paper);
  border: 2px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--fg);
  font-weight: 700; font-size: 17px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile svg { width: 44px; height: 44px; color: var(--accent); }
.tile.detected { border-color: var(--accent); }
.tile .badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}

/* Firmen-PC-Frage */
.choice { display: grid; gap: 12px; margin: 0 0 20px; }
@media (min-width: 700px) { .choice { grid-template-columns: 1fr 1fr; } }
.choice a {
  display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--radius); background: var(--paper);
  border: 2px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--fg);
}
.choice a:hover { border-color: var(--accent); }
.choice a b { font-size: 18px; }
.choice a span { color: var(--muted); font-size: 15px; }

/* Kästen */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.note, .ok, .warn { border-radius: 10px; padding: 12px 16px; margin: 0; }
.note { background: var(--key); }
.ok { background: var(--ok-soft); border-left: 4px solid var(--ok); }
.warn { background: var(--warn-soft); border-left: 4px solid var(--warn); }
.ok b:first-child, .warn b:first-child { display: block; margin-bottom: 2px; }
details.check { margin: 0 0 24px; }
details.check summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 4px 0; }
details.check ol { margin: 8px 0 0; padding-left: 22px; }

.firma-ok { margin-bottom: 22px; }
.overview-h { margin-bottom: 12px; }

/* Übersicht Themen */
.overview { display: grid; gap: 10px; margin: 0 0 28px; }
@media (min-width: 700px) { .overview { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.overview a {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start;
  padding: 14px 16px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line);
  text-decoration: none; color: var(--fg); box-shadow: var(--shadow);
}
.overview a:hover { border-color: var(--accent); }
.overview .ico { grid-row: span 2; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.overview .ico svg { width: 22px; height: 22px; }
.overview b { font-size: 17px; }
.overview span { color: var(--muted); font-size: 15px; line-height: 1.4; }

/* Themen-Abschnitte */
section.topic { margin: 0 0 34px; }
.topic-head { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; }
.topic-head .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; flex: none; }
.topic-head .ico svg { width: 24px; height: 24px; }
.topic-intro { color: var(--muted); margin: 0 0 14px; }
.part { margin: 18px 0 0; }
.part > h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px; }

ol.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 12px; }
ol.steps > li {
  counter-increment: step; position: relative;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 16px 62px; box-shadow: var(--shadow); display: grid; gap: 10px; min-width: 0;
}
ol.steps > li::before {
  content: counter(step); position: absolute; left: 16px; top: 15px;
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-variant-numeric: tabular-nums;
}
.step-text { display: grid; gap: 6px; min-width: 0; }
.step-text p { margin: 0; }
.step-text ul { margin: 0; padding-left: 20px; }
@media (min-width: 760px) {
  ol.steps > li.has-fig { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; align-items: start; }
}

/* Bilder und Platzhalter */
figure { margin: 0; min-width: 0; }
.shot {
  display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #111; cursor: zoom-in; position: relative;
}
.shot img { display: block; width: 100%; height: auto; }
.shot .hide { position: absolute; background: #2a2a2c; border-radius: 4px; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.placeholder {
  border: 2px dashed var(--line); border-radius: 10px; padding: 18px 14px; text-align: center;
  color: var(--muted); font-size: 14px; display: grid; gap: 6px; justify-items: center; background: var(--bg);
}
.placeholder svg { width: 28px; height: 28px; opacity: .6; }

/* Kopierfelder und Knöpfe */
.copy { display: grid; gap: 4px; }
.copy label { font-size: 13px; font-weight: 700; color: var(--muted); }
.copy-row { display: flex; gap: 8px; min-width: 0; }
.copy-row input {
  flex: 1; min-width: 0; font: 14px var(--mono); padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 9px 16px; border-radius: 10px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 15px;
  text-align: center; max-width: 100%;
}
.copy-row .btn { flex: none; }
.btn.secondary { background: var(--key); color: var(--fg); border: 1px solid var(--line); }
.btn svg { width: 18px; height: 18px; }
.btn.done { background: var(--ok); color: #fff; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }

/* Probleme */
.problems { width: 100%; border-collapse: collapse; font-size: 15px; }
.problems th, .problems td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.problems tr:last-child td { border-bottom: 0; }
.problems th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.problems td:first-child { font-weight: 700; width: 42%; }
.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
@media (max-width: 560px) {
  .problems thead { display: none; }
  .problems tr { display: grid; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .problems tr:last-child { border-bottom: 0; }
  .problems td { padding: 2px 0; border: 0; width: auto !important; }
}

/* Kontakt + Fuß */
.contact { margin: 10px 0 34px; display: grid; gap: 6px; }
.contact h2 { font-size: 20px; }
.contact p { margin: 0; }
.footer { color: var(--muted); font-size: 13px; text-align: center; padding: 10px 16px 30px; }
.todo { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 0 6px; font-weight: 700; }

/* Vergrößerung */
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.86); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1500px, 96vw); max-height: 88vh; border-radius: 8px; }
.lightbox-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 14px; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 26px; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .lang, .back, .btn, .lightbox { display: none !important; }
  body { background: #fff; }
  ol.steps > li, .card, .table-wrap { box-shadow: none; break-inside: avoid; }
}
