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

:root {
  --c-bg: #fff8e7;
  --c-panel: #fff;
  --c-accent: #e63946;      /* 桃鉄レッド */
  --c-accent-dark: #c42f3a;
  --c-green: #43aa8b;       /* 桃鉄グリーン */
  --c-yellow: #ffd166;
  --c-blue: #4cc9f0;
  --c-navy: #264653;
  --c-text: #2b2b2b;
  --c-muted: #8a7f6f;
  --c-border: #f1dfa4;
  --c-visited: #e63946;
  --c-wish: #f4a261;
  --c-danger: #e76f51;
  --shadow-pop: 0 4px 0 rgba(0,0,0,.12), 0 6px 12px rgba(0,0,0,.08);
}

html, body {
  font-family: 'M PLUS Rounded 1c', 'Kosugi Maru', -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 10% 20%, #ffecb3 0%, transparent 30%),
    radial-gradient(circle at 90% 80%, #b8e0d2 0%, transparent 30%),
    var(--c-bg);
  color: var(--c-text);
  min-height: 100%;
  overflow-x: hidden;
  font-weight: 500;
}

header {
  padding: 16px 16px 12px;
  background: linear-gradient(135deg, #e63946 0%, #f4a261 100%);
  border-bottom: 4px solid #c42f3a;
  color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.08);
}
.header-deco { text-align: center; }
header h1 {
  font-size: 26px;
  font-weight: 900;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2), -1px -1px 0 #fff3;
  letter-spacing: 1px;
}
.subtitle {
  font-size: 13px;
  margin-top: 4px;
  opacity: .95;
  font-weight: 700;
}

/* タブ */
.tabs {
  display: flex;
  background: var(--c-panel);
  border-bottom: 4px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,.05);
}
.tab-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--c-muted);
  border-bottom: 4px solid transparent;
  transition: all .15s;
  font-family: inherit;
  line-height: 1.3;
}
.tab-btn.active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
  background: #fff5f5;
}
.tab-btn br + * { font-size: 13px; }

main { padding: 14px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ポップボタン */
button {
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 14px;
  border: none;
  background: var(--c-panel);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: var(--c-text);
  transition: transform .1s, box-shadow .1s;
}
.pop-btn {
  box-shadow: var(--shadow-pop);
  border: 3px solid rgba(0,0,0,.08);
}
.pop-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.08);
}
button.primary {
  background: var(--c-accent);
  color: #fff;
}
button.primary:hover { background: var(--c-accent-dark); }
button.big-btn { font-size: 18px; padding: 14px 28px; }

/* 地図 */
.map-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.count-badge {
  font-size: 13px;
  color: var(--c-accent);
  background: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  border: 3px solid var(--c-accent);
  font-weight: 900;
  box-shadow: 0 2px 0 rgba(0,0,0,.08);
}
#map, #pref-map {
  height: 55vh;
  min-height: 340px;
  border-radius: 16px;
  overflow: hidden;
  border: 4px solid var(--c-navy);
  box-shadow: var(--shadow-pop);
}

/* 駅マーク風ピン */
.station-pin {
  background: none !important;
  border: none !important;
}
.station-pin-inner {
  width: 30px;
  height: 30px;
  background: var(--c-accent);
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  position: relative;
}
.station-pin-inner::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  background: #fff;
  border-radius: 50%;
}

/* Google Maps未設定ガイド */
.gmap-setup {
  padding: 20px;
  background: #fff;
  border: 3px dashed var(--c-accent);
  border-radius: 14px;
  color: var(--c-navy);
  font-weight: 700;
}
.gmap-setup h3 { color: var(--c-accent); margin-bottom: 10px; font-size: 16px; }
.gmap-setup ol { padding-left: 20px; line-height: 1.7; font-size: 13px; }
.gmap-setup code {
  background: #fff5f5;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  font-size: 12px;
}
.gmap-setup a { color: var(--c-accent); font-weight: 700; }

