/* 経県値 — 見た目（タイムバケットと同じ配色・丸み・シンプルさ） */
:root {
  --bg: #fff8f0;
  --card: #ffffff;
  --ink: #33302e;
  --ink-soft: #8a837e;
  --accent: #e86a4a;
  --accent-soft: #fdeee8;
  --accent-dark: #d95538;
  --line: #f0e6dc;
  --stay: #e23b2e;   /* 宿泊：赤 */
  --visit: #f6c945;  /* 観光：黄色 */
  --none: #fff8f0;   /* 未経県：背景と同じ色（本家風） */
  --map-line: #6f6152;
  --danger: #c0392b;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

.app { max-width: 560px; margin: 0 auto; padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); }

/* ヘッダー */
.header { text-align: center; margin-bottom: 8px; }
.header h1 { font-size: 22px; margin: 6px 0 2px; letter-spacing: 0.06em; }
.header .subtitle { color: var(--ink-soft); font-size: 13px; margin: 0; }

[hidden] { display: none !important; }
.account-bar {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--ink-soft); margin: 2px 4px 0;
}
.account-bar button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 4px 12px; font-size: 12px; color: var(--ink-soft); cursor: pointer;
}
.login-gate { text-align: center; padding: 40px 16px; }
.login-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.login-note { font-size: 13px; color: var(--ink-soft); margin: 0 0 20px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }

/* 凡例（本家風：色の意味を表示） */
.legend {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  margin: 14px 0 2px; font-size: 13px; color: var(--ink);
}
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--map-line);
}
.legend .dot.stay { background: var(--stay); }
.legend .dot.visit { background: var(--visit); }
.legend .dot.none { background: var(--none); }
.legend .cnt { font-weight: 700; }

.sync-status { text-align: center; font-size: 12px; color: var(--ink-soft); min-height: 18px; margin-bottom: 6px; }
.sync-status.error { color: var(--danger); }

/* 地図（背景と同化させる：カード枠なし） */
.map-viewport { position: relative; margin-top: 2px; }
#japanMap { display: block; width: 100%; height: auto; touch-action: none; }
#japanMap path {
  stroke: var(--map-line); stroke-width: 2.4; stroke-linejoin: round;
  fill: var(--none); cursor: pointer;
}
#japanMap path.lv-stay { fill: var(--stay); }
#japanMap path.lv-visit { fill: var(--visit); }
#japanMap path.selected { stroke: var(--accent); stroke-width: 5; }
#japanMap .leader { stroke: #b9a888; stroke-width: 2; pointer-events: none; }

/* 拡大・縮小ボタン（地図の左上に重ねる） */
.zoom-ctl {
  position: absolute; top: 6px; left: 2px;
  display: flex; flex-direction: column; gap: 6px;
}
.zoom-ctl button {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255,255,255,0.92);
  color: var(--ink); font-size: 17px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 4px rgba(90, 70, 40, 0.18);
}
.zoom-ctl button:active { background: var(--accent-soft); }

/* シート */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: none; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 20px 20px 0 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet h2 { font-size: 18px; margin: 2px 0 6px; }
.sheet label { display: block; font-size: 13px; color: var(--ink-soft); margin: 12px 0 4px; }
.sheet input[type="date"] {
  width: 100%; padding: 11px 12px; font-size: 16px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink);
}
.pref-status { font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }

/* 訪問記録の行 */
.visit-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; text-align: left;
  font-size: 15px; color: var(--ink);
}
.visit-row .v-date { flex: 1; }
.visit-row .v-edit { color: var(--ink-soft); font-size: 17px; }
.visit-row.pending { opacity: 0.7; border-style: dashed; }
.visit-row.failed { border-color: var(--danger); }
.level-chip {
  flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.level-chip.stay { background: var(--stay); color: #fff; }
.level-chip.visit { background: var(--visit); color: #5c4a00; }
.no-visits { font-size: 14px; color: var(--ink-soft); text-align: center; padding: 10px 0 2px; }
.save-failed { font-size: 13px; color: var(--danger); margin: 2px 0 8px; }
.save-failed button {
  margin-right: 8px; margin-top: 4px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--danger); background: #fff; color: var(--danger); font-size: 13px; cursor: pointer;
}

/* 追加ボックス */
.add-box {
  margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px;
}
.add-box-title { font-size: 14px; font-weight: 700; margin: 0 0 8px; }

/* 宿泊/観光の切替 */
.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 11px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); font-size: 15px; cursor: pointer;
}
.seg button.active.seg-stay { background: var(--stay); border-color: var(--stay); color: #fff; font-weight: 700; }
.seg button.active.seg-visit { background: var(--visit); border-color: #dfa90f; color: #5c4a00; font-weight: 700; }

.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .primary {
  flex: 1; padding: 13px; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
}
.sheet-actions .secondary {
  padding: 13px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-soft); font-size: 15px; cursor: pointer;
}
.delete-btn {
  display: block; width: 100%; margin-top: 22px; padding: 12px;
  border: none; background: none; color: var(--danger); font-size: 15px; cursor: pointer;
}
.delete-btn.confirm { background: var(--danger); color: #fff; border-radius: 999px; font-weight: 700; }
.sheet-error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }
