/* ================================================================
   沖縄本島 市町村 色塗りマップ — style.css
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;700&display=swap');

.ocm-wrap {
  display: flex;
  flex-wrap: nowrap;  /* 横並び固定 */
  gap: 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  color: #2a2520;
  box-sizing: border-box;
  border: 1px solid #d8d2ca;
  border-radius: 10px;
  overflow: hidden;
  background: #f0ede8;
  max-width: 100%;
  /* 画面全高 − WPツールバー(32px) − マージン(16px×2) */
  height: calc(100dvh - 80px);
  min-height: 480px;
  margin: 8px auto;
}
.ocm-wrap *,
.ocm-wrap *::before,
.ocm-wrap *::after {
  box-sizing: border-box;
}

/* ── パネル ── */
.ocm-panel {
  width: 260px;
  min-width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #d8d2ca;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  height: 100%;
}

.ocm-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7a736b;
  padding-bottom: 5px;
  border-bottom: 1px solid #e8e4df;
  margin-bottom: 6px;
}

/* ── パレット ── */
.ocm-palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.ocm-color-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.1s;
}
.ocm-color-btn:hover { transform: scale(1.12); }
.ocm-color-btn.active {
  border-color: #2a2520;
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}
.ocm-color-btn.eraser {
  background: #fff;
  border: 2px solid #ccc;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ocm-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ocm-custom-row label {
  font-size: 0.75rem;
  color: #7a736b;
  flex: 1;
  min-width: 70px;
}
.ocm-custom-row input[type="color"] {
  width: 34px;
  height: 26px;
  border: 1px solid #d8d2ca;
  border-radius: 4px;
  cursor: pointer;
  padding: 1px;
  background: none;
}

/* ── トグル ── */
.ocm-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f5f3f0;
}
.ocm-toggle-row:last-child { border-bottom: none; }
.ocm-toggle {
  position: relative;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}
.ocm-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.ocm-toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.ocm-toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.ocm-toggle input:checked + .ocm-toggle-slider { background: #2a5fa8; }
.ocm-toggle input:checked + .ocm-toggle-slider::before { transform: translateX(18px); }

/* ── 選択中 ── */
.ocm-selected-info {
  background: #f5f3f0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: #7a736b;
  min-height: 34px;
  line-height: 1.5;
}
.ocm-selected-info strong {
  display: block;
  color: #2a2520;
  font-size: 0.88rem;
}

/* ── ボタン ── */
.ocm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  width: 100%;
  transition: background 0.15s, opacity 0.15s;
  line-height: 1;
}
.ocm-btn:active { opacity: 0.8; }
.ocm-btn-sm {
  width: auto;
  padding: 4px 8px;
  font-size: 0.72rem;
}
.ocm-btn-primary  { background: #2a5fa8; color: #fff; }
.ocm-btn-primary:hover  { background: #1e4f94; color: #fff; }
.ocm-btn-secondary { background: #e8e4df; color: #2a2520; }
.ocm-btn-secondary:hover { background: #ddd8d0; }
.ocm-btn-danger   { background: #fce8e8; color: #c0392b; }
.ocm-btn-danger:hover   { background: #f5d0d0; }

.ocm-btn-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── マップエリア ── */
.ocm-map-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 10px;
  background: #f0ede8;
  overflow: hidden;
  height: 100%;
}
.ocm-map-container {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  overflow: hidden;
  width: 100%;
  flex: 1;
  min-height: 0;   /* flex子要素が縮めるように */
  position: relative;
  touch-action: none;
  user-select: none;
}
.ocm-map-container svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  /* transformは使わない → viewBox操作でズーム */
}

/* ── SVG 内スタイル（!important でテーマCSSを確実に上書き） ── */
.ocm-map-container svg path {
  fill: #dff3ff !important;
  stroke: none !important;
}
.ocm-map-container #ocm-municipality-group path {
  fill: #dff3ff !important;
  stroke: none !important;
  cursor: pointer;
  transition: filter 0.1s;
}
.ocm-map-container #ocm-municipality-group path:hover {
  filter: brightness(0.88);
}
.ocm-map-container #ocm-border-group path {
  fill: none !important;
  stroke: #24527a !important;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}
.ocm-map-container .ocm-label {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: #16324a !important;
  pointer-events: none;
  user-select: none;
}

/* ── レスポンシブ ── */
@media (max-width: 620px) {
  .ocm-wrap {
    flex-direction: column;
    flex-wrap: nowrap;
    height: calc(100dvh - 60px);
  }
  .ocm-panel {
    width: 100%;
    height: auto;
    max-height: 38vh;  /* パネルは画面の38%まで */
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid #d8d2ca;
  }
  .ocm-map-area {
    flex: 1;
    min-height: 0;
    padding: 8px;
  }
}
