/* Layout: einspaltige Phone-App, Karten je Arbeitsschritt, Aktionsleiste unten fest */
:root {
  --bg: #eceee9;
  --surface: #ffffff;
  --ink: #1b211e;
  --muted: #5d6862;
  --line: #d2d8d1;
  --accent: #9a6a14;
  --accent-ink: #ffffff;
  --good: #2c7a4c;
  --warn: #a8701a;
  --bad: #b23626;
  --trace: #2a5c88;
  --paper: #ffffff;
  --paper-ink: #111111;
  --grid: #c9c9c9;
  --grid-strong: #8e8e8e;
  --hole: #111111;
  --f-display: "SF Pro Display", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --surface: #1b211e;
    --ink: #e5eae6;
    --muted: #98a39d;
    --line: #313a35;
    --accent: #d9a54c;
    --accent-ink: #1a1206;
    --good: #5cba83;
    --warn: #e0a64a;
    --bad: #e3705e;
    --trace: #7eb1de;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--f-body);
  padding-top: env(safe-area-inset-top, 0px);
}
main {
  max-width: 520px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px calc(96px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
h1, h2, h3 { margin: 0; text-wrap: balance; font-family: var(--f-display); }
h2 { font-size: 21px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.top { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.brand { font-size: 34px; font-weight: 800; letter-spacing: .01em; text-transform: uppercase; }
.brand span { color: var(--accent); }
.bar-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.card.empty p { color: var(--muted); }
.safety { border-color: var(--accent); }
.safety ul, .prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose p { color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.setup-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tag { font-family: var(--f-mono); font-size: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--muted); white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  min-height: 46px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .link:focus-visible, .session-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.row-btns > .btn { flex: 1 1 auto; }
.row-btns.center { justify-content: center; }
.stack-btns { display: flex; flex-direction: column; gap: 8px; }

.actions {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}
.actions.single { grid-template-columns: 1fr; }
.actions:empty { display: none; }

.links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.links a, .link { color: var(--muted); background: none; border: 0; padding: 4px 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.steps li { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.steps i { display: block; height: 4px; border-radius: 2px; background: var(--line); }
.steps .done i { background: var(--accent); opacity: .5; }
.steps .on { color: var(--ink); font-weight: 600; }
.steps .on i { background: var(--accent); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.field input:not([type="range"]), .field select {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  min-width: 0;
  width: 100%;
}
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin-top: 2px; }
.hint { font-size: 14px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 10px; }
.error, .notice { color: var(--bad); font-size: 14px; border: 1px solid var(--bad); border-radius: 8px; padding: 10px 12px; }
.notice { margin-top: 4px; }
.ok { color: var(--good); font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.pill.ruhig { color: var(--good); }
.pill.unruhig { color: var(--warn); }
.pill.verrissen { color: var(--bad); }
.pill.unbekannt { color: var(--muted); }
.pill.live { color: var(--good); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

canvas#live { width: 100%; height: 130px; display: block; background: var(--bg); border-radius: 8px; }
.meter { position: relative; height: 10px; border-radius: 5px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--trace); }
.meter i.hot { background: var(--bad); }
.meter b { position: absolute; top: -1px; bottom: -1px; width: 3px; background: var(--ink); }
.flash { min-height: 1.5em; font-weight: 600; color: var(--accent); opacity: 0; }
.flash.show { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.shots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.shots li { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; }
.shots li.muted { display: block; }

.sessions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.session-row { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.session-row span:first-child { display: flex; flex-direction: column; min-width: 0; }
.session-row small { color: var(--muted); font-size: 13px; }
.session-row:disabled { opacity: .5; cursor: default; }

.canvas-wrap { overflow: auto; border-radius: 8px; max-height: 70vh; -webkit-overflow-scrolling: touch; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; touch-action: manipulation; }
.canvas-wrap.zoomed canvas { width: 200%; }
.step-hint { font-size: 15px; }

.sheet { border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.sheet svg { display: block; width: 100%; height: auto; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; display: flex; flex-direction: column; }
.tile small { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tile b { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.tile em { font-style: normal; font-size: 11px; color: var(--muted); }
.correction { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.correction div { border: 2px solid var(--accent); border-radius: 10px; padding: 12px; text-align: center; display: flex; flex-direction: column; }
.correction b { font-family: var(--f-display); font-size: 40px; line-height: 1; }
.correction span { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
details.raw summary { cursor: pointer; font-weight: 600; }

@media (max-width: 360px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .flash.show { animation: none; opacity: 1; }
}
