:root {
  --bg-ocean-start: #3ba3ec;
  --bg-ocean-end: #2563a8;
  --land-green: #7ed321;
  --land-stroke: #4a8b1c;
  --header-bg: rgba(31, 41, 55, 0.95);
  --text-primary: #ffffff;
  --text-secondary: #ffd93d;
  --shadow-color: #5a9216;
  --accent: #ff6b6b;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Press Start 2P", "Noto Sans JP", system-ui, monospace;
  background: var(--bg-ocean-end);
  color: var(--text-primary);
  overflow: hidden;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

header {
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  box-sizing: border-box;
  background: #0a0a0a;
  border-bottom: 4px solid #1a1a1a;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}

.title {
  font-size: 18px;
  font-weight: 400;
  font-family: "DotGothic16", "Press Start 2P", monospace;
  color: #7ed321;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.8), 0 0 10px rgba(126, 211, 33, 0.3);
  letter-spacing: 2px;
}

.subtitle {
  color: #f5f5f5;
  font-size: 9px;
  letter-spacing: 0.5px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
  margin-top: 4px;
}

main {
  height: calc(100vh - 80px);
  display: flex;
  align-items: stretch;
}

#mapWrap {
  flex: 1;
  position: relative;
  background-image: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 8px,
      rgba(255, 255, 255, 0.03) 8px,
      rgba(255, 255, 255, 0.03) 16px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 8px,
      rgba(255, 255, 255, 0.03) 8px,
      rgba(255, 255, 255, 0.03) 16px
    ),
    repeating-linear-gradient(
      45deg,
      #2563a8 0px,
      #2563a8 4px,
      #3ba3ec 4px,
      #3ba3ec 8px
    );
  background-size: 16px 16px, 16px 16px, 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#mapContainer {
  width: 100%;
  height: 100%;
  position: relative;
}

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

.prefecture {
  fill: var(--land-green);
  stroke: #ffffff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: grab;
  transition: filter 0.1s;
}

.prefecture:hover {
  filter: brightness(1.25) saturate(1.2);
}

.prefecture.dragging {
  cursor: grabbing;
  filter: brightness(1.3);
}

.prefecture.moved {
  opacity: 0.95;
}

/* 重なりレイヤー：最前面に来るようにする */
.overlap-layer {
  pointer-events: none;
  isolation: isolate;
}

/* 重なり部分のスタイル：鮮やかな赤 */
.overlap-indicator {
  fill: #ff2a2a;
  /* 鮮やかな赤 */
  fill-opacity: 0.7;
  stroke: #ffcccc;
  stroke-width: 1;
  stroke-opacity: 0.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.prefecture-shadow {
  fill: var(--shadow-color);
  stroke: var(--land-stroke);
  stroke-width: 1;
  opacity: 0.4;
  pointer-events: none;
}

.okinawa-prefecture {
  fill: var(--land-green);
  stroke: #ffffff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.copyright {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 8px;
  color: #ffffff;

  /* --- 描画問題を解決する追加設定 --- */
  z-index: 100; /* MsgBoxなどよりは下、地図よりは上に */
  transform: translateZ(0); /* GPUレンダリングを強制して描画スキップを防ぐ */
  -webkit-transform: translateZ(0);
  will-change: transform; /* ブラウザに「これは動かない独立した要素だ」と教える */
  /* -------------------------------- */

  background: rgba(0, 0, 0, 0.5);
  padding: 4px 6px;
  border-radius: 2px;
  pointer-events: none;
}

.msg {
  position: absolute;
  right: 18px;
  top: 18px;
  background: rgba(31, 41, 55, 0.95);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 0;
  z-index: 5;
  border: 3px solid #1f2937;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
  font-size: 10px;
  letter-spacing: 0.5px;
}
