/* start screen: where to be born (start-map.ts) and the household's income. Tokens come from index.html. */
.pick-block { margin: var(--para-gap) 0; }
.pick-h { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: 700; color: var(--accent-text); margin: 0 0 8px; }

/* income: the random button and a slider of five dots. The native range input sits over the dots (it keeps the keyboard and
   screen readers); the thumb's centre runs from half a thumb inside each end, so the dots and labels are inset by that much */
.q-head { display: flex; flex-wrap: wrap; gap: 0 10px; }
.q-word { font-weight: 500; color: var(--ink); }
.q-row { --q-h: var(--btn-s); --q-thumb: 24px; display: flex; align-items: flex-start; gap: 16px; }
.place-btn.q-rand { flex: none; min-height: var(--q-h); padding: 0 14px; color: var(--ink); }
.place-btn.q-rand[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.q-slider { flex: 1 1 auto; min-width: 0; --q-on: var(--accent); }
.q-slider.off { --q-on: var(--faint); }
.q-track { position: relative; height: var(--q-h); }
.q-dots { position: absolute; left: calc(var(--q-thumb) / 2); right: calc(var(--q-thumb) / 2); top: 50%; }
.q-dots::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--q-on); opacity: .45; }
.q-dots > i { position: absolute; top: -4px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--q-on); }
.q-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; background: transparent; cursor: pointer; touch-action: pan-y; -webkit-appearance: none; appearance: none; }
.q-range::-webkit-slider-runnable-track { height: var(--q-thumb); background: transparent; }
.q-range::-moz-range-track { background: transparent; }
.q-range::-webkit-slider-thumb { -webkit-appearance: none; width: var(--q-thumb); height: var(--q-thumb); border: 3px solid var(--panel); border-radius: 50%; background: var(--q-on); box-shadow: 0 0 0 1px var(--q-on); }
.q-range::-moz-range-thumb { box-sizing: border-box; width: var(--q-thumb); height: var(--q-thumb); border: 3px solid var(--panel); border-radius: 50%; background: var(--q-on); box-shadow: 0 0 0 1px var(--q-on); }
.q-range:focus { outline: none; }
.q-range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.q-range:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.q-labels { position: relative; height: 20px; margin: 0 calc(var(--q-thumb) / 2); }
.q-labels > span { position: absolute; transform: translateX(-50%); font-size: 13px; line-height: 20px; white-space: nowrap; color: var(--muted); cursor: pointer; }
.q-labels > span.on { font-weight: 700; color: var(--ink); }

/* the conditions and what is picked on the left, 태어나기 on the right as tall as both. A phone has no room for the two columns of
   picks beside the button: they go under the row. Open, one column: the map takes the width, the button comes under it */
.go-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "det go" "sum go"; gap: 12px; margin: 0 0 24px; }
.go-row > details { grid-area: det; min-width: 0; margin: 0; }
.go-row > .cond-sum { grid-area: sum; }
.go-row > .primary { grid-area: go; width: auto; height: auto; margin: 0; padding: 0 40px; white-space: nowrap; }
.go-row.open { grid-template-columns: minmax(0, 1fr); grid-template-areas: "det" "go"; }
.go-row.open > .primary { width: 100%; min-height: var(--btn-l); }
@media (max-width: 767px) {
  .go-row { grid-template-areas: "det go" "sum sum"; }
  .go-row > .primary { padding: 0 16px; }
  .go-row.open { grid-template-areas: "det" "go"; }
}
/* what is picked, under the closed conditions: two to a line, the words lined up in columns */
.cond-sum { display: grid; grid-template-columns: auto auto auto 1fr; gap: 4px 10px; margin: 0; padding: 0 2px; font-size: var(--fs-caption); line-height: var(--lh-caption); word-break: keep-all; }
/* the first value takes only what it needs, which brings 태어날 곳 and 장애 to the left; on a phone only up to a third, or a long income squeezes the right-hand value to a letter a line */
@media (max-width: 767px) { .cond-sum { grid-template-columns: auto fit-content(34%) auto minmax(0, 1fr); } }
/* the narrowest phones have no room for the 30px below */
@media (max-width: 379px) { .cond-sum { grid-template-columns: auto fit-content(28%) auto minmax(0, 1fr); } .cond-sum > .cond-k:nth-child(4n + 3) { margin-left: 12px; } }
.cond-sum[hidden] { display: none; }
.cond-k { font-weight: 700; color: var(--accent-text); white-space: nowrap; }
.cond-k:nth-child(4n + 3) { margin-left: 30px; } /* 태어날 곳 and 장애: a little apart from the first pair */
.cond-v { color: var(--ink); min-width: 0; }

