:root {
  color-scheme: light;
  --ink: #172033;
  --ink-soft: #5d6678;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-solid: #ffffff;
  --surface-subtle: #f5f7fb;
  --line: #dde2eb;
  --line-strong: #c8cfdb;
  --blue: #1769e0;
  --blue-dark: #0f53b8;
  --blue-soft: #e9f1ff;
  --green: #138a5b;
  --green-soft: #e5f6ef;
  --amber: #c87413;
  --amber-soft: #fff2dd;
  --coral: #d45145;
  --coral-soft: #ffebe8;
  --purple: #6f55c8;
  --shadow: 0 14px 42px rgba(37, 51, 78, 0.18), 0 2px 8px rgba(37, 51, 78, 0.08);
  --shadow-small: 0 6px 20px rgba(37, 51, 78, 0.16), 0 1px 4px rgba(37, 51, 78, 0.08);
  --radius: 18px;
  --radius-small: 12px;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #dfe8ed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button,
label,
summary,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

#app {
  position: relative;
  isolation: isolate;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #dce9ec;
}

#map:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-tile-pane {
  filter: saturate(0.92) contrast(0.99);
}

.leaflet-control-attribution {
  color: #596272;
  background: rgba(255, 255, 255, 0.86) !important;
  backdrop-filter: blur(8px);
  border-radius: 7px 0 0 0;
  padding: 3px 7px !important;
}

.leaflet-control-attribution a {
  color: #3d587c;
}

.leaflet-control-zoom {
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-small) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  width: 42px !important;
  height: 42px !important;
  line-height: 40px !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

.leaflet-control-zoom a:hover,
.leaflet-control-zoom a:focus-visible {
  background: var(--blue-soft) !important;
  color: var(--blue) !important;
}

.app-header {
  position: absolute;
  z-index: 800;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) 18px 0;
  pointer-events: none;
}

.brand-surface,
.stats-surface {
  pointer-events: auto;
  display: flex;
  align-items: center;
  min-height: 52px;
  background: var(--surface);
  border: 1px solid rgba(209, 216, 228, 0.9);
  border-radius: 15px;
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(14px);
}

.brand-surface {
  gap: 10px;
  padding: 7px 13px 7px 8px;
  color: inherit;
  text-decoration: none;
}

.brand-surface:focus-visible {
  outline: 3px solid rgba(33, 120, 231, 0.34);
  outline-offset: 3px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #2879e8, #135bc7);
  border-radius: 11px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.22);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand-copy span {
  color: var(--ink-soft);
  font-size: 11px;
}

.stats-surface {
  padding: 7px 14px;
}

.stat-compact {
  display: flex;
  min-width: 56px;
  flex-direction: column;
  gap: 1px;
  text-align: center;
}

.stat-compact span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-compact strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.stats-divider {
  width: 1px;
  height: 28px;
  margin: 0 10px;
  background: var(--line);
}

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

