:root {
  --ink: #17201c;
  --muted: #68736f;
  --line: #dfe7e2;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --clean: #20b26b;
  --clean-soft: #e8f8ef;
  --grey: #ee9f28;
  --grey-soft: #fff3df;
  --dark: #0e1915;
  --blue: #49697a;
  --teal: #0f766e;
  --rose: #8d4a4a;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

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

button,
input {
  font: inherit;
}

.site-header {
  color: #f6faf8;
  background:
    linear-gradient(90deg, rgba(14, 25, 21, 0.92), rgba(14, 25, 21, 0.68)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1800&q=78")
      center/cover;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  border-radius: 8px;
}

.nav-actions a {
  color: rgba(246, 250, 248, 0.82);
  font-size: 0.92rem;
}

.nav-button {
  border: 0;
  background: transparent;
  color: rgba(246, 250, 248, 0.82);
  cursor: pointer;
  padding: 0;
  font-size: 0.92rem;
}

.nav-actions a:hover,
.nav-button:hover,
.nav-button:focus {
  color: #ffffff;
  outline: none;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  margin: -18px 0 34px;
}

.footer-link-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
}

.footer-link-button:hover,
.footer-link-button:focus {
  color: var(--teal);
  outline: none;
}

.hero {
  width: min(1180px, calc(100% - 40px));
  margin: 34px auto 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  align-items: end;
}

.hero-copy {
  max-width: 720px;
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.15rem, 4.5vw, 4.05rem);
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 760px;
}

.hero-copy p:last-child {
  color: rgba(246, 250, 248, 0.78);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 720px;
  margin-bottom: 0;
}

.hero-side {
  display: grid;
  gap: 12px;
}

.discord-card,
.hero-panel {
  display: grid;
  gap: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(16px);
  border-radius: 8px;
  padding: 16px;
}

.discord-card {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.78), rgba(88, 101, 242, 0.42));
  border-color: rgba(255, 255, 255, 0.24);
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  box-shadow: 0 16px 40px rgba(25, 32, 84, 0.24);
}

.discord-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
}

.discord-icon svg {
  width: 25px;
  height: 25px;
  fill: #ffffff;
}

.discord-copy strong,
.discord-copy span {
  display: block;
}

.discord-copy strong {
  font-size: 1rem;
}

.discord-copy span {
  color: rgba(246, 250, 248, 0.82);
  font-size: 0.9rem;
}

.legend-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
}

.legend-row strong,
.legend-row span:last-child {
  display: block;
}

.legend-row span:last-child {
  color: rgba(246, 250, 248, 0.72);
  font-size: 0.9rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 10px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
  margin-top: 6px;
}

.status-dot.clean {
  background: var(--clean);
}

.status-dot.grey {
  background: var(--grey);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.controls {
  transform: translateY(-28px);
  margin-bottom: -8px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 18px 44px rgba(20, 36, 31, 0.12);
}

.control-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.segmented {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.segment {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.segment:hover,
.segment.active {
  background: #eff5f1;
  color: var(--ink);
}

.segment .status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  min-width: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  margin-top: 0;
  box-shadow: none;
}

.search {
  width: min(320px, 45vw);
  flex: 0 0 auto;
}

.search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfdfb;
}

.search input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: var(--teal);
}

.table-section,
.sources,
.insight-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-section {
  overflow: visible;
}

.table-heading,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.table-heading {
  padding: 14px 16px;
  position: relative;
  z-index: 5;
  background: #ffffff;
}

.section-head {
  padding: 22px 24px;
}

.table-heading h2,
.section-head h2,
.insight-grid h2 {
  font-size: 1rem;
  margin-bottom: 6px;
  letter-spacing: 0;
}

.table-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-title-row h2 {
  margin-bottom: 0;
}

.info-tip {
  position: relative;
  display: inline-flex;
}

.info-button {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: help;
  font-size: 0.72rem;
  font-weight: 780;
  line-height: 1;
  padding: 0;
}

.info-button:hover,
.info-button:focus {
  border-color: var(--teal);
  color: var(--teal);
  outline: none;
}

.tooltip {
  position: absolute;
  right: 0;
  top: calc(100% + 9px);
  width: min(330px, 78vw);
  background: var(--dark);
  color: #f6faf8;
  border-radius: 6px;
  padding: 9px 10px;
  box-shadow: 0 12px 26px rgba(20, 36, 31, 0.2);
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 20;
}

.info-tip:hover .tooltip,
.info-tip:focus-within .tooltip {
  opacity: 1;
}

