:root {
  --white: #fff;
  --yellow: #ffd600;
  --cyan: #5ff4dd;
  --green: #48dd75;
  --red: #ff285c;
  --purple: #5424c8;
  --ink: #26000c;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--white);
  font-family: Impact, "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(37,0,9,.95) 0%, rgba(122,8,43,.88) 26%, rgba(124,68,105,.62) 58%, rgba(189,224,243,.98) 100%),
    radial-gradient(circle at 13% 10%, rgba(255,44,88,.72), transparent 420px),
    radial-gradient(circle at 85% 18%, rgba(35,0,21,.72), transparent 560px);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(90deg, transparent 0 91%, rgba(20,0,8,.34) 91.25% 91.7%, transparent 92%),
    radial-gradient(ellipse at 72% 26%, rgba(255,255,255,.08), transparent 410px);
}

body::after {
  position: fixed;
  inset: auto -10vw -18vh -10vw;
  z-index: -1;
  height: 42vh;
  content: "";
  background: radial-gradient(ellipse at 45% 65%, rgba(237,250,255,.68), transparent 580px);
  filter: blur(18px);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.hud {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 86px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(18px, 5vw, 72px) 0;
  background: linear-gradient(180deg, rgba(0,0,0,.72), rgba(60,0,16,.56), transparent);
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-icon {
  width: 54px;
  height: 54px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 48px;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,.45);
}

.hud-round {
  position: relative;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: white;
  font-size: 28px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  backdrop-filter: blur(8px);
}

.rank, .vip, .cash, .gold, .fuel, .gear, .resource-pill {
  font-size: 24px;
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.vip, .gold, .yellow { color: var(--yellow); }
.fuel { color: var(--cyan); }

.plus {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #063d1e;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.resource-pill {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(0,0,0,.18);
  color: white;
  backdrop-filter: blur(6px);
}

.resource-pill.gold {
  color: var(--yellow);
}

.resource-pill.fuel {
  color: var(--cyan);
}

.resource-editor {
  position: fixed;
  top: 82px;
  right: clamp(16px, 5vw, 72px);
  z-index: 40;
  width: min(440px, calc(100vw - 32px));
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(72,0,22,.96), rgba(22,0,18,.92));
  padding: 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,.42);
}

.resource-editor form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.resource-editor div, .resource-editor small {
  grid-column: 1 / -1;
  font-family: Arial, sans-serif;
  font-weight: 800;
  color: rgba(255,255,255,.78);
}

.resource-editor strong {
  color: var(--yellow);
}

.resource-editor input {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.14);
  color: white;
  padding: 0 12px;
  font-family: Arial, sans-serif;
  font-weight: 900;
}

.app {
  max-width: 1540px;
  margin: 0 auto;
  padding: 36px clamp(18px, 5vw, 72px) 70px;
}

.app-error {
  position: sticky;
  top: 86px;
  z-index: 35;
  margin: 0 auto;
  max-width: 1540px;
  border-radius: 12px;
  background: rgba(255, 40, 92, .92);
  color: white;
  padding: 12px 18px;
  font-family: Arial, sans-serif;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
}

.view { display: none; }
.view.active { display: block; }

h1, h2 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -.018em;
  line-height: .92;
  text-shadow: 0 2px 12px rgba(20,0,10,.38);
}

h1 { font-size: clamp(64px, 8vw, 112px); }
h2 { font-size: clamp(42px, 5vw, 72px); }

.bigline {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 900;
}

.lead {
  max-width: 760px;
  margin: 16px 0 0;
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  color: rgba(255,255,255,.8);
}

.hero, .panel, .filters {
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(3px);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  padding: 24px;
}

.primary, .text-button, .segment, .complete-button, .ghost-button {
  border: 0;
  border-radius: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.primary {
  min-height: 48px;
  padding: 0 22px;
  background: var(--yellow);
  color: #4d2600;
  box-shadow: 0 4px 18px rgba(255,210,0,.28);
}

.text-button {
  background: transparent;
  color: var(--yellow);
  font-size: 20px;
}

.complete-button, .ghost-button {
  min-height: 48px;
  padding: 0 18px;
}

.complete-button {
  background: var(--green);
  color: #063d1e;
}

.ghost-button {
  background: rgba(255,255,255,.14);
  color: white;
}

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

.stat, .tip, .detail-block {
  border-radius: 14px;
  background: rgba(0,0,0,.24);
  backdrop-filter: blur(3px);
}

.stat {
  padding: 18px;
}

.stat span {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  color: rgba(255,255,255,.74);
}

.stat strong {
  display: block;
  margin-top: 10px;
  color: var(--yellow);
  font-size: 44px;
  line-height: 1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 34px 0 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 22px;
}

.event-card {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, #3fe0a0, #3a68e6 52%, #5b25ce 100%);
  box-shadow: 0 8px 18px rgba(20,0,16,.24);
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease;
}

.car-art {
  position: absolute;
  inset: 0 0 32%;
  z-index: 1;
  background: var(--car-image);
  background-position: center;
  background-size: cover;
  opacity: 0;
  transform: scale(1.04);
}

.has-car-image .car-art {
  opacity: 1;
}

.has-car-image::before {
  background:
    linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.04)),
    radial-gradient(ellipse at 50% 100%, rgba(0,0,0,.45), transparent 70%);
}

.has-car-image::after {
  inset: 44% 0 0;
  transform: none;
  opacity: .92;
  background: linear-gradient(180deg, rgba(35,0,32,0), rgba(87,35,199,.95) 44%, rgba(80,33,188,1));
}

.event-card:hover, .event-card:focus-visible {
  transform: translateY(-4px);
  filter: brightness(1.08);
  outline: 0;
}

.event-card::before {
  position: absolute;
  inset: 0 0 34%;
  content: "";
  background:
    radial-gradient(ellipse at 42% 50%, rgba(255,255,255,.88), transparent 72px),
    linear-gradient(135deg, rgba(80,255,190,.7), rgba(36,170,255,.78) 52%, rgba(255,93,45,.72));
}

.event-card::after {
  position: absolute;
  inset: 14% -12% 36% 8%;
  content: "";
  background:
    linear-gradient(12deg, transparent 0 35%, rgba(13,28,42,.82) 35% 62%, transparent 62%),
    radial-gradient(ellipse at 35% 84%, rgba(0,0,0,.65), transparent 80px);
  transform: skewX(-12deg);
  opacity: .72;
}

.event-card > * { position: relative; z-index: 2; }

.badge-row {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
}

.badge {
  border-radius: 999px;
  background: rgba(0,0,0,.36);
  padding: 5px 10px;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 900;
}

.car-label {
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 900;
  color: rgba(255,255,255,.82);
}

.event-card h3 {
  margin: 4px 0 0;
  font-size: 38px;
  line-height: .95;
  text-transform: uppercase;
}

.completion {
  color: var(--yellow);
  font-size: 25px;
}

.tap-hint {
  margin-top: 4px;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
}

.progress {
  height: 12px;
  margin-top: 12px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(0,0,0,.36);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--yellow);
}

.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 18px 0 24px;
  padding: 12px;
}

.filters input, .filters select, .import-form input, .edit-grid input, .edit-grid select, .edit-grid textarea {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.13);
  color: white;
  padding: 0 14px;
  font-family: Arial, sans-serif;
  font-weight: 800;
  outline: 0;
}

.filters input { flex: 1; }
.segments { display: flex; gap: 8px; flex-wrap: wrap; }
.segment { min-height: 44px; padding: 0 14px; color: rgba(255,255,255,.78); background: rgba(255,255,255,.11); }
.segment.active { background: var(--yellow); color: #4d2600; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}

.detail-block, .panel {
  padding: 18px;
}

.detail-car-art {
  min-height: 260px;
  margin: -18px -18px 18px;
  border-radius: 14px 14px 0 0;
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 -80px 80px rgba(30,0,25,.76);
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.detail-block h2 { font-size: 42px; margin-bottom: 16px; }

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.material, .kit, .wall {
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  padding: 13px;
}

.material-title, .kit {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: Arial, sans-serif;
  font-weight: 900;
}

.stepper {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.stepper button, .kit {
  border: 0;
  color: white;
}

.stepper button {
  height: 38px;
  border-radius: 8px;
  background: rgba(0,0,0,.28);
  font-size: 24px;
}

.kit.done { color: var(--green); }
.wall strong { color: var(--yellow); font-size: 24px; }

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.tip {
  padding: 18px;
  font-family: Arial, sans-serif;
  font-weight: 800;
  line-height: 1.45;
}

.tip b { color: var(--yellow); }

.import-form {
  display: grid;
  gap: 12px;
  max-width: 820px;
  margin-top: 24px;
}

.import-form label {
  font-size: 22px;
  font-weight: 900;
}

.edit-grid {
  display: grid;
  gap: 10px;
}

@media (max-width: 900px) {
  .hud-right { display: none; }
  .hud { padding-inline: 14px; }
  .rank, .vip { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hero, .filters { flex-direction: column; align-items: stretch; }
  .detail-layout { grid-template-columns: 1fr; }
}
