:root {
  --paper: #faf7f1;
  --paper-deep: #f0eae0;
  --ink: #3c342a;
  --muted: #94897a;
  --line: #e4daca;
  --accent: #0b5fae;
  --accent-soft: #e8f1fb;
  --shadow: 0 6px 24px rgba(60, 52, 42, .12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(800px 400px at 10% 0%, #fffdf8 0%, transparent 70%), var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  background: rgba(250, 247, 241, .92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .5px;
  background: linear-gradient(145deg, #56b4ef, #0b5fae);
  box-shadow: 0 2px 8px rgba(11, 95, 174, .3);
}
.brand h1 { font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand p { font-size: 11px; color: var(--muted); line-height: 1.4; }
.day-nav { display: flex; gap: 6px; overflow-x: auto; margin-left: auto; scrollbar-width: none; }
.day-nav::-webkit-scrollbar { display: none; }
.day-nav a {
  flex: 0 0 auto; font-size: 11px; text-decoration: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 100px; padding: 5px 10px; background: #fffdf9;
}
.day-nav a:hover { color: var(--accent); border-color: #b8d4ef; }

.timeline { max-width: 1500px; margin: 0 auto; padding: 18px 16px 80px; }
.loading { text-align: center; color: var(--muted); font-size: 13px; padding: 80px 0; }
.day-section { margin-bottom: 28px; scroll-margin-top: 70px; }
.day-head {
  display: flex; align-items: baseline; gap: 10px;
  position: sticky; top: 60px; z-index: 10;
  padding: 8px 0; background: linear-gradient(180deg, var(--paper) 78%, transparent);
  border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.day-date { font-size: 16px; font-weight: 700; }
.day-count { font-size: 11px; color: var(--muted); }

.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.group-card {
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: #fffdf9; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(60, 52, 42, .08);
  transition: transform .15s ease, box-shadow .15s ease;
}
.group-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--paper-deep); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-count {
  position: absolute; right: 8px; bottom: 8px;
  font-size: 10px; color: #fff; background: rgba(30, 28, 24, .65);
  border-radius: 100px; padding: 2px 8px;
}
.card-info { padding: 8px 10px 10px; }
.card-place { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-time { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.ph-loading { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 11px; }

.gate {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(28, 36, 46, .5); backdrop-filter: blur(6px); padding: 20px;
}
.gate-card {
  width: min(420px, 100%); background: #fffdf9; border-radius: 16px;
  padding: 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.gate-card h2 { font-size: 18px; margin-bottom: 8px; }
.gate-card p { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.gate-card input {
  width: 100%; margin: 16px 0 10px; padding: 10px 12px; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none;
}
.gate-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate-error { color: #b42318 !important; margin-top: 8px; }
.gate-card form input {
  width: 100%; margin: 10px 0 0; padding: 10px 12px; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none;
}
.gate-card form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.gate-note { margin-top: 14px !important; font-size: 11px !important; color: var(--muted); }
.top-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.text-btn {
  font: inherit; font-size: 12px; color: var(--muted); cursor: pointer;
  border: 1px solid var(--line); border-radius: 100px; padding: 6px 12px; background: #fffdf9;
}
.text-btn:hover { color: var(--accent); border-color: #b8d4ef; }

button.primary {
  font: inherit; font-size: 13px; font-weight: 600; color: #fff; cursor: pointer;
  border: 1px solid #094c8d; border-radius: 9px; padding: 9px 18px;
  background: linear-gradient(180deg, #3a8adf, #0b5fae);
}
.icon-btn {
  font: inherit; font-size: 26px; line-height: 1; color: var(--ink); cursor: pointer;
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%;
  background: #fffdf9; display: grid; place-items: center; flex: 0 0 auto;
}

.overlay { position: fixed; inset: 0; z-index: 40; background: var(--paper); overflow-y: auto; }
.sheet { max-width: 1200px; margin: 0 auto; padding: 16px 16px 60px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 8px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.sheet-head h2 { font-size: 17px; }
.sheet-head p { font-size: 11px; color: var(--muted); }
.sheet-head .icon-btn:last-child { margin-left: auto; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-tile {
  position: relative; aspect-ratio: 1; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-deep);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile:hover img { transform: scale(1.03); transition: transform .2s ease; }

.lightbox {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(16, 18, 20, .94); padding: 60px 16px;
}
.lightbox img { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; touch-action: pinch-zoom; }
.lb-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 16px; color: #fff; background: rgba(255, 255, 255, .12); border-color: rgba(255,255,255,.25); }
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: #fff; background: rgba(255, 255, 255, .12); border-color: rgba(255,255,255,.25);
}
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-caption { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); color: #e8e8e8; font-size: 12px; }

@media (max-width: 767px) {
  .topbar { gap: 10px; padding-top: max(10px, env(safe-area-inset-top)); }
  .brand h1 { font-size: 13px; }
  .brand p { display: none; }
  .top-actions .text-btn { padding: 5px 8px; font-size: 11px; }
  .timeline { padding: 12px 12px 60px; }
  .day-head { top: 56px; }
  .group-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .card-info { padding: 7px 8px 9px; }
  .card-place { font-size: 11px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .icon-btn { width: 40px; height: 40px; }
}

@media (min-width: 1200px) {
  .topbar { padding-left: 28px; padding-right: 28px; }
  .group-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