/* ピン配置モードバナー */
.pick-banner {
  background: linear-gradient(135deg, #ffd166, #f4a261);
  border: 3px dashed #e63946;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-pop);
  animation: pulse 1.5s ease-in-out infinite;
}
.pick-banner.hidden { display: none; }
.pick-text { font-weight: 900; color: var(--c-navy); font-size: 14px; display: block; margin-bottom: 8px; }
.pick-actions { display: flex; gap: 8px; }
.pick-actions button {
  flex: 1;
  padding: 8px;
  background: #fff;
  border: 2px solid var(--c-navy);
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
}
.pick-actions button#pick-cancel { background: #fff5f5; color: var(--c-accent); border-color: var(--c-accent); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 0 rgba(0,0,0,.12), 0 6px 12px rgba(0,0,0,.08); }
  50% { box-shadow: 0 4px 0 rgba(0,0,0,.12), 0 0 16px rgba(230, 57, 70, .4); }
}

/* 写真プレビュー */
.photo-preview {
  margin-top: 6px;
  display: none;
}
.photo-preview.show {
  display: block;
}
.photo-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--c-border);
}

/* 座標エリア */
.coord-area {
  background: #fffdf6;
  border: 2px solid var(--c-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}
.coord-status { color: var(--c-muted); }
#coord-display { color: var(--c-green); }
#coord-display.unset { color: var(--c-muted); }
.coord-area button {
  padding: 6px 10px;
  background: var(--c-accent);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* アルバムリンクボタン */
.album-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  background: #fffbe6;
  border: 2px solid var(--c-yellow);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--c-navy);
  text-decoration: none;
}
.album-link:hover { background: #fff3b8; }

/* リストサムネイル */
.list-item-photo {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--c-border);
  flex-shrink: 0;
}
.list-item-photo-full {
  display: none;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 8px;
}
.list-item.expanded .list-item-photo-full { display: block; }

/* リスト */
.list-area { margin-top: 14px; }
.list-item {
  background: var(--c-panel);
  border: 3px solid var(--c-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  box-shadow: 0 3px 0 rgba(0,0,0,.06);
}
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-weight: 900; font-size: 16px; color: var(--c-navy); }
.list-item-sub {
  display: inline-block;
  font-size: 11px;
  color: #fff;
  background: var(--c-green);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
  font-weight: 700;
}
.list-item-memo { font-size: 13px; margin-top: 6px; color: #555; line-height: 1.4; }
.list-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon {
  padding: 6px 10px;
  font-size: 15px;
  background: #fff3f0;
  border-radius: 10px;
  border: 2px solid var(--c-border);
}
.btn-icon:hover { background: #ffe3de; }
.empty-msg { text-align: center; color: var(--c-muted); padding: 30px 10px; font-size: 14px; font-weight: 700; }

/* 進捗 */
.progress-area {
  background: var(--c-panel);
  border: 3px solid var(--c-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-pop);
}
.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  align-items: center;
}
.progress-label { font-weight: 900; font-size: 15px; color: var(--c-navy); }
#progress-text {
  font-weight: 900;
  color: var(--c-accent);
  background: #fff5f5;
  padding: 4px 12px;
  border-radius: 12px;
  border: 2px solid var(--c-accent);
  font-size: 14px;
}
.progress-bar-outer {
  height: 16px;
  background: #f0e8d4;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--c-border);
}
.progress-bar-inner {
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--c-accent), var(--c-accent) 10px,
    #ff6b6b 10px, #ff6b6b 20px
  );
  width: 0%;
  transition: width .6s ease-out;
}
.progress-sub {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--c-muted);
  font-weight: 700;
}

