/* Color Tokens and Base Variables */
:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e3e3e0;
  --bg: #fbfbf9;
  --accent: #b5403a;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

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

/* Nav Header Styling */
.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--ink);
  padding: 14px 0;
  margin-bottom: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

@media (max-width: 600px) {
  .nav-header {
    flex-wrap: wrap;
    gap: 8px;
  }
}

.nav-brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-links a.active {
  color: var(--accent);
  font-weight: 700;
}

/* Masthead */
header.masthead {
  text-align: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 8px;
}

header.masthead h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}

header.masthead p.dek {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--muted);
  font-size: 15px;
  margin: 0 auto;
  max-width: 660px;
}

/* Interactive Buttons */
button.btn {
  font: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

button.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button.btn:hover {
  filter: brightness(0.97);
}

/* Footer & Badges */
footer.foot {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  color: var(--muted);
  max-width: 820px;
  margin: 40px auto 0;
  text-align: center;
  line-height: 1.6;
}

.badge {
  display: inline-block;
  font-size: 11px;
  background: #f0f0ec;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 9px;
  color: var(--muted);
  margin-bottom: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Longform Explanations */
.longform {
  max-width: 820px;
  margin: 48px auto 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.longform h2 {
  font-size: 22px;
  margin: 0 0 14px;
  border-top: 1px solid var(--line);
  padding-top: 30px;
  letter-spacing: -0.2px;
}

.longform p {
  font-size: 15px;
  color: #2c2c2c;
  line-height: 1.7;
  margin: 0 0 14px;
}

.longform p.small {
  font-size: 13px;
  color: var(--muted);
}

.longform .lead {
  font-weight: 600;
  color: var(--ink);
}

.longform .formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f4f4f0;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
  display: block;
  margin: 4px 0 16px;
  overflow-x: auto;
}

.dl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.dl-note {
  font-size: 13px;
  color: var(--muted);
}

.explore-link {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 13px 24px;
  border-radius: 10px;
  font-size: 16px;
}

.explore-link:hover {
  filter: brightness(0.95);
}

ul.explore-list {
  font-size: 15px;
  color: #2c2c2c;
  line-height: 1.6;
  margin: 2px 0 18px;
  padding-left: 20px;
}

ul.explore-list li {
  margin-bottom: 6px;
}

/* Home Page Mode Selector */
.mode-select {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 30px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.mode-select h2 {
  font-family: Georgia, serif;
  font-size: 26px;
  margin: 0 0 6px;
  font-weight: normal;
  text-align: center;
  color: var(--ink);
}

.mode-select p.intro {
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  margin: 0 auto 16px;
  max-width: 520px;
  line-height: 1.45;
}

.mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 600px) {
  .mode-options {
    grid-template-columns: 1fr;
  }
}

.mode-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
}

.mode-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.mode-card .mode-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.mode-card .mode-count {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 14px;
}

.mode-card .mode-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

/* Quiz Specific Layout Styles */
.progress-bar {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 14px 0 22px;
}

.progress-track {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  max-width: 420px;
  margin: 8px auto 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: start;
}

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

.question {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.question .qnum {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.question h3 {
  font-size: 19px;
  margin: 6px 0 14px;
  font-weight: normal;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.opt:hover {
  background: #f5f5f2;
}

.opt input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.opt.selected {
  border-color: var(--accent);
  background: #fbf1f0;
}

.results {
  position: relative;
}

@media (min-width: 901px) {
  .results {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding-right: 4px;
  }
  .results::-webkit-scrollbar {
    width: 6px;
  }
  .results::-webkit-scrollbar-track {
    background: transparent;
  }
  .results::-webkit-scrollbar-thumb {
    background: #d8d8d4;
    border-radius: 3px;
  }
  .results::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
  }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.02em;
}

.panel .sub {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
}

svg.usmap {
  width: 100%;
  height: auto;
  display: block;
}

.state-border {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 0.7;
}

.anchor-dot {
  fill: rgba(0, 0, 0, 0.28);
}

.city-dot.top {
  fill: #1a7f37;
  stroke: #fff;
  stroke-width: 1;
}

.city-dot.bottom {
  fill: #2457b5;
  stroke: #fff;
  stroke-width: 1;
}

.city-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  fill: #1a1a1a;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 2.5px;
  stroke-linejoin: round;
}

.legend {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.legend .grad {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #2457b5, #f4f4c3, #b5403a);
}

.citygrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.citygrid h4 {
  font-size: 13px;
  margin: 0 0 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.citygrid h4.most {
  color: #1a7f37;
}

.citygrid h4.least {
  color: #2457b5;
}

.citygrid ol {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

.citygrid li {
  margin-bottom: 4px;
}

.citygrid .pct {
  color: var(--muted);
  font-size: 12px;
}

.giveaway {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

.giveaway .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.giveaway .row:last-child {
  border-bottom: none;
}

.giveaway .ans {
  color: var(--accent);
  font-weight: 600;
  text-align: right;
}

.empty {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  padding: 40px 10px;
}

.toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 4px 0 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.headline {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  margin: 0 0 10px;
}

.headline b {
  color: var(--accent);
}

.disclaimer-box {
  background-color: #fcfaf2;
  border: 1px solid #e6dfc3;
  border-radius: 8px;
  color: #7d6b35;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
