:root {
  font-family:
    Arial, "Noto Sans CJK TC", "Microsoft JhengHei", "Yu Gothic",
    "Malgun Gothic", sans-serif;
  color: #333;
  background: #9dc3fb;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid #174b86;
  outline-offset: 3px;
}
button {
  background: #fff;
  border: 1.5px solid #333;
  border-radius: 4px;
  padding: 9px 13px;
}
button:hover {
  background: #eaf2fe;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px 3vw;
  border-bottom: 1px solid #3335;
  background: #ffffff1c;
}
.brand {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  text-decoration: none;
  color: #333;
}
.brand span {
  background: #333;
  color: #9dc3fb;
  padding: 3px 5px;
  margin-left: 5px;
}
.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.top-actions button {
  border: 0;
  background: none;
  font-size: 13px;
}
select {
  background: #ffffffb8;
  border: 1px solid #3339;
  padding: 8px;
  border-radius: 3px;
}
main {
  max-width: 1920px;
  margin: auto;
  padding: 30px 3vw 15px;
}
.heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-bottom: 24px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  margin: 0 0 9px;
  font-weight: 700;
}
h1 {
  font-size: clamp(25px, 3vw, 43px);
  margin: 0;
  font-weight: 700;
  letter-spacing: 1px;
}
.instruction {
  font-size: 13px;
  margin: 12px 0 0;
  line-height: 1.65;
}
.score {
  text-align: right;
  min-width: 125px;
}
.score > span {
  font-size: 12px;
  display: block;
}
.score strong {
  font-size: 57px;
  line-height: 1.1;
  display: block;
  font-variant-numeric: tabular-nums;
}
.score small {
  font-size: 12px;
}
#countries {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 20px;
}
#countries button {
  background: #ffffff3a;
  border-color: #3336;
  padding: 9px 18px;
  font-size: 14px;
}
#countries button[aria-pressed="true"] {
  background: #333;
  color: white;
  border-color: #333;
}
#countries small {
  opacity: 0.6;
  margin-left: 8px;
  font-size: 10px;
}
.workspace {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.paper {
  background: #fffffff0;
  border: 1.7px solid #333;
  border-radius: 7px;
  padding: 17px;
}
.paper h2 {
  font-size: 15px;
  margin: 0 0 15px;
}
.legend-row {
  display: grid;
  grid-template-columns: 31px 1fr 16px;
  gap: 9px;
  align-items: center;
  margin: 14px 0;
  font-size: 13px;
}
.swatch {
  height: 19px;
  border: 1px solid #333;
  display: block;
}
.legend-row strong {
  font-size: 14px;
}
.hint {
  border-top: 1px solid #ddd;
  padding-top: 13px;
  margin: 16px 0 0;
  font-size: 11px;
  line-height: 1.65;
  color: #555;
}
.search-box label {
  font-size: 12px;
  font-weight: bold;
  display: block;
  margin-bottom: 9px;
}
input[type="search"] {
  width: 100%;
  border: 1px solid #888;
  padding: 10px;
  border-radius: 3px;
  background: white;
  font-size: 13px;
}
#results {
  max-height: 240px;
  overflow: auto;
}
#results button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #ddd;
  border-radius: 0;
  font-size: 12px;
  line-height: 1.5;
}
#results p {
  font-size: 12px;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.actions button {
  font-size: 12px;
  padding: 10px 5px;
  background: #ffffffb0;
}
.actions #png {
  grid-column: 1/-1;
  background: #333;
  color: white;
}
.actions #share {
  grid-column: 1/-1;
}
.save-state {
  font-size: 11px;
  line-height: 1.6;
  margin: 0;
  color: #334f6a;
}
.map-wrap {
  min-width: 0;
  border: 1px solid #3335;
  border-radius: 6px;
  overflow: hidden;
}
.map-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 13px;
  border-bottom: 1px solid #3333;
  background: #ffffff24;
  gap: 10px;
}
.map-tools > span {
  font-size: 13px;
  font-weight: bold;
}
.map-tools button {
  background: transparent;
  padding: 3px 8px;
  border-color: #3337;
  border-radius: 3px;
  font-size: 13px;
}
.map-tools > div {
  display: flex;
  gap: 5px;
  align-items: center;
}
.boundary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 4px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.boundary-toggle input {
  accent-color: #333;
}
#viewport {
  height: max(590px, 67vh);
  max-height: 1200px;
  overflow: hidden;
  touch-action: none;
}
#map {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  touch-action: none;
  cursor: grab;
}
#map:active {
  cursor: grabbing;
}
.region {
  cursor: pointer;
  outline: none;
}
.region .geometry {
  fill: var(--fill, #fff);
  stroke: #333;
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.geometry * {
  vector-effect: non-scaling-stroke;
  stroke-width: 0.9;
}
#map.boundaries-hidden .region .geometry {
  stroke: var(--fill, #fff);
}
.country-outline {
  fill: none;
  stroke: #333;
  stroke-width: 1.35;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.region:hover .geometry,
.region:focus .geometry {
  stroke: #111;
  filter: brightness(0.95);
}
.region:focus-visible .geometry {
  stroke: #174b86;
  stroke-width: 5;
}
.region text {
  pointer-events: none;
  fill: #222;
  text-anchor: middle;
  dominant-baseline: central;
  font-weight: 500;
  font-size: 12px;
}
.region .secondary {
  font-size: 9px;
  fill: #343434;
}
.region.dim {
  opacity: 0.16;
}
.map-caption {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 13px;
  border-top: 1px solid #3333;
  font-size: 10px;
  color: #3b526e;
}
.inset-label {
  font-size: 13px;
  fill: #334f6a;
}
footer {
  max-width: 1920px;
  margin: auto;
  padding: 15px 3vw 25px;
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #3b526e;
  flex-wrap: wrap;
}
footer a {
  color: inherit;
}
footer span:last-child {
  margin-left: auto;
}
dialog {
  border: 2px solid #333;
  border-radius: 8px;
  padding: 22px;
  width: min(440px, calc(100vw - 28px));
  max-height: 88vh;
  color: #333;
  box-shadow: 0 12px 60px #1235;
}
dialog::backdrop {
  background: #173d5940;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.dialog-head button {
  border: 0;
  padding: 0 6px;
  font-size: 26px;
  background: transparent;
}
dialog h2 {
  margin: 10px 0 5px;
  font-size: 25px;
}
#place-subtitle {
  font-size: 17px;
  margin: 7px 0 10px;
}
#place-members {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
}
#choices {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 18px;
}
.choice {
  display: grid;
  grid-template-columns: 33px 1fr 20px;
  gap: 11px;
  align-items: center;
  text-align: left;
  padding: 11px;
  border-color: #999;
}
.choice.selected {
  border: 2px solid #333;
  padding: 10px;
  background: #eef4fc;
}
.choice span:first-child {
  height: 23px;
  border: 1px solid #333;
}
.choice strong {
  font-size: 14px;
  font-weight: 500;
}
.choice small {
  display: block;
  font-size: 11px;
  line-height: 1.55;
  margin-top: 4px;
  color: #555;
}
.choice b {
  font-size: 18px;
}
#about-dialog {
  width: min(660px, calc(100vw - 28px));
}
#about-copy {
  font-size: 14px;
  line-height: 1.9;
}
#about-copy h3 {
  font-size: 16px;
  margin: 20px 0 4px;
}
#about-copy a {
  color: #174b86;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  background: #333;
  color: white;
  border-radius: 5px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}
