:root {
  --bg: #fff7f2;
  --card: #ffffff;
  --ink: #5a4a42;
  --ink-light: #a08d84;
  --accent: #f28b9b;
  --accent-deep: #e5637a;
  --accent-soft: #fde3e8;
  --mint: #9fd8c9;
  --mint-soft: #e3f5f0;
  --sun: #f7c873;
  --sun-soft: #fdf1da;
  --lav: #b9a7e0;
  --lav-soft: #efeafa;
  --line: #f3e4dc;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(160, 120, 100, 0.10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
  line-height: 1.6;
}

.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: rgba(255, 247, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.app-title { font-weight: 700; font-size: 18px; letter-spacing: 0.03em; }
.icon-btn {
  border: none; background: var(--card); box-shadow: var(--shadow);
  width: 38px; height: 38px; border-radius: 50%; font-size: 17px; cursor: pointer;
}

.sync-bar {
  text-align: center; font-size: 12px; padding: 5px 12px;
  background: var(--mint-soft); color: #3f7d6d;
}
.sync-bar.error { background: #fdeaea; color: #b04a4a; }

main { padding: 16px 16px 8px; max-width: 560px; margin: 0 auto; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.page-head h2 { margin: 0; font-size: 20px; }
.head-actions { display: flex; gap: 8px; }

.btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700;
  background: var(--accent); color: #fff;
  border-radius: 999px; padding: 12px 20px; font-size: 15px;
  box-shadow: var(--shadow);
}
.btn:active { transform: scale(0.97); }
.btn.small { padding: 9px 16px; font-size: 13px; }
.btn.ghost { background: var(--card); color: var(--accent-deep); border: 1.5px solid var(--accent-soft); }
.btn.block { width: 100%; margin-top: 6px; }
.btn.subtle { background: var(--accent-soft); color: var(--accent-deep); box-shadow: none; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--line);
}

.hint-card {
  background: var(--sun-soft); border-radius: var(--radius);
  padding: 12px 14px; font-size: 13px; margin-bottom: 14px; color: #8a6d3c;
}

.empty {
  text-align: center; color: var(--ink-light); padding: 44px 16px;
  font-size: 14px;
}
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---- チップ ---- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer;
  font-family: inherit; color: var(--ink);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 2px 10px; margin-right: 6px;
}
.tag.gourmet { background: var(--accent-soft); color: var(--accent-deep); }
.tag.drive { background: var(--mint-soft); color: #3f7d6d; }
.tag.sports { background: var(--sun-soft); color: #a3762a; }
.tag.music { background: var(--lav-soft); color: #7a63b3; }
.tag.other { background: #eee9e6; color: #857468; }
.tag.done { background: #e8e8e8; color: #999; }

/* ---- スポット ---- */
.spot-title { font-weight: 700; font-size: 15px; }
.spot-title.visited { color: var(--ink-light); text-decoration: line-through; }
.spot-note { font-size: 13px; color: var(--ink-light); margin-top: 2px; }
.spot-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mini-btn {
  border: none; font-family: inherit; cursor: pointer; font-size: 12px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 999px; padding: 6px 12px; text-decoration: none; display: inline-block;
}
.mini-btn.gray { background: #f0ebe8; color: #8a7a70; }

/* ---- プラン ---- */
.plan-date { font-size: 12px; color: var(--accent-deep); font-weight: 700; }
.plan-title { font-weight: 700; font-size: 17px; margin: 2px 0 4px; }
.plan-preview { font-size: 13px; color: var(--ink-light); }

.timeline { margin-top: 14px; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item::before {
  content: ""; position: absolute; left: 26px; top: 30px; bottom: -2px;
  width: 2px; background: var(--accent-soft);
}
.tl-item:last-child::before { display: none; }
.tl-time {
  flex: 0 0 54px; text-align: center; font-weight: 700; font-size: 13px;
  background: var(--accent); color: #fff; border-radius: 12px;
  padding: 4px 0; height: fit-content; z-index: 1;
}
.tl-body { flex: 1; background: #fffdfb; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.tl-name { font-weight: 700; font-size: 14px; }
.tl-note { font-size: 12px; color: var(--ink-light); }
.tl-del { float: right; border: none; background: none; color: #ccb; cursor: pointer; font-size: 14px; }

/* ---- 思い出 ---- */
.mem-date { font-size: 12px; color: var(--ink-light); }
.mem-title { font-weight: 700; font-size: 16px; margin: 1px 0; }
.mem-hearts { color: var(--accent); letter-spacing: 2px; }
.mem-note { font-size: 14px; margin-top: 6px; white-space: pre-wrap; }

/* ---- きろく ---- */
.act-row { display: flex; align-items: center; gap: 12px; }
.act-emoji { font-size: 30px; }
.act-name { font-weight: 700; font-size: 15px; }
.act-count { font-size: 12px; color: var(--ink-light); }
.act-count b { color: var(--accent-deep); font-size: 18px; }
.act-plus {
  margin-left: auto; border: none; cursor: pointer; font-family: inherit;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  border-radius: 999px; padding: 10px 16px; box-shadow: var(--shadow);
}
.act-plus:active { transform: scale(0.95); }

/* ---- よてい ---- */
.ev-group-label { font-size: 13px; font-weight: 700; color: var(--accent-deep); margin: 16px 4px 8px; }
.ev-row { display: flex; gap: 12px; align-items: center; }
.ev-datebox {
  flex: 0 0 52px; text-align: center; background: var(--accent-soft);
  border-radius: 12px; padding: 6px 2px;
}
.ev-datebox .d { font-size: 19px; font-weight: 700; color: var(--accent-deep); line-height: 1.2; }
.ev-datebox .w { font-size: 11px; color: var(--accent-deep); }
.ev-title { font-weight: 700; font-size: 15px; }
.ev-sub { font-size: 12px; color: var(--ink-light); }

/* ---- タブバー ---- */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab-btn {
  border: none; background: none; font-family: inherit; cursor: pointer;
  font-size: 10.5px; color: var(--ink-light); font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 10px; border-radius: 12px;
}
.tab-btn span { font-size: 21px; }
.tab-btn.active { color: var(--accent-deep); background: var(--accent-soft); }

/* ---- モーダル ---- */
.modal-overlay[hidden] { display: none; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(90, 60, 50, 0.35);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg); width: 100%; max-width: 560px;
  border-radius: 22px 22px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
  animation: slideup 0.22s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 14px; font-size: 17px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 4px; color: var(--ink-light); }
.field input, .field textarea, .field select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px; font-family: inherit; font-size: 16px; background: var(--card);
  color: var(--ink);
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.rating-pick { display: flex; gap: 6px; font-size: 28px; cursor: pointer; }
.rating-pick .h { filter: grayscale(1); opacity: 0.35; }
.rating-pick .h.on { filter: none; opacity: 1; }

.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.code-display {
  text-align: center; font-size: 24px; font-weight: 700; letter-spacing: 0.1em;
  background: var(--card); border: 2px dashed var(--accent); border-radius: 14px;
  padding: 14px; margin: 10px 0; color: var(--accent-deep);
}

.settings-note { font-size: 12.5px; color: var(--ink-light); margin: 6px 0 14px; }

.pick-list { max-height: 240px; overflow-y: auto; margin-bottom: 12px; }
.pick-item {
  display: block; width: 100%; text-align: left; font-family: inherit;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px; cursor: pointer; font-size: 14px; color: var(--ink);
}
.pick-item:active { border-color: var(--accent); }

.toast {
  position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 700;
  border-radius: 999px; padding: 10px 20px; box-shadow: var(--shadow);
  white-space: nowrap;
}