.table-heading p,
.section-head p,
.insight-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.count {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.9rem;
}

.table-more {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 16px;
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.table-more[hidden] {
  display: none;
}

.rows-toggle {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  min-height: 36px;
  padding: 0 15px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 680;
}

.rows-toggle:hover,
.rows-toggle:focus {
  background: #f8fbf9;
  border-color: rgba(15, 118, 110, 0.3);
  color: var(--teal);
  outline: none;
}

.rows-toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -4px;
}

.rows-toggle.is-expanded::after {
  transform: rotate(225deg);
  margin-top: 4px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 8px 8px;
}

table {
  border-collapse: collapse;
  min-width: 1020px;
  width: 100%;
}

th,
td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  line-height: 1.28;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 720;
  background: #f3f6f4;
}

.th-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.table-info-tip .info-button {
  width: 16px;
  height: 16px;
  font-size: 0.62rem;
  text-transform: none;
}

.table-info-tip .tooltip {
  top: calc(100% + 7px);
  left: 50%;
  right: auto;
  width: min(260px, 70vw);
  transform: translateX(-50%);
  text-align: left;
  text-transform: none;
  font-size: 0.76rem;
  font-weight: 560;
}

td {
  font-size: 0.82rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbf8f1;
}

.rank {
  width: 34px;
  color: var(--muted);
}

.country-cell {
  min-width: 160px;
}

.country {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 680;
}

.flag {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #edf2ef;
  font-size: 0.95rem;
}

.region {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 0;
}

.path-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 720;
}

.path-badge.clean {
  color: #0f6f45;
  background: var(--clean-soft);
}

.path-badge.grey {
  color: #935d0d;
  background: var(--grey-soft);
}

.path-badge .status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  min-width: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 0;
  box-shadow: none;
}

.score {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.92rem;
}

.money,
.stay,
.min-days {
  color: var(--dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.min-days {
  font-size: 0.78rem;
  font-weight: 680;
}

.money.cost-low {
  color: #16794a;
  font-weight: 720;
}

.money.cost-high {
  color: #b42318;
  font-weight: 760;
}

.note {
  color: var(--muted);
  max-width: 390px;
}

.details-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 20px;
  padding: 0;
  cursor: pointer;
  margin: 5px 0 0;
  font-size: 0.76rem;
  font-weight: 680;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.details-button:hover,
.details-button:focus {
  color: var(--teal);
  outline: none;
}

.details-button::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
}

.detail-row td {
  padding: 0;
  background: #f7faf8;
}

.detail-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 12px 16px 14px 50px;
  border-bottom: 1px solid var(--line);
}

.detail-panel strong {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.detail-panel p {
  margin-bottom: 0;
}

.detail-panel a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.insight-grid article {
  padding: 20px;
}

.sources {
  margin-bottom: 34px;
  overflow: hidden;
}

.sources-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.sources-summary::-webkit-details-marker {
  display: none;
}

.sources-summary .section-head {
  border-bottom: 0;
  padding-right: 12px;
}

.sources-details[open] .sources-summary {
  border-bottom: 1px solid var(--line);
}

.sources-state {
  margin-right: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  padding: 7px 12px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.sources-state-open,
.sources-details[open] .sources-state-closed {
  display: none;
}

.sources-details[open] .sources-state-open {
  display: inline;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.source-item {
  background: #ffffff;
  padding: 16px 20px;
  min-height: 112px;
}

.source-item strong {
  display: block;
  margin-bottom: 8px;
}

.source-item a {
  color: var(--teal);
  display: inline-block;
  margin: 0 12px 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.9rem;
}

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 36px;
  color: var(--muted);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.has-modal {
  overflow: hidden;
}

.changelog-modal[hidden] {
  display: none;
}

.changelog-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.changelog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 25, 21, 0.48);
}

.changelog-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(620px, calc(100vh - 40px));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(14, 25, 21, 0.28);
}

.changelog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.changelog-head h2 {
  margin-bottom: 3px;
  font-size: 1rem;
}

.changelog-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.changelog-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
}

.changelog-close::before,
.changelog-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 1.5px;
  background: var(--muted);
}

.changelog-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.changelog-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.changelog-close:hover,
.changelog-close:focus {
  border-color: rgba(15, 118, 110, 0.34);
  outline: none;
}

.changelog-list {
  overflow: auto;
  padding: 8px 10px 10px;
}

.changelog-item {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}

.changelog-item:last-child {
  border-bottom: 0;
}

.changelog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 720;
  text-transform: uppercase;
}

