/* Trippy デザインシステム — モバイルファースト、丸くてやわらかい旅のしおり */
:root {
  --bg: #FFF8F2;
  --card: #FFFFFF;
  --ink: #4A4039;
  --muted: #A2948A;
  --accent: #FF8A7A;
  --accent-deep: #F06D5C;
  --accent-soft: #FFE3DE;
  --teal: #63BFB0;
  --teal-soft: #DFF3F0;
  --line: #F2E7DD;
  --danger: #E05555;
  --shadow: 0 4px 16px rgba(120, 90, 70, .10);
  --shadow-lift: 0 10px 28px rgba(120, 90, 70, .16);
  --radius: 18px;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100dvh;
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  background: var(--bg); color: var(--ink);
  overscroll-behavior-y: none;
}
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; }
img { display: block; }
a { color: var(--accent-deep); }

.shell { max-width: 640px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* ───── アプリバー ───── */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.appbar .brand { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: .02em; }
.appbar .spacer { flex: 1; }
.appbar .title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: none; border-radius: 999px; background: transparent; color: var(--ink);
  font-size: 20px; cursor: pointer; transition: background .15s;
}
.icon-btn:active { background: var(--accent-soft); }
.avatar { width: 32px; height: 32px; border-radius: 999px; object-fit: cover; background: var(--accent-soft); }

