:root {
  color-scheme: light;
  --paper: #f2f1ea;
  --paper-2: #e8e7df;
  --white: #ffffff;
  --ink: #111310;
  --muted: #6f726a;
  --line: #c9cbc2;
  --lime: #d8ff3e;
  --lime-deep: #b9e600;
  --green: #20a56b;
  --green-soft: #ccebdc;
  --red: #ec4b43;
  --yellow: #ffdd55;
  --land: #deddd4;
  --land-line: #9b9d95;
  --shadow: 0 20px 60px rgba(19, 23, 17, 0.12);
  font-family: "Pretendard", "SUIT", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { min-height: 100vh; }

.start-screen {
  position: relative;
  display: grid;
  grid-template-columns: minmax(18rem, 0.8fr) minmax(34rem, 1.2fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(3rem, 8vw, 8.5rem);
  align-items: center;
  width: min(1280px, 100%);
  min-height: 100vh;
  padding: 1.5rem clamp(1.25rem, 4vw, 4rem) 2.5rem;
  margin: 0 auto;
}

.start-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.5rem;
  border-bottom: 1px solid var(--ink);
}

.wordmark,
.edition {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.wordmark::before {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: inset 0 0 0 1px var(--ink);
  content: "";
}

.edition { color: var(--muted); }

.start-screen::before {
  position: fixed;
  top: 38%;
  left: -4.5rem;
  width: 9rem;
  height: 9rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.start-screen::after {
  position: fixed;
  right: 4vw;
  bottom: -5rem;
  width: 10rem;
  height: 10rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  content: "";
  pointer-events: none;
  z-index: -1;
}

.brand-block { padding: 3rem 0; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.brand-block .eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.8rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
}

.brand-block h1 {
  margin: 1.25rem 0 1.5rem;
  font-size: clamp(4rem, 7.7vw, 7.3rem);
  font-weight: 950;
  line-height: 0.88;
  letter-spacing: 0;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 550;
  line-height: 1.75;
}

.setup-panel,
.mode-panel {
  position: relative;
  display: grid;
  gap: 1.35rem;
  padding: clamp(1.5rem, 3vw, 2.4rem);
  border: 1px solid var(--ink);
  background: var(--white);
  box-shadow: 10px 10px 0 var(--ink);
}

.setup-panel {
  gap: 0.8rem;
  padding: 1.2rem 1.5rem;
}

.setup-panel .setup-heading { padding-bottom: 0.7rem; }
.setup-panel legend { margin-bottom: 0.45rem; }
.setup-panel .region-card { min-height: 3.45rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }

.mode-panel {
  align-content: start;
}

.ranking-open {
  display: flex;
  min-height: 3rem;
  padding: 0 0.9rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--ink);
  background: var(--lime);
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
}

.ranking-open small { color: var(--muted); font-size: 0.62rem; font-weight: 900; }
.ranking-open:hover { background: var(--ink); color: var(--white); }
.ranking-open:hover small { color: #c8cbc3; }

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mode-card {
  position: relative;
  display: flex;
  min-height: 17rem;
  padding: 1.2rem;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.mode-card:nth-child(2) {
  background: var(--ink);
  color: var(--white);
}

.mode-card span {
  color: var(--muted);
  font-size: 0.67rem;
  font-style: normal;
  font-weight: 900;
}

.mode-card:nth-child(2) span,
.mode-card:nth-child(2) small { color: #bfc2ba; }

.mode-card strong {
  max-width: 5ch;
  margin-top: auto;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 950;
  line-height: 0.98;
}

.mode-card small {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.mode-card i {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-style: normal;
  font-weight: 900;
}

.mode-card:hover:not(:disabled),
.mode-card:focus-visible {
  background: var(--lime);
  color: var(--ink);
  outline: 0;
  transform: translateY(-3px);
}

.mode-card:hover:not(:disabled) span,
.mode-card:hover:not(:disabled) small { color: var(--ink); }
.mode-card:disabled { cursor: wait; opacity: 0.5; }

.setup-back {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
}

.setup-back:hover { color: var(--ink); }

.setup-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--ink);
}

.setup-heading span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.setup-heading strong {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.2;
}

fieldset { padding: 0; margin: 0; border: 0; }

legend {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

legend > span:first-child {
  color: var(--muted);
  font-size: 0.67rem;
}

legend > span:not(:first-child) {
  color: var(--ink);
  font-size: inherit;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.region-card {
  position: relative;
  display: grid;
  gap: 0.16rem;
  min-height: 4.2rem;
  padding: 0.78rem 2.4rem 0.78rem 0.9rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease;
}

.region-card input,
.goal-picker input { position: absolute; opacity: 0; pointer-events: none; }

.region-card span:first-of-type { font-size: 0.92rem; font-weight: 900; }
.region-card span:last-of-type { color: var(--muted); font-size: 0.72rem; line-height: 1.35; }

.region-card::after {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  width: 0.65rem;
  height: 0.65rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
}

.region-card:hover { background: #f4f5ef; }

.region-card:has(input:checked) {
  background: var(--ink);
  color: var(--white);
}

.region-card:has(input:checked)::after {
  border-color: var(--lime);
  background: var(--lime);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.region-card:has(input:checked) span:last-of-type { color: #bfc2ba; }

.goal-picker {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(12rem, 0.9fr);
  gap: 0.65rem;
}

.goal-main {
  position: relative;
  display: flex;
  min-height: 5.5rem;
  padding: 1rem 5.2rem 1rem 1.1rem;
  align-items: center;
  border: 1px solid var(--ink);
  background: var(--lime);
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
}

.goal-main-copy { display: grid; gap: 0.15rem; }
.goal-main-copy small { font-size: 0.6rem; font-weight: 950; }
.goal-main-copy strong { font-size: 1.32rem; font-weight: 950; }
.goal-main-copy em { color: var(--muted); font-size: 0.7rem; font-style: normal; font-weight: 750; }
.goal-main > b {
  position: absolute;
  right: 1rem;
  color: transparent;
  font-size: 3rem;
  font-weight: 950;
  line-height: 1;
  -webkit-text-stroke: 1px var(--ink);
}
.goal-main:hover { transform: translateY(-2px); }
.goal-main:not(:has(input:checked)) { background: var(--white); box-shadow: none; }
.goal-main:not(:has(input:checked)) .goal-main-copy small { color: var(--muted); }

.goal-hard {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  background: var(--paper);
}

.goal-hard-heading {
  display: flex;
  padding: 0.55rem 0.65rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.goal-hard-heading span { font-size: 0.59rem; font-weight: 950; }
.goal-hard-heading small { color: var(--muted); font-size: 0.56rem; }
.goal-hard-options { display: grid; grid-template-columns: repeat(2, 1fr); }
.goal-hard-options label { position: relative; display: grid; cursor: pointer; }
.goal-hard-options label + label { border-left: 1px solid var(--line); }
.goal-hard-options label > span { display: grid; gap: 0.15rem; padding: 0.7rem; align-content: center; }
.goal-hard-options strong { font-size: 1rem; font-weight: 950; }
.goal-hard-options small { color: var(--muted); font-size: 0.6rem; }
.goal-hard-options label:hover > span { background: #e6e8df; }
.goal-hard-options label:has(input:checked) > span { background: var(--ink); color: var(--white); }
.goal-hard-options label:has(input:checked) small { color: #c5c8bf; }
.goal-main:has(input:focus-visible),
.goal-hard-options label:has(input:focus-visible) > span { outline: 3px solid var(--yellow); outline-offset: 2px; }

.primary-action,
.ghost-action,
.icon-action {
  min-height: 3rem;
  border-radius: 0;
  cursor: pointer;
  font-weight: 900;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.primary-action {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
}

.primary-action::after { margin-left: 0.45rem; content: "→"; }
.primary-action:hover:not(:disabled) { background: var(--lime); color: var(--ink); transform: translateY(-2px); }
.primary-action:active:not(:disabled) { transform: translateY(0); }
.primary-action:disabled { cursor: wait; opacity: 0.46; }

.load-status {
  min-height: 1rem;
  margin: -0.45rem 0 -0.45rem;
  color: var(--muted);
  font-size: 0.69rem;
}

.ghost-action,
.icon-action {
  padding: 0 0.9rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

.ghost-action:hover,
.icon-action:hover { background: var(--ink); color: var(--white); }

.icon-action[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
.header-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }

.start-screen.is-leaving { animation: start-leave 240ms ease forwards; }
.start-screen.is-returning { animation: start-return 300ms ease both; }
.game-screen.is-entering { animation: game-enter 260ms ease both; }
.panel-out-forward { animation: panel-out-forward 150ms ease-in both; }
.panel-out-backward { animation: panel-out-backward 150ms ease-in both; }
.panel-in-forward { animation: panel-in-forward 250ms ease-out both; }
.panel-in-backward { animation: panel-in-backward 250ms ease-out both; }

.game-screen {
  min-height: 100vh;
  padding: 0 clamp(0.75rem, 2vw, 1.5rem) 1.5rem;
  background: var(--paper);
}

.game-header {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  width: min(1380px, 100%);
  min-height: 6.1rem;
  margin: 0 auto;
  border-bottom: 1px solid var(--ink);
}

.prompt-block { display: flex; align-items: center; gap: 1rem; }

.prompt-block .eyebrow {
  flex: 0 0 auto;
  padding: 0.44rem 0.68rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
}

.game-header h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
  font-weight: 950;
  line-height: 1.12;
}

.stats-row { display: flex; align-items: stretch; }

.stats-row div {
  display: grid;
  min-width: 4.4rem;
  padding: 0.45rem 0.72rem;
  border-left: 1px solid var(--line);
}

.stats-row div:last-child { border-right: 1px solid var(--line); }
.stats-row span { color: var(--muted); font-size: 0.63rem; font-weight: 800; }
.stats-row strong { font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.game-progress {
  display: grid;
  grid-template-columns: auto minmax(10rem, 1fr) auto;
  gap: 1rem;
  align-items: center;
  width: min(1380px, 100%);
  min-height: 3.7rem;
  margin: 0 auto;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--ink);
}

.progress-copy {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  min-width: 9rem;
}

.progress-copy span,
.progress-detail {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 900;
}

.progress-copy strong {
  color: var(--ink);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.progress-rail {
  height: 1.35rem;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: #d9dbd3;
  box-shadow: 3px 3px 0 var(--ink);
}

.progress-rail span {
  display: block;
  width: 0;
  height: 100%;
  border-right: 1px solid var(--ink);
  background: var(--lime);
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-detail {
  min-width: 4.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.map-stage {
  position: relative;
  width: min(1380px, 100%);
  height: calc(100vh - 11.3rem);
  min-height: 540px;
  margin: 1rem auto 0;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: #e8e9e2;
}

.map-stage::before {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--muted);
  content: "MAP VIEW";
  font-size: 0.58rem;
  font-weight: 900;
  pointer-events: none;
}

#map { display: block; width: 100%; height: 100%; }

.district {
  fill: var(--land);
  stroke: var(--land-line);
  stroke-width: 0.52;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
  transition: fill 140ms ease, stroke 140ms ease, stroke-width 140ms ease;
}

.district.is-partial { fill: var(--green-soft); stroke: #77aa91; }
.district.is-complete { fill: var(--green); stroke: #0d7249; }

.district.is-target {
  fill: var(--yellow);
  stroke: var(--ink);
  stroke-width: 1.7;
  filter: drop-shadow(0 5px 3px rgba(17, 19, 16, 0.2));
}

.candidate-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.candidate-card {
  position: absolute;
  display: grid;
  grid-template-columns: 2.65rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  width: min(17rem, 30%);
  min-height: 3.8rem;
  padding: 0.58rem 0.8rem 0.58rem 0.58rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 5px 5px 0 rgba(17, 19, 16, 0.92);
  cursor: pointer;
  pointer-events: auto;
  text-align: left;
  transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  animation: candidate-reveal 220ms ease-out both;
  animation-delay: calc(var(--order) * 42ms);
}

.candidate-card strong {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--lime);
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.candidate-card span { overflow-wrap: anywhere; font-size: 0.9rem; font-weight: 900; line-height: 1.25; }
.candidate-card:hover, .candidate-card:focus-visible { background: var(--lime); outline: 0; box-shadow: 2px 2px 0 var(--ink); }
.candidate-card.up { top: 1.25rem; left: 50%; transform: translateX(-50%); }
.candidate-card.down { bottom: 1.25rem; left: 50%; transform: translateX(-50%); }
.candidate-card.left { top: 50%; left: 1.25rem; transform: translateY(-50%); }
.candidate-card.right { top: 50%; right: 1.25rem; transform: translateY(-50%); }
.candidate-card.up:hover, .candidate-card.down:hover { transform: translateX(-50%) translateY(-2px); }
.candidate-card.left:hover, .candidate-card.right:hover { transform: translateY(-50%) translateY(-2px); }

.feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  min-width: 10rem;
  padding: 0.85rem 1.2rem;
  border: 2px solid var(--ink);
  background: var(--lime);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  font-size: clamp(1.1rem, 3vw, 2rem);
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.94) rotate(-1deg);
}

.feedback.show { animation: feedback-pop 360ms ease forwards; }
.feedback.wrong { background: var(--red); color: var(--white); }
.feedback.wrong.show { animation: feedback-wrong-pop 1500ms ease forwards; }
.mobile-candidates { display: none; }
.map-stage.hit { animation: stage-hit 250ms ease; }

.burst {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: 0.55rem;
  height: 0.55rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  pointer-events: none;
  animation: burst 340ms ease-out forwards;
}

.finish-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  width: min(35rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 2rem;
  overflow-y: auto;
  border: 2px solid var(--ink);
  background: var(--white);
  box-shadow: 12px 12px 0 var(--ink);
  transform: translate(-50%, -50%);
}

.finish-panel .eyebrow {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
}

.finish-panel h3 { margin: 0.65rem 0 1.4rem; font-size: 2rem; line-height: 1.1; }

.finish-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 1.2rem;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.finish-stats div { display: grid; gap: 0.15rem; padding: 0.85rem; }
.finish-stats div + div { border-left: 1px solid var(--line); }
.finish-stats span { color: var(--muted); font-size: 0.7rem; }
.finish-stats strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.rank-entry {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.rank-entry label { font-size: 0.72rem; font-weight: 900; }
.rank-entry > div { display: grid; grid-template-columns: 1fr auto; gap: 0.45rem; }
.rank-entry input {
  min-width: 0;
  min-height: 3rem;
  padding: 0 0.8rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  outline: 0;
}
.rank-entry input:focus { box-shadow: inset 0 -4px 0 var(--lime); }
.rank-entry .primary-action { padding: 0 1rem; }
.rank-entry p { min-height: 1rem; margin: 0; color: var(--muted); font-size: 0.67rem; }
.finish-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem; }

body.modal-open { overflow: hidden; }

.ranking-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  padding: 1rem;
  place-items: center;
  background: rgba(17, 19, 16, 0.68);
  animation: modal-fade 170ms ease-out both;
}

.ranking-dialog {
  width: min(42rem, 100%);
  max-height: min(44rem, calc(100vh - 2rem));
  padding: 1.5rem;
  overflow-y: auto;
  border: 2px solid var(--ink);
  background: var(--white);
  box-shadow: 12px 12px 0 var(--lime);
  animation: dialog-enter 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.screen-transition {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ink);
  color: var(--white);
  pointer-events: none;
  transform: translateX(-105%);
}

.screen-transition::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0.8rem;
  background: var(--lime);
  content: "";
}

.screen-transition span { font-size: clamp(0.85rem, 2vw, 1.2rem); font-weight: 950; }
.screen-transition.is-running { animation: screen-wipe 520ms cubic-bezier(0.72, 0, 0.28, 1) both; }

.ranking-dialog > header {
  display: flex;
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
}
.ranking-dialog header span { color: var(--muted); font-size: 0.64rem; font-weight: 950; }
.ranking-dialog h2 { margin: 0.2rem 0 0; font-size: 2rem; line-height: 1; }
.ranking-close {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}
.ranking-close:hover { background: var(--ink); color: var(--white); }
.ranking-filter-label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.66rem; font-weight: 900; }
.ranking-filter {
  width: 100%;
  min-height: 3rem;
  margin-bottom: 1rem;
  padding: 0 0.8rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
}
.ranking-list { border-top: 1px solid var(--ink); }
.ranking-row {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) 5rem 3rem;
  gap: 0.6rem;
  min-height: 3.15rem;
  padding: 0 0.65rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.ranking-row span:nth-last-child(-n + 2) { text-align: right; }
.ranking-row.is-podium { background: var(--lime); color: var(--ink); }
.ranking-row.is-podium strong { font-size: 1.05rem; }
.ranking-head { min-height: 2.1rem; color: var(--muted); font-size: 0.6rem; font-weight: 900; }
.ranking-head span:first-child { text-align: left; }
.ranking-empty { display: grid; gap: 0.35rem; padding: 3.5rem 1rem; text-align: center; }
.ranking-empty span { color: var(--muted); font-size: 0.76rem; }
.ranking-footer { display: flex; margin-top: 1rem; align-items: center; justify-content: space-between; gap: 1rem; }
.ranking-note { margin: 0; color: var(--muted); font-size: 0.66rem; }
.ranking-footer button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 900;
  text-decoration: underline;
}
.ranking-footer button:hover { color: var(--red); }

@keyframes feedback-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.82) rotate(-2deg); }
  22%, 68% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-1deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.05) rotate(0deg); }
}

@keyframes feedback-wrong-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.82) rotate(-2deg); }
  10%, 88% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-1deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.03) rotate(0deg); }
}

@keyframes stage-hit { 45% { filter: saturate(1.2); transform: scale(1.002); } }
@keyframes start-leave { to { opacity: 0; transform: translateY(-1.5rem); } }
@keyframes start-return { from { opacity: 0; transform: translateY(0.8rem); } }
@keyframes game-enter { from { opacity: 0; transform: translateY(0.75rem); } }
@keyframes burst { to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.12); } }
@keyframes panel-out-forward { to { opacity: 0; transform: translateX(-1.25rem); } }
@keyframes panel-out-backward { to { opacity: 0; transform: translateX(1.25rem); } }
@keyframes panel-in-forward { from { opacity: 0; transform: translateX(1.25rem); } }
@keyframes panel-in-backward { from { opacity: 0; transform: translateX(-1.25rem); } }
@keyframes candidate-reveal { from { opacity: 0; clip-path: inset(0 48% 0 48%); filter: blur(2px); } }
@keyframes mobile-candidate-reveal { from { opacity: 0; clip-path: inset(0 48% 0 48%); } }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(0.75rem) scale(0.985); } }
@keyframes screen-wipe {
  0% { transform: translateX(-105%); }
  44%, 56% { transform: translateX(0); }
  100% { transform: translateX(105%); }
}

