/* =========================================================================
   Taxameter – styles
   Dark "taxi interior" aesthetic, amber LCD, chunky mechanical buttons.
   ========================================================================= */

:root {
  --bg: #0a0a0a;
  --bg-elev: #151515;
  --bg-elev-2: #1d1d1d;
  --panel: #0f0f10;
  --stroke: #2a2a2a;
  --stroke-strong: #3a3a3a;

  --amber: #ffb000;
  --amber-soft: #ffd066;
  --amber-dim: rgba(255, 176, 0, 0.18);

  --red: #ff3b30;
  --red-soft: #ff6b6b;
  --green: #34d399;

  --taxi: #ffcc00;
  --text: #e9e9e9;
  --text-dim: #9a9a9a;

  --radius: 14px;
  --radius-lg: 22px;

  --shadow-deep: 0 12px 30px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(255, 255, 255, 0.03) inset;

  --glow-amber: 0 0 2px rgba(255, 176, 0, 0.9), 0 0 18px rgba(255, 176, 0, 0.35);

  --font-lcd: "DSEG7 Classic", "Share Tech Mono", "Menlo", ui-monospace, monospace;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 800px at 50% -20%, #1b1b1b 0%, #070707 60%, #000 100%);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

body {
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* -------------------------------------------------------------------------
   Overall cab shell
   ------------------------------------------------------------------------- */
.cab {
  width: min(560px, 100%);
  padding: 18px 14px 28px;
  display: grid;
  gap: 16px;
}

/* Roof taxi sign */
.roofsign {
  position: relative;
  justify-self: center;
  background: linear-gradient(180deg, #ffd84a 0%, #f0b700 100%);
  color: #111;
  font-weight: 900;
  letter-spacing: 0.4em;
  padding: 10px 22px 10px 34px;
  border-radius: 6px;
  box-shadow:
    0 10px 24px rgba(240, 183, 0, 0.25),
    0 2px 0 rgba(0, 0, 0, 0.35) inset;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-ui);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.roofsign__lamp {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 12px #ff3b30, 0 0 2px #fff inset;
  animation: pulseRed 1.8s ease-in-out infinite;
}
@keyframes pulseRed {
  50% {
    opacity: 0.45;
  }
}
.roofsign__text {
  font-size: 20px;
}
.roofsign__domain {
  font-size: 10px;
  letter-spacing: 0.18em;
  opacity: 0.7;
  font-weight: 700;
}

/* -------------------------------------------------------------------------
   Meter body – the "device"
   ------------------------------------------------------------------------- */
.meter {
  background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-deep);
  display: grid;
  gap: 14px;
  position: relative;
}
.meter::before {
  /* brushed-metal highlight */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%);
}

.meter__topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.lamp {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--stroke-strong);
  background: var(--bg-elev);
  color: #5a5a5a;
  text-align: center;
  transition: color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.lamp--frei.active {
  color: #111;
  background: var(--green);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.55);
}
.lamp--kasse.active {
  color: #111;
  background: var(--red);
  box-shadow: 0 0 14px rgba(255, 59, 48, 0.6);
}
.tariff {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.24em;
  font-size: 11px;
  color: var(--amber-soft);
  background: rgba(255, 176, 0, 0.08);
  border: 1px solid rgba(255, 176, 0, 0.25);
  padding: 6px 12px;
  border-radius: 8px;
}

/* -------------------------------------------------------------------------
   Main fare display
   ------------------------------------------------------------------------- */
