:root {
  color-scheme: dark;
  --bg: #080808;
  --surface: #111111;
  --surface-2: #171717;
  --line: #2a2a2a;
  --text: #f5f5f5;
  --muted: #ababab;
  --quiet: #777777;
  --accent: #ff3b30;
  --accent-soft: #ff8178;
  --focus: #9fd1ff;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 280px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 13% 0%, rgba(255, 59, 48, 0.12), transparent 31rem),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  padding-left: 24px;
  padding-right: 24px;
  padding-left: calc(24px + constant(safe-area-inset-left));
  padding-right: calc(24px + constant(safe-area-inset-right));
  padding-left: calc(24px + env(safe-area-inset-left));
  padding-right: calc(24px + env(safe-area-inset-right));
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

button,
a,
summary {
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
}

button {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
}

button:focus,
a:focus,
summary:focus {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -200px;
  left: 16px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fff;
  color: #000;
  font-weight: 800;
}

.skip-link:focus {
  top: 16px;
}

.shell {
  width: 100%;
  max-width: 2360px;
  margin: 0 auto;
  padding-top: 38px;
  padding-bottom: 48px;
}

.hero,
.ranking-panel,
.notes-panel {
  min-width: 0;
}

.hero {
  padding-right: clamp(2px, 0.8vw, 14px);
  padding-bottom: 34px;
  padding-left: clamp(10px, 1.6vw, 30px);
}

.tweet-frame {
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 0 0 34px;
  overflow: hidden;
  border: 1px solid #30363d;
  border-radius: 14px;
  background: #111c27;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.tweet-frame img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: #111c27;
}

.eyebrow,
.kicker,
.winner-label {
  margin: 0;
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.15em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 0.92;
}

h1 span {
  color: var(--accent);
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 620px;
  margin-bottom: 24px;
  color: #d5d5d5;
  font-size: 18px;
  line-height: 1.45;
}

.hero-actions {
  margin: -6px 0 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 10px;
  margin-right: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
}

.button-primary {
  background: var(--text);
  color: #000;
}

.button-primary:hover {
  background: #dcdcdc;
}

.button-secondary {
  border-color: #3a3a3a;
  background: transparent;
  color: var(--text);
}

.button-secondary:hover {
  background: #181818;
}

.winner-card {
  max-width: 530px;
  padding: 20px;
  border: 1px solid rgba(255, 59, 48, 0.4);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.13), rgba(255, 59, 48, 0.03));
}

.winner-city {
  margin: 5px 0 3px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1;
}

.winner-score {
  margin-bottom: 0;
  color: #cacaca;
  font-size: 14px;
}

.winner-score strong {
  color: var(--text);
  font-size: 18px;
}

.ranking-panel,
.notes-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 17, 17, 0.94);
}

.ranking-panel {
  padding: 20px 14px 16px;
}