@media (max-width: 980px) {
  .start-screen { grid-template-columns: minmax(15rem, 0.62fr) minmax(30rem, 1fr); column-gap: 2.5rem; }
  .brand-block h1 { font-size: clamp(3.6rem, 8vw, 5.6rem); }
  .game-header { grid-template-columns: 1fr auto; padding: 0.75rem 0; }
  .stats-row { grid-column: 1 / -1; grid-row: 2; }
  .map-stage { height: calc(100vh - 14.2rem); }
}

@media (max-width: 720px) {
  .start-screen {
    display: block;
    min-height: auto;
    padding: 0 1rem 2rem;
  }

  .start-topbar { min-height: 3.3rem; }
  .start-screen::before, .start-screen::after { display: none; }
  .brand-block { padding: 2.4rem 0 2rem; }
  .brand-block h1 { margin: 0.9rem 0 1rem; font-size: clamp(3.7rem, 18vw, 5.2rem); }
  .lede { font-size: 0.88rem; }
  .setup-panel,
  .mode-panel { gap: 1.15rem; padding: 1.1rem; box-shadow: 6px 6px 0 var(--ink); }
  .mode-grid { gap: 0.5rem; }
  .mode-card { min-height: 12rem; padding: 0.9rem; }
  .mode-card strong { font-size: clamp(1.55rem, 8vw, 2rem); }
  .mode-card i { right: 0.75rem; bottom: 0.75rem; width: 1.9rem; height: 1.9rem; }
  .setup-heading { align-items: flex-start; flex-direction: column; gap: 0.35rem; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-card { min-height: 4rem; padding: 0.7rem 1.8rem 0.7rem 0.72rem; }
  .region-card::after { right: 0.6rem; }
  .region-card span:first-of-type { font-size: 0.86rem; }
  .region-card span:last-of-type { font-size: 0.66rem; }
  .goal-picker { grid-template-columns: 1fr; gap: 0.55rem; }
  .goal-main { min-height: 5.5rem; padding: 0.8rem 4.5rem 0.8rem 0.85rem; box-shadow: 4px 4px 0 var(--ink); }
  .goal-main-copy strong { font-size: 1.1rem; }
  .goal-main > b { right: 0.8rem; font-size: 2.5rem; }
  .goal-hard-heading { padding: 0.45rem 0.55rem; }
  .goal-hard-options label > span { min-height: 3.4rem; padding: 0.55rem; }

  .game-screen { padding: 0 0.65rem 9.4rem; }
  .game-header { grid-template-columns: 1fr auto; gap: 0.55rem; min-height: auto; padding: 0.7rem 0; }
  .prompt-block { display: block; }
  .prompt-block .eyebrow { display: inline-block; margin-bottom: 0.4rem; padding: 0.28rem 0.52rem; }
  .game-header h2 { font-size: 1.18rem; }
  .header-actions { gap: 0.3rem; }
  .header-actions > button { min-height: 2.4rem; padding: 0 0.58rem; font-size: 0.72rem; }
  .stats-row { width: 100%; }
  .stats-row div { flex: 1; min-width: 0; padding: 0.4rem 0.48rem; }
  .stats-row span { font-size: 0.59rem; }
  .stats-row strong { font-size: 0.84rem; }

  .game-progress {
    grid-template-columns: auto 1fr auto;
    gap: 0.55rem;
    min-height: 3.15rem;
    padding: 0.5rem 0;
  }
  .progress-copy { min-width: auto; }
  .progress-copy span { display: none; }
  .progress-copy strong { font-size: 1rem; }
  .progress-rail { height: 1rem; box-shadow: 2px 2px 0 var(--ink); }
  .progress-detail { min-width: 3.9rem; font-size: 0.6rem; }

  .map-stage { height: calc(100vh - 15.3rem); min-height: 390px; margin-top: 0.65rem; }
  .map-stage::before { top: 0.55rem; left: 0.55rem; }
  .candidate-layer { display: none; }

  .mobile-candidates {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    padding: 0.65rem max(0.65rem, env(safe-area-inset-right)) calc(0.65rem + env(safe-area-inset-bottom)) max(0.65rem, env(safe-area-inset-left));
    border-top: 1px solid var(--ink);
    background: var(--paper);
    isolation: isolate;
  }

  .mobile-candidates .candidate-card {
    position: static;
    width: auto;
    min-height: 3.35rem;
    padding: 0.45rem 0.55rem;
    box-shadow: 3px 3px 0 var(--ink);
    transform: none;
    grid-template-columns: 2.15rem minmax(0, 1fr);
    background: var(--white);
    filter: none;
    animation-name: mobile-candidate-reveal;
  }

  .mobile-candidates .candidate-card strong { width: 2.15rem; height: 2.15rem; font-size: 1.05rem; }
  .mobile-candidates .candidate-card span { font-size: 0.78rem; }
  .finish-panel { max-height: calc(100% - 1rem); padding: 1.15rem; box-shadow: 7px 7px 0 var(--ink); }
  .finish-panel h3 { margin-bottom: 1rem; font-size: 1.6rem; }
  .finish-stats { margin-bottom: 0.8rem; }
  .finish-stats div { padding: 0.65rem 0.45rem; }
  .rank-entry { margin-bottom: 0.75rem; padding: 0.7rem 0; }
  .rank-entry > div { grid-template-columns: 1fr; }
  .finish-actions { grid-template-columns: 1fr; }
  .ranking-dialog { padding: 1rem; box-shadow: 7px 7px 0 var(--lime); }
  .ranking-dialog h2 { font-size: 1.6rem; }
  .ranking-row { grid-template-columns: 2.7rem minmax(0, 1fr) 4.2rem 2.4rem; gap: 0.35rem; padding: 0 0.45rem; font-size: 0.73rem; }
}

@media (max-width: 380px) {
  .brand-block h1 { font-size: 3.5rem; }
  .region-card { min-height: 3.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .feedback.show { opacity: 1; animation: none !important; }
}