.display {
  background: radial-gradient(120% 100% at 50% 0%, #181308 0%, #0a0703 60%, #060402 100%);
  border: 1px solid #2a1e03;
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 176, 0, 0.08) inset,
    0 12px 24px rgba(0, 0, 0, 0.55);
}
.display::after {
  /* subtle scanlines */
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  mix-blend-mode: screen;
}
.display__label {
  color: var(--amber);
  letter-spacing: 0.35em;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.75;
  margin-bottom: 4px;
}
.display__value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--amber);
  text-shadow: var(--glow-amber);
  font-family: var(--font-lcd);
  line-height: 1;
}
.display__euro {
  font-size: clamp(28px, 7vw, 44px);
}
.display__digits {
  font-size: clamp(56px, 16vw, 96px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.display.flash {
  animation: displayFlash 0.4s ease;
}
@keyframes displayFlash {
  0% {
    background-color: rgba(255, 176, 0, 0.25);
  }
  100% {
    background-color: transparent;
  }
}

/* -------------------------------------------------------------------------
   Sub readouts (time, distance, speed, surcharge)
   ------------------------------------------------------------------------- */
.readouts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.readout {
  background: #0c0c0c;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}
.readout__label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
}
.readout__value {
  font-family: var(--font-lcd);
  color: var(--amber-soft);
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.25);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 460px) {
  .readouts {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* -------------------------------------------------------------------------
   Action buttons – chunky & mechanical
   ------------------------------------------------------------------------- */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.btn {
  appearance: none;
  border: 1px solid var(--stroke-strong);
  background: linear-gradient(180deg, #2a2a2a 0%, #141414 100%);
  color: var(--text);
  padding: 14px 10px;
  border-radius: 12px;
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease, filter 0.15s ease,
    background 0.15s ease;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 10px 20px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(0, 0, 0, 0.3) inset;
  display: grid;
  gap: 4px;
  text-align: center;
  user-select: none;
  touch-action: manipulation;
}
.btn:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(0, 0, 0, 0.3) inset;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.btn__key {
  font-size: 13px;
  letter-spacing: 0.22em;
}
.btn__hint {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  font-weight: 600;
}

.btn--start {
  background: linear-gradient(180deg, #2a5e2a 0%, #0f2f0f 100%);
  border-color: #2f6f2f;
}
.btn--start .btn__key {
  color: #c8f7c5;
}
.btn--pause {
  background: linear-gradient(180deg, #5a4a14 0%, #2a2108 100%);
  border-color: #6f5a1b;
}
.btn--pause .btn__key {
  color: #ffe6a0;
}
.btn--stop {
  background: linear-gradient(180deg, #6b1d1d 0%, #2a0909 100%);
  border-color: #8a2a2a;
}
.btn--stop .btn__key {
  color: #ffd0cc;
}
.btn--ghost {
  background: transparent;
  border: 1px solid var(--stroke-strong);
  padding: 10px 14px;
  box-shadow: none;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* -------------------------------------------------------------------------
   Secondary chips (tariff/gps/demo-speed/history)
   ------------------------------------------------------------------------- */
.secondary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  flex: 1 1 auto;
  background: #121212;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  min-height: 38px;
  cursor: pointer;
}
.chip__label {
  color: var(--text-dim);
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
}
.chip__select,
.chip input[type="range"] {
  background: transparent;
  color: var(--text);
  border: none;
  outline: none;
  font: inherit;
  flex: 1;
}
.chip--range {
  min-width: 180px;
}
.chip__value {
  font-family: var(--font-lcd);
  color: var(--amber-soft);
  font-size: 13px;
  min-width: 26px;
  text-align: right;
}
.chip--button {
  justify-content: center;
  font-weight: 700;
  color: var(--amber-soft);
  border-color: rgba(255, 176, 0, 0.25);
  background: rgba(255, 176, 0, 0.06);
}

/* -------------------------------------------------------------------------
   Surcharge ticker
   ------------------------------------------------------------------------- */
.ticker {
  background: #0d0d0d;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 110px;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ticker__title {
  letter-spacing: 0.26em;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 800;
  margin-bottom: 8px;
}
.ticker__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.ticker__list li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
  color: var(--text);
  padding: 8px 10px;
  background: #111;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
  animation: slideIn 0.35s ease both;
}
.ticker__list li .time {
  color: var(--text-dim);
  font-family: var(--font-lcd);
  font-size: 11px;
}
.ticker__list li .amt {
  font-family: var(--font-lcd);
  font-weight: 700;
  color: var(--amber);
}
.ticker__list li .amt.neg {
  color: var(--green);
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Plate */
.plate {
  justify-self: center;
  font-family: "Oswald", var(--font-ui);
  letter-spacing: 0.16em;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-dim);
  display: inline-flex;
  gap: 10px;
  align-items: center;
  background: #131313;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 6px 12px;
}
.plate__sep {
  opacity: 0.4;
}

/* -------------------------------------------------------------------------
   Toast
   ------------------------------------------------------------------------- */
.toast-slot {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 520px);
}
.toast {
  pointer-events: auto;
  background: #1c1c1c;
  border: 1px solid var(--stroke-strong);
  border-left: 4px solid var(--amber);
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.35s ease both;
  font-size: 14px;
}
.toast.toast--neg {
  border-left-color: var(--green);
}
.toast .toast__amt {
  font-family: var(--font-lcd);
  font-weight: 800;
  color: var(--amber);
}
.toast.toast--neg .toast__amt {
  color: var(--green);
}
.toast.out {
  animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-16px);
  }
}

/* -------------------------------------------------------------------------
   Modal / dialog
   ------------------------------------------------------------------------- */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text);
  max-width: 92vw;
  width: 480px;
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #121212;
  border: 1px solid var(--stroke);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
}
.modal__header h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.12em;
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px;
  background: #121212;
  border: 1px solid var(--stroke);
  border-top: none;
  border-radius: 0 0 14px 14px;
}

/* Receipt (styled like a thermal print) */
.receipt {
  background: #f6f2e6;
  color: #1a1a1a;
  padding: 22px 22px 28px;
  border-radius: 14px 14px 0 0;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
}
.receipt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 12px;
  background:
    radial-gradient(circle at 6px 0, #f6f2e6 6px, transparent 7px) repeat-x;
  background-size: 12px 12px;
}
.receipt h3 {
  margin: 0 0 8px;
  font-size: 18px;
  text-align: center;
  letter-spacing: 0.12em;
}
.receipt .sub {
  text-align: center;
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 14px;
}
.receipt hr {
  border: none;
  border-top: 1px dashed #999;
  margin: 10px 0;
}
.receipt .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.receipt .row.total {
  font-size: 18px;
  font-weight: 900;
  margin-top: 6px;
}
.receipt .line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  font-size: 12px;
}
.receipt .line .label {
  opacity: 0.85;
}
.receipt .foot {
  text-align: center;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 12px;
}

/* History list */
.history-list {
  max-height: 55vh;
  overflow-y: auto;
  background: #121212;
  border-left: 1px solid var(--stroke);
  border-right: 1px solid var(--stroke);
  padding: 6px 10px;
}
.history-list .hist {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid #1a1a1a;
  font-size: 13px;
}
.history-list .hist .when {
  color: var(--text-dim);
  font-size: 11px;
}
.history-list .hist .amt {
  font-family: var(--font-lcd);
  color: var(--amber);
  font-weight: 700;
}
.history-list .empty {
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
  font-size: 13px;
}

/* Install banner */
.install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: #151515;
  border: 1px solid var(--stroke-strong);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 80;
  margin-inline: auto;
  max-width: 560px;
}
.install-banner[hidden] {
  display: none;
}
.install-banner span {
  flex: 1;
}

/* Running state tint */
.meter.is-running .display {
  box-shadow:
    0 0 0 1px rgba(255, 59, 48, 0.2) inset,
    0 12px 24px rgba(0, 0, 0, 0.55);
}
