:root {
  color-scheme: dark;
  --bg: #07100d;
  --panel: #0d1915;
  --panel-strong: #11221c;
  --line: rgba(215, 236, 223, 0.12);
  --line-bright: rgba(215, 236, 223, 0.24);
  --text: #f2f7f3;
  --muted: #9baaa1;
  --accent: #b7ef78;
  --accent-strong: #8bd542;
  --warning: #f2c76e;
  --danger: #f28c8c;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 80% -10%, rgba(137, 212, 66, 0.14), transparent 32rem),
    radial-gradient(circle at -10% 28%, rgba(53, 113, 86, 0.16), transparent 30rem),
    var(--bg);
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 calc(48px + env(safe-area-inset-bottom));
}

.topbar {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 2px 0 0; font-size: 1.2rem; letter-spacing: -0.02em; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(183, 239, 120, 0.42);
  border-radius: 14px;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(183, 239, 120, 0.15), rgba(183, 239, 120, 0.03));
  box-shadow: inset 0 0 18px rgba(183, 239, 120, 0.08);
  font-weight: 800;
  letter-spacing: -0.06em;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.install-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}

.search-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(183, 239, 120, 0.09), transparent 46%),
    linear-gradient(155deg, #13241e, #0b1612 72%);
  box-shadow: var(--shadow);
}

