:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --paper: #ffffff;
  --paper-soft: #f9faf7;
  --ink: #18181b;
  --muted: #6b6b65;
  --line: rgba(24, 24, 27, 0.12);
  --line-strong: rgba(24, 24, 27, 0.2);
  --accent: #0f766e;
  --accent-soft: #dff3ed;
  --amber: #b7791f;
  --shadow: 0 18px 50px rgba(31, 27, 20, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(246, 243, 237, 0.92)),
    radial-gradient(circle at 20% 0%, rgba(15, 118, 110, 0.13), transparent 32%),
    radial-gradient(circle at 88% 12%, rgba(183, 121, 31, 0.11), transparent 28%),
    var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 243, 237, 0.86);
  backdrop-filter: blur(18px);
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 650;
}

.brand-mark {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #111111;
  color: #ffffff;
  font-size: 11px;
  letter-spacing: 0;
}

.nav-links {
  color: var(--muted);
}

.nav-links a {
  padding: 8px 10px;
  border-radius: 8px;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  gap: 28px;
  align-items: stretch;
}

.hero-copy,
.snapshot-panel,
.ranking-section,
.source-note,
.toolbar {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 58px);
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  color: var(--ink);
}

h1 {
  max-width: 780px;
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.08;
  font-weight: 760;
  overflow-wrap: break-word;
}

h2 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
}

.lede {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.7;
}

.snapshot-panel {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #18181b, #25251f);
  color: #f8fafc;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(248, 250, 252, 0.7);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: auto;
}

.stat-card {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.stat-card span {
  display: block;
  color: rgba(248, 250, 252, 0.58);
  font-size: 12px;
  font-weight: 650;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  color: #ffffff;
  font-size: 24px;
  line-height: 1.1;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.65fr) auto;
  align-items: end;
  gap: 18px;
  margin-top: 22px;
  padding: 16px;
  border-radius: 8px;
}

.plan-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.plan-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.plan-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.plan-button:hover,
.plan-button.active {
  border-color: rgba(24, 24, 27, 0.28);
  background: #18181b;
  color: #ffffff;
}

.search-box {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.segment {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.segment:hover,
.segment.active {
  border-color: rgba(15, 118, 110, 0.32);
  background: var(--accent-soft);
  color: #12423d;
}

.ranking-section {
  margin-top: 22px;
  overflow: hidden;
  border-radius: 8px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(24, 24, 27, 0.08);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f1eee7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
th:nth-child(3),
th:nth-child(4),
th:nth-child(5) {
  text-align: right;
}

tbody tr {
  background: rgba(255, 255, 255, 0.55);
}

tbody tr:hover {
  background: #f6fbf8;
}

.rank-pill {
  display: inline-grid;
  width: 42px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--muted);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.country {
  display: grid;
  gap: 3px;
}

.country strong,
.price-main {
  color: var(--ink);
  font-weight: 760;
}

.country span,
.local-price,
.spread {
  color: var(--muted);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.price-main {
  font-variant-numeric: tabular-nums;
}

.bar-cell {
  min-width: 150px;
}

.bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.08);
}

.bar span {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--amber));
}

.spread {
  display: block;
  margin-top: 6px;
}

.source-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.freshness-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.62fr);
  gap: 18px;
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 56px rgba(20, 20, 18, 0.08);
}

.freshness-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  letter-spacing: 0;
}

.freshness-card p {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.freshness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.freshness-grid div {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.freshness-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.freshness-grid dd {
  margin: 18px 0 0;
  color: var(--ink);
  font-weight: 760;
}

.freshness-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-size: 12px;
}

.freshness-pill.stale {
  color: #92400e;
  background: #fef3c7;
}

.source-note p {
  margin: 0;
}

.source-note a {
  flex: none;
  color: var(--accent);
  font-weight: 760;
}

.source-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 12px;
}

.empty-row td {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar,
  .section-head,
  .source-note,
  .freshness-card {
    align-items: stretch;
    flex-direction: column;
  }

  .freshness-card {
    grid-template-columns: 1fr;
  }

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

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

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

  .snapshot-panel,
  .hero-copy {
    min-height: auto;
  }

  .segmented {
    justify-content: flex-start;
  }

}

@media (max-width: 560px) {
  .nav-links {
    display: none;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 22px;
  }

  h1 {
    font-size: 28px;
    line-height: 1.12;
  }

  .hero-copy,
  .snapshot-panel,
  .section-head {
    padding: 18px;
  }
}