.changelog-meta span {
  color: var(--teal);
}

.changelog-item h3 {
  margin: 4px 0 4px;
  font-size: 0.94rem;
  line-height: 1.25;
}

.changelog-item p,
.changelog-empty {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.changelog-empty {
  padding: 16px 8px;
}

@media (max-width: 860px) {
  .site-header {
    min-height: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 24px;
    margin: 24px auto 52px;
  }

  .hero-copy,
  .hero-side,
  .controls,
  .table-section {
    min-width: 0;
  }

  h1 {
    font-size: 3rem;
  }

  .hero-panel {
    max-width: 520px;
  }

  .hero-side {
    max-width: 520px;
  }

  .controls,
  .table-heading,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .control-groups {
    width: 100%;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    text-align: center;
  }

  .insight-grid,
  .source-list,
  .detail-panel {
    grid-template-columns: 1fr;
  }

  .sources-summary {
    grid-template-columns: 1fr;
  }

  .sources-state {
    width: fit-content;
    margin: 0 24px 18px;
  }

  .detail-panel {
    padding-left: 24px;
  }
}

@media (max-width: 860px) {
  .table-heading {
    padding: 14px;
  }

  .table-title-row {
    justify-content: space-between;
  }

  .count {
    white-space: normal;
  }

  .table-wrap {
    overflow: visible;
    border-radius: 0;
  }

  table {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: #f3f6f4;
  }

  .country-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    gap: 10px 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(20, 36, 31, 0.06);
  }

  .country-row.is-open {
    border-radius: 8px 8px 0 0;
  }

  .country-row td {
    display: block;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    font-size: 0.86rem;
  }

  .country-row td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 760;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .country-row .rank {
    position: absolute;
    top: 12px;
    right: 12px;
    width: auto;
    min-width: 34px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #edf2ef;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 720;
    line-height: 1;
    text-align: center;
  }

  .country-row .rank::before {
    content: "#";
    display: inline;
    margin: 0;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-transform: none;
  }

  .country-row .country-cell {
    grid-column: 1 / -1;
    padding-right: 52px;
  }

  .country-row .country-cell::before {
    display: none;
  }

  .country-row .note {
    grid-column: 1 / -1;
    max-width: none;
    padding-top: 2px;
    color: var(--dark);
    line-height: 1.4;
    overflow-wrap: break-word;
  }

  .country-row .score {
    font-size: 1rem;
  }

  .country-row .flag {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    font-size: 1rem;
  }

  .country-row .path-badge {
    min-height: 28px;
    padding: 0 9px;
  }

  .details-button {
    min-height: 28px;
    margin-top: 8px;
  }

  .detail-row {
    display: block;
    margin-top: -10px;
  }

  .detail-row td {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  .detail-panel {
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: #f8faf8;
    padding: 14px;
  }

  .table-more {
    border-top-color: var(--line);
  }
}

@media (max-width: 540px) {
  .topbar,
  .hero,
  main,
  footer {
    width: calc(100% - 24px);
    max-width: 1180px;
  }

  .topbar {
    min-height: 64px;
  }

  .nav-actions {
    display: flex;
  }

  .nav-actions a {
    display: none;
  }

  .site-header {
    min-height: auto;
  }

  .hero {
    gap: 20px;
    margin: 18px auto 26px;
  }

  h1 {
    margin-bottom: 12px;
    font-size: 2.35rem;
  }

  .hero-copy p:last-child {
    font-size: 0.92rem;
    line-height: 1.48;
  }

  .discord-card,
  .hero-panel {
    padding: 14px;
  }

  .discord-card {
    grid-template-columns: 38px 1fr;
  }

  .discord-icon {
    width: 38px;
    height: 38px;
  }

  .legend-row {
    gap: 10px;
  }

  .tooltip {
    left: auto;
    right: 0;
    width: min(280px, calc(100vw - 32px));
    transform: none;
  }

  .controls {
    transform: none;
    gap: 8px;
    margin: 14px 0 16px;
    padding: 8px;
  }

  .control-groups {
    gap: 7px;
  }

  .segmented {
    gap: 3px;
  }

  .segment {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.88rem;
    white-space: normal;
  }

  .table-heading {
    gap: 8px;
    padding: 13px;
  }

  .insight-grid {
    gap: 12px;
    margin: 18px 0;
  }

  .insight-grid article,
  .source-item {
    padding: 16px;
  }

  .source-item {
    min-height: auto;
  }

  .sources-state {
    margin: 0 16px 16px;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 2.15rem;
  }
}