/* sex and disability: the heading, then radio buttons drawn as toggles (the input itself is .sr, so the keyboard still works) */
.seg-row { display: flex; align-items: flex-start; gap: 12px; margin: 8px 0; }
.seg-row > .pick-h { flex: none; margin: 0; line-height: var(--btn-s); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.seg-opt { position: relative; margin: 0; }
.seg-opt > span { display: flex; align-items: center; min-height: var(--btn-s); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-4); background: var(--panel); color: var(--ink); font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.seg-opt > input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg-opt > input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) { .seg-opt > span { padding: 0 8px; font-size: 14px; } }

/* place */
.place-status { font-size: var(--fs-chart-note); margin: 0 0 8px; }
.place-k { color: var(--muted); }
.place-row { position: relative; display: flex; gap: 8px; }
.place-search { flex: 1 1 auto; min-width: 0; }
.place-input { width: 100%; min-height: var(--btn-m); padding: 0 14px; font: inherit; font-size: max(16px, var(--fs-control)); color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-4); }
.place-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.place-list { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-4); box-shadow: 0 8px 24px rgb(0 0 0 / .14); }
.place-opt { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 16px; }
.place-opt[aria-selected="true"], .place-opt:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.place-sub { color: var(--muted); font-size: 13px; white-space: nowrap; }

.place-map { position: relative; margin: 12px 0 8px; border: 1px solid var(--line); border-radius: var(--r-6); background: var(--sea); overflow: hidden; }
.place-svg { display: block; width: 100%; height: auto; aspect-ratio: 5564 / 6102; max-height: min(72vh, 450px); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.place-svg:active { cursor: grabbing; }
.place-hint { position: absolute; left: 10px; bottom: 8px; font-size: var(--fs-source); color: var(--muted); pointer-events: none;
  background: color-mix(in srgb, var(--panel) 80%, transparent); padding: 2px 8px; border-radius: var(--r-max); }
.place-hint.place-note { bottom: auto; top: 8px; color: var(--ink); font-weight: 700; }
/* on a phone the map's box is 2/3 of the height the whole country would need; the country sits in it with sea on both sides (2026-11-05, the user) */
@media (max-width: 767px) { .place-svg { aspect-ratio: 5564 / 4068; } }
/* North Korea (map.json land): land in the colour of a province not in focus, never a target */
.m-north { fill: color-mix(in srgb, var(--panel) 55%, var(--hl0)); pointer-events: none; }
.m-sido path { fill: var(--panel); stroke: var(--muted); stroke-width: 1.4; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .15s; }
/* only with a real pointer: after a tap a touch screen keeps :hover on whatever lies under the finger, and once the map has
   zoomed in that was a district nobody picked (2026-11-05, the user) */
@media (hover: hover) {
  .m-sido path:hover { fill: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
  .m-sgg path.show:hover { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
}
.focused .m-sido path { fill: color-mix(in srgb, var(--panel) 55%, var(--hl0)); }
.focused .m-sido path.on { fill: var(--panel); }
.m-sgg path { display: none; fill: transparent; stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; cursor: pointer; }
.m-sgg path.show { display: inline; stroke: color-mix(in srgb, var(--muted) 60%, transparent); }
.m-sgg path.on { display: inline; fill: var(--accent); stroke: var(--accent-text); stroke-width: 2; }
.m-lab text { display: none; fill: var(--ink); text-anchor: middle; dominant-baseline: middle; pointer-events: none; font-weight: 700;
  paint-order: stroke; stroke: var(--panel); stroke-width: .25em; stroke-linejoin: round; }
.m-lab text.show { display: inline; }
.m-lab text.sgg-l { font-weight: 500; }

.place-tools { flex: none; display: flex; gap: 8px; }
.place-btn { min-height: var(--btn-xs); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-4); background: var(--panel); font-size: 15px; font-weight: 700; white-space: nowrap; }
.place-tools > .place-btn { min-height: var(--btn-m); }
/* a phone leaves the search box little room beside the buttons: tighter buttons, and the long hint cut with an ellipsis (the words typed stay 16px, or phones zoom in) */
.place-input { text-overflow: ellipsis; }
@media (max-width: 767px) {
  .place-row { gap: 6px; }
  .place-tools { gap: 6px; }
  .place-tools > .place-btn { padding: 0 8px; font-size: 14px; }
  .place-input { padding: 0 10px; }
  .place-input::placeholder { font-size: 14px; }
}

/* '조건 설정하기': closed by default; the reader opens it to pick income, place, sex and disability */
details.cond { color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-6); background: var(--panel); padding: 0 16px; }
details.cond > summary { min-height: var(--btn-m); display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; color: var(--accent-text); }
details.cond[open] { padding-bottom: 8px; }
details.cond[open] > summary { border-bottom: 1px solid var(--line); }
details.cond .pick-block:first-of-type { margin-top: 16px; }
details.cond > summary::-webkit-details-marker { display: none; }
details.cond > summary { list-style: none; }
details.cond > summary::before { content: ""; width: .5em; height: .5em; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details.cond[open] > summary::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { details.cond > summary::before { transition: none; } }
