/* ============================================================================
   speed app ch — styles.css
   mobile-first · system/dark-mode · grossi lesbari speed-zahl
   ========================================================================= */

:root {
  /* farbe — default (dark) */
  --bg: #0e1116;
  --bg-elev: #171b22;
  --bg-elev-2: #1f242d;
  --text: #f2f5f8;
  --text-dim: #9aa4b2;
  --border: #2a3038;

  /* status-farbe */
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --crit: #f87171;
  --crit-bg: rgba(248, 113, 113, 0.14);
  --idle: #6b7686;

  /* marken-akzent (us em logo: pink/crimson) */
  --accent: #fa1e5a;
  --accent-bright: #ff3d74;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);

  /* aktuelli status-farbe (wird per js gsetzt via [data-status]) */
  --status: var(--idle);
  --status-bg: var(--bg-elev);
}

/* light-mode wenn s system das will */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fa;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef1f6;
    --text: #10151c;
    --text-dim: #5c6773;
    --border: #dce1e8;
    --ok-bg: rgba(16, 160, 110, 0.12);
    --warn-bg: rgba(200, 140, 10, 0.14);
    --crit-bg: rgba(220, 60, 60, 0.12);
    --ok: #0ea86e;
    --warn: #c88c0a;
    --crit: #dc3c3c;
    --idle: #8a94a3;
    --shadow: 0 6px 20px rgba(20, 30, 50, 0.10);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

/* status-abhängigi akzentfarbe */
.app[data-status="ok"]   { --status: var(--ok);   --status-bg: var(--ok-bg); }
.app[data-status="warn"] { --status: var(--warn); --status-bg: var(--warn-bg); }
.app[data-status="crit"] { --status: var(--crit); --status-bg: var(--crit-bg); }
.app[data-status="idle"] { --status: var(--idle); --status-bg: var(--bg-elev); }

.app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 18px
           calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- brand / logo ---------- */
.brand {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}
.brand__logo {
  display: block;
  width: min(80%, 260px);
  height: auto;
  background: #fff;
  padding: 8px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

/* ---------- banner ---------- */
.banner {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--text);
}
.banner[data-kind="error"] { border-left-color: var(--crit); }
.banner[data-kind="info"]  { border-left-color: var(--accent); }
.banner button.link {
  background: none; border: none; padding: 0; margin-top: 6px;
  color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer;
  display: block;
}

/* ---------- speedo ---------- */
.speedo {
  background:
    radial-gradient(120% 90% at 50% 0%, var(--status-bg), transparent 70%),
    var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 16px 20px;
  text-align: center;
  transition: background 0.25s ease;
}
.speedo__value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}
.speedo__number {
  font-size: clamp(5rem, 34vw, 9rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--status);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}
.speedo__number.is-dimmed { opacity: 0.4; }
.speedo__unit {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dim);
}
.speedo__accuracy {
  margin-top: 8px;
  min-height: 1.1em;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ---------- diff ---------- */
.diff { text-align: center; }
.diff__line {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--status);
}
.diff__limit {
  margin: 0;
  font-size: 1rem;
  color: var(--text-dim);
}
.diff__limit strong { color: var(--text); font-weight: 700; }
.diff__cat {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ---------- sanction ---------- */
.sanction {
  background: var(--status-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: background 0.25s ease;
}
.sanction__label {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--status);
}
.sanction__note {
  margin: 6px 0 0;
  min-height: 1em;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ---------- switcher ---------- */
.switcher__row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  padding: 14px 6px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 52px;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- controls ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}
.btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  min-height: 56px;
  transition: all 0.15s ease;
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:active { transform: scale(0.98); }
.btn--primary.is-active {
  background: var(--crit);
  border-color: var(--crit);
}
.btn--ghost {
  background: var(--bg-elev);
  color: var(--text);
}
.btn--ghost[aria-pressed="true"] {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  color: var(--accent);
}
.btn--wide { grid-column: 1 / -1; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- stimm-iistellige ---------- */
.voice-settings {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.vs-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
}
.vs-val { color: var(--accent); }
.vs-row select {
  appearance: none;
  width: 100%;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font: inherit;
  font-size: 0.95rem;
}
.vs-row input[type="range"] {
  width: 100%;
  height: 30px;
  accent-color: var(--accent);
}
#voiceTestBtn { padding: 12px; }

/* ---------- disclaimer ---------- */
.disclaimer {
  text-align: center;
}
.disclaimer p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-dim);
}

/* reduzierti bewegig respektiere */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