/* ───── ボタン・チップ ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 22px; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, opacity .15s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.ghost { background: var(--card); color: var(--accent-deep); border: 1.5px solid var(--accent-soft); box-shadow: none; }
.btn.small { padding: 8px 16px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--teal-soft); color: #3D8B7E;
}
.chip.coral { background: var(--accent-soft); color: var(--accent-deep); }
.chip.gray { background: #F1ECE7; color: var(--muted); }

/* ───── カード ───── */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.trip-card { display: block; margin: 14px 0; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.trip-card:active { transform: scale(.98); }
.trip-card .cover {
  height: 150px; width: 100%; object-fit: cover;
  background: linear-gradient(135deg, #FFD3CB, #FFE9D6 55%, #D9F1EC);
}
.trip-card .cover.placeholder { display: grid; place-items: center; font-size: 40px; }
.trip-card .body { padding: 14px 16px 16px; }
.trip-card h2 { margin: 0 0 4px; font-size: 18px; }
.trip-card .dates { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.trip-card .chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ───── FAB ───── */
.fab {
  position: fixed; right: max(20px, env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 8px;
  padding: 16px 22px; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 800;
  box-shadow: var(--shadow-lift); cursor: pointer; transition: transform .12s;
}
.fab:active { transform: scale(.94); }

/* ───── タブ ───── */
.tabs {
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 25;
  display: flex; gap: 6px; padding: 6px; margin: 4px 0 10px;
  background: #F6EDE5; border-radius: 999px;
}
.tabs button {
  flex: 1; padding: 9px 0; border: none; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background .15s, color .15s;
}
.tabs button.active { background: var(--card); color: var(--accent-deep); box-shadow: var(--shadow); }

/* ───── 写真タイムライン ───── */
.day-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 22px 4px 10px; font-weight: 800;
}
.day-head .num { color: var(--accent-deep); font-size: 17px; }
.day-head .date { color: var(--muted); font-size: 13px; font-weight: 700; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photo-cell {
  position: relative; aspect-ratio: 1; border: none; padding: 0;
  border-radius: 10px; overflow: hidden; cursor: pointer; background: #F1E9E1;
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
.photo-cell .video-mark {
  position: absolute; right: 6px; bottom: 6px;
  width: 22px; height: 22px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; font-size: 10px;
}
.photo-cell .broken { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: 22px; }

/* ───── ライトボックス ───── */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  background: rgba(20, 14, 12, .96); color: #fff;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.lightbox .lb-top {
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
}
.lightbox .lb-top .icon-btn { color: #fff; }
.lightbox .lb-top .lb-info { flex: 1; font-size: 13px; opacity: .85; }
.lightbox .lb-stage { flex: 1; display: grid; place-items: center; min-height: 0; touch-action: pan-y; }
.lightbox .lb-stage img, .lightbox .lb-stage video { max-width: 100vw; max-height: 100%; object-fit: contain; }
.lightbox .lb-actions {
  display: flex; justify-content: space-around;
  padding: 10px 8px calc(14px + env(safe-area-inset-bottom));
}
.lightbox .lb-actions button, .lightbox .lb-actions a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; background: none; color: #fff; font-size: 11px; cursor: pointer;
  text-decoration: none; opacity: .9;
}
.lightbox .lb-actions .glyph { font-size: 20px; }

/* ───── アップロード進捗 ───── */
.upload-panel { margin: 12px 0; padding: 12px 14px; }
.upload-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.upload-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row .bar { flex: 2; height: 6px; border-radius: 999px; background: #F1E9E1; overflow: hidden; }
.upload-row .bar i { display: block; height: 100%; width: 0; background: var(--teal); border-radius: 999px; transition: width .2s; }
.upload-row.error .bar i { background: var(--danger); }
.upload-row .stat { width: 40px; text-align: right; color: var(--muted); font-size: 12px; }

/* ───── ボトムシート ───── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(60, 40, 30, .35);
  animation: fadeIn .18s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  max-width: 640px; margin: 0 auto;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(120, 90, 70, .2);
  animation: slideUp .22s cubic-bezier(.2, .9, .3, 1);
  max-height: 86dvh; overflow-y: auto;
}
@keyframes slideUp { from { transform: translateY(40%); opacity: .6; } }
.sheet .grip { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 2px auto 12px; }
.sheet h3 { margin: 0 0 14px; font-size: 17px; }
.sheet .row { margin-bottom: 14px; }
.sheet label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.sheet input[type="text"], .sheet input[type="date"], .sheet input[type="time"],
.sheet input[type="datetime-local"], .sheet input[type="url"], .sheet textarea, .sheet select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #FDFAF7; color: var(--ink); outline: none; transition: border-color .15s;
}
.sheet input:focus, .sheet textarea:focus { border-color: var(--accent); }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }

/* ───── トースト ───── */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 200;
  transform: translateX(-50%);
  padding: 11px 20px; border-radius: 999px;
  background: rgba(60, 45, 38, .92); color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow-lift); white-space: nowrap;
  animation: toastIn .25s cubic-bezier(.2, .9, .3, 1);
}
.toast.error { background: var(--danger); }
@keyframes toastIn { from { transform: translate(-50%, 16px); opacity: 0; } }

/* ───── 空状態・ローディング ───── */
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .glyph { font-size: 44px; margin-bottom: 10px; }
.skeleton { border-radius: var(--radius); background: linear-gradient(100deg, #F3EAE2 40%, #FBF4EE 50%, #F3EAE2 60%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.boot-loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* ───── ログイン ───── */
.login-screen { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px; }
.login-screen h1 { font-size: 46px; margin: 0 0 4px; color: var(--accent); font-weight: 800; }
.login-screen p { color: var(--muted); margin: 0 0 28px; }
.login-error { color: var(--danger); margin-top: 18px; font-size: 13px; }

/* ───── バナー ───── */
.banner {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0; padding: 12px 16px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent-deep); font-size: 13px; font-weight: 700;
}
.banner .btn { margin-left: auto; flex: none; }

/* ───── 行程表 ───── */
.day-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex: none; padding: 8px 16px; border: none; border-radius: 999px;
  background: #F6EDE5; color: var(--muted); font-weight: 800; font-size: 13px; cursor: pointer;
  transition: background .15s, color .15s;
}
.day-tab.active { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.day-tab .sub { display: block; font-size: 10px; font-weight: 700; opacity: .8; }
.sched-list { position: relative; padding-left: 22px; min-height: 40px; }
.sched-list::before {
  content: ''; position: absolute; left: 8px; top: 10px; bottom: 10px;
  width: 2.5px; border-radius: 2px; background: var(--accent-soft);
}
.sched-item {
  position: relative; display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 10px; padding: 12px 10px 12px 14px; cursor: pointer;
  touch-action: pan-y;
}
.sched-item::before {
  content: ''; position: absolute; left: -18px; top: 21px;
  width: 9px; height: 9px; border-radius: 999px; background: var(--accent);
}
.sched-item .time { font-weight: 800; color: var(--accent-deep); font-size: 13px; min-width: 42px; padding-top: 3px; }
.sched-item .time.none { color: #D8CCC2; }
.sched-item .icon { font-size: 20px; line-height: 1.4; }
.sched-item .body { flex: 1; min-width: 0; }
.sched-item .name { font-weight: 800; overflow-wrap: anywhere; }
.sched-item .name.untitled { color: var(--muted); font-weight: 700; }
.sched-item .memo { font-size: 12px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.sched-item .maps { font-size: 12px; }
.sched-item .handle {
  align-self: center; color: #D8CCC2; font-size: 17px; padding: 6px 4px;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.sched-item.dragging { opacity: .92; box-shadow: var(--shadow-lift); transform: scale(1.02); z-index: 5; }
.sched-item.drop-target-space { transition: transform .15s; }

/* ───── スポット ───── */
.spot-card { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; padding: 13px 14px; cursor: pointer; }
.spot-card .body { flex: 1; min-width: 0; }
.spot-card .name { font-weight: 800; overflow-wrap: anywhere; }
.spot-card .name a { color: inherit; text-decoration: none; }
.spot-card .sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.spot-card .memo { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.spot-card.visited { opacity: .62; }
.spot-card.match { outline: 2.5px solid var(--accent); outline-offset: -2.5px; background: linear-gradient(135deg, #FFF4F1, #FFFDF6); }
.hearts { display: flex; align-items: center; }
.heart-btn {
  border: none; background: none; font-size: 21px; cursor: pointer; padding: 4px 3px;
  filter: grayscale(1); opacity: .35; transition: filter .15s, opacity .15s, transform .15s;
}
.heart-btn.on { filter: none; opacity: 1; }
.heart-btn:active { transform: scale(1.25); }
.heart-btn[disabled] { pointer-events: none; }
.match-note { font-size: 11px; color: var(--accent-deep); font-weight: 800; }

/* ───── オートコンプリート ───── */
.suggest { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 95;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow-lift);
  max-height: 176px; overflow-y: auto;
}
.suggest-list button {
  display: block; width: 100%; text-align: left; padding: 10px 14px;
  border: none; background: none; font-size: 14px; cursor: pointer; color: var(--ink);
}
.suggest-list button:active { background: var(--accent-soft); }