.search-panel::after {
  content: "";
  position: absolute;
  width: 22rem;
  height: 22rem;
  right: -8rem;
  top: -10rem;
  border: 1px solid rgba(183, 239, 120, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 3rem rgba(183, 239, 120, 0.025), 0 0 0 7rem rgba(183, 239, 120, 0.02);
  pointer-events: none;
}

.search-copy { position: relative; z-index: 1; }
.search-copy h2 { margin: 8px 0 8px; font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -0.055em; line-height: 0.98; }
.search-copy > p:last-child { margin: 0; color: var(--muted); font-size: clamp(0.92rem, 2vw, 1.05rem); }

.search-box {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 12px;
  width: min(720px, 100%);
  min-height: 72px;
  margin-top: 30px;
  padding: 0 18px 0 20px;
  border: 1px solid rgba(238, 247, 240, 0.22);
  border-radius: 18px;
  background: rgba(3, 9, 7, 0.7);
  box-shadow: 0 12px 36px rgba(0,0,0,0.28), inset 0 0 0 1px rgba(255,255,255,0.025);
  backdrop-filter: blur(18px);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-box:focus-within {
  border-color: rgba(183, 239, 120, 0.76);
  box-shadow: 0 0 0 4px rgba(183, 239, 120, 0.09), 0 18px 44px rgba(0,0,0,0.34);
}

.search-box svg { width: 24px; fill: none; stroke: var(--accent); stroke-width: 1.8; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: clamp(1.25rem, 4vw, 1.75rem); font-weight: 720; letter-spacing: 0.04em; text-transform: uppercase; }
.search-box input::placeholder { color: #66736c; font-weight: 520; letter-spacing: 0; }

.clear-button, .modal-close {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
}
.clear-button { width: 34px; height: 34px; font-size: 1.6rem; line-height: 1; }
.search-hint { position: relative; z-index: 1; margin: 12px 0 0; color: #78877e; font-size: 0.8rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0 38px;
}

.stat-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 78px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13, 25, 21, 0.78);
}
.stat-card span { color: var(--muted); font-size: 0.82rem; }
.stat-card strong { font-size: 1.5rem; letter-spacing: -0.04em; }

.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.results-heading h2 { margin: 5px 0 0; font-size: 1.75rem; letter-spacing: -0.04em; }
.result-count { color: var(--muted); font-size: 0.84rem; }
.results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.vehicle-card {
  display: grid;
  grid-template-columns: minmax(155px, 0.72fr) 1fr auto;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 154px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: inherit;
  text-align: left;
  background: linear-gradient(150deg, rgba(20, 38, 31, 0.98), rgba(10, 19, 16, 0.98));
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.vehicle-card:hover, .vehicle-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(183, 239, 120, 0.32);
  background: linear-gradient(150deg, rgba(24, 45, 37, 1), rgba(11, 21, 17, 1));
  outline: none;
}

.plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: 10px 14px;
  border: 2px solid #dce8df;
  border-radius: 8px;
  color: #f7fff9;
  background: #0a0d0b;
  box-shadow: 0 0 0 3px #202a24, 0 0 22px rgba(207, 255, 214, 0.11), inset 0 0 14px rgba(255,255,255,0.06);
  font-family: "Arial Narrow", "Roboto Condensed", ui-monospace, monospace;
  font-size: clamp(1.08rem, 2.7vw, 1.42rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.065em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 7px rgba(236, 255, 240, 0.42);
  white-space: nowrap;
}

.plate mark {
  padding: 2px 1px;
  border-radius: 3px;
  color: #0b120e;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(183, 239, 120, 0.5);
}

.plate.no-plate { color: #a8b3ac; border-style: dashed; font-size: 0.82rem; letter-spacing: 0.04em; text-shadow: none; }
.vehicle-main { min-width: 0; }
.vehicle-main h3 { margin: 0 0 9px; overflow: hidden; font-size: 1rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-main p { margin: 4px 0; overflow: hidden; color: var(--muted); font-size: 0.79rem; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-arrow { color: var(--accent); font-size: 1.45rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { padding: 5px 8px; border: 1px solid var(--line-bright); border-radius: 999px; color: #c7d3cb; background: rgba(255,255,255,0.035); font-size: 0.65rem; font-weight: 760; letter-spacing: 0.04em; text-transform: uppercase; }
.badge.accent { color: var(--accent); border-color: rgba(183,239,120,0.3); background: rgba(183,239,120,0.07); }

.skeleton { position: relative; overflow: hidden; min-height: 154px; border-radius: 22px; background: #0f1b17; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.055), transparent); animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.empty-state { padding: 56px 20px; border: 1px dashed var(--line-bright); border-radius: 24px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 14px 0 6px; color: var(--text); }
.empty-state p { margin: 0; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto; border: 1px solid var(--line-bright); border-radius: 15px; color: var(--accent); font-weight: 900; }

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 5, 3, 0.78);
  backdrop-filter: blur(12px);
}

.vehicle-modal {
  position: relative;
  width: min(780px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  padding: clamp(24px, 5vw, 46px);
  border: 1px solid var(--line-bright);
  border-radius: 28px;
  background: linear-gradient(160deg, #14261f, #09120f 74%);
  box-shadow: 0 34px 120px rgba(0,0,0,0.56);
}

.modal-close { position: absolute; z-index: 2; top: 16px; right: 16px; width: 38px; height: 38px; font-size: 1.8rem; }
.modal-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding-right: 42px; }
.modal-hero .plate { min-width: 205px; min-height: 72px; font-size: 1.55rem; }
.modal-title-wrap { flex: 1; min-width: 210px; }
.modal-title-wrap h2 { margin: 7px 0 0; font-size: clamp(1.55rem, 5vw, 2.35rem); line-height: 1.04; letter-spacing: -0.05em; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 30px; }
.detail-item { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.025); }
.detail-item.wide { grid-column: 1 / -1; }
.detail-item dt { margin: 0 0 6px; color: var(--muted); font-size: 0.68rem; font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }
.detail-item dd { margin: 0; overflow-wrap: anywhere; font-size: 0.88rem; line-height: 1.45; }

.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(440px, calc(100% - 32px)); padding: 12px 16px; border: 1px solid var(--line-bright); border-radius: 12px; background: #17261f; box-shadow: var(--shadow); font-size: 0.85rem; }

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

@media (max-width: 620px) {
  .app-shell { width: min(100% - 20px, 1180px); }
  .topbar { min-height: 78px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
  .brand h1 { font-size: 1rem; }
  .search-panel { padding: 26px 18px; border-radius: 24px; }
  .search-copy h2 { font-size: 2.15rem; }
  .search-box { min-height: 64px; padding-left: 15px; }
  .stats { margin-top: 10px; margin-bottom: 30px; gap: 8px; }
  .stat-card { min-height: 68px; padding: 15px; }
  .vehicle-card { grid-template-columns: 132px 1fr; gap: 15px; min-height: 142px; padding: 16px; }
  .vehicle-arrow { display: none; }
  .plate { min-height: 56px; padding: 8px 9px; font-size: 1rem; }
  .modal-backdrop { align-items: end; padding: 0; }
  .vehicle-modal { width: 100%; max-height: 91vh; border-radius: 26px 26px 0 0; border-bottom: 0; padding: 28px 18px calc(28px + env(safe-area-inset-bottom)); }
  .details-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: auto; }
}

@media (max-width: 400px) {
  .vehicle-card { grid-template-columns: 1fr; }
  .vehicle-main h3, .vehicle-main p { white-space: normal; }
  .plate { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