#toast.show {
  opacity: 1;
}
@media (min-width: 1800px) {
  .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}
@media (max-width: 800px) {
  main {
    padding: 23px 16px 12px;
  }
  header {
    padding: 14px 16px;
  }
  .brand {
    font-size: 14px;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions button {
    padding: 6px;
  }
  .heading {
    align-items: start;
    margin-bottom: 19px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .instruction {
    max-width: 250px;
    font-size: 11px;
  }
  .score strong {
    font-size: 44px;
  }
  .score {
    min-width: 88px;
  }
  .score small {
    font-size: 10px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
  .map-wrap {
    width: 100%;
    order: 0;
  }
  aside {
    width: 100%;
    order: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .legend {
    grid-row: span 2;
    padding: 13px;
  }
  .legend-row {
    font-size: 11px;
    grid-template-columns: 22px 1fr 13px;
    gap: 6px;
    margin: 11px 0;
  }
  .legend .hint {
    font-size: 10px;
  }
  .search-box {
    padding: 12px;
    align-self: start;
  }
  .actions {
    align-self: start;
  }
  .save-state {
    grid-column: 1/-1;
  }
  #viewport {
    height: 62vh;
    min-height: 410px;
    max-height: 800px;
  }
  #countries {
    gap: 5px;
    padding-bottom: 16px;
  }
  #countries button {
    padding: 8px 12px;
    font-size: 12px;
  }
  #countries small {
    display: none;
  }
  .map-caption {
    font-size: 9px;
  }
  .map-tools {
    font-size: 11px;
  }
  footer span:last-child {
    margin-left: 0;
  }
  .paper h2 {
    font-size: 13px;
  }
  #results {
    max-height: 180px;
  }
}