.panel,
.guess-dock,
.map-actions {
  pointer-events: auto;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(209, 216, 228, 0.94);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.setup-panel {
  position: absolute;
  top: 84px;
  left: 18px;
  width: min(410px, calc(100vw - 36px));
  max-height: calc(100vh - 104px);
  padding: 23px;
  overflow: auto;
  overscroll-behavior: contain;
}

.setup-heading {
  margin-bottom: 20px;
}

.eyebrow,
.category-kicker {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

h1,
h2 {
  color: var(--ink);
  letter-spacing: -0.03em;
}

[tabindex="-1"]:focus {
  outline: none;
}

h1 {
  max-width: 340px;
  margin: 7px 0 9px;
  font-size: clamp(27px, 3.2vw, 36px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 7px;
  font-size: 25px;
  line-height: 1.12;
}

.setup-heading p,
.question-panel > p,
.learning-fact {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.setup-heading p {
  margin-bottom: 0;
}

.form-section {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.form-section legend,
.select-field > span,
.section-label-row .section-legend {
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.section-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.text-button {
  min-height: 32px;
  padding: 0;
  color: var(--blue);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.text-button:hover {
  text-decoration: underline;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.category-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.category-option-wide {
  grid-column: 1 / -1;
}

.category-option input,
.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.category-content {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 9px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  transition: 160ms ease;
}

.category-option input:checked + .category-content {
  background: var(--blue-soft);
  border-color: rgba(23, 105, 224, 0.55);
  box-shadow: inset 0 0 0 1px rgba(23, 105, 224, 0.08);
}

.category-option:hover .category-content {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.category-option input:focus-visible + .category-content,
.segmented-control input:focus-visible + span {
  outline: 3px solid var(--blue-dark);
  outline-offset: 2px;
}

.category-icon {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 10px;
}

.category-option input:checked + .category-content .category-icon::after {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  content: "✓";
  color: #fff;
  background: var(--blue);
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 900;
}

.category-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.category-icon-roads {
  color: #5f6877;
  background: #eef1f5;
}

.category-icon-bars {
  color: var(--coral);
  background: var(--coral-soft);
}

.category-icon-neighborhoods {
  color: var(--purple);
  background: #f0ecff;
}

.category-icon-landmarks {
  color: var(--amber);
  background: var(--amber-soft);
}

.category-icon-nature {
  color: var(--green);
  background: var(--green-soft);
}

.category-icon-towns {
  color: var(--blue);
  background: var(--blue-soft);
}

.category-content > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.category-content strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-content small {
  color: var(--ink-soft);
  font-size: 10px;
}

.form-error {
  margin: 7px 0 0;
  color: var(--coral);
  font-size: 12px;
  font-weight: 650;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
  background: #edf1f6;
  border-radius: 13px;
}

.segmented-control label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.segmented-control label > span {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.segmented-control input:checked + span::after {
  position: absolute;
  top: 4px;
  right: 7px;
  content: "✓";
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
}

.segmented-control label > span small {
  font-size: 9px;
  font-weight: 500;
}

.segmented-control input:checked + span {
  color: var(--ink);
  background: var(--surface-solid);
  box-shadow: 0 1px 5px rgba(42, 54, 74, 0.13);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.select-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.select-field > span {
  margin-bottom: 7px;
}

.select-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 36px 0 12px;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}

.select-field select:focus-visible,
.button:focus-visible,
.map-action:focus-visible,
.text-button:focus-visible,
.review-item:focus-visible,
summary:focus-visible,
.dialog-close:focus-visible {
  outline: 3px solid var(--blue-dark);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.47;
}

.button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.button-primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 6px 14px rgba(23, 105, 224, 0.24);
}

.button-primary:hover:not(:disabled) {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.button-secondary {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #c9dcfb;
}

.button-secondary:hover:not(:disabled) {
  background: #dce9ff;
}

.button-quiet {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line);
}

.button-quiet:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-subtle);
}

.button-full {
  width: 100%;
}

.how-to {
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.how-to summary,
.review-details summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
}

.how-to ol {
  margin: 10px 0 8px;
  padding-left: 20px;
}

.how-to li + li {
  margin-top: 5px;
}

.how-to p {
  margin-bottom: 0;
}

.data-note {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  text-align: center;
}

.data-note.is-error {
  color: var(--coral);
  font-weight: 750;
}

.question-panel,
.feedback-panel,
.results-panel {
  position: absolute;
  top: 84px;
  left: 18px;
  width: min(380px, calc(100vw - 36px));
  padding: 20px;
}

.question-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.round-progress {
  height: 4px;
  margin: 9px 0 17px;
  overflow: hidden;
  background: #e6eaf0;
  border-radius: 100px;
}

.round-progress span {
  display: block;
  width: 10%;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width 260ms ease;
}

.timer-badge {
  min-width: 54px;
  padding: 5px 8px;
  color: var(--ink-soft);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  text-align: center;
}

.timer-badge.is-urgent {
  color: var(--coral);
  background: var(--coral-soft);
  border-color: #ffc6c0;
}

.category-kicker {
  margin-bottom: 5px;
  color: var(--ink-soft);
}

.question-panel h2 {
  margin-bottom: 6px;
  font-size: 28px;
}

.question-panel > p {
  margin-bottom: 13px;
}

.hint-list {
  display: grid;
  gap: 7px;
  margin: 13px 0;
}

.hint-item {
  position: relative;
  margin: 0;
  padding: 10px 11px 10px 32px;
  color: #5c4a2c;
  background: var(--amber-soft);
  border: 1px solid #f1d7ad;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.hint-item::before {
  position: absolute;
  top: 9px;
  left: 11px;
  content: "✦";
  color: var(--amber);
}

.question-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.question-actions .button:first-child {
  flex: 1;
}

.guess-dock {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  width: min(520px, calc(100vw - 36px));
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 10px 10px 13px;
  background: var(--surface);
  border: 1px solid rgba(209, 216, 228, 0.94);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.guess-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.guess-status-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 50%;
  font-size: 19px;
}

.guess-status > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.guess-status strong {
  font-size: 12px;
}

.guess-status small {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guess-dock .button {
  flex: 0 0 auto;
}

.map-actions {
  position: absolute;
  right: 14px;
  bottom: 124px;
  display: grid;
  grid-template-columns: repeat(2, 42px);
  gap: 8px;
}

.map-action {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-small);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
}

.map-action:hover:not(:disabled) {
  color: var(--blue);
  background: var(--blue-soft);
}

.map-action[aria-pressed="true"],
.map-action[aria-pressed="true"]:hover:not(:disabled) {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.map-action:disabled {
  color: var(--ink-soft);
  background: var(--surface-subtle);
  cursor: not-allowed;
  opacity: 0.62;
}

.map-action-text span {
  font-size: 11px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.map-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.feedback-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feedback-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  font-size: 23px;
  font-weight: 800;
}

.feedback-panel[data-result="close"] .feedback-icon {
  background: var(--amber);
}

.feedback-panel[data-result="missed"] .feedback-icon {
  background: var(--coral);
}

.feedback-heading h2 {
  margin: 3px 0 0;
}

.score-breakdown {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin: 17px 0 13px;
  padding: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}

.score-breakdown > span:not([aria-hidden="true"]) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.score-breakdown strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.score-breakdown small {
  color: var(--ink-soft);
  font-size: 9px;
  text-transform: uppercase;
}

.score-breakdown > span[aria-hidden="true"] {
  color: #a0a8b7;
}

.score-breakdown .round-total strong {
  color: var(--blue);
}

.learning-fact {
  margin: 0 0 16px;
  padding-left: 12px;
  border-left: 3px solid var(--blue);
}

.results-panel {
  width: min(430px, calc(100vw - 36px));
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.results-panel h2 {
  margin-top: 5px;
  margin-bottom: 4px;
  font-size: 28px;
}

.final-score {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 17px;
}

.final-score strong {
  color: var(--blue);
  font-size: 44px;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.final-score span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 17px;
  padding: 13px 0;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.results-stats > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 0 8px;
  text-align: center;
}

.results-stats > div + div {
  border-left: 1px solid var(--line);
}

.results-stats strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.results-stats span {
  color: var(--ink-soft);
  font-size: 9px;
  text-transform: uppercase;
}

.category-results {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
}

.category-result-row {
  display: grid;
  grid-template-columns: 104px 1fr 35px;
  align-items: center;
  gap: 9px;
  font-size: 11px;
}

.category-result-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-bar {
  height: 7px;
  overflow: hidden;
  background: #e6eaf0;
  border-radius: 99px;
}

.category-bar span {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
}

.category-result-row > strong {
  color: var(--ink-soft);
  font-size: 10px;
  text-align: right;
}

.review-details {
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.review-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.review-item {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-top: 1px solid #edf0f4;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.review-item:first-child {
  border-top: 0;
}

.review-item > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.review-item small {
  color: var(--ink-soft);
}

.review-item > strong {
  align-self: center;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.review-item:hover > span > strong {
  color: var(--blue);
}

.review-empty {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.results-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.personal-best {
  margin: 11px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  text-align: center;
}

.help-dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.help-dialog::backdrop {
  background: rgba(24, 33, 48, 0.42);
  backdrop-filter: blur(3px);
}

.help-dialog form {
  padding: 21px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dialog-heading h2 {
  margin: 4px 0 0;
}

.dialog-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 22px;
}

.shortcut-list {
  display: grid;
  gap: 0;
  margin: 16px 0;
}

.shortcut-list > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.shortcut-list dt {
  font-weight: 750;
}

.shortcut-list dd {
  margin: 0;
  color: var(--ink-soft);
}

.toast {
  position: absolute;
  z-index: 1200;
  top: 18px;
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  color: #fff;
  background: #24334d;
  border-radius: 10px;
  box-shadow: var(--shadow-small);
  font-size: 12px;
  font-weight: 650;
  transform: translateX(-50%);
}

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

.noscript-message {
  position: absolute;
  z-index: 1400;
  inset: 50% auto auto 50%;
  padding: 18px;
  background: white;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

.guess-div-icon,
.answer-div-icon {
  background: none !important;
  border: 0 !important;
}

.guess-pin {
  position: relative;
  width: 28px;
  height: 28px;
  background: var(--blue);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 3px 10px rgba(25, 55, 100, 0.34);
  transform: rotate(-45deg);
}

.guess-pin::after {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 8px;
  height: 8px;
  content: "";
  background: #fff;
  border-radius: 50%;
}

.answer-pin {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  background: var(--green);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(23, 78, 58, 0.32);
  font-size: 15px;
  font-weight: 900;
}

.answer-pin::before {
  position: absolute;
  z-index: -1;
  inset: -8px;
  content: "";
  border: 2px solid rgba(19, 138, 91, 0.38);
  border-radius: 50%;
  animation: answer-pulse 1.8s ease-out infinite;
}

.answer-tooltip.leaflet-tooltip,
.distance-tooltip.leaflet-tooltip {
  padding: 6px 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
}

.answer-tooltip.leaflet-tooltip::before,
.distance-tooltip.leaflet-tooltip::before {
  display: none;
}

.distance-tooltip.leaflet-tooltip {
  color: var(--blue);
}

.leaflet-marker-icon.guess-div-icon.leaflet-drag-target {
  cursor: grabbing;
}

@keyframes answer-pulse {
  0% { opacity: 0.85; transform: scale(0.75); }
  70%, 100% { opacity: 0; transform: scale(1.35); }
}

@media (max-width: 720px) {
  .app-header {
    padding: max(10px, env(safe-area-inset-top)) 10px 0;
  }

  .brand-surface,
  .stats-surface {
    min-height: 46px;
    border-radius: 13px;
  }

  .brand-surface {
    padding: 5px 10px 5px 6px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .brand-mark svg {
    width: 23px;
    height: 23px;
  }

  .brand-copy span {
    display: none;
  }

  .category-content strong {
    display: -webkit-box;
    line-height: 1.15;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .stats-surface {
    padding: 5px 10px;
  }

  .stat-compact {
    min-width: 47px;
  }

  .stat-compact strong {
    font-size: 15px;
  }

  .stats-divider {
    margin: 0 7px;
  }

  .setup-panel,
  .question-panel,
  .feedback-panel,
  .results-panel {
    top: auto;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
  }

  .setup-panel {
    max-height: calc(100vh - 70px - env(safe-area-inset-top));
    padding: 19px;
  }

  .setup-heading {
    margin-bottom: 16px;
  }

  h1 {
    font-size: 27px;
  }

  .question-panel {
    top: max(66px, calc(env(safe-area-inset-top) + 58px));
    right: auto;
    bottom: auto;
    width: min(312px, calc(100vw - 20px));
    max-height: calc(100vh - 166px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 166px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 10px 11px;
    overflow-y: auto;
    border-radius: 14px;
    overscroll-behavior: contain;
  }

  .question-panel .question-topline {
    gap: 7px;
  }

  .question-panel .eyebrow,
  .question-panel .category-kicker {
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .question-panel .round-progress {
    margin: 4px 0 8px;
  }

  .question-panel h2 {
    margin-bottom: 3px;
    font-size: clamp(17px, 5vw, 20px);
    line-height: 1.12;
  }

  .question-panel > p {
    margin-bottom: 5px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .question-panel .category-kicker {
    margin-bottom: 2px;
  }

  .question-panel .timer-badge {
    min-width: 48px;
    padding: 3px 7px;
    font-size: 10px;
  }

  .question-panel .hint-list {
    gap: 5px;
    margin: 7px 0;
  }

  .question-panel .hint-item {
    padding: 7px 8px 7px 26px;
    font-size: 11px;
    line-height: 1.3;
  }

  .question-panel .hint-item::before {
    top: 6px;
    left: 9px;
  }

  .question-panel .question-actions {
    gap: 6px;
    margin-top: 7px;
  }

  .feedback-panel,
  .results-panel {
    max-height: min(52vh, 520px);
    overflow: auto;
    padding: 17px;
  }

  .feedback-heading h2 {
    font-size: 22px;
  }

  .guess-dock {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    transform: none;
  }

  .map-actions {
    right: 10px;
    bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .leaflet-bottom.leaflet-right {
    bottom: 169px;
  }

  #app[data-phase="guessing"] .leaflet-bottom.leaflet-left {
    bottom: 72px;
  }

  #app[data-phase="reveal"] .leaflet-bottom.leaflet-left,
  #app[data-phase="results"] .leaflet-bottom.leaflet-left {
    bottom: calc(52vh + 12px);
  }

  #app[data-phase="setup"] .leaflet-control-attribution {
    display: none;
  }

  #app[data-phase="setup"] .map-actions,
  #app[data-phase="reveal"] .map-actions,
  #app[data-phase="results"] .map-actions {
    display: none;
  }

  #app[data-phase="setup"] .leaflet-control-zoom,
  #app[data-phase="results"] .leaflet-control-zoom {
    display: none;
  }

  .results-panel h2 {
    font-size: 25px;
  }

  .final-score strong {
    font-size: 38px;
  }

  .toast {
    top: calc(64px + env(safe-area-inset-top));
  }
}

@media (max-width: 390px) {
  .category-content {
    gap: 7px;
    padding: 7px;
  }

  .category-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .segmented-control label > span {
    font-size: 11px;
  }

  .segmented-control label > span small {
    display: none;
  }

  .guess-status small {
    max-width: 126px;
  }

  .guess-dock .button {
    padding: 0 13px;
  }

  .results-stats span {
    font-size: 8px;
  }
}

@media (max-height: 820px) and (min-width: 721px) {
  .setup-panel,
  .results-panel {
    top: 76px;
    max-height: calc(100vh - 88px);
  }

  .setup-panel {
    padding: 14px 20px;
  }

  .setup-heading {
    margin-bottom: 9px;
  }

  .setup-heading h1 {
    max-width: none;
    margin: 4px 0 6px;
    font-size: 26px;
  }

  .setup-heading p {
    font-size: 12px;
    line-height: 1.4;
  }

  .form-section {
    margin-bottom: 8px;
  }

  .category-content {
    min-height: 45px;
    padding: 5px 8px;
  }

  .category-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .segmented-control label > span {
    min-height: 38px;
  }

  .select-field select {
    min-height: 38px;
  }

  .button {
    min-height: 40px;
  }

  .how-to {
    margin-top: 8px;
    padding-top: 8px;
  }

  .data-note {
    margin-top: 8px;
  }
}

@media (max-height: 500px) and (min-width: 721px) {
  .question-panel {
    top: 72px;
    max-height: calc(100vh - 168px);
    padding: 15px 17px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .question-panel h2 {
    margin-bottom: 4px;
    font-size: 23px;
  }

  .round-progress {
    margin: 7px 0 11px;
  }

  .question-actions {
    position: sticky;
    bottom: -1px;
    margin-top: 8px;
    padding-top: 8px;
    background: var(--surface-solid);
  }

  .feedback-panel {
    top: 72px;
    max-height: calc(100vh - 84px);
    padding: 15px 17px;
    overflow-y: auto;
  }

  .guess-dock {
    bottom: 14px;
  }
}

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