:root {
  --rcm-red: #ffc61a;
  --rcm-black: #111111;
  --rcm-charcoal: #474747;
  --rcm-silver: #d1d1d1;
  --rcm-white: #ffffff;
  --rcm-bg: #f6f6f6;
  --rcm-border: rgba(17, 17, 17, 0.12);
  --rcm-shadow: 0 14px 40px rgba(17, 17, 17, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--rcm-black);
  background:
    linear-gradient(180deg, var(--rcm-red) 0 126px, var(--rcm-bg) 126px 100%);
  font-family: Arial, Helvetica, sans-serif;
}

.page {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.masthead {
  padding: 2px 4px 20px;
  color: var(--rcm-white);
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-home-link {
  color: inherit;
  text-decoration: none;
}

.brand-home-link:hover,
.brand-home-link:focus-visible {
  text-decoration: none;
}

.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(17, 17, 17, 0.12);
  background: rgba(255, 255, 255, 0.12);
  object-fit: cover;
}

.section-label,
.stat-label,
.field span {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.45rem, 2.8vw, 2.45rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(0.98rem, 1.2vw, 1.28rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 0.94rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.masthead-note {
  margin: 6px 0 0;
  max-width: 46ch;
  font-size: 0.78rem;
  line-height: 1.3;
  opacity: 0.92;
}

.hero-grid--stacked {
  grid-template-columns: 1fr;
}

.hero-card,
.station-card,
.empty-state {
  border: 1px solid var(--rcm-border);
  border-radius: var(--radius);
  background: var(--rcm-white);
  box-shadow: var(--rcm-shadow);
}

.hero-card {
  padding: 15px;
}

.leaderboard-card {
  display: grid;
  gap: 18px;
  align-content: start;
}

.citywide-card {
  padding-top: 14px;
}

.leaderboard-intro {
  margin-bottom: 2px;
}

.leaderboard-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.leaderboard-group-heading {
  grid-column: 1 / -1;
  margin-bottom: -4px;
}

.leaderboard-section {
  min-width: 0;
  display: grid;
  align-content: start;
}

.leaderboard-note {
  margin: 6px 0 0;
  max-width: none;
  color: var(--rcm-charcoal);
  font-size: 0.78rem;
  line-height: 1.45;
}

.leaderboard-trust {
  margin: 4px 0 0;
  max-width: none;
  color: var(--rcm-charcoal);
  font-size: 0.78rem;
  line-height: 1.45;
  font-weight: 500;
  opacity: 0.92;
}

.list-header {
  display: flex;
  justify-content: flex-start;
  gap: 18px;
  align-items: end;
  margin-top: 20px;
}

.list-note {
  margin: 0;
  max-width: 34ch;
  color: var(--rcm-charcoal);
  line-height: 1.5;
}

.card-heading {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.leaderboard-section .card-heading {
  min-height: 46px;
}

.section-label {
  color: var(--rcm-red);
}

.section-label--ghost {
  visibility: hidden;
}

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

.stat-box {
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
  border: 1px solid var(--rcm-border);
}

.stat-label {
  display: block;
  color: var(--rcm-charcoal);
  margin-bottom: 6px;
}

.stat-box strong {
  display: block;
  font-size: 0.96rem;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-areas:
    "search search search search fuel fuel"
    "sort sort sort sort action action";
  gap: 10px;
  margin-top: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
}

.field--search {
  grid-area: search;
}

.field--fuel {
  grid-area: fuel;
}

.field--sort {
  grid-area: sort;
}

.toolbar-action {
  grid-area: action;
}

.field span {
  color: var(--rcm-charcoal);
}

input,
select,
.button {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--rcm-border);
  font-size: 0.94rem;
}

input,
select {
  width: 100%;
  padding: 0 14px;
  background: var(--rcm-white);
  color: var(--rcm-black);
}

.button {
  padding: 0 18px;
  background: var(--rcm-red);
  color: var(--rcm-white);
  font-weight: 700;
  cursor: pointer;
}

.toolbar-action .button {
  width: 100%;
}

.summary {
  margin-top: 12px;
  padding: 14px 16px 0;
  border-top: 1px solid var(--rcm-border);
}

.status {
  color: var(--rcm-charcoal);
  line-height: 1.5;
  max-width: 48ch;
}

.explore-grid {
  display: grid;
  grid-template-columns: minmax(400px, 1.12fr) minmax(0, 0.88fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.leaderboard-list {
  display: grid;
  gap: 4px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 7px 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--rcm-border);
  background: transparent;
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--rcm-black);
  color: var(--rcm-white);
  font-weight: 700;
  font-size: 0.74rem;
}

.leaderboard-station {
  font-weight: 700;
  line-height: 1.05;
  font-size: 0.84rem;
}

.leaderboard-main {
  min-width: 0;
}

.leaderboard-meta {
  margin-top: 2px;
  color: var(--rcm-charcoal);
  font-size: 0.74rem;
}

.leaderboard-price {
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.map-card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.map-frame {
  border: 1px solid var(--rcm-border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 3, 3, 0.08), transparent 14%),
    linear-gradient(180deg, #fff6f6 0%, #f3f3f3 100%);
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.map-canvas {
  position: relative;
  min-height: 100%;
  height: 100%;
  padding: 12px;
}

.map-canvas.is-leaflet {
  padding: 0;
}

.map-canvas.is-leaflet::before {
  display: none;
}

.map-canvas::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(17,17,17,0.04) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(rgba(17,17,17,0.04) 1px, transparent 1px) 0 0 / 36px 36px;
  pointer-events: none;
}

.map-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--rcm-black);
  box-shadow: 0 4px 16px rgba(17,17,17,0.16);
}

.map-dot.is-best {
  background: var(--rcm-red);
  transform: scale(1.15);
}

.map-label {
  position: absolute;
  transform: translate(10px, -10px);
  padding: 3px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--rcm-border);
  font-size: 0.68rem;
  white-space: nowrap;
  line-height: 1.15;
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.08);
}

.map-label-name {
  display: block;
  font-weight: 700;
}

.map-label-price {
  display: block;
  margin-top: 1px;
  font-size: 0.6rem;
  color: var(--rcm-charcoal);
}

.map-note {
  margin: 8px 0 0;
  color: var(--rcm-charcoal);
  font-size: 0.78rem;
  line-height: 1.4;
}

.price-pin-icon {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.map-pin {
  position: relative;
  display: inline-flex;
  min-width: 52px;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: var(--rcm-black);
  color: var(--rcm-white);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.18);
}

.map-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 12px;
  height: 12px;
  background: inherit;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: translateX(-50%) rotate(45deg);
}

.map-pin.is-best {
  background: var(--rcm-red);
  transform: scale(1.04);
}

.station-tooltip {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 3, 3, 0.2);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.08);
  color: var(--rcm-black);
  padding: 3px 6px;
}

.station-tooltip::before {
  display: none;
}

.station-tooltip .tooltip-name {
  display: block;
  font-weight: 700;
  font-size: 0.76rem;
  line-height: 1.1;
}

.station-tooltip .tooltip-price {
  display: block;
  margin-top: 1px;
  color: var(--rcm-charcoal);
  font-size: 0.62rem;
  line-height: 1.1;
}

.station-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.station-card {
  padding: 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.card-header > :first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.brand {
  margin: 0 0 6px;
  color: var(--rcm-red);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.name {
  overflow-wrap: anywhere;
}

.price-pill {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--rcm-black);
  color: var(--rcm-white);
  font-weight: 700;
  font-size: 0.92rem;
}

.address {
  margin: 10px 0 10px;
  color: var(--rcm-charcoal);
  line-height: 1.4;
  font-size: 0.8rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--rcm-charcoal);
  font-size: 0.86rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.station-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--rcm-border);
  background: #fafafa;
  color: var(--rcm-black);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.88rem;
}

.station-link:hover {
  background: #f0f0f0;
}

.fuel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.fuel-grid div {
  padding-top: 8px;
  border-top: 1px solid var(--rcm-border);
}

.fuel-grid dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--rcm-charcoal);
}

.fuel-grid dd {
  margin: 4px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  line-height: 1.6;
  color: var(--rcm-charcoal);
}

@media (max-width: 960px) {
  .explore-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "search search"
      "fuel sort"
      "action action";
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .list-header {
    flex-direction: column;
    align-items: start;
  }

  .leaderboard-group {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    background:
      linear-gradient(180deg, var(--rcm-red) 0 96px, var(--rcm-bg) 96px 100%);
  }

  .page {
    width: min(100%, calc(100% - 20px));
    padding-top: 0;
  }

  .masthead {
    padding: 4px 2px 14px;
  }

  .brand-lockup {
    gap: 10px;
    align-items: flex-start;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  h1 {
    font-size: 1.22rem;
    line-height: 1.08;
    padding-top: 2px;
  }

  h2 {
    font-size: 1.12rem;
  }

  .masthead-note {
    margin-top: 2px;
    font-size: 0.8rem;
    line-height: 1.22;
  }

  .hero-card,
  .station-card,
  .empty-state {
    border-radius: 20px;
  }

  .citywide-card {
    margin-top: 0;
    padding-top: 16px;
  }

  .hero-card {
    padding: 16px;
  }

  .leaderboard-item {
    padding: 6px 0;
  }

  .leaderboard-intro {
    margin-bottom: 0;
  }

  .leaderboard-note {
    font-size: 0.72rem;
    line-height: 1.35;
    max-width: none;
  }

  .leaderboard-trust {
    margin-top: 4px;
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .leaderboard-station {
    font-size: 0.78rem;
  }

  .leaderboard-meta {
    margin-top: 0;
    font-size: 0.68rem;
  }

  .leaderboard-price {
    font-size: 0.68rem;
  }

  .leaderboard-section .card-heading {
    margin-bottom: 2px;
    min-height: 0;
  }

  .leaderboard-section h2 {
    font-size: 0.9rem;
  }

  .leaderboard-group {
    gap: 8px;
  }

  .leaderboard-main {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
  }

  .leaderboard-station {
    grid-column: 1;
    grid-row: 1;
  }

  .leaderboard-main .leaderboard-price {
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
    align-self: center;
  }

  .leaderboard-meta {
    grid-column: 1;
    grid-row: 2;
  }

  .map-card-header {
    flex-direction: column;
    align-items: start;
  }

  .toolbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "search"
      "fuel"
      "sort"
      "action";
  }

  .map-canvas {
    min-height: 100%;
  }

  .map-frame {
    aspect-ratio: 4 / 3;
  }

  .fuel-grid {
    grid-template-columns: 1fr;
  }
}
