:root {
  --bg: #192f60;
  --bg2: #233143;
  --card: rgba(255, 255, 255, 0.95);
  --text: #192f60;
  --muted: #667085;
  --primary: #d3381c;
  --primary-dark: #ad2d16;
  --line: #e6e8ee;
  --soft: #f7f8fb;
  --ok: #16a34a;
  --warn: #f59e0b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg), var(--bg2));
}

body {
  min-height: 100vh;
}

.page {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.hero {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}


.label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
}

h2 {
  margin: 0 0 14px;
  font-size: 24px;
}

h3 {
  margin: 0;
  font-size: 22px;
}

p {
  margin: 0;
  line-height: 1.8;
}

.lead {
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  padding: 7px 12px;
  background: var(--soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #445268;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress {
  height: 14px;
  background: #eceef3;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #ffb04c);
  transition: width 0.25s ease;
}

.notice {
  margin-top: 14px;
  padding: 15px 16px;
  border-radius: 18px;
  background: var(--soft);
  color: #445268;
  font-size: 14px;
  line-height: 1.75;
}

.controls {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  background: var(--primary);
  color: white;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn.sub {
  background: #eef2f7;
  color: var(--text);
}

.btn.sub:hover {
  background: #dfe6ee;
}

.map-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.map-card {
  padding: 16px;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  background: white;
  font-size: 14px;
  color: var(--text);
  min-width: 170px;
}

#map {
  width: 100%;
  height: 600px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.area {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.status {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.done {
  background: #dcfce7;
  color: #166534;
}

.status.todo {
  background: #eef2f7;
  color: #475467;
}

.spot-image {
  margin: 14px 0;
  width: 100%;
  height: 180px;
  border-radius: 20px;
  object-fit: cover;
  background: #f3f4f6;
  border: 1px solid var(--line);
}

.meta-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.meta-item {
  background: var(--soft);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: #445268;
}

.meta-item strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.action-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.message {
  font-size: 14px;
  line-height: 1.8;
  background: var(--soft);
  border-radius: 18px;
  padding: 14px 16px;
  color: #445268;
  margin-top: 14px;
}

.list-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

.spot-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.spot-item {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
  transition: 0.2s ease;
  border: 2px solid transparent;
}

.spot-item:hover {
  transform: translateY(-2px);
}

.spot-item.active {
  border-color: #ec6d51;
}

.spot-item p {
  font-size: 14px;
  color: #475467;
  margin-top: 10px;
  min-height: 78px;
}

.spot-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.reward {
  border-radius: 22px;
  padding: 18px;
  background: var(--soft);
  font-size: 14px;
  line-height: 1.8;
  color: #445268;
}

.reward.unlocked {
  background: linear-gradient(135deg, #ffe8a0, #ec6d51);
  color: #382d1d;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot.todo {
  background: #e75b90;
}

.dot.done {
  background: #16a34a;
}

.dot.goal {
  background: #f59e0b;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.leaflet-popup-content-wrapper {
  border-radius: 18px;
}

.popup-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}

.popup-text {
  font-size: 13px;
  color: #475467;
  line-height: 1.6;
  margin-bottom: 8px;
}

.popup-btn {
  appearance: none;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ========================================
   スタンプボード（追加分）
======================================== */
.stamp-section {
  margin-top: 8px;
  margin-bottom: 28px;
}

.stamp-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.stamp-section-head h2 {
  margin: 0;
}

.stamp-board {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}

.stamp-board-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 14px;
}

.stamp-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.stamp-cell:hover {
  transform: translateY(-2px);
}

.stamp-frame {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  border: 2.5px dashed #d8dce8;
  background: #f7f8fb;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.stamp-cell:hover .stamp-frame {
  border-color: #ec6d51;
}

.stamp-frame.stamped {
  border: 2.5px solid #d32d2d;
  background: white;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.18);
}

.stamp-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.stamp-frame img.loaded {
  opacity: 1;
}

.stamp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(247, 248, 251, 0.82);
  transition: opacity 0.2s ease;
}

.stamp-frame.stamped .stamp-overlay {
  display: none;
}

.stamp-overlay-icon {
  font-size: 22px;
  opacity: 0.35;
}

.stamp-ink {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.stamp-frame.stamped .stamp-ink {
  display: flex;
}

.stamp-ink-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(22, 163, 74, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 163, 74, 0.08);
}

.stamp-ink-check {
  font-size: 22px;
  line-height: 1;
}

@keyframes stampPop {
  0% {
    transform: scale(1.4);
    opacity: 0;
  }

  60% {
    transform: scale(0.92);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.stamp-frame.stamp-anim .stamp-ink {
  animation: stampPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.stamp-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.4;
  max-width: 88px;
  word-break: break-all;
}

.stamp-area-tag {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.stamp-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #ffe2ee, #fff0d6);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
}

@media (max-width: 980px) {
  .hero,
  .map-layout,
  .spot-list,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  #map {
    height: 460px;
  }

  .stamp-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
  }

  .stamp-frame {
    width: 68px;
    height: 68px;
  }
}
/* ========================================
   キーワード入力モーダル
======================================== */
#keyword-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 40, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: kwFadeIn 0.18s ease;
}

@keyframes kwFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.kw-modal {
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  padding: 32px 28px 28px;
  width: min(460px, 100%);
  animation: kwSlideUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes kwSlideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.kw-modal-header {
  margin-bottom: 22px;
}

.kw-spot-area {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.kw-spot-name {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--text);
}

.kw-description {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.kw-input-wrap {
  margin-bottom: 18px;
}

.kw-input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--soft);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.kw-input:focus {
  border-color: var(--primary);
  background: white;
}

.kw-hint {
  min-height: 22px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  padding-left: 4px;
}

.kw-hint.error {
  color: #dc2626;
}

.kw-hint.success {
  color: var(--ok);
}

.kw-actions {
  display: grid;
  gap: 10px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}

.kw-input.shake {
  animation: shake 0.35s ease;
  border-color: #dc2626;
}
