@media (max-width: 980px) {
  .layout,
  .stage,
  .panel,
  .scoring-guide-wrap,
  .map-wrap {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
}
:root {
  --bg: #ece9e4;
  --panel-bg: #f4f1ec;
  --line: #cfc9bf;
  --text: #45423d;
  --muted: #6f6a63;
  --accent: #7b0e47;
  --empty-country: #f9f8f5;
  --no: #B91928;
  --low: #F39600;
  --medium: #F2CF00;
  --high: #689C65;
  --title-to-selector-gap: 24px;
  --panel-pad-y: clamp(22px, 3vw, 30px);
  --panel-pad-x: clamp(18px, 3vw, 34px);
  --panel-top-offset: clamp(22px, 3vw, 30px);
  --panel-bottom-offset: clamp(16px, 2.6vw, 24px);
  --panel-vertical-gap: 28px;
  --donut-to-legend-gap: 24px;
  --donut-size: min(260px, 30vh);
  --donut-center-y: 50vh;
  --stage-pad-x: clamp(16px, 2.6vw, 32px);
  --content-max: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Roboto", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}

.layout {
  min-height: 100dvh;
  height: auto;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  width: 100%;
  margin-inline: auto;
  position: relative;
}

.country-underlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--panel-underlay-width, 0px);
  background: #f7f5f2;
  z-index: 2;
  pointer-events: none;
  transition: width 320ms ease;
}

.layout.is-country-expanded .country-underlay {
  width: 100%;
}

.panel {
  background: #F7F5F2;
  padding: var(--panel-top-offset) var(--panel-pad-x) var(--panel-bottom-offset);
  display: grid;
  gap: var(--panel-vertical-gap);
  grid-template-rows: auto auto auto 1fr auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 3;
}

.title {
  margin: 0;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.12;
}

.mobile-top-nav-slot {
  display: none;
}

.desktop-top-nav-slot {
  display: contents;
}

.country-select-wrap {
  margin-top: 0;
  border-bottom: 1px solid #7b746b;
  margin-top: var(--title-to-selector-gap);
}

.country-select-root {
  position: relative;
  width: 100%;
}

.country-select-trigger {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  padding: 4px 26px 8px 0;
  cursor: pointer;
  position: relative;
}

.country-select-trigger::before,
.country-select-trigger::after {
  content: "";
  position: absolute;
  right: 8px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  top: 50%;
  margin-top: -5px;
}

.country-select-root.is-open .country-select-trigger::before,
.country-select-root.is-open .country-select-trigger::after {
  transform: rotate(225deg);
  margin-top: -1px;
}

.country-select-trigger:focus {
  outline: none;
}

.country-select-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: rgba(244, 241, 236, 0.82);
  border: none;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(69, 66, 61, 0.12);
  max-height: 600px;
  overflow: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  z-index: 40;
  display: none;
}

.country-select-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.country-select-root.is-open .country-select-list {
  display: block;
}

.country-select-option {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 12px;
  color: #555049;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}

.country-select-option:hover,
.country-select-option[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.45);
  color: #3f3a34;
}

.summary {
  margin: 0;
  color: #555049;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.chart-wrap {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  justify-items: center;
  gap: var(--donut-to-legend-gap);
  min-height: 0;
}

#summaryFooterText {
  width: 100%;
  justify-self: stretch;
  font-size: 12px;
  color: #a8a197;
}

