:root {
  --bg: #0c0e12;
  --bg2: #14171e;
  --panel: #1a1e27;
  --panel2: #20252f;
  --line: #2a303c;
  --text: #eef1f6;
  --muted: #99a2b2;
  --hypercar: #e0241b;
  --lmp2: #2f7ce0;
  --lmgt3: #2fb15a;
  --accent: #ffcc00;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1b2230 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100svh;
}

a { color: var(--accent); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(12,14,18,.96), rgba(12,14,18,.86));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: max(14px, env(safe-area-inset-top))
           max(clamp(14px, 4vw, 40px), env(safe-area-inset-right))
           12px
           max(clamp(14px, 4vw, 40px), env(safe-area-inset-left));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.brand h1 {
  margin: 0;
  font-size: clamp(20px, 3.4vw, 30px);
  font-weight: 800;
  letter-spacing: .04em;
}
.brand h1 span { color: var(--accent); }
.install {
  margin-left: auto;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.install:hover { background: var(--accent); color: #0c0e12; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-ico {
  position: absolute;
  left: 14px;
  width: 20px; height: 20px;
  color: var(--muted);
  pointer-events: none;
}
#q {
  width: 100%;
  padding: 13px 44px 13px 44px;
  font-size: 16px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#q::placeholder { color: #6c7686; }
#q:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,204,0,.16);
}
.clear {
  position: absolute;
  right: 10px;
  width: 28px; height: 28px;
  border: none; border-radius: 8px;
  background: var(--panel2);
  color: var(--muted);
  font-size: 18px; line-height: 1;
  cursor: pointer;
}
.clear:hover { color: var(--text); }

.chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.chip {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: .15s;
}
.chip:hover { color: var(--text); border-color: #3a4250; }
.chip.is-active { color: #0c0e12; background: var(--accent); border-color: var(--accent); }

/* ---------- main ---------- */
main { padding: 18px clamp(14px, 4vw, 40px) 60px; }
.count { color: var(--muted); font-size: 14px; margin: 4px 2px 16px; }
.count b { color: var(--text); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--cls, var(--line));
  transition: transform .12s ease, border-color .12s;
}
.card:hover { transform: translateY(-3px); }

.card .liv {
  display: block;
  width: 100%;
  background: #fff;
  aspect-ratio: 1200 / 373;
  object-fit: cover;
}

.card .body { padding: 12px 14px 14px; }

.card .head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.num {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .02em;
  color: #fff;
  background: var(--cls, #444);
  padding: 2px 10px;
  border-radius: 8px;
  min-width: 44px;
  text-align: center;
}
.head .names { min-width: 0; }
.head .team {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.head .car { font-size: 12.5px; color: var(--muted); }
.cls-tag {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--cls, var(--muted));
  border: 1px solid var(--cls, var(--line));
  border-radius: 6px;
  padding: 3px 7px;
  white-space: nowrap;
}

.drivers { list-style: none; margin: 0; padding: 0; }
.drivers li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
  border-top: 1px solid var(--line);
}
.drivers li:first-child { border-top: none; }
.drivers .flag { font-size: 17px; width: 22px; text-align: center; flex: none; }
.note {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  font-style: italic;
}

mark { background: rgba(255,204,0,.32); color: inherit; border-radius: 3px; padding: 0 1px; }

.empty { color: var(--muted); text-align: center; padding: 40px; }

.foot {
  border-top: 1px solid var(--line);
  padding: 18px clamp(14px, 4vw, 40px);
  color: #6c7686;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

main { padding-left: max(clamp(14px,4vw,40px), env(safe-area-inset-left));
       padding-right: max(clamp(14px,4vw,40px), env(safe-area-inset-right)); }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .brand { flex-wrap: wrap; gap: 8px; }
  .num { font-size: 20px; }
}

@media (hover: none) {
  .card:hover { transform: none; }
}