/* 凡例 */
.legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--c-muted);
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 2px solid var(--c-navy);
}
.legend-swatch.visited { background: var(--c-accent); }
.legend-swatch.unvisited { background: #f0e8d4; }

/* 行きたいフォーム */
.wish-form {
  background: var(--c-panel);
  border: 3px solid var(--c-border);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-pop);
}
.wish-form input, .wish-form select {
  padding: 10px 12px;
  border: 2px solid var(--c-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fffdf6;
}
.wish-form input:focus, .wish-form select:focus {
  outline: none;
  border-color: var(--c-accent);
}

/* ダーツの旅 */
.darts-area {
  background: var(--c-panel);
  border: 3px solid var(--c-border);
  border-radius: 20px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-pop);
}
.darts-area h2 {
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--c-navy);
  font-weight: 900;
}
.darts-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  text-align: left;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.darts-mode label {
  padding: 10px 14px;
  background: #fffdf6;
  border: 2px solid var(--c-border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.darts-mode label:has(input:checked) {
  background: #fff5f5;
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.dart-wheel-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#dart-wheel {
  width: 100%;
  height: 100%;
  transition: transform 4s cubic-bezier(0.17, 0.67, 0.25, 1);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.2));
}
.dart-arrow {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 40px;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
  transition: transform .3s;
}
.dart-arrow.thrown {
  animation: dart-throw .5s cubic-bezier(0.5, 0, 0.75, 0.5);
}
@keyframes dart-throw {
  0% { transform: translateX(-50%) translateY(-80px) scale(.5); opacity: 0; }
  70% { transform: translateX(-50%) translateY(8px) scale(1.2); opacity: 1; }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
.wheel-center {
  fill: #fff;
  stroke: var(--c-navy);
  stroke-width: 3;
}

.darts-result {
  margin-top: 18px;
  padding: 20px;
  background: linear-gradient(135deg, #fff4e6 0%, #ffe3cc 100%);
  border: 3px solid var(--c-yellow);
  border-radius: 16px;
  min-height: 60px;
  display: none;
  box-shadow: inset 0 0 0 3px #fff, var(--shadow-pop);
}
.darts-result.show { display: block; animation: pop .5s; }
.darts-result .pref-name {
  font-size: 32px;
  font-weight: 900;
  color: var(--c-accent);
  text-shadow: 2px 2px 0 #fff, 3px 3px 0 rgba(0,0,0,.1);
  letter-spacing: 2px;
}
.darts-result .place-name {
  font-size: 20px;
  margin-top: 6px;
  font-weight: 700;
  color: var(--c-navy);
}
.darts-result .hint {
  font-size: 13px;
  color: var(--c-muted);
  margin-top: 10px;
  font-weight: 700;
}
@keyframes pop {
  0% { transform: scale(.7); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 70, 83, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--c-panel);
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  border: 4px solid var(--c-navy);
  box-shadow: 0 8px 0 rgba(0,0,0,.15), 0 12px 24px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 14px; color: var(--c-navy); font-size: 18px; }
.modal label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--c-muted);
  font-weight: 700;
}
.modal input, .modal select, .modal textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  border: 2px solid var(--c-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  background: #fffdf6;
  font-weight: 500;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none;
  border-color: var(--c-accent);
}
.coord-hint {
  font-size: 12px;
  color: var(--c-accent);
  background: #fff5f5;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 10px 0;
  font-weight: 700;
  border: 2px dashed var(--c-accent);
}
.coord-hint.done {
  color: var(--c-green);
  background: #effaf5;
  border-color: var(--c-green);
}
.modal-buttons {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}

/* Leaflet popup 桃鉄化 */
.leaflet-popup-content-wrapper {
  border-radius: 14px !important;
  border: 3px solid var(--c-navy);
  box-shadow: 0 4px 0 rgba(0,0,0,.12) !important;
  font-family: 'M PLUS Rounded 1c', sans-serif !important;
  font-weight: 700;
}
.leaflet-popup-content { margin: 12px 14px !important; }
.leaflet-popup-tip { border: 2px solid var(--c-navy); }

/* レスポンシブ */
@media (min-width: 640px) {
  .wish-form { grid-template-columns: 2fr 1fr 2fr auto; }
  main { max-width: 820px; margin: 0 auto; }
  .dart-wheel-wrap { width: 340px; height: 340px; }
}