.notes-panel {
  margin-top: 18px;
  padding: 22px 20px;
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head > div:first-child {
  margin-bottom: 14px;
}

.kicker {
  margin-bottom: 7px;
}

.metric-switch {
  display: inline-flex;
  width: 100%;
  padding: 3px;
  border: 1px solid #333;
  border-radius: 999px;
  background: #0b0b0b;
}

.metric-button {
  flex: 1 1 50%;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.metric-button.is-active {
  background: #ececec;
  color: #080808;
}

.metric-note {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.chart-key {
  display: flex;
  justify-content: space-between;
  padding: 0 8px 7px 46px;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.leaderboard {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-row {
  position: relative;
  display: block;
  min-height: 72px;
  margin-bottom: 7px;
  padding: 12px 12px 11px 46px;
  overflow: hidden;
  border: 1px solid #252525;
  border-radius: 13px;
  background: linear-gradient(180deg, #141516, #111213);
}

.rank-row:last-child {
  margin-bottom: 0;
}

.rank-row:before {
  content: attr(data-rank);
  position: absolute;
  top: 14px;
  left: 12px;
  width: 24px;
  color: #888;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.rank-row[data-rank="1"] {
  border-color: rgba(255, 59, 48, 0.64);
  background: linear-gradient(180deg, rgba(255, 59, 48, 0.11), rgba(255, 59, 48, 0.055));
}

.rank-row[data-rank="1"]:before {
  color: var(--accent-soft);
}

.row-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
}

.metro-name {
  min-width: 0;
  padding-right: 12px;
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value {
  flex: 0 0 auto;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.row-meta {
  position: relative;
  z-index: 2;
  margin-top: 4px;
  color: #969696;
  font-size: 11px;
  line-height: 1.25;
}

.bar-track {
  position: relative;
  z-index: 2;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #303236;
  border-radius: 999px;
  background: #090a0b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7);
}

.bar-fill {
  display: block;
  width: 0;
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #74787d, #e5e7ea);
}

.rank-row[data-rank="1"] .bar-fill {
  background: linear-gradient(90deg, #c82018, var(--accent) 72%, #ff8178);
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.24);
}

.notes-panel h2 {
  margin-bottom: 14px;
}

.notes-panel > p {
  color: #bdbdbd;
}

.method-grid {
  margin: 22px 0;
}

.method-grid > div {
  padding: 13px 0;
  border-top: 1px solid #2c2c2c;
}

.method-grid > div:last-child {
  border-bottom: 1px solid #2c2c2c;
}

.method-grid dt {
  color: #858585;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.method-grid dd {
  margin: 3px 0 0;
  font-size: 15px;
  font-weight: 700;
}

details {
  margin-top: 22px;
  padding: 14px;
  border: 1px solid #303030;
  border-radius: 12px;
  background: #0d0d0d;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

details p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.source-links {
  margin-top: 22px;
}

.source-links a {
  display: inline-block;
  margin-right: 16px;
  margin-bottom: 8px;
  color: #d9d9d9;
  font-weight: 700;
}

.fine-print {
  margin: 20px 0 0;
  color: #727272 !important;
  font-size: 11px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 2200px;
  margin: 0 auto;
  padding: 0 16px 34px;
  color: #777;
  font-size: 12px;
  text-align: center;
}

.footer span,
.footer a {
  margin: 0 4px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 11px 14px;
  transform: translateY(30px);
  border: 1px solid #333;
  border-radius: 999px;
  background: #f2f2f2;
  color: #111;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.noscript {
  margin: 18px 0 0;
  padding: 12px;
  border: 1px solid #5a2f2b;
  border-radius: 10px;
  color: #ffb7b1;
}

.noscript p {
  margin: 4px 0 0;
}

@media (min-width: 600px) {
  body {
    padding-left: 40px;
    padding-right: 40px;
    padding-left: calc(40px + constant(safe-area-inset-left));
    padding-right: calc(40px + constant(safe-area-inset-right));
    padding-left: calc(40px + env(safe-area-inset-left));
    padding-right: calc(40px + env(safe-area-inset-right));
  }

  .shell {
    padding-top: 52px;
  }

  h1 {
    font-size: 72px;
  }

  .lede {
    font-size: 21px;
  }

  .ranking-panel {
    padding: 24px;
  }

  .panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
  }

  .panel-head > div:first-child {
    margin-bottom: 0;
  }

  .metric-switch {
    width: auto;
    min-width: 250px;
  }

  .rank-row {
    min-height: 74px;
    padding-left: 54px;
  }

  .rank-row:before {
    left: 16px;
  }

  .metro-name,
  .metric-value {
    font-size: 17px;
  }
}

@media (min-width: 1080px) {
  .shell {
    display: -ms-grid;
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(530px, 1.25fr);
    grid-template-areas:
      "hero ranking"
      "notes ranking";
    gap: 24px;
    align-items: start;
  }

  .hero {
    grid-area: hero;
    padding: 18px 18px 0 36px;
  }

  .ranking-panel {
    grid-area: ranking;
  }

  .notes-panel {
    grid-area: notes;
    margin-top: 0;
  }

  h1 {
    font-size: clamp(68px, 6.2vw, 104px);
  }

  .tweet-frame {
    margin-bottom: 42px;
  }

  .ranking-panel {
    padding: 26px;
  }
}

@media (min-width: 1400px) {
  .shell {
    grid-template-columns: minmax(390px, 0.82fr) minmax(760px, 1.45fr);
    gap: 34px;
    padding-top: 58px;
  }

  .hero {
    padding-left: 48px;
  }

  h2 {
    font-size: 34px;
  }

  .lede {
    font-size: 23px;
  }

  .ranking-panel {
    padding: 30px;
  }

  .rank-row {
    min-height: 77px;
  }
}

@media (min-width: 2000px) {
  .shell {
    grid-template-columns: minmax(520px, 0.8fr) minmax(1020px, 1.45fr);
    gap: 50px;
    padding-top: 76px;
  }

  h1 {
    font-size: 112px;
  }

  .tweet-frame {
    max-width: 760px;
  }

  .lede {
    max-width: 760px;
    font-size: 28px;
  }

  .winner-card {
    max-width: 690px;
    padding: 28px;
  }

  .winner-city {
    font-size: 46px;
  }

  .ranking-panel {
    padding: 40px;
  }

  .rank-row {
    min-height: 86px;
    padding-top: 15px;
    padding-bottom: 14px;
  }

  .metro-name,
  .metric-value {
    font-size: 21px;
  }

  .row-meta {
    font-size: 13px;
  }
}

@media (max-width: 359px) {
  body {
    padding-left: 18px;
    padding-right: 18px;
    padding-left: calc(18px + constant(safe-area-inset-left));
    padding-right: calc(18px + constant(safe-area-inset-right));
    padding-left: calc(18px + env(safe-area-inset-left));
    padding-right: calc(18px + env(safe-area-inset-right));
  }

  .shell {
    padding-top: 28px;
  }

  h1 {
    font-size: 40px;
  }

  h2 {
    font-size: 24px;
  }

  .tweet-frame {
    margin-bottom: 24px;
    border-radius: 10px;
  }

  .ranking-panel {
    padding: 15px 10px 11px;
  }

  .rank-row {
    min-height: 78px;
    padding-right: 9px;
    padding-left: 39px;
  }

  .rank-row:before {
    left: 8px;
  }

  .metro-name {
    font-size: 14px;
  }

  .metric-value {
    font-size: 14px;
  }

  .row-meta {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *:before,
  *:after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
