* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, sans-serif;
  overscroll-behavior: none;
}

#app {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 190px;
  height: 100dvh;
  max-width: 100vw;
  overflow: hidden;
}

#map {
  min-height: 0;
  overflow: hidden;
  background: var(--color-sea);
  touch-action: none;
}

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

/* Fill carries the state; the 6px transparent stroke is the enlarged tap zone. */
.pref {
  fill: var(--color-prefecture);
  stroke: transparent;
  stroke-width: 6px;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
}

.pref[data-selected="true"] {
  fill: var(--color-selected);
}

/* Visible borders, drawn above the fills and never hit-tested. */
.pref-outline {
  fill: none;
  stroke: var(--color-prefecture-stroke);
  stroke-width: 1px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.pref-outline.is-selected {
  stroke: var(--color-selected-stroke);
  stroke-width: 3px;
}

.inset-frame {
  fill: none;
  stroke: var(--color-inset-frame);
  stroke-width: 1.5px;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

#info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 190px;
  padding: 8px 12px;
  overflow: hidden;
  background: var(--color-surface);
}

#info-prefecture {
  margin: 0;
  min-height: 1.6em;
  font-size: 1.25rem;
  font-weight: 600;
}

#info-capital {
  margin: 0;
  min-height: 1.4em;
  font-size: 1rem;
}

#controls {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

#mode-toggle,
#reset-view {
  min-width: 48px;
  touch-action: manipulation;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--color-text-muted);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

#about {
  margin: 0;
  min-height: 1.2em;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