.country-mode-content {
  display: none;
  min-height: 0;
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.country-chart-wrap {
  width: min(
    100%,
    calc(100vw - clamp(280px, 28vw, 360px) - (var(--stage-pad-x) * 2))
  );
  margin: var(--panel-pad-y) auto 0;
  min-height: calc(100vh - var(--panel-pad-y) * 2);
  display: grid;
  place-items: center;
}

.country-chart {
  width: min(100%, calc(100vh - (var(--panel-pad-y) * 2)));
  height: auto;
  max-height: 100%;
  pointer-events: auto;
}

.donut-chart {
  width: var(--donut-size);
  max-width: 100%;
  max-height: 40vh;
  aspect-ratio: 1;
  border-radius: 50%;
  justify-self: center;
  position: relative;
  top: auto;
  transform: none;
  z-index: 5;
  transition: background 0.14s ease-out, filter 0.14s ease-out;
  background: conic-gradient(var(--no) 0deg 90deg, var(--low) 90deg 180deg, var(--medium) 180deg 270deg, var(--high) 270deg 360deg);
}

.donut-chart::before {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: var(--panel-bg);
  box-shadow: inset 0 0 0 1px #ece6dd;
  z-index: 1;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 34% 18%;
  z-index: 3;
  color: #4b4741;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;
  pointer-events: none;
}

.country-center-label {
  text-anchor: middle;
  dominant-baseline: middle;
  fill: #4b4741;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 500;
  pointer-events: none;
}

.country-center-guideline-label {
  text-anchor: middle;
  dominant-baseline: middle;
  fill: #6a635a;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.country-line-value-label {
  dominant-baseline: middle;
  fill: #4b4741;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  paint-order: stroke;
  stroke: rgba(236, 233, 228, 0.96);
  stroke-width: 3px;
  pointer-events: none;
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  align-self: start;
  width: min(100%, 260px);
  position: relative;
  top: auto;
  z-index: auto;
}

.donut-legend li {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #56514a;
  transition: color 0.16s ease;
}

.legend-value {
  text-align: left;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color 0.16s ease, font-weight 0.16s ease;
}

.legend-line {
  position: relative;
  height: 4px;
  width: 100%;
  background: transparent;
}

.legend-line-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: transform 0.16s ease, filter 0.16s ease;
  transform-origin: left center;
}

.donut-legend li.is-highlight {
  color: #3f3a34;
}

.donut-legend li.is-highlight .legend-value {
  color: #3f3a34;
  font-weight: 600;
}

.donut-legend li.is-highlight .legend-line-fill {
  transform: scaleY(1.35);
  filter: brightness(1.08);
}

.donut-legend li.is-muted {
  opacity: 0.42;
}

.explore-btn {
  margin-top: auto;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #5b564f;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.arrow {
  font-size: 1.6em;
  line-height: 1;
}

.stage {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: var(--panel-pad-y) var(--stage-pad-x) clamp(16px, 2.6vw, 24px);
  min-height: 0;
  min-width: 0;
  position: relative;
}

.country-overlay {
  display: none;
}

.layout.is-country-expanded .chart-wrap {
  display: none;
}

.layout.is-country-expanded .country-mode-content {
  display: block;
}

.layout.is-country-expanded .donut-chart,
.layout.is-country-expanded .donut-legend {
  display: none;
}

.layout.is-country-expanded .map-wrap {
  pointer-events: none;
}

.layout.is-guide .map-wrap,
.layout.is-guide .food-picker-wrap {
  display: none;
}

.layout.is-guide .stage {
  grid-template-rows: auto 1fr;
}

.layout.is-guide .scoring-guide-wrap {
  display: grid;
  align-content: center;
  min-height: 0;
}

.top-nav {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  justify-self: stretch;
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: clamp(16px, 2vw, 28px);
  align-items: center;
  min-width: 0;
  position: relative;
  z-index: 80;
}

.top-nav-link {
  text-decoration: none;
  color: #9f9890;
  font-size: 14px;
  font-weight: 500;
}

.top-nav-link.active {
  color: #42403c;
}

.map-wrap {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.scoring-guide-wrap {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  min-width: 0;
  min-height: 0;
  display: none;
}

.scoring-guide-card {
  border: 1px solid #ddd6cc;
  border-radius: 14px;
  background: rgba(247, 245, 242, 0.9);
  box-shadow: 0 10px 24px rgba(69, 66, 61, 0.08);
  padding: 14px;
  min-width: 0;
}

.scoring-guide-title {
  margin: 0 0 12px;
  color: #5a554d;
  font-size: 14px;
  font-weight: 600;
}

.scoring-guide-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

.scoring-guide-table {
  width: max-content;
  max-width: none;
  border-collapse: collapse;
  min-width: 980px;
  font-size: 12px;
  color: #4a463f;
}

.scoring-guide-table th,
.scoring-guide-table td {
  border: 1px solid #e2dbd1;
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
}

.scoring-guide-table th {
  background: var(--accent);
  color: #f9f4ef;
  font-weight: 600;
}

.scoring-guide-table .label-full {
  display: inline;
}

.scoring-guide-table .label-short {
  display: none;
}

.scoring-guide-table td:first-child {
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}

.scoring-guide-row {
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.scoring-guide-row.is-selected {
  background: rgba(123, 14, 71, 0.04);
  box-shadow: inset 3px 0 0 var(--accent);
}

.scoring-guide-row.is-selected .scoring-guide-group,
.scoring-guide-row.is-selected .scoring-guide-approach {
  background: rgba(123, 14, 71, 0.04);
}

.scoring-guide-row:hover {
  background: rgba(123, 14, 71, 0.03);
}

.scoring-guide-row.is-selected:hover {
  background: rgba(123, 14, 71, 0.04);
}

.scoring-guide-row.is-selected:hover .scoring-guide-group,
.scoring-guide-row.is-selected:hover .scoring-guide-approach {
  background: rgba(123, 14, 71, 0.04);
}

.scoring-guide-approach {
  font-weight: 500;
  background: transparent;
}

.scoring-guide-approach.encourage {
  background: transparent;
}

.scoring-guide-approach.balance {
  background: transparent;
}

.scoring-guide-approach.limit {
  background: transparent;
}

.scoring-guide-score.score-3 {
  background: rgba(104, 156, 101, 0.5);
}

.scoring-guide-score.score-2 {
  background: rgba(242, 207, 0, 0.5);
}

.scoring-guide-score.score-1 {
  background: rgba(243, 150, 0, 0.5);
}

.scoring-guide-score.score-0 {
  background: rgba(185, 25, 40, 0.5);
}

.scoring-guide-row.is-selected .scoring-guide-score.score-3 {
  background: rgba(104, 156, 101, 1);
}

.scoring-guide-row.is-selected .scoring-guide-score.score-2 {
  background: rgba(242, 207, 0, 1);
}

.scoring-guide-row.is-selected .scoring-guide-score.score-1 {
  background: rgba(243, 150, 0, 1);
}

.scoring-guide-row.is-selected .scoring-guide-score.score-0 {
  background: rgba(185, 25, 40, 1);
}

.map-color-legend {
  position: absolute;
  top: 20px;
  right: 0;
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 10px 0 10px 12px;
  background: transparent;
  z-index: 30;
  pointer-events: none;
}

.map-legend-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  font-size: 12px;
  color: #555049;
  line-height: 1;
  white-space: nowrap;
}

.map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.loading {
  text-align: center;
  margin-top: 18vh;
  color: #8f897f;
}

#mapSvgContainer,
#mapSvgContainer svg {
  width: 100%;
  display: block;
}

#mapSvgContainer {
  aspect-ratio: 1000 / 684;
  min-height: clamp(260px, 36vw, 520px);
  height: auto;
  position: relative;
  z-index: 1;
}

#mapSvgContainer svg {
  height: 100%;
}

#mapSvgContainer path {
  stroke: #ded8cf;
  stroke-width: 0.6;
  transition: opacity 0.15s ease;
}

#mapSvgContainer path[data-no-data="true"] {
  fill: var(--empty-country);
}

.food-line {
  transition: opacity 160ms ease, stroke-width 160ms ease;
}

.food-picker-wrap {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  border-top: 1px solid #dbd4ca;
  padding-top: 12px;
  min-height: 0;
}

.food-picker {
  display: grid;
  gap: 8px;
}

.food-group-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
}

.food-group-title {
  color: #7a746d;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  padding-top: 1px;
}

.food-group-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.food-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #5a554d;
  font-size: 12px;
  cursor: pointer;
}

.food-option input {
  display: none;
}

.food-box {
  width: 12px;
  height: 12px;
  background: #f8f6f2;
}

.food-option input:checked + .food-box {
  background: rgba(69, 66, 61, 0.5);
}

.tooltip {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  max-width: min(320px, 82vw);
  background: rgba(244, 241, 236, 0.82);
  box-shadow: 0 10px 24px rgba(69, 66, 61, 0.12);
  color: var(--text);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  padding: 9px 11px;
}

.tooltip-country-title {
  font-size: 14px;
}

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

@media (min-width: 981px) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .layout {
    height: 100dvh;
    min-height: 100dvh;
    grid-template-rows: minmax(0, 1fr);
  }

  .panel,
  .stage {
    min-height: 0;
  }

  .panel {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  .stage {
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .layout.is-guide .stage {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .map-wrap {
    min-height: 0;
    overflow: hidden;
    display: grid;
    place-items: stretch center;
  }

  #mapSvgContainer {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    display: grid;
    place-items: center;
    margin-inline: auto;
  }

  #mapSvgContainer svg {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
  }

  .explore-btn {
    grid-row: 5;
    margin-top: 0;
    align-self: end;
  }

  .food-picker-wrap {
    grid-row: 3;
    align-self: end;
  }
}

@media (max-width: 980px) {
  :root {
    --donut-size: min(220px, 26vh);
    --panel-vertical-gap: 18px;
    --donut-to-legend-gap: 16px;
  }

  .layout {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid #ddd6cc;
  }

  .top-nav {
    justify-content: flex-end;
    gap: 12px;
  }

  .country-chart-wrap {
    width: 100%;
  }

  .country-chart {
    width: min(100%, 100vw);
  }
}

@media (max-width: 860px) {
  .scoring-guide-table .label-full {
    display: none;
  }

  .scoring-guide-table .label-short {
    display: inline;
  }
}

@media (max-width: 980px) {
  .layout.is-guide .scoring-guide-wrap {
    display: block;
    width: 100%;
    max-width: 100vw;
    min-height: 220px;
    margin: 0;
    padding: 0;
    background: transparent;
  }
  .scoring-guide-card {
    box-shadow: none;
    border-radius: 0;
    background: transparent;
    padding: 0 0 12px 0;
  }
  .scoring-guide-table-wrap {
    overflow-x: auto;
    border-radius: 0;
    margin: 0;
    padding: 0 0 0 0;
    width: 100%;
    max-width: 100vw;
  }
  .scoring-guide-table {
    min-width: 640px;
    width: max-content;
    font-size: 12px;
  }
  .country-underlay {
    display: none !important;
  }
  .map-wrap {
    min-height: 220px;
  }
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
    overflow-x: hidden;
  }

  .layout {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }
  
  #mapSvgContainer {
    min-height: 220px;
    aspect-ratio: 1000 / 684;
  }

  #mapSvgContainer svg {
    height: 100%;
  }

  .panel {
    grid-template-rows: auto auto auto auto auto;
    gap: var(--panel-vertical-gap);
    overflow: visible;
    padding-bottom: 16px;
  }

  .title {
    max-width: calc(100% - 120px);
  }

  .chart-wrap {
    align-content: start;
    justify-items: center;
    /* row-gap: 20px; */
  }

  .donut-chart,
  .donut-legend {
    position: relative;
    top: auto;
    transform: none;
  }

  .donut-legend {
    align-self: start;
    width: min(100%, 260px);
  }

  .country-mode-content {
    position: relative;
    inset: auto;
    min-height: 0;
  }

  .country-chart-wrap {
    width: 100%;
    margin: 8px auto 0;
    min-height: 0;
  }

  .country-chart {
    width: min(100%, 680px);
    max-height: none;
  }

  .explore-btn {
    margin-top: 12px;
    align-self: start;
  }

  .stage {
    grid-template-rows: minmax(300px, 1fr) auto;
    gap: 10px;
    padding-top: 10px;
  }

  .layout.is-guide .stage {
    grid-template-rows: 1fr;
  }

  .mobile-top-nav-slot {
    display: flex;
    justify-content: flex-end;
    position: absolute;
    top: var(--panel-top-offset);
    right: var(--panel-pad-x);
    margin-top: 0;
  }

  .mobile-top-nav-slot .top-nav {
    width: auto;
    margin: 0;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 4px;
  }

  /* #guideNavLink {
      display: none;
    } */
}

@media (max-width: 980px) {
  :root {
    --donut-size: min(240px, 24vh);
  }

  .map-wrap {
    min-height: 0;
  }
}