/* Funk im Browser – dieselben Farben und Maße wie die Tacho-App (ui/theme/Theme.kt). */
:root {
  --bg: #000;
  --surface: #1c1c1e;
  --surface2: #2c2c2e;
  --surface3: #3a3a3c;
  --fill: rgba(118, 118, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.32);
  --separator: rgba(84, 84, 88, 0.6);
  --hairline: rgba(255, 255, 255, 0.09);
  --label: #fff;
  --secondary: rgba(235, 235, 245, 0.6);
  --tertiary: rgba(235, 235, 245, 0.3);
  --accent: #64d2ff;
  --green: #30d158;
  --yellow: #ffd60a;
  --orange: #ff9f0a;
  --red: #ff453a;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.3px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 40px) max(16px, env(safe-area-inset-left));
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: inherit; }
button:disabled { cursor: default; }
input { font: inherit; letter-spacing: inherit; color: var(--label); background: none; border: 0; outline: none; min-width: 0; }
input::placeholder { color: var(--tertiary); }

/* Text */
.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -0.7px; margin: 36px 4px 10px; }
.center { text-align: center; }
.callout { font-size: 16px; line-height: 21px; letter-spacing: -0.25px; }
.subhead { font-size: 15px; line-height: 20px; letter-spacing: -0.2px; }
.footnote { font-size: 13px; line-height: 18px; letter-spacing: -0.05px; }
.secondary { color: var(--secondary); }
.tertiary { color: var(--tertiary); }
.accent { color: var(--accent); }
.bold { font-weight: 600; }
.section-header { font-size: 13px; line-height: 18px; letter-spacing: 0.2px; text-transform: uppercase; color: var(--secondary); padding: 26px 16px 7px; }
.footer { font-size: 13px; line-height: 18px; color: var(--secondary); margin: 7px 16px 0; white-space: pre-line; }
.device-id { font-size: 13px; color: var(--tertiary); text-align: center; margin-top: 28px; font-variant-numeric: tabular-nums; }

/* Karten und Zeilen */
.card { background: var(--surface); border-radius: 12px; overflow: hidden; }
.row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 46px; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--separator); }
.row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field span { flex: 1; }
.field input { flex: 1.4; text-align: right; color: var(--secondary); }
.action { color: var(--accent); }
.action.red { color: var(--red); }
.action svg { margin-left: auto; }
.row:active.action, .text-btn:active, .link:active { opacity: 0.55; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface3); flex: none; }
.dot.small { width: 8px; height: 8px; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.text-btn { color: var(--accent); white-space: nowrap; transition: opacity 0.2s; }
.text-btn.muted { color: var(--secondary); }
.text-btn:disabled { color: var(--tertiary); }

/* Knöpfe */
.capsule {
  height: 58px; border-radius: 999px; background: var(--surface2); color: var(--label);
  font-size: 18px; font-weight: 600; letter-spacing: -0.3px;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}
.capsule:active:not(:disabled) { transform: scale(0.97); transition-duration: 0.06s; }
.capsule.accent { background: var(--accent); color: #000; }
.capsule.danger { background: rgba(255, 69, 58, 0.17); color: var(--red); }
.capsule:disabled { background: var(--surface2); color: var(--tertiary); }
.capsule.small { height: 50px; font-size: 17px; }
.buttons { display: flex; gap: 12px; margin-top: 12px; }
.link { display: block; margin: 28px auto 4px; color: var(--accent); font-size: 17px; font-weight: 600; padding: 10px 16px; }

/* Schalter (iOS) */
.switch { width: 51px; height: 31px; border-radius: 999px; background: var(--fill-strong); position: relative; flex: none; transition: background 0.3s var(--ease-out); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06); transition: transform 0.3s var(--ease-out); }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.5; }

/* Segmente */
.segmented { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; height: 32px; position: relative; }
.segmented button { flex: 1; font-size: 13px; font-weight: 500; border-radius: 7px; transition: background 0.25s var(--ease-out); }
.segmented button[aria-pressed="true"] { background: #636366; font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }

/* Schieberegler */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; margin: 4px 0 2px; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--p, 50%) 100% no-repeat, var(--fill-strong); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; margin-top: -12px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-strong); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; }

/* Startbildschirm */
.welcome { display: flex; flex-direction: column; }
.hero-icon { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); border: 0.5px solid var(--hairline); display: grid; place-items: center; margin: 44px auto 0; }
.welcome .large-title { margin: 22px 0 8px; }
.welcome > p.callout { margin: 0 16px 8px; }

/* Kurzmeldung oben */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 8px); transform: translate(-50%, -140%) scale(0.95);
  background: var(--surface2); padding: 11px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); opacity: 0; transition: transform 0.32s var(--ease-out), opacity 0.2s;
  max-width: calc(100% - 32px); text-align: center; z-index: 10; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* Bestätigungsdialog */
dialog { background: var(--surface2); color: var(--label); border: 0; border-radius: 18px; padding: 0; width: 290px; box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog .msg { padding: 20px; text-align: center; }
dialog .msg h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
dialog .msg p { margin: 0; font-size: 13px; line-height: 18px; color: var(--secondary); }
dialog .btns { display: flex; border-top: 0.5px solid var(--separator); }
dialog .btns button { flex: 1; height: 48px; color: var(--accent); }
dialog .btns button + button { border-left: 0.5px solid var(--separator); color: var(--red); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
