

@font-face {
  font-family: "Hylia Serif";
  src: url("/assets/fonts/hylia-serif.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #0b1420;
  --paper-pure: #f0ecdc;
  --panel: #101c29;
  --panel-2: #16232f;
  --graphite: #ece7d4;
  --ink: #f0ecdc;
  --ink-soft: #9db0a8;
  --ink-faint: #6e8179;
  --blush: #e0c068;
  --blush-deep: #d4af45;
  --blush-mist: rgba(224, 192, 104, 0.16);
  --future: #4fe0d0;
  --future-deep: #2ea89c;
  --future-rgb: 79, 224, 208;
  --line: rgba(224, 192, 104, 0.14);
  --line-strong: rgba(224, 192, 104, 0.28);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.35);
  --slate: #0e1a26;
  --slate-soft: #1b2a3a;
  --radius: 6px;
  --radius-card: 10px;
  --radius-lg: 12px;
  --nav-h: 58px;
  
  --mag-h: 118px;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-display: "Cormorant Garamond", "Noto Serif SC", serif;
  
  --font-crest: "Hylia Serif", "Cormorant Garamond", serif;
  --font-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  
  --clouds: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='600'%3E%3Cdefs%3E%3Cfilter id='c' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0045 0.012' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 -0.36'/%3E%3C/filter%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='.5' stop-color='%23fff' stop-opacity='.85'/%3E%3Cstop offset='1' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3Cmask id='m'%3E%3Cellipse cx='600' cy='300' rx='620' ry='330' fill='url(%23g)'/%3E%3C/mask%3E%3C/defs%3E%3Crect width='1200' height='600' filter='url(%23c)' mask='url(%23m)'/%3E%3C/svg%3E");
  
  --safe-top: 0px;
  --safe-top: constant(safe-area-inset-top, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: 0px;
  --safe-right: constant(safe-area-inset-right, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: 0px;
  --safe-bottom: constant(safe-area-inset-bottom, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: 0px;
  --safe-left: constant(safe-area-inset-left, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
}

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

body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: 4400;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(224, 192, 104, 0.18);
  background: var(--paper);
}
.hidden { display: none !important; }
button { font: inherit; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blush-deep);
  outline-offset: 3px;
}

#map {
  position: fixed; inset: 0;
  background: var(--paper);
  touch-action: pan-x pan-y;
  opacity: 1;
  transition: opacity 0.35s var(--ease-out);
}
body.mode-map #map,
body.mode-plans #map {
  opacity: 1;
}
#map-veil {
  
  display: none;
}
body.mode-map #map-veil,
body.mode-plans #map-veil { opacity: 0; }
.leaflet-container { background: #8fc3dc; font: inherit; touch-action: pan-x pan-y; }
.leaflet-control-attribution { font-size: 9px; opacity: 0.35; font-family: var(--font-sans); }
.leaflet-control-zoom { display: none; }
body.mode-map .leaflet-control-zoom,
body.mode-plans .leaflet-control-zoom { display: block; }
.leaflet-bottom { bottom: max(88px, calc(var(--safe-bottom) + 80px)); }
.leaflet-right { right: max(12px, var(--safe-right)); }

@media (max-width: 900px) {
  body.mode-plans .leaflet-control-zoom { display: none; }
}
.leaflet-control-zoom a {
  width: 36px !important; height: 36px !important;
  line-height: 36px !important;
  color: var(--paper-pure) !important;
  border-color: rgba(224, 192, 104, 0.35) !important;
  background: rgba(26, 36, 48, 0.88) !important;
}

.country-label, .province-label { background: none; border: none; }
.country-label-text, .province-label-text {
  display: inline-block;
  transform: translate(-50%, -50%);
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.12em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 5px rgba(240, 234, 210, 0.9), 0 0 2px rgba(240, 234, 210, 0.9);
}
.country-label-text { color: rgba(96, 78, 46, 0.62); font-size: 11px; }
.province-label-text { color: rgba(96, 78, 46, 0.5); font-size: 10px; }
.painted-map path.country-fill,
.painted-map path.province-line { stroke-linejoin: round; stroke-linecap: round; }
.painted-map path.province-line { pointer-events: none; fill: none; }

.photo-marker { background: none !important; border: none !important; }
.photo-pin-wrap {
  display: block;
  width: 38px; height: 38px;
  pointer-events: auto;
}
.photo-pin {
  position: relative;
  width: 38px; height: 38px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s var(--ease-out);
}
.photo-pin-wrap:hover .photo-pin { transform: translateY(-2px) scale(1.06); }
.photo-pin.is-featured::before,
.photo-pin.is-featured::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  border: 1.5px solid rgba(224, 192, 104, 0.55);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
}
.photo-pin.is-featured::before {
  width: 48px; height: 48px;
  animation: feature-ring 0.9s ease-out 1;
}
@media (max-width: 900px) {
  .photo-pin.is-featured::before { animation: none; opacity: 0.45; }
  .photo-pin.is-featured::after { opacity: 0.7; }
}
.photo-pin.is-featured::after {
  width: 42px; height: 42px;
  border-color: rgba(212, 175, 69, 0.9);
}
@keyframes feature-ring {
  0% { transform: translate(-50%, -50%) scale(0.92); opacity: 0.7; }
  70% { transform: translate(-50%, -50%) scale(1.18); opacity: 0; }
  100% { opacity: 0; }
}
.photo-pin-frame {
  width: 38px; height: 38px;
  padding: 0;
  background: #1b2a3a;
  border-radius: 50%;
  border: 2px solid var(--blush);
  box-shadow: 0 0 10px rgba(224, 192, 104, 0.35), 0 3px 8px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.leaflet-container .leaflet-marker-pane img.photo-pin-img,
.leaflet-container .leaflet-marker-pane .pin-wheel-item img {
  width: 100%; height: 100%;
}
.photo-pin-img {
  object-fit: cover;
  object-position: center;
  display: block;
}
.photo-pin-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #22323f, #1b2a3a);
  color: var(--blush);
  font-family: var(--font-display);
  font-size: 16px; line-height: 1;
}
.photo-pin-count {
  position: absolute;
  right: -3px; bottom: -2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--blush);
  color: #16202c;
  border: 1px solid rgba(11, 20, 32, 0.6);
  font-family: var(--font-sans);
  font-size: 9px; font-weight: 600;
  line-height: 14px;
  text-align: center;
  z-index: 2;
  box-sizing: border-box;
}

.pin-wheel {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  z-index: 1000;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.pin-wheel::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 260px; height: 170px;
  transform: translate(-50%, -150px);
}
.pin-wheel.flip::before {
  transform: translate(-50%, -20px);
}
.pin-wheel-item {
  position: absolute;
  left: 0; top: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid var(--blush);
  background: #1b2a3a;
  box-shadow: 0 0 10px rgba(224, 192, 104, 0.35), 0 4px 10px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  touch-action: none;
}
.pin-wheel.snap .pin-wheel-item {
  transition: transform 0.2s var(--ease-out), opacity 0.2s ease;
}
.pin-wheel-item img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
  pointer-events: none;
}
.pin-wheel-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--blush); font-family: var(--font-display); font-size: 18px;
  background: linear-gradient(160deg, #22323f, #1b2a3a);
  pointer-events: none;
}
.pin-wheel-item.is-focus {
  border-color: var(--blush-deep);
  box-shadow: 0 0 0 2px rgba(224, 192, 104, 0.5), 0 0 18px rgba(224, 192, 104, 0.55), 0 6px 14px rgba(0, 0, 0, 0.4);
}
.pin-wheel-caption {
  position: absolute;
  left: 0; top: 0;
  
  transform: translate(-50%, 42px);
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 28, 41, 0.92);
  border: 1px solid rgba(224, 192, 104, 0.4);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 10.5px; letter-spacing: 0.08em;
  pointer-events: none;
}
.pin-wheel.flip .pin-wheel-caption {
  transform: translate(-50%, -68px);
}

.pin-wheel-hub {
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, -5.5px);
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 4;
  text-align: center;
}

.pin-wheel.flip .pin-wheel-hub {
  flex-direction: column-reverse;
  transform: translate(-50%, calc(-100% + 5.5px));
}
.pin-wheel-hub-dot {
  width: 11px; height: 11px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--blush);
  box-shadow:
    0 0 0 3px rgba(16, 28, 41, 0.9),
    0 0 0 4.5px rgba(224, 192, 104, 0.55),
    0 0 14px rgba(224, 192, 104, 0.5);
}

.pin-wheel-hub-plate {
  max-width: 15em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 28, 41, 0.92);
  border: 1px solid rgba(224, 192, 104, 0.45);
  font-family: var(--font-sans);
  font-size: 10px; letter-spacing: 0.08em;
  color: rgba(232, 199, 106, 0.92);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pin-wheel-hub-plate b { font-weight: 500; color: #f3eede; }
@keyframes ripple {
  0% { transform: scale(0.5); opacity: 0.85; }
  100% { transform: scale(1.85); opacity: 0; }
}
@keyframes pin-drop {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes soft-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.story-hero::before {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  z-index: 3;
  opacity: 0.55;
  background-repeat: no-repeat;
  background-image:
    linear-gradient(var(--blush), var(--blush)),
    linear-gradient(var(--blush), var(--blush)),
    linear-gradient(var(--blush), var(--blush)),
    linear-gradient(var(--blush), var(--blush)),
    linear-gradient(var(--blush), var(--blush)),
    linear-gradient(var(--blush), var(--blush)),
    linear-gradient(var(--blush), var(--blush)),
    linear-gradient(var(--blush), var(--blush));
  background-size: 10px 1.5px, 1.5px 10px, 10px 1.5px, 1.5px 10px, 10px 1.5px, 1.5px 10px, 10px 1.5px, 1.5px 10px;
  background-position: 0 0, 0 0, 100% 0, 100% 0, 0 100%, 0 100%, 100% 100%, 100% 100%;
}

#loading {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 15px;
  
  background:
    radial-gradient(128% 66% at 50% 104%, rgba(112, 190, 184, 0.3) 0%, rgba(112, 190, 184, 0) 62%),
    linear-gradient(180deg, #050a11 0%, #0a1522 42%, #102132 74%, #162c3c 100%);
  overflow: hidden;
  transition: opacity 0.16s ease-out;
}
#loading.fade { opacity: 0; pointer-events: none; }

.sky-clouds {
  position: absolute; inset: 0;
  background: var(--clouds) no-repeat 8% 92% / 180% 66%;
  opacity: 0.3;
  mix-blend-mode: screen;
  animation: cloud-drift 66s ease-in-out infinite alternate;
}
.sky-clouds::after {
  content: ""; position: absolute; inset: 0;
  background: var(--clouds) no-repeat 84% 2% / 150% 52%;
  opacity: 0.5;
  animation: cloud-drift 95s ease-in-out infinite alternate-reverse;
}
@keyframes cloud-drift {
  from { transform: translate3d(-2.4%, 0, 0); }
  to { transform: translate3d(2.4%, 0, 0); }
}

.sky-disc {
  position: absolute; left: 50%; top: 50%;
  width: min(150vw, 760px); height: min(150vw, 760px);
  transform: translate(-50%, -72%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(150, 234, 220, 0.26) 0%, rgba(126, 208, 196, 0.12) 26%,
      rgba(110, 186, 190, 0.05) 44%, rgba(110, 186, 190, 0) 62%),
    radial-gradient(circle, rgba(244, 242, 234, 0.16) 0%, rgba(244, 242, 234, 0.05) 22%, rgba(244, 242, 234, 0) 40%);
  animation: disc-breathe 9s ease-in-out infinite;
}
@keyframes disc-breathe {
  0%, 100% { opacity: 0.84; transform: translate(-50%, -72%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -72%) scale(1.045); }
}

.qixi {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.qixi-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, rgba(255,255,255,0.9) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,0.7) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 88% 34%, rgba(255,255,255,0.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 24% 38%, rgba(255,255,255,0.6) 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 62% 8%, rgba(255,255,255,0.9) 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 26%, rgba(255,255,255,0.55) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 8% 58%, rgba(255,255,255,0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 62%, rgba(255,255,255,0.5) 50%, transparent 51%);
  animation: star-twinkle 3.6s ease-in-out infinite;
}
@keyframes star-twinkle {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.qixi-milkyway {
  position: absolute; left: 50%; top: 50%;
  width: 160vmax; height: clamp(90px, 22vw, 150px);
  transform: translate(-50%, -58%) rotate(-14deg);
  background:
    radial-gradient(closest-side, rgba(150, 214, 220, 0.28), rgba(150, 214, 220, 0) 70%),
    linear-gradient(90deg, transparent, rgba(190, 226, 232, 0.16) 22%, rgba(220, 240, 244, 0.3) 50%, rgba(190, 226, 232, 0.16) 78%, transparent);
  filter: blur(2px);
  animation: milkyway-flow 14s ease-in-out infinite;
}
@keyframes milkyway-flow {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.qixi-bridge {
  position: absolute; left: 50%; top: 50%;
  width: clamp(180px, 46vw, 320px); height: clamp(60px, 15vw, 100px);
  transform: translate(-50%, -30%);
  border-radius: 50% 50% 0 0;
  border-top: 1.5px solid rgba(240, 220, 160, 0.65);
  box-shadow: 0 -6px 24px rgba(240, 220, 160, 0.18);
  opacity: 0;
  animation: bridge-rise 2.2s var(--ease-out) 1.2s forwards;
}
@keyframes bridge-rise {
  from { opacity: 0; transform: translate(-50%, -18%) scaleY(0.6); }
  to { opacity: 1; transform: translate(-50%, -30%) scaleY(1); }
}

.qixi-figure {
  position: absolute; top: 50%;
  width: clamp(26px, 6.5vw, 34px);
  color: #0a1622;
  filter: drop-shadow(0 0 5px rgba(150, 220, 214, 0.55));
}
.qixi-figure svg { display: block; width: 100%; height: auto; }
.qixi-figure .qx-fill { fill: currentColor; stroke: rgba(150, 220, 214, 0.5); stroke-width: 0.5; }
.qixi-figure .qx-line { stroke: rgba(150, 220, 214, 0.7); stroke-width: 1.6; fill: none; stroke-linecap: round; }
.qixi-link {
  left: 16%;
  color: #16302a;
  animation: link-approach 9s ease-in-out 1.6s forwards;
}

.qixi-ox {
  left: 16%;
  width: clamp(34px, 8.5vw, 44px);
  color: #101d18;
  transform: translate(-30px, 10px);
  animation: ox-approach 9s ease-in-out 1.9s forwards;
}
.qixi-zelda {
  right: 16%;
  color: #2e2616;
  animation: zelda-approach 9s ease-in-out 1.6s forwards;
}

@keyframes link-approach {
  0% { transform: translate(0, 0); }
  55% { transform: translate(clamp(58px, 15vw, 104px), -8px); }
  70% { transform: translate(clamp(58px, 15vw, 104px), -8px); }
  100% { transform: translate(clamp(64px, 17vw, 116px), -10px); }
}

@keyframes ox-approach {
  0% { transform: translate(-30px, 10px); }
  55% { transform: translate(clamp(20px, 6vw, 40px), 4px); }
  70% { transform: translate(clamp(20px, 6vw, 40px), 4px); }
  100% { transform: translate(clamp(26px, 7vw, 48px), 2px); }
}
@keyframes zelda-approach {
  0% { transform: translate(0, 0); }
  55% { transform: translate(clamp(-104px, -15vw, -58px), -8px); }
  70% { transform: translate(clamp(-104px, -15vw, -58px), -8px); }
  100% { transform: translate(clamp(-116px, -17vw, -64px), -10px); }
}

.qixi-greeting {
  position: absolute; left: 50%; top: 13%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 92vw;
  text-align: center;
  opacity: 0;
  animation: greeting-in 1.6s var(--ease-out) 1.4s forwards;
}
@keyframes greeting-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.qixi-to {
  font-family: var(--font-serif);
  font-size: clamp(22px, 5.8vw, 32px);
  font-weight: 600; letter-spacing: 0.12em;
  white-space: nowrap;
  color: #f6f1e2;
  text-shadow: 0 0 18px rgba(240, 220, 160, 0.4), 0 2px 8px rgba(4, 9, 15, 0.9);
}
@media (prefers-reduced-motion: reduce) {
  .qixi-stars, .qixi-milkyway, .qixi-bridge, .qixi-link, .qixi-ox, .qixi-zelda, .qixi-greeting { animation: none; }
  .qixi-bridge, .qixi-greeting { opacity: 1; }
  .qixi-link { transform: translate(clamp(64px, 17vw, 116px), -10px); }
  .qixi-ox { transform: translate(clamp(26px, 7vw, 48px), 2px); }
  .qixi-zelda { transform: translate(clamp(-116px, -17vw, -64px), -10px); }
}
.loading-mark {
  position: relative;
  font-family: var(--font-crest);
  font-size: clamp(42px, 12vw, 76px);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  animation: fade-up 0.9s var(--ease-out);
}
.loading-rule {
  position: relative;
  width: min(52vw, 168px); height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 242, 234, 0.42), transparent);
  animation: soft-in 0.9s ease 0.15s both;
}

.loading-rule::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 5px; height: 5px; margin: -3px 0 0 -3px;
  background: #f4f2ea; transform: rotate(45deg);
  box-shadow: 0 0 9px rgba(244, 242, 234, 0.5);
}
.loading-text {
  position: relative;
  font-family: var(--font-sans);
  font-size: 11px; letter-spacing: 0.32em;
  color: rgba(238, 236, 226, 0.6);
  text-shadow: 0 1px 6px rgba(4, 9, 15, 0.9);
  animation: soft-in 0.9s ease 0.2s both;
}

.gate-form {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-top: 16px;
  animation: fade-up 0.9s var(--ease-out) 0.12s both;
}
.gate-form[hidden] { display: none; }

.gate-field {
  display: flex; align-items: stretch;
  width: min(76vw, 300px);
  border: 1px solid rgba(244, 242, 234, 0.3);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(12, 28, 42, 0.78) 0%, rgba(6, 15, 24, 0.9) 100%);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.5),
    0 8px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.gate-field:focus-within {
  border-color: rgba(244, 242, 234, 0.6);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.5),
    0 0 0 3px rgba(244, 242, 234, 0.1),
    0 8px 28px rgba(0, 0, 0, 0.35);
}
.gate-input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  color: var(--paper-pure);
  font-family: var(--font-sans);
  font-size: 17px; letter-spacing: 0.34em; text-indent: 0.34em;
  text-align: center;
  padding: 14px 6px 14px 14px;
  outline: none;
}
.gate-input::placeholder {
  color: rgba(244, 242, 234, 0.4);
  font-size: 13px; letter-spacing: 0.2em; text-indent: 0.2em;
}

.gate-enter {
  flex-shrink: 0;
  width: 52px; border: none;
  border-left: 1px solid rgba(244, 242, 234, 0.2);
  background: rgba(244, 242, 234, 0.1);
  color: rgba(244, 242, 234, 0.9);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: manipulation;
  transition: background 0.2s ease, color 0.2s ease;
}
.gate-enter:hover, .gate-enter:focus-visible {
  background: rgba(244, 242, 234, 0.2);
  color: #fff;
}
.gate-enter[disabled] { opacity: 0.45; cursor: default; }
.gate-error {
  margin: 0; min-height: 1.1em;
  font-family: var(--font-sans);
  font-size: 12px; letter-spacing: 0.16em;
  color: rgba(230, 148, 130, 0.92);
}
.gate-form.shake { animation: gate-shake 0.34s ease; }
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  45% { transform: translateX(6px); }
  70% { transform: translateX(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .sky-clouds, .sky-clouds::after, .sky-disc, .gate-form.shake { animation: none; }
}

.boot-error {
  position: fixed; inset: 0; z-index: 5100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 32px; background: rgba(26, 36, 48, 0.94);
  text-align: center;
}
.boot-error p {
  margin: 0; max-width: 18em;
  font-family: var(--font-sans);
  font-size: 15px; line-height: 1.6; color: rgba(240, 236, 220, 0.72);
}
.boot-error button {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--graphite);
  font-family: var(--font-sans);
  font-size: 13px; letter-spacing: 0.12em;
  padding: 12px 22px; min-height: 44px; cursor: pointer;
  touch-action: manipulation;
}

.mag-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
  display: none; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: max(22px, calc(var(--safe-top) + 14px)) clamp(40px, 5vw, 72px) 16px;
  pointer-events: none;
}
.mag-header > * { pointer-events: auto; }

.mag-brand { max-width: 18em; }
.mag-brand h1 {
  font-family: var(--font-crest);
  font-size: clamp(30px, 2.5vw, 40px); font-weight: 700;
  letter-spacing: 0.08em; line-height: 1.05;
  text-transform: uppercase;
}
.mag-brand-en {
  margin-top: 9px;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-sans);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.3em; color: rgba(74, 63, 44, 0.62);
}

.mag-brand-en::before {
  content: ""; width: 20px; height: 1px; background: var(--blush);
  flex-shrink: 0;
}
.mag-nav {
  display: flex; align-items: center; gap: 2px;
  flex-shrink: 0;
  padding: 4px;
  background: rgba(14, 24, 34, 0.6);
  border: 1px solid rgba(224, 192, 104, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(9, 17, 26, 0.18);
}
.mag-nav-item {
  position: relative; border: none; background: transparent;
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.2em; color: rgba(238, 232, 214, 0.72);
  cursor: pointer; padding: 8px 17px; border-radius: 999px;
  touch-action: manipulation;
  transition: color 0.2s ease, background 0.2s ease;
}
.mag-nav-item:hover { color: #f4f2ea; }
.mag-nav-item.is-active {
  color: #f4f2ea;
  background: rgba(224, 192, 104, 0.16);
  box-shadow: inset 0 0 0 1px rgba(224, 192, 104, 0.4);
}
.mag-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  color: var(--blush-deep); background: rgba(16, 28, 41, 0.82);
  font-size: 13px; margin-left: 14px; flex-shrink: 0;
}

.mobile-hero {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: max(10px, calc(var(--safe-top) + 6px)) max(22px, var(--safe-right)) 0 max(24px, var(--safe-left));
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s var(--ease-out);
}

.mobile-hero::before,
.mobile-hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0; bottom: -74px;
  z-index: -1;
  pointer-events: none;
}

.mobile-hero::before {
  background:
    radial-gradient(108% 72% at 26% 14%, rgba(126, 208, 198, 0.16) 0%, rgba(126, 208, 198, 0) 54%),
    linear-gradient(180deg, rgba(6, 13, 21, 0.95) 0%, rgba(6, 13, 21, 0.9) 40%,
      rgba(7, 15, 24, 0.68) 64%, rgba(8, 17, 26, 0.24) 86%, rgba(8, 17, 26, 0) 100%);
}

.mobile-hero::after {
  background: var(--clouds) no-repeat 28% 104% / 205% 66%;
  opacity: 0.32;
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, transparent 20%, #000 50%, #000 76%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 20%, #000 50%, #000 76%, transparent 100%);
}
body.mode-map .mobile-hero,
body.mode-plans .mobile-hero {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}
.mobile-hero-top {
  display: flex; justify-content: space-between;
  pointer-events: auto; margin-bottom: 8px;
}
.icon-btn {
  width: 44px; height: 44px; border: none; background: transparent;
  color: rgba(238, 232, 214, 0.9);
  filter: drop-shadow(0 1px 2px rgba(8, 15, 22, 0.75));
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: manipulation;
}

.icon-btn.on { color: var(--blush); }
.icon-btn.on svg { animation: bgm-sway 2.2s ease-in-out infinite; }
@keyframes bgm-sway {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-7deg); }
  65% { transform: rotate(5deg); }
}
#mobile-brand {
  font-family: var(--font-crest);
  
  font-size: clamp(24px, 7.2vw, 34px);
  font-weight: 700; letter-spacing: 0.1em;
  line-height: 1.1;
  text-transform: uppercase;
  pointer-events: auto; user-select: none;
  animation: fade-up 0.7s var(--ease-out);
}

.site-crest {
  color: #f4f2ea;
  text-shadow:
    0 1px 2px rgba(6, 12, 19, 0.55),
    0 0 22px rgba(6, 12, 19, 0.4);
}
.mobile-sub {
  margin-top: 7px; max-width: 22em;
  font-family: var(--font-serif);
  font-size: 14px; font-weight: 500;
  line-height: 1.6; letter-spacing: 0.06em;
  color: rgba(238, 232, 214, 0.94);
  text-shadow: 0 1px 3px rgba(8, 15, 22, 0.75), 0 0 10px rgba(8, 15, 22, 0.5);
  text-wrap: balance;
}
.mobile-stats {
  margin-top: 5px;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; color: rgba(238, 236, 226, 0.82);
  text-shadow: 0 1px 3px rgba(8, 15, 22, 0.85), 0 0 10px rgba(8, 15, 22, 0.6);
}
#anniversary-banner {
  margin-top: 12px; display: inline-block;
  padding: 7px 12px;
  border: 1px solid rgba(224, 192, 104,0.4);
  color: var(--blush-deep);
  font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.06em;
  background: rgba(16, 28, 41, 0.72);
}
#anniversary-banner.hidden { display: none; }
body.celebrate-hearts .photo-pin {
  animation: pin-drop 0.5s ease, celebrate-pulse 1.7s ease-in-out infinite;
}
@keyframes celebrate-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.story-rail {
  position: fixed; left: 0; right: 0;
  
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 44px);
  z-index: 1050; height: 138px;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.45s var(--ease-out), bottom 0.35s ease;
}

body.mode-map .story-rail {
  opacity: 1;
  transform: none;
  pointer-events: none;
  visibility: visible;
  height: 92px;
}

body.mode-plans .story-rail {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(12px);
}
body.mode-plans .time-scrub {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
}
.story-track {
  height: 100%; display: flex; align-items: center; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 8px max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
  pointer-events: auto; scrollbar-width: none;
}
.story-track::-webkit-scrollbar { display: none; }

.story-card {
  flex: 0 0 min(34vw, 132px);
  width: min(34vw, 132px);
  height: 108px;
  scroll-snap-align: center;
  background: linear-gradient(180deg, #1b2a3a, #101c29);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(224, 192, 104, 0.22), 0 8px 20px rgba(26, 36, 48, 0.28);
  border: 1px solid rgba(224, 192, 104, 0.55);
  overflow: hidden;
  display: flex; flex-direction: column;
  cursor: pointer; touch-action: manipulation;
  color: inherit; padding: 5px 5px 0;
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s ease, opacity 0.08s linear;
  position: relative;
  contain: layout paint style;
}
.story-card.is-centered {
  transform: scale(1.12);
  border-color: var(--blush);
  box-shadow:
    inset 0 0 0 1px rgba(224, 192, 104, 0.45),
    0 0 0 1px var(--blush),
    0 0 18px rgba(224, 192, 104, 0.35),
    0 10px 24px rgba(26, 36, 48, 0.3);
}
.story-card.is-centered .story-card-hud::after {
  content: "";
  display: inline-block;
  width: 5px; height: 5px; margin-left: 6px;
  border: 1px solid var(--blush);
  background: var(--blush);
  transform: rotate(45deg);
}
.story-card:active { transform: scale(0.97); }
.story-card:focus-visible {
  outline: 2px solid var(--blush);
  outline-offset: 2px;
}
.story-card-media {
  position: relative;
  flex: 1; min-height: 0; width: 100%;
  background: #1b2a3a; overflow: hidden;
}
.story-card-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.55s var(--ease-out);
}
.story-card:hover .story-card-media img { transform: scale(1.04); }
.story-card-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--blush); font-family: var(--font-display); font-size: 28px;
  background: linear-gradient(160deg, #22323f, #1b2a3a);
}
.story-card-hud {
  flex-shrink: 0;
  height: 26px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  font-family: var(--font-sans);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.06em;
  color: #f0ecdc;
  background: transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.desktop-stage {
  display: none; position: fixed; inset: 0; z-index: 900;
  pointer-events: none;
  padding: 0;
  transition: opacity 0.4s ease;
}
body.mode-map .desktop-stage {
  opacity: 0; visibility: hidden; pointer-events: none;
}

.feature-card {
  pointer-events: auto;
  position: absolute;
  left: clamp(40px, 4.5vw, 72px);
  top: calc(var(--mag-h) + 14px);
  width: min(560px, calc(100vw - 200px));
  background: linear-gradient(180deg, #1b2a3a, #101c29);
  border: 1px solid rgba(224, 192, 104, 0.62);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 1px rgba(224, 192, 104, 0.2),
    0 22px 60px rgba(26, 36, 48, 0.28);
  overflow: hidden;
  animation: fade-up 0.55s var(--ease-out);
  display: flex;
  flex-direction: column;
  padding: 8px;
  position: relative;
}
.feature-card.hidden { display: none; }
.feature-hit {
  display: grid;
  grid-template-columns: minmax(200px, 46%) 1fr;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  width: 100%;
}
.feature-media {
  min-height: 240px;
  background: #1b2a3a;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(224, 192, 104, 0.4);
}
.feature-media img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  position: absolute; inset: 0;
  transition: transform 0.7s var(--ease-out);
}
.feature-hit:hover .feature-media img { transform: scale(1.03); }
.feature-media-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #22323f, #1b2a3a);
  color: var(--blush);
  font-family: var(--font-display);
  font-size: 42px;
}
.feature-body {
  padding: 18px 22px 8px;
  display: flex;
  flex-direction: column;
  min-height: 240px;
  background: var(--panel);
}
.feature-kicker {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.22em; color: var(--blush-deep);
}
.feature-kicker::before,
.feature-kicker::after {
  content: "";
  width: 6px; height: 6px;
  border: 1px solid var(--blush);
  transform: rotate(45deg);
}
.feature-meta {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; color: var(--ink-soft);
}
.feature-meta #feature-place { display: none; }
.feature-byline {
  margin-top: 12px;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; color: var(--blush-deep);
}
#feature-title {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: clamp(22px, 1.7vw, 28px);
  font-weight: 600; line-height: 1.35;
  letter-spacing: 0.04em; color: var(--graphite);
}
#feature-story {
  margin-top: 12px;
  font-family: var(--font-sans);
  font-size: 13px; line-height: 1.85;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.feature-pager {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 8px;
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.14em; color: var(--blush);
  background: var(--slate);
}
.feature-pager button {
  width: 28px; height: 28px; border: none; border-radius: 2px;
  background: transparent; color: var(--paper-pure);
  font-size: 18px; line-height: 1; cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s ease, color 0.18s ease;
}
.feature-pager button:hover {
  background: var(--blush-mist); color: var(--blush-deep);
}
#feature-index { min-width: 4.5em; text-align: center; }

.mag-quote {
  pointer-events: none;
  position: absolute;
  left: clamp(48px, 5vw, 72px);
  bottom: 32px;
  max-width: min(380px, 34vw);
  padding: 14px 18px 16px;
  background: linear-gradient(180deg, #1b2a3a, #101c29);
  border: 1px solid rgba(224, 192, 104, 0.55);
  box-shadow: inset 0 0 0 1px rgba(224, 192, 104, 0.18);
}
.mag-quote-zh {
  font-family: var(--font-serif);
  font-size: clamp(16px, 1.35vw, 20px); color: var(--paper-pure);
  letter-spacing: 0.06em; line-height: 1.55;
}
.mag-quote-en {
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.22em; color: var(--blush);
}
.mag-seal { display: none; }

.desktop-fabs {
  display: none; position: fixed;
  right: clamp(28px, 3.5vw, 48px);
  bottom: clamp(28px, 3.5vh, 40px);
  z-index: 1200; flex-direction: column; gap: 12px;
}
.circle-fab {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(224, 192, 104, 0.35);
  background: rgba(26, 36, 48, 0.92);
  color: var(--paper-pure); font-size: 17px;
  cursor: pointer; box-shadow: var(--shadow-soft);
  touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 0; padding: 0;
  transition: transform 0.22s var(--ease-out), background 0.2s ease, box-shadow 0.2s ease;
}
.circle-fab:hover { transform: scale(1.06); }
.circle-fab.primary {
  background: var(--blush); border-color: transparent; color: #16202c;
  font-size: 0; line-height: 0;
  box-shadow: 0 12px 28px rgba(212, 175, 69, 0.36);
}
.circle-fab .fab-plus {
  display: block;
  flex-shrink: 0;
}
.circle-fab.on:not(.primary) { background: var(--slate-soft); border-color: rgba(79, 224, 208, 0.45); color: var(--future); }
.circle-fab.primary.on {
  background: var(--blush);
  box-shadow: 0 12px 28px rgba(212, 175, 69, 0.36);
}
body.manage-open .circle-fab.primary {
  background: var(--slate-soft);
  box-shadow: 0 12px 28px rgba(0,0,0,0.4);
}
#bgm-toggle { position: relative; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300;
  
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 4px 12px var(--safe-bottom);
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  align-items: center; justify-items: center;
  background: rgba(26, 36, 48, 0.96);
  border-top: 1px solid rgba(224, 192, 104, 0.22);
  
  box-sizing: border-box;
}
.bnav-item {
  border: none; background: transparent; color: rgba(240, 236, 220, 0.55);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: var(--font-sans); font-size: 10px; font-weight: 500;
  letter-spacing: 0.18em; cursor: pointer; padding: 4px;
  touch-action: manipulation; transition: color 0.2s ease;
  min-width: 44px; min-height: 44px; justify-content: center;
}
.bnav-item.is-active { color: var(--blush); }
.bnav-icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 0;
}
.bnav-icon svg { display: block; flex-shrink: 0; }
.bnav-record {
  border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 4px; min-width: 44px; min-height: 44px;
  color: rgba(240, 236, 220, 0.55);
  font-family: var(--font-sans); font-size: 10px; font-weight: 500;
  letter-spacing: 0.18em; cursor: pointer;
  touch-action: manipulation;
  
  transform: none;
}
.bnav-fab {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blush); color: #16202c;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 0; padding: 0; box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(212, 175, 69, 0.32);
  transition: transform 0.25s var(--ease-out), background 0.2s ease, box-shadow 0.25s ease;
}
.bnav-fab svg {
  display: block;
  flex-shrink: 0;
  
  transform: translate(0, 0);
}
.bnav-record:active .bnav-fab { transform: scale(0.94); }
body.manage-open .bnav-fab,
body.plan-open .bnav-fab {
  background: var(--future);
  box-shadow: 0 6px 16px rgba(var(--future-rgb), 0.32);
}

.plan-ember-marker { pointer-events: none; }
.plan-ember {
  display: block; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle, rgba(190, 240, 230, 0.9) 0%, rgba(126, 208, 196, 0.5) 42%, rgba(126, 208, 196, 0) 72%);
  animation: ember-breathe 4.2s ease-in-out infinite;
}
.plan-ember.is-done {
  background: radial-gradient(circle, rgba(190, 200, 208, 0.6) 0%, rgba(150, 168, 178, 0.3) 42%, rgba(150, 168, 178, 0) 72%);
  animation: none;
}
@keyframes ember-breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.82); }
  50% { opacity: 0.9; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .plan-ember { animation: none; }
}

.plans-view {
  position: fixed;
  left: 0; right: 0;
  top: max(12px, var(--safe-top));
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  z-index: 1100;
  display: none;
  pointer-events: none;
  padding: 8px max(16px, var(--safe-right)) 12px max(16px, var(--safe-left));
  box-sizing: border-box;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
}
body.mode-plans .plans-view {
  display: flex;
}
.plans-view[hidden] { display: none !important; }
body.mode-plans .plans-view[hidden] { display: flex !important; }
body.mode-plans #empty-state { display: none !important; }

.plans-chrome {
  position: relative;
  pointer-events: none;
  align-self: stretch;
  padding: 6px 2px 14px;
}

.plans-view::before {
  content: "";
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 200px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(9, 17, 26, 0.8) 0%,
    rgba(9, 17, 26, 0.66) 48%,
    rgba(9, 17, 26, 0.3) 78%,
    rgba(9, 17, 26, 0) 100%);
}
.plans-kicker {
  font-family: var(--font-sans);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.28em;
  color: rgba(224, 192, 104, 0.75);
  margin: 0 0 8px;
}
.plans-chrome h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 500;
  color: rgba(243, 238, 222, 0.98);
  text-shadow: 0 1px 3px rgba(8, 15, 22, 0.7);
  margin: 0; line-height: 1.15;
}
.plans-chrome h2::after {
  content: "";
  display: block;
  width: 34px; height: 1px;
  margin-top: 10px;
  background: rgba(224, 192, 104, 0.55);
}
.plans-lead {
  margin: 10px 0 0;
  font-family: var(--font-sans);
  font-size: 12px; line-height: 1.6;
  color: rgba(226, 220, 202, 0.72);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(8, 15, 22, 0.65);
}

.plans-rail {
  pointer-events: auto;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  
  margin: auto -4px 0;
  padding: 4px 2px 10px;
  scrollbar-width: none;
}
.plans-rail::-webkit-scrollbar { display: none; }
.plan-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-width: 148px;
  max-width: 200px;
  text-align: left;
  border: 1.5px dashed rgba(var(--future-rgb), 0.48);
  background: rgba(16, 28, 41, 0.92);
  border-radius: 6px;
  padding: 12px 14px 10px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  touch-action: manipulation;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.plan-chip:active { transform: scale(0.98); }
.plan-chip.is-done {
  opacity: 0.62;
  border-style: solid;
  border-color: rgba(240, 236, 220, 0.18);
}
.plan-chip.is-active {
  border-color: var(--future);
  border-style: solid;
  box-shadow: 0 10px 24px rgba(var(--future-rgb), 0.2);
}
.plan-chip-title {
  display: block;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 500;
  color: var(--graphite); line-height: 1.25;
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-chip-sub {
  display: block;
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--future-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-chip-tag {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.plans-empty {
  pointer-events: none;
  text-align: center;
  margin: auto 0;
  padding: 26px 22px;
  font-family: var(--font-sans);
  font-size: 13.5px; line-height: 1.9;
  letter-spacing: 0.04em;
  color: rgba(230, 224, 206, 0.82);
  background: rgba(11, 20, 30, 0.74);
  border: 1px solid rgba(224, 192, 104, 0.22);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(224, 192, 104, 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-width: 300px;
  align-self: center;
}
.plans-empty.hidden { display: none; }
.plans-add-btn {
  pointer-events: auto;
  align-self: center;
  min-height: 46px;
  padding: 0 26px;
  border: 1px solid rgba(224, 192, 104, 0.6);
  border-radius: 4px;
  background: rgba(14, 24, 35, 0.92);
  color: var(--blush);
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.2em;
  cursor: pointer; touch-action: manipulation;
  box-shadow:
    inset 0 0 0 1px rgba(224, 192, 104, 0.14),
    0 10px 28px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  flex-shrink: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.plans-add-btn:active {
  background: rgba(24, 38, 52, 0.95);
  border-color: rgba(224, 192, 104, 0.85);
}

.plan-marker { background: none !important; border: none !important; }
.plan-pin-wrap {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  width: 72px; pointer-events: auto;
}

.plan-pin {
  position: relative;
  width: 13px; height: 13px;
  transform: rotate(45deg);
  border: 1.5px solid var(--future);
  background: rgba(var(--future-rgb), 0.34);
  
  box-shadow: 0 0 0 1px rgba(12, 22, 30, 0.3), 0 2px 6px rgba(10, 20, 28, 0.4);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s var(--ease-out), background 0.2s ease;
}

.plan-pin::after {
  content: "";
  position: absolute;
  inset: -14px;
}
.plan-pin-wrap:hover .plan-pin,
.plan-pin.is-active {
  transform: rotate(45deg) scale(1.28);
  background: var(--future);
}
.plan-pin.is-done {
  border-color: rgba(240, 236, 220, 0.45);
  background: rgba(240, 236, 220, 0.3);
}
.plan-pin-label {
  margin-top: 7px;
  max-width: 78px;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.plan-pin-label.is-above {
  position: absolute;
  left: 50%; bottom: calc(100% + 5px);
  transform: translateX(-50%);
  
  width: max-content;
  margin-top: 0;
}

.plan-pin-label.is-crowded { opacity: 0; }
.plan-pin-place {
  display: block;
  font-family: var(--font-sans);
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--future-deep);
  line-height: 1.25;
  text-shadow: 0 0 4px rgba(240, 234, 210, 0.9), 0 0 2px rgba(240, 234, 210, 0.9);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.plan-pin-date {
  display: block;
  margin-top: 2px;
  font-family: var(--font-sans);
  font-size: 9px; letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.plan-detail {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 10px);
  z-index: 1400;
  max-width: 440px;
  margin: 0 auto;
  padding: 18px 18px 16px;
  background: rgba(16, 28, 41, 0.97);
  border: 1px solid rgba(var(--future-rgb), 0.26);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.12);
  transform: translateY(0);
  transition: transform 0.35s var(--ease-out), opacity 0.28s ease;
}
.plan-detail.hidden {
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.plan-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.plan-detail h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 7vw, 32px);
  font-weight: 500; color: var(--graphite);
  margin: 4px 0 0; line-height: 1.2;
}
.plan-detail-meta {
  margin: 10px 0 0;
  font-family: var(--font-sans);
  font-size: 11px; letter-spacing: 0.1em;
  color: var(--ink-faint);
}
.plan-detail-place {
  margin: 10px 0 0;
  font-family: var(--font-sans);
  font-size: 13px; letter-spacing: 0.04em;
  color: var(--future-deep);
}
.plan-detail-place:empty,
.plan-detail-note:empty { display: none; }
.plan-detail-note {
  margin: 12px 0 0;
  font-family: var(--font-sans);
  font-size: 14px; line-height: 1.65;
  color: var(--ink-soft);
  white-space: pre-wrap;
}
.plan-detail-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 16px;
}
.plan-detail-actions .us-btn {
  min-height: 44px;
  padding: 0 16px;
  font-size: 11px;
  letter-spacing: 0.12em;
}
.danger-text { color: #c9705f !important; }
body.kb-open #plan-detail { bottom: calc(var(--kb, 0px) + 12px); }

.record-chooser {
  position: fixed; inset: 0; z-index: 1600;
  display: flex; align-items: flex-end; justify-content: center;
}
.record-chooser.hidden { display: none !important; }
.record-chooser-backdrop {
  position: absolute; inset: 0;
  border: none; padding: 0; margin: 0;
  background: rgba(0,0,0,0.28);
  cursor: pointer;
}
.record-chooser-sheet {
  position: relative; z-index: 1;
  width: min(100%, 440px);
  background: rgba(16, 28, 41, 0.98);
  border-radius: 20px 20px 0 0;
  padding: 22px 22px calc(18px + var(--safe-bottom));
  box-shadow: 0 -18px 50px rgba(0,0,0,0.12);
  animation: chooser-up 0.28s var(--ease-out);
}
@keyframes chooser-up {
  from { transform: translateY(18px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.record-chooser-hint {
  margin: 8px 0 0;
  font-family: var(--font-sans);
  font-size: 13px; line-height: 1.6;
  color: var(--ink-soft);
}
.record-chooser-sheet h2 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 500;
  color: var(--graphite); margin: 4px 0 0;
}
.record-chooser-actions {
  display: grid; gap: 10px; margin-top: 18px;
}
.chooser-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; text-align: left;
  border: 1px solid rgba(224, 192, 104, 0.16);
  background: var(--paper);
  border-radius: 14px;
  padding: 16px 16px;
  cursor: pointer; touch-action: manipulation;
  color: inherit; font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.chooser-opt:active { background: rgba(224, 192, 104, 0.12); border-color: rgba(224, 192, 104, 0.4); }
.chooser-opt-title {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 500; color: var(--graphite);
}
.chooser-opt-sub {
  font-family: var(--font-sans);
  font-size: 12px; letter-spacing: 0.06em; color: var(--ink-soft);
}
.record-chooser-cancel {
  display: block; width: 100%;
  margin-top: 14px; min-height: 44px;
  border: none; background: transparent;
  color: var(--ink-soft); cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; letter-spacing: 0.12em;
}

#plan-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1650;
  width: min(400px, 100vw); display: flex; flex-direction: column;
  background: rgba(16, 28, 41, 0.99);
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 48px rgba(0,0,0,0.1);
  transition: transform 0.4s var(--ease-out);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}
#plan-panel.hidden {
  transform: translateX(110%); pointer-events: none; box-shadow: none;
}
body.kb-open #plan-panel { bottom: var(--kb, 0px); }
.plan-form-scroll { padding: 4px 20px 24px; overflow-y: auto; flex: 1; }
#plan-form-msg { min-height: 1.2em; margin-top: 8px; font-size: 13px; color: var(--ink-soft); }
#plan-form-msg.ok { color: #4fae72; }
#plan-form-msg.err { color: #c9705f; }

.us-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1400;
  background: rgba(16, 28, 41, 0.98);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -18px 50px rgba(0,0,0,0.1);
  transform: translateY(0);
  transition: transform 0.4s var(--ease-out);
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
  max-height: min(72dvh, 560px);
}
.us-sheet.collapsed { transform: translateY(110%); pointer-events: none; }
.us-sheet-inner { padding: 30px 28px 22px; position: relative; }
.sheet-close {
  position: absolute; top: 16px; right: 16px;
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 15px;
}
.us-kicker, .empty-kicker, .intro-kicker, .manage-kicker {
  font-family: var(--font-sans); font-size: 10px; font-weight: 500;
  letter-spacing: 0.32em; color: var(--ink-soft);
}
.us-rule, .empty-rule, .intro-rule, .manage-rule {
  width: 28px; height: 1px; background: var(--blush); margin: 12px 0 14px;
}
#us-title {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 500; color: var(--graphite);
}
.us-days {
  margin-top: 14px;
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  color: var(--blush-deep); letter-spacing: 0.08em;
}
.us-sub {
  margin-top: 8px; color: var(--ink-soft);
  font-family: var(--font-sans); font-size: 13px; line-height: 1.75;
}
.us-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.us-btn {
  min-height: 46px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--blush); color: #16202c;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  letter-spacing: 0.2em; cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.us-btn:active { transform: scale(0.98); }
.us-btn.ghost { background: transparent; color: var(--graphite); }

#empty-state {
  position: fixed; inset: 0; z-index: 850;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; padding: 24px;
}
#empty-state.hidden { display: none; }
.empty-card {
  pointer-events: auto; max-width: 320px; text-align: center;
  padding: 40px 30px; background: rgba(16, 28, 41, 0.96);
  border: 1px solid rgba(224, 192, 104, 0.32); border-radius: var(--radius);
  outline: 1px solid rgba(224, 192, 104, 0.2);
  outline-offset: -5px;
  box-shadow: var(--shadow); animation: fade-up 0.55s var(--ease-out);
}
.empty-card h2 {
  font-family: var(--font-display); font-size: 26px; font-weight: 500; color: var(--graphite);
}
.empty-card p {
  margin-top: 12px; color: var(--ink-soft);
  font-family: var(--font-sans); font-size: 13px; line-height: 1.85;
}

#intro {
  position: fixed; inset: 0; z-index: 3500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26, 36, 48, 0.96);
  padding: max(20px, var(--safe-top)) 24px max(20px, var(--safe-bottom));
  animation: soft-in 0.4s ease;
}
#intro.hidden { display: none; }
.intro-card { max-width: 380px; width: 100%; text-align: center; padding: 42px 24px 30px; }
#intro-title {
  font-family: var(--font-crest); font-size: 30px; font-weight: 700;
  letter-spacing: 0.12em; line-height: 1.15;
  text-transform: uppercase;
}
#intro-days {
  margin-top: 18px; color: var(--blush-deep);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500; letter-spacing: 0.1em;
}
#intro-sub {
  margin-top: 8px; color: rgba(240, 236, 220, 0.62);
  font-family: var(--font-sans); font-size: 13px; letter-spacing: 0.08em;
}
.intro-actions {
  margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
#intro-begin {
  min-width: 168px; min-height: 46px; border: none; border-radius: 999px;
  background: var(--blush-deep); color: var(--slate);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  letter-spacing: 0.22em; cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
#intro-begin:hover { background: #cfa53e; }
#intro-skip, .ghost-btn, button.textish {
  border: none; background: transparent; color: var(--ink-soft);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  letter-spacing: 0.14em; cursor: pointer; padding: 8px 12px;
  touch-action: manipulation;
}

#panel.story-magazine {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--paper);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.42s var(--ease-out), opacity 0.35s ease;
  box-shadow:
    inset 0 0 0 1px rgba(224, 192, 104, 0.55),
    inset 0 0 0 5px var(--paper),
    inset 0 0 0 6px rgba(224, 192, 104, 0.28);
}
#panel.story-magazine.hidden {
  opacity: 0; pointer-events: none;
  transform: translateY(10%);
}

.story-top {
  position: relative; z-index: 5; flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(8px, calc(var(--safe-top) + 4px)) max(10px, var(--safe-right)) 6px max(8px, var(--safe-left));
  background: var(--slate);
  border-bottom: 1px solid rgba(224, 192, 104, 0.28);
}
#panel-close {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border: none; background: transparent;
  color: var(--paper-pure); cursor: pointer; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; flex-shrink: 0;
}
#panel-close .panel-back-gif {
  width: 34px; height: 34px; object-fit: contain;
  display: block; pointer-events: none; user-select: none;
  
  animation: cat-stroll 2.4s ease-in-out infinite;
}
@keyframes cat-stroll {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-1.5px) rotate(-2deg); }
  75% { transform: translateY(-1px) rotate(2deg); }
}
.story-top-right {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end;
  min-width: 44px;
}
.story-more-btn {
  width: 44px; height: 44px; border: none; background: transparent;
  color: var(--paper-pure); cursor: pointer; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.story-more-btn[aria-expanded="true"] {
  background: rgba(224, 192, 104, 0.16);
}
.story-more-menu {
  position: absolute; top: calc(100% - 4px); right: 0;
  min-width: 132px; padding: 6px;
  background: rgba(26, 36, 48, 0.98);
  border: 1px solid rgba(224, 192, 104, 0.28);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(26, 36, 48, 0.28);
  z-index: 20;
  display: flex; flex-direction: column; gap: 2px;
}
.story-more-menu.hidden { display: none !important; }
.story-more-menu button {
  border: none; background: transparent;
  text-align: left; padding: 12px 14px;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  letter-spacing: 0.12em; color: var(--paper-pure);
  border-radius: 4px; cursor: pointer; touch-action: manipulation;
}
.story-more-menu button:active { background: rgba(224, 192, 104, 0.12); }
.story-more-menu button.danger { color: #d96a5c; }
.story-editorial {
  flex-shrink: 0;
  padding: 16px max(28px, var(--safe-right)) 14px max(28px, var(--safe-left));
  background: var(--paper);
  animation: fade-up 0.55s var(--ease-out);
  max-height: 42dvh;
  overflow-y: auto;
}

#panel-title {
  position: sticky;
  top: -16px;
  z-index: 4;
  margin: -16px calc(-1 * max(28px, var(--safe-right))) 0 calc(-1 * max(28px, var(--safe-left)));
  padding: 16px max(28px, var(--safe-right)) 10px max(28px, var(--safe-left));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-serif);
  font-size: clamp(34px, 9.5vw, 48px);
  font-weight: 600; line-height: 1.22;
  letter-spacing: 0.08em; color: var(--graphite);
  white-space: pre-line; max-width: none;
}
.story-caption:empty { display: none; }
.story-caption {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-size: 14px; line-height: 1.75;
  color: var(--ink); letter-spacing: 0.04em;
  max-width: 22em;
}
.story-credits {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 14px;
  padding-left: 12px;
  border-left: 2px solid var(--blush);
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-soft); max-width: 280px;
}
#panel-author { color: var(--blush-deep); }

.comments-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  max-width: 100%;
}
.comments-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.comments-kicker {
  font-family: var(--font-sans); font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; color: var(--blush-deep);
}
.comments-count {
  font-family: var(--font-display); font-size: 14px; color: var(--blush-deep);
}
.comments-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: min(28vh, 220px); overflow-y: auto;
  padding-right: 4px; margin-bottom: 12px;
}
.comments-empty {
  font-family: var(--font-serif); font-size: 13px;
  color: rgba(240, 236, 220, 0.45); letter-spacing: 0.04em;
}
.comment-item { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.comment-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--font-sans); font-size: 10px;
  letter-spacing: 0.12em; color: rgba(240, 236, 220, 0.5);
}
.comment-author { color: var(--graphite); font-weight: 500; }
.comment-time { opacity: 0.75; }
.comment-del {
  border: none; background: none; padding: 0; cursor: pointer;
  color: rgba(217, 106, 92, 0.9); font-size: 10px; letter-spacing: 0.1em;
}
.comment-text {
  margin-top: 4px;
  font-family: var(--font-serif); font-size: 13.5px; line-height: 1.65;
  color: var(--ink); letter-spacing: 0.03em; white-space: pre-wrap;
}
.comment-who {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  font-family: var(--font-sans); font-size: 11px;
  color: rgba(240, 236, 220, 0.55); letter-spacing: 0.06em;
}
.comment-switch {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--blush-deep); font-size: 11px; letter-spacing: 0.1em;
  text-decoration: underline; text-underline-offset: 3px;
}
.comment-row { display: flex; gap: 8px; align-items: stretch; }
#comment-input {
  flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--panel); color: var(--ink);
  font-family: var(--font-serif); font-size: 16px;
}
#comment-input:focus {
  outline: 2px solid rgba(224, 192, 104,0.35); border-color: var(--blush);
}
#comment-send {
  flex-shrink: 0; padding: 0 14px; border: none; border-radius: 999px;
  background: var(--blush); color: #16202c;
  font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.16em;
  cursor: pointer;
}
.comment-msg {
  min-height: 16px; margin-top: 6px;
  font-family: var(--font-sans); font-size: 11px; color: #d96a5c;
}

.intro-kicker { color: var(--blush) !important; }
.intro-rule { background: var(--blush); }
#intro-skip { color: rgba(240, 236, 220, 0.55); }

@media (max-width: 900px) {
  body.kb-open #panel.story-magazine { bottom: var(--kb, 0px); }
  body.kb-open .story-editorial {
    flex: 1 1 auto; min-height: 0; max-height: none;
    padding-bottom: calc(12px + var(--safe-bottom));
  }
  body.kb-open .story-hero { flex: 0 0 0; min-height: 0; }
}

.story-hero {
  position: relative; flex: 1; min-height: 0;
  margin: 0 10px 10px;
  background: #1b2a3a; overflow: hidden;
  animation: soft-in 0.6s ease 0.05s both;
  border: 1px solid rgba(224, 192, 104, 0.6);
  box-shadow:
    inset 0 0 0 1px rgba(11, 20, 32, 0.9),
    inset 0 0 0 2px rgba(224, 192, 104, 0.35),
    0 14px 36px rgba(0, 0, 0, 0.45);
}
#panel-gallery,
#gallery-main {
  position: absolute; inset: 0;
}
#gallery-main img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  cursor: zoom-in; animation: soft-in 0.22s ease-out both;
}

@media (min-width: 901px) {
  #gallery-main { padding: 12px; box-sizing: border-box; }
  #gallery-main img { object-fit: contain; }
}
@keyframes kenburns {
  from { transform: scale(1.04); }
  to { transform: scale(1); }
}
#gallery-main .no-photo {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--blush); font-family: var(--font-display); font-size: 48px;
  background: linear-gradient(160deg, #22323f, #1b2a3a);
}
#gallery-thumbs {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end;
  max-width: 40%;
}
#gallery-thumbs img {
  width: 36px; height: 36px; object-fit: cover; border-radius: 2px;
  opacity: 0.55; border: 1.5px solid transparent; cursor: pointer;
  transition: opacity 0.2s ease, border-color 0.2s ease;
  
  box-sizing: content-box;
  padding: 4px;
  margin: -4px;
  background-clip: content-box;
}
#gallery-thumbs img.active { opacity: 1; border-color: var(--blush); }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: rgba(20,18,16,0.35); color: #fff; font-size: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.gallery-nav.hidden { display: none; }
#gallery-prev { left: 12px; }
#gallery-next { right: 12px; }
.story-hero-scrim {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(180deg,
    rgba(20,18,16,0.05) 0%,
    rgba(20,18,16,0.0) 40%,
    rgba(20,18,16,0.45) 100%);
}
.story-poem-wrap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 0 max(120px, calc(var(--safe-right) + 96px)) max(22px, calc(var(--safe-bottom) + 14px)) max(16px, var(--safe-left));
  pointer-events: none;
}
.story-poem {
  position: relative;
  padding: 14px 18px 14px 16px;
  color: rgba(240, 236, 220, 0.96);
  font-family: var(--font-serif);
  font-size: 14px; line-height: 1.8; letter-spacing: 0.04em;
  white-space: pre-wrap; max-width: min(22em, 100%);
  min-height: 0;
  
  overflow: hidden;
  background: rgba(18, 24, 32, 0.84);
  border: 1px solid rgba(224, 192, 104, 0.55);
  box-shadow: inset 0 0 0 1px rgba(224, 192, 104, 0.16), 0 10px 28px rgba(0, 0, 0, 0.28);
  animation: fade-up 0.65s var(--ease-out) 0.12s both;
}
.story-poem::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--blush);
}
.story-poem::after {
  content: "";
  position: absolute; right: 10px; top: 10px;
  width: 6px; height: 6px;
  border: 1px solid var(--blush);
  transform: rotate(45deg);
}

.story-magazine.longform .story-poem-wrap { display: none; }
@media (max-width: 900px) {
  
  body:not(.kb-open) .story-magazine.longform .story-editorial {
    max-height: 56dvh;
    
    padding-bottom: 34px;
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent 100%);
  }
}
@media (min-width: 901px) {
  
  .story-magazine.longform .story-editorial { justify-content: flex-start; }
}
.story-magazine.longform .story-caption {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(224, 192, 104, 0.22);
  max-width: 34em;
  font-size: 15px;
  line-height: 1.95;
  white-space: pre-wrap;
}

.story-poem.clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
}
.story-poem.expanded {
  max-height: min(34dvh, 360px);
  overflow-y: auto;
  pointer-events: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  
  background: rgba(14, 20, 28, 0.94);
}
.story-expand {
  pointer-events: auto;
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(224, 192, 104, 0.55);
  border-radius: 8px;
  background: rgba(18, 24, 32, 0.86);
  color: var(--blush);
  font-family: var(--font-sans);
  font-size: 11px; letter-spacing: 0.14em;
  cursor: pointer;
}
.story-expand:hover { border-color: rgba(224, 192, 104, 0.85); }
.panel-actions {
  position: absolute; right: max(18px, var(--safe-right));
  bottom: max(18px, calc(var(--safe-bottom) + 12px));
  z-index: 4;
}
.ghost-btn {
  display: inline-flex; align-items: center;
  padding: 8px 14px !important;
  border: 1px solid rgba(224, 192, 104, 0.7) !important;
  border-radius: 8px; color: var(--blush) !important;
  background: rgba(26, 36, 48, 0.55) !important;
  font-size: 11px !important; letter-spacing: 0.14em;
  backdrop-filter: blur(6px);
}
.mem-anniv { margin-left: 6px; color: var(--blush-deep); }

#lightbox {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(20,18,16,0.95);
  display: flex; align-items: center; justify-content: center;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  animation: soft-in 0.25s ease;
}
#lightbox.hidden { display: none; }
#lightbox img {
  max-width: 92vw; max-height: 92dvh; border-radius: 2px;
  user-select: none; pointer-events: none;
}
#lightbox button {
  position: absolute; z-index: 10; border: none; cursor: pointer;
  background: rgba(255,255,255,0.12); color: #fff;
  width: 46px; height: 46px; border-radius: 50%; font-size: 22px;
}
#lightbox-close { top: max(20px, calc(var(--safe-top) + 10px)); right: max(20px, calc(var(--safe-right) + 10px)); font-size: 17px; }
#lightbox-prev { left: max(18px, calc(var(--safe-left) + 8px)); top: 50%; transform: translateY(-50%); }
#lightbox-next { right: max(18px, calc(var(--safe-right) + 8px)); top: 50%; transform: translateY(-50%); }

.time-scrub {
  position: fixed;
  left: max(16px, var(--safe-left));
  right: max(16px, var(--safe-right));
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 6px);
  width: auto;
  z-index: 1060;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.4s var(--ease-out);
}
.time-scrub.hidden { display: none !important; }
.time-scrub:hover,
.time-scrub:focus-within,
body.scrubbing .time-scrub {
  opacity: 1;
}
.time-scrub-inner {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0 10px;
  padding: 5px 10px 6px 12px;
  background: rgba(26, 36, 48, 0.28);
  border: 1px solid transparent;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}
.time-scrub:hover .time-scrub-inner,
.time-scrub:focus-within .time-scrub-inner,
body.scrubbing .time-scrub-inner {
  background: rgba(16, 28, 41, 0.92);
  border-color: rgba(224, 192, 104, 0.28);
  box-shadow: 0 4px 18px rgba(26, 36, 48, 0.08);
}
.time-scrub-kicker {
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.26em;
  color: var(--ink-faint);
  line-height: 1;
  transition: color 0.2s ease;
}
body.scrubbing .time-scrub-kicker { color: var(--blush-deep); }
.time-scrub-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  line-height: 1;
  white-space: nowrap;
  min-width: 4.8em;
  transition: color 0.2s ease;
}
body.scrubbing .time-scrub-label { color: var(--graphite); }
.time-scrub-track {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
#time-scrub-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}
#time-scrub-range:focus { outline: none; }
#time-scrub-range:focus-visible {
  outline: 1.5px solid var(--blush);
  outline-offset: 2px;
  border-radius: 3px;
}
#time-scrub-range::-webkit-slider-runnable-track {
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(224, 192, 104, 0.35), rgba(26, 36, 48, 0.12));
}
#time-scrub-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(16, 28, 41, 0.95);
  box-shadow: none;
  transition: transform 0.18s var(--ease-out), background 0.18s ease, border-color 0.18s ease;
}
#time-scrub-range:active::-webkit-slider-thumb,
body.scrubbing #time-scrub-range::-webkit-slider-thumb {
  transform: scale(1.15);
  background: var(--blush);
  border-color: transparent;
}
#time-scrub-range::-moz-range-track {
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(224, 192, 104, 0.35), rgba(26, 36, 48, 0.12));
}
#time-scrub-range::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(16, 28, 41, 0.95);
  box-shadow: none;
}
.time-scrub-ends {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.2s ease;
}
.time-scrub:hover .time-scrub-ends,
.time-scrub:focus-within .time-scrub-ends,
body.scrubbing .time-scrub-ends {
  opacity: 0.85;
  max-height: 14px;
}
.time-scrub-reset {
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 2px;
  min-width: 44px;
  min-height: 44px;
  
  margin-block: -11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: color 0.2s ease, opacity 0.2s ease;
}
.time-scrub-reset:hover { color: var(--graphite); }
.time-scrub-reset:disabled {
  opacity: 0.28;
  cursor: default;
}
body.scrubbing .photo-pin-wrap,
body.scrubbing .story-card,
body.scrubbing .story-card.is-centered,
body.scrubbing .story-card:active,
body.scrubbing .feature-card {
  transform: none;
  transition: opacity 0.08s linear, border-color 0.12s ease, box-shadow 0.12s ease;
  will-change: auto;
}
body.scrubbing .story-card-media img {
  transform: none !important;
  transition: none;
}
body.scrubbing .story-card.is-centered .story-card-hud::after {
  display: none;
}

body.scrubbing .story-track {
  scroll-snap-type: none;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: auto;
  overflow-anchor: none;
}
body.scrubbing .photo-pin-wrap.is-far,
body.scrubbing .story-card.is-far {
  pointer-events: none;
}
body.manage-open .time-scrub,
body.intro-open .time-scrub {
  opacity: 0 !important;
  pointer-events: none;
  visibility: hidden;
}

#timeline {
  position: fixed;
  top: max(16px, calc(var(--safe-top) + 8px));
  bottom: max(16px, calc(var(--safe-bottom) + 8px));
  left: max(16px, calc(var(--safe-left) + 8px));
  width: min(300px, calc(100vw - 32px));
  z-index: 1600; display: flex; flex-direction: column;
  background: rgba(16, 28, 41, 0.97);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform 0.4s var(--ease-out), opacity 0.25s ease;
}
#timeline.collapsed {
  transform: translateX(calc(-100% - 24px));
  opacity: 0; pointer-events: none;
}
.timeline-handle {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line);
}
.timeline-grip {
  width: 18px; height: 3px; border-radius: 999px;
  background: rgba(240, 236, 220, 0.2); display: none;
}
.timeline-title {
  flex: 1; font-family: var(--font-display);
  font-size: 17px; letter-spacing: 0.12em; color: var(--graphite);
}
#timeline-close {
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
#timeline-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px; }
.timeline-empty {
  padding: 24px 12px; text-align: center; color: var(--ink-soft);
  font-family: var(--font-sans); font-size: 13px; line-height: 1.7;
}
.timeline-item {
  display: flex; gap: 10px; align-items: center; width: 100%;
  padding: 10px; border: none; border-radius: 8px; background: transparent;
  text-align: left; cursor: pointer; color: inherit; touch-action: manipulation;
  transition: background 0.18s ease;
}
.timeline-item:hover, .timeline-item.active { background: var(--blush-mist); }
.tl-cover img, .tl-ph {
  width: 48px; height: 48px; border-radius: 4px; object-fit: cover;
  flex-shrink: 0; background: #1b2a3a;
}
.tl-ph {
  display: flex; align-items: center; justify-content: center;
  color: var(--blush); font-size: 18px;
}
.tl-meta { min-width: 0; flex: 1; }
.tl-date {
  font-family: var(--font-sans); font-size: 11px; font-weight: 500;
  color: var(--blush-deep); letter-spacing: 0.1em;
}
.tl-title {
  margin-top: 2px; font-family: var(--font-serif);
  font-size: 13.5px; font-weight: 600; color: var(--graphite);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-place {
  margin-top: 2px; font-family: var(--font-sans);
  font-size: 11.5px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#manage-unlock.hidden, #member-pick.hidden, #cancel-edit-btn.hidden,
#draft-hint.hidden, #search-results.hidden, #plan-search-results.hidden,
#manage-list-section.hidden, #member-switch.hidden,
#manage-logout.hidden, .form-who.hidden,
.manage-step.hidden { display: none !important; }

body.manage-open #mobile-hero,
body.manage-open #story-rail,
body.manage-open #desktop-stage,
body.manage-open #empty-state { opacity: 0.28; pointer-events: none; }
body.manage-open #bottom-nav { opacity: 0.45; }
body.manage-open #manage-toggle { opacity: 1; pointer-events: auto; }
body.manage-open #desktop-fabs { opacity: 0.35; pointer-events: none; }
body.manage-open #manage-toggle-desktop { pointer-events: auto; opacity: 1; }

.pick-marker { background: none; border: none; }
.pick-pin {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(16, 28, 41, 0.95);
  border: 1.5px solid var(--blush-deep); color: var(--blush-deep);
  font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,0.16); line-height: 1;
}

#map-crosshair {
  position: fixed; left: 50%; top: 34%; z-index: 1640;
  width: 44px; height: 44px; margin: -22px 0 0 -22px; pointer-events: none;
}
#map-crosshair.hidden { display: none !important; }
body.manage-peek #map-crosshair { top: 30%; }
.crosshair-ring {
  position: absolute; inset: 0;
  border: 2px solid rgba(224, 192, 104, 0.9); border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(224, 192, 104, 0.25), 0 6px 18px rgba(0,0,0,0.3);
  background: rgba(224, 192, 104, 0.08);
}
.crosshair-dot {
  position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--blush-deep); box-shadow: 0 0 0 2px rgba(16, 28, 41, 0.9);
}

#map-pick-bar {
  position: fixed; left: 50%; z-index: 1660; transform: translateX(-50%);
  bottom: calc(48dvh + 12px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: max-content; max-width: min(340px, calc(100vw - 32px));
}
#map-pick-bar.hidden { display: none !important; }
.map-pick-tip {
  padding: 5px 12px; border-radius: 999px;
  background: rgba(16, 28, 41, 0.92);
  font-family: var(--font-sans); font-size: 11.5px; line-height: 1.4;
  color: var(--ink); letter-spacing: 0.04em; text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.map-pick-actions { display: flex; align-items: center; gap: 4px; }
#confirm-pick-btn {
  min-height: 46px; padding: 0 24px; border: none; border-radius: 999px;
  background: var(--blush); color: #16202c;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  letter-spacing: 0.18em;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22); cursor: pointer;
  touch-action: manipulation;
}
#cancel-pick-btn {
  min-height: 46px; border-radius: 999px;
  background: rgba(16, 28, 41, 0.9); box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
body.manage-peek #map-pick-bar { bottom: calc(40dvh + 12px + var(--safe-bottom)); }

body.kb-open #map-pick-bar,
body.kb-open #map-crosshair { display: none !important; }

#manage-unlock, #member-pick {
  position: fixed; inset: 0; z-index: 3600;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 14, 0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: max(20px, var(--safe-top)) 20px max(20px, var(--safe-bottom));
  animation: soft-in 0.25s ease;
  overflow-y: auto; overscroll-behavior: contain;
}
#manage-unlock.hidden, #member-pick.hidden { display: none !important; }

body.kb-open #manage-unlock,
body.kb-open #member-pick {
  bottom: var(--kb, 0px);
  align-items: flex-start;
  padding-top: 10px; padding-bottom: 10px;
}
body.kb-open .manage-unlock-card { padding: 16px 20px 16px; }
body.kb-open .manage-unlock-card h2 { font-size: 20px; }
body.kb-open .manage-unlock-card .manage-kicker,
body.kb-open .manage-unlock-card .manage-rule,
body.kb-open .member-pick-hint { display: none; }

body.kb-open .member-pick-list {
  margin-top: 4px; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px;
}
body.kb-open .member-choice {
  width: auto; min-width: 92px; min-height: 40px; padding: 0 16px; font-size: 16px;
}
body.kb-open .member-pw-label { margin-top: 10px; }
body.kb-open .manage-unlock-card input { margin-top: 6px; }
body.kb-open .manage-unlock-actions { margin-top: 10px; }
body.kb-open #manage-login-error,
body.kb-open #member-pick-error { margin-top: 6px; min-height: 0; }
.manage-unlock-card {
  width: min(340px, 100%); padding: 38px 30px 30px; text-align: center;
  background: rgba(16, 28, 41, 0.98); border: 1px solid rgba(224, 192, 104, 0.32);
  border-radius: var(--radius);
  outline: 1px solid rgba(224, 192, 104, 0.2);
  outline-offset: -5px;
  box-shadow: var(--shadow);
  animation: fade-up 0.4s var(--ease-out);
}
.manage-unlock-card h2 {
  font-family: var(--font-display); font-size: 26px; font-weight: 500;
  letter-spacing: 0.08em; color: var(--graphite);
}
.manage-unlock-card input {
  width: 100%; margin-top: 14px; padding: 13px 14px; font-size: 16px;
  text-align: center; border: 1px solid var(--line); border-radius: 4px;
  background: var(--panel); color: var(--ink); font-family: var(--font-sans);
}
.manage-unlock-card input:focus {
  outline: 2px solid rgba(224, 192, 104,0.35); border-color: var(--blush);
}
.member-pick-hint {
  margin-top: 10px;
  font-family: var(--font-serif); font-size: 13px; line-height: 1.55;
  color: rgba(240, 236, 220, 0.55); letter-spacing: 0.04em;
}
.member-pick-list {
  margin-top: 20px; display: flex; flex-direction: column; gap: 8px;
}
.member-choice {
  width: 100%; min-height: 46px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel); color: var(--graphite);
  font-family: var(--font-display); font-size: 18px; letter-spacing: 0.12em;
  cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease;
}
.member-choice.is-selected {
  border-color: var(--blush-deep);
  background: rgba(224, 192, 104,0.14);
  color: var(--graphite);
}
.member-pick-empty {
  font-family: var(--font-sans); font-size: 12px; color: #d96a5c; line-height: 1.5;
}
.member-pw-label {
  display: block; margin-top: 18px;
  font-family: var(--font-sans); font-size: 10px; letter-spacing: 0.22em;
  color: rgba(240, 236, 220, 0.45);
}
.manage-unlock-actions {
  margin-top: 16px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#manage-login-btn, #member-pick-confirm {
  min-width: 148px; min-height: 46px; border: none; border-radius: 999px;
  background: var(--blush); color: #16202c;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  letter-spacing: 0.2em; cursor: pointer;
}
#manage-login-error, #member-pick-error {
  margin-top: 10px; min-height: 18px; color: #d96a5c;
  font-family: var(--font-sans); font-size: 12px;
}
.form-who {
  margin-top: 6px;
  font-family: var(--font-sans); font-size: 11px;
  letter-spacing: 0.08em; color: rgba(240, 236, 220, 0.55);
}

#manage-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1650;
  width: min(400px, 100vw); display: flex; flex-direction: column;
  background: rgba(16, 28, 41, 0.99);
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 48px rgba(0,0,0,0.1);
  transition: transform 0.4s var(--ease-out);
  padding-bottom: var(--safe-bottom);
}
#manage-panel.hidden {
  transform: translateX(110%); pointer-events: none; box-shadow: none;
}

body.kb-open #manage-panel { bottom: var(--kb, 0px); }

@media (max-width: 900px) {
  body.kb-open .manage-head,
  body.short-view .manage-head { padding-top: 6px; padding-bottom: 6px; }
  body.kb-open .manage-head h2,
  body.short-view .manage-head h2 { margin-top: 0; font-size: 17px; }
  body.kb-open .manage-head .manage-kicker,
  body.kb-open .manage-head .form-who,
  body.short-view .manage-head .manage-kicker,
  body.short-view .manage-head .form-who { display: none; }
  body.kb-open .manage-stepper,
  body.short-view .manage-stepper { padding: 4px 16px 5px; }
  body.kb-open .manage-step-tab,
  body.short-view .manage-step-tab { min-height: 32px; padding: 3px 8px; }
  body.kb-open #manage-panel::before,
  body.short-view #manage-panel::before { display: none; }
  body.kb-open .manage-search-block,
  body.short-view .manage-search-block { padding-bottom: 8px; }
  body.kb-open .search-label,
  body.short-view .search-label { margin-bottom: 5px; }
  body.short-view .manage-actions { padding-top: 8px; padding-bottom: calc(8px + var(--safe-bottom)); }
  
  body.kb-open .manage-actions {
    display: flex !important;
    position: sticky;
    bottom: 0;
    z-index: 6;
    margin: 0;
    padding: 8px 16px calc(8px + var(--safe-bottom));
    background: rgba(16, 28, 41, 0.97);
    border-top: 1px solid var(--line);
    gap: 8px;
  }
  body.kb-open .manage-actions .secondary,
  body.kb-open .manage-actions #cancel-edit-btn {
    display: none;
  }
  body.kb-open .manage-actions #save-btn {
    flex: 1;
    min-height: 44px;
  }
}
.manage-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: max(18px, calc(var(--safe-top) + 10px)) max(16px, var(--safe-right)) 14px 22px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.manage-head h2 {
  margin-top: 4px; font-family: var(--font-display);
  font-size: 24px; font-weight: 500; letter-spacing: 0.06em;
  color: var(--graphite); line-height: 1.35;
}
.manage-head-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
#manage-close {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: transparent; color: var(--ink-soft); font-size: 15px; cursor: pointer;
}

.manage-stepper {
  display: flex; align-items: center; justify-content: center; gap: 0;
  padding: 10px 22px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: linear-gradient(180deg, #16232f 0%, #101c29 100%);
}
.manage-step-tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: transparent; cursor: pointer;
  padding: 6px 10px; min-height: 40px;
  font-family: var(--font-sans); color: var(--ink-faint);
  touch-action: manipulation;
  transition: color 0.2s ease;
}
.manage-step-tab .step-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.manage-step-tab .step-label {
  font-size: 12px; font-weight: 500; letter-spacing: 0.1em;
}
.manage-step-tab.is-active { color: var(--graphite); }
.manage-step-tab.is-active .step-num {
  background: var(--blush); color: #16202c; border-color: transparent;
}
.manage-step-tab.is-done .step-num {
  background: var(--blush-mist, rgba(224, 192, 104, 0.16));
  border-color: rgba(224, 192, 104,0.55);
  color: var(--blush-deep);
}
.step-rule {
  width: 28px; height: 1px; margin: 0 4px;
  background: var(--line); flex-shrink: 0;
}
.manage-step.hidden { display: none !important; }
.step-lead {
  margin: 2px 0 10px;
  font-family: var(--font-sans); font-size: 13px;
  color: var(--ink-soft); line-height: 1.55; letter-spacing: 0.02em;
}
.photo-zone {
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.photo-zone.is-empty {
  padding: 0;
  border: none;
  background: transparent;
}
.photo-zone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}
.photo-zone.is-empty .photo-zone-grid {
  grid-template-columns: 1fr;
}
.manage-form .photo-add-btn {
  display: flex !important; align-items: center; justify-content: center; gap: 8px;
  margin: 0 !important; letter-spacing: 0;
  min-height: 48px; min-width: 44px;
  padding: 10px 14px;
  border: 1.5px dashed rgba(224, 192, 104, 0.3);
  border-radius: 12px;
  background: linear-gradient(165deg, #16232f 0%, #121e2b 100%);
  cursor: pointer; text-align: left; font-weight: 500;
  touch-action: manipulation;
}
.photo-zone.is-empty .photo-add-btn {
  width: 100%;
}
.photo-zone.has-photos .photo-add-btn {
  flex-direction: column; gap: 2px;
  aspect-ratio: 1; min-height: 44px; padding: 6px 4px;
  border-radius: 8px; text-align: center;
}
.photo-add-plus {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; font-weight: 400; color: var(--blush-deep);
  background: rgba(224, 192, 104,0.22);
}
.photo-zone.has-photos .photo-add-plus { width: 24px; height: 24px; font-size: 20px; }
.photo-add-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.photo-add-text {
  font-family: var(--font-sans); font-size: 14px; font-weight: 600;
  letter-spacing: 0.06em; color: var(--graphite);
}
.photo-zone.has-photos .photo-add-text { font-size: 12px; letter-spacing: 0.08em; }
.photo-add-hint { margin: 0 !important; font-size: 12px; }
#manage-step-1 .photo-add-btn:hover,
#manage-step-1 .photo-add-btn:focus-within {
  border-color: rgba(224, 192, 104,0.65);
  background: linear-gradient(165deg, #16232f 0%, #101c29 100%);
}
.manage-form .photo-add-btn.is-hidden { display: none !important; }
#manage-step-1 #f-photos {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
#manage-step-1 { position: relative; }
.step-actions { margin-top: 12px; }
#manage-step-next {
  min-height: 46px; padding: 10px 28px;
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--blush); color: #16202c;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  letter-spacing: 0.14em; touch-action: manipulation;
}
#manage-step-back { min-height: 42px; }

.manage-search-block {
  flex-shrink: 0; padding: 0 0 14px;
  border-bottom: 1px solid var(--line); background: transparent;
  position: relative; z-index: 20;
  margin-bottom: 4px;
}
.manage-search-block .search-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 0 0 8px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  color: var(--ink); letter-spacing: 0.08em;
}
.manage-search-block .search-label .hint,
.manage-form .hint {
  font-weight: 400; color: var(--ink-faint); font-size: 11px;
}

.place-alt-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px;
  margin-top: 10px;
}
.link-action {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 34px; padding: 4px 8px;
  border: none; border-radius: 999px; background: transparent;
  color: var(--ink-soft); cursor: pointer; touch-action: manipulation;
  font-family: var(--font-sans); font-size: 12.5px; letter-spacing: 0.04em;
  transition: color 0.15s ease, background 0.15s ease;
}
.link-action svg { flex-shrink: 0; opacity: 0.75; }
.link-action:hover, .link-action:active {
  color: var(--graphite); background: rgba(224, 192, 104, 0.08);
}
.link-action:disabled { opacity: 0.5; cursor: wait; }
.link-action.is-on {
  color: var(--blush-deep); background: var(--blush-mist);
}
.locate-hint {
  margin: 6px 2px 0; font-size: 12px; line-height: 1.45; color: var(--ink-soft);
}
.locate-hint.warn { color: #a97a5e; }
.locate-hint.ok { color: var(--graphite); }

.place-picked {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 8px 12px; border-radius: 8px;
  background: var(--blush-mist); border: 1px solid rgba(224, 192, 104,0.4);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  color: var(--graphite); letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.place-picked::before {
  content: "✓"; flex-shrink: 0;
  color: var(--blush-deep); font-weight: 700; font-size: 12px;
}

.manage-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding: 8px 22px 32px; min-height: 0;
}
.manage-form label {
  display: block; margin: 16px 0 6px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  color: var(--ink); letter-spacing: 0.08em;
}
.hint-line {
  margin-top: 6px; color: var(--ink-faint);
  font-family: var(--font-sans); font-size: 12px; min-height: 16px;
}
#draft-hint { color: var(--blush-deep); }

.manage-form input[type="text"],
.manage-form input[type="search"],
.manage-form input[type="date"],
.manage-form textarea,
#place-search {
  width: 100%; max-width: 100%; padding: 14px 16px; font-size: 17px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  color: var(--ink); font-family: var(--font-sans);
}
#place-search,
#plan-place-search { min-height: 52px; box-shadow: var(--shadow-soft); }
#place-search::placeholder,
#plan-place-search::placeholder { color: var(--ink-faint); font-size: 15px; }
.manage-form textarea { resize: vertical; line-height: 1.7; min-height: 96px; }
.manage-form input:focus,
.manage-form textarea:focus,
#place-search:focus,
#plan-place-search:focus {
  outline: 2px solid rgba(224, 192, 104,0.35); border-color: var(--blush);
}
.manage-form input[type="file"] {
  font-size: 13px; padding: 6px 0; color: var(--ink-soft); font-family: var(--font-sans);
}
.manage-form input[type="date"] {
  min-height: 44px; appearance: none; -webkit-appearance: none;
}

.search-wrap { position: relative; }

#search-results,
#plan-search-results {
  margin-top: 8px;
  max-height: min(320px, max(150px, calc(var(--vvh, 100dvh) - 210px)));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-soft);
}
.search-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; border: none; background: var(--panel); color: var(--ink);
  padding: 14px; font-size: 14px; line-height: 1.4; cursor: pointer;
  border-bottom: 1px solid var(--line); font-family: var(--font-sans);
  min-height: 48px; touch-action: manipulation;
}
.search-item-title { font-weight: 600; color: var(--graphite); }
.search-item-sub {
  font-size: 12px; color: var(--ink-soft); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item:active { background: rgba(224, 192, 104, 0.08); }
.search-item.muted { color: var(--ink-faint); cursor: default; display: block; }

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
}
.photo-thumb img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
}
.photo-thumb.removing img { opacity: 0.3; filter: grayscale(1); }
.photo-thumb .remove-x {
  position: absolute; top: -4px; right: -4px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #d96a5c; color: #fff; font-size: 13px; line-height: 28px;
  text-align: center; cursor: pointer; padding: 0; border: none;
  touch-action: manipulation;
}
.photo-thumb .move-photo {
  position: absolute; bottom: -4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(16, 28, 41, 0.92); color: var(--blush);
  border: 1px solid rgba(224, 192, 104, 0.45);
  font-size: 14px; line-height: 22px; text-align: center;
  cursor: pointer; padding: 0;
  touch-action: manipulation;
}
.photo-thumb .move-l { left: -4px; }
.photo-thumb .move-r { right: -4px; }
.photo-thumb .photo-order {
  position: absolute; top: -4px; left: -4px;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: rgba(16, 28, 41, 0.92);
  border: 1px solid rgba(224, 192, 104, 0.5);
  color: var(--blush);
  font-family: var(--font-sans);
  font-size: 10px; font-weight: 600; line-height: 18px;
  text-align: center; pointer-events: none;
}
.photo-thumb .photo-order.is-cover {
  background: var(--blush); color: #16202c; border-color: transparent;
}
.photo-thumb.removing .photo-order { display: none; }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.manage-actions {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 12px max(16px, var(--safe-right)) calc(12px + var(--safe-bottom)) 22px;
  border-top: 1px solid var(--line); background: var(--panel);
}
.manage-actions.hidden { display: none !important; }
#save-btn, .manage-form button.secondary, .memory-item .actions button {
  border: none; border-radius: 999px; cursor: pointer;
  font-family: var(--font-sans); touch-action: manipulation;
}
#save-btn {
  min-height: 46px; padding: 10px 28px; background: var(--blush); color: #16202c;
  font-size: 13px; font-weight: 500; letter-spacing: 0.16em;
}
#save-btn:disabled, .manage-form button:disabled { opacity: 0.55; cursor: not-allowed; }
.manage-form button.secondary, button.secondary {
  background: var(--panel-2); color: var(--ink); padding: 8px 16px; font-size: 12px;
}
.manage-form button.small, button.small { padding: 6px 12px; font-size: 12px; }
button.danger {
  background: rgba(217, 106, 92, 0.14); color: #d96a5c; padding: 6px 12px; font-size: 12px;
  border: none; border-radius: 999px; cursor: pointer; font-family: var(--font-sans);
}
#form-msg { margin-top: 12px; font-size: 13px; min-height: 18px; font-family: var(--font-sans); }
#form-msg.ok { color: #5fc98f; }
#form-msg.err { color: #d96a5c; }

.manage-list-section {
  margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line);
}

#manage-panel.manage-list-only .manage-stepper,
#manage-panel.manage-list-only #manage-step-1,
#manage-panel.manage-list-only #manage-step-2,
#manage-panel.manage-list-only .manage-actions {
  display: none !important;
}
#manage-panel.manage-list-only .manage-list-section {
  margin-top: 4px; padding-top: 4px; border-top: none;
}
#manage-list-lead { margin: 2px 0 12px; }
#manage-panel:not(.manage-list-only) #manage-list-lead { display: none; }
.manage-list-section h3 {
  font-family: var(--font-display); font-size: 17px; font-weight: 500;
  letter-spacing: 0.12em; color: var(--graphite); margin-bottom: 8px;
}
.manage-list-section h3 span { color: var(--blush-deep); font-size: 13px; letter-spacing: 0; }
.memory-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.memory-item:last-child { border-bottom: none; }
.memory-item img.cover, .memory-item .cover-placeholder {
  width: 48px; height: 48px; object-fit: cover; border-radius: 4px; flex-shrink: 0;
}
.memory-item .cover-placeholder {
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
  color: var(--blush); font-size: 18px;
}
.memory-item .info { flex: 1; min-width: 0; }
.memory-item .info .t {
  font-family: var(--font-serif); font-size: 13.5px; font-weight: 600; color: var(--graphite);
}
.memory-item .info .s {
  font-family: var(--font-sans); font-size: 11.5px; color: var(--ink-soft); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.memory-item .actions { display: flex; gap: 6px; flex-shrink: 0; }
.empty-tip {
  color: var(--ink-faint); font-family: var(--font-sans);
  font-size: 13px; padding: 12px 0; line-height: 1.7;
}

@media (max-width: 900px) {
  
  :root {
    --safe-bottom: max(28px, constant(safe-area-inset-bottom, 0px));
    --safe-bottom: max(28px, env(safe-area-inset-bottom, 0px));
  }
  .mag-header, .desktop-stage, .desktop-fabs { display: none !important; }
  .mobile-hero, .story-rail { display: block; }
  .bottom-nav { display: grid; }
  
  .time-scrub {
    left: max(18px, var(--safe-left));
    right: max(18px, var(--safe-right));
    width: auto;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
    opacity: 0.85;
    visibility: visible;
    pointer-events: none;
    z-index: 1060;
  }
  .time-scrub:hover,
  .time-scrub:focus-within,
  body.scrubbing .time-scrub,
  body.mode-map .time-scrub {
    opacity: 1;
  }
  .time-scrub-inner { pointer-events: auto; }
  body.mode-map .time-scrub-inner { pointer-events: auto; }
  .time-scrub-inner {
    grid-template-columns: auto auto 1fr auto;
    gap: 0 8px;
    padding: 2px 10px 3px;
    background: rgba(16, 28, 41, 0.88);
    border: 1px solid rgba(224, 192, 104, 0.3);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  }
  body.mode-map .time-scrub-inner {
    background: rgba(16, 28, 41, 0.94);
  }
  .time-scrub-label { font-size: 11px; min-width: 4.2em; }
  .time-scrub-ends { display: none; }
  .time-scrub-kicker { letter-spacing: 0.2em; }
  .story-rail {
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 40px);
    height: 116px;
  }
  body.mode-map .story-rail {
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 38px);
    height: 96px;
  }
  body.mode-map .story-card {
    flex: 0 0 min(28vw, 104px);
    height: 78px;
  }
  body.mode-map .story-card-hud { height: 20px; font-size: 8.5px; }
}

@media (max-width: 640px) {
  #map { opacity: 1; }
  body.mode-map #map { opacity: 1; }
  .photo-pin-wrap,
  .photo-pin,
  .photo-pin-frame { width: 32px; height: 32px; }

  #timeline {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: min(58dvh, 480px);
    border-radius: 18px 18px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
  }
  #timeline.collapsed { transform: translateY(110%); opacity: 1; }
  .timeline-grip { display: block; }
  .timeline-handle {
    flex-direction: column; align-items: stretch; gap: 6px;
    padding-top: 10px; cursor: pointer;
  }
  .timeline-handle .timeline-grip { margin: 0 auto; }
  #timeline-close { position: absolute; right: 10px; top: 28px; }

  #manage-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    height: min(82dvh, 100%); max-height: min(82dvh, 100%);
    border-left: none; border-radius: 18px 18px 0 0;
    box-shadow: 0 -14px 48px rgba(0,0,0,0.14);
    transition: transform 0.4s var(--ease-out), height 0.28s ease, max-height 0.28s ease;
    padding-bottom: calc(var(--nav-h) * 0.3 + var(--safe-bottom));
  }
  #plan-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    height: min(72dvh, 100%); max-height: min(72dvh, 100%);
    border-left: none; border-radius: 18px 18px 0 0;
    box-shadow: 0 -14px 48px rgba(0,0,0,0.14);
    transition: transform 0.4s var(--ease-out), height 0.28s ease, max-height 0.28s ease;
    padding-bottom: calc(var(--nav-h) * 0.3 + var(--safe-bottom));
  }
  
  body.short-view #manage-panel,
  body.short-view #plan-panel {
    height: min(96dvh, 100%); max-height: min(96dvh, 100%);
  }
  
  body.manage-peek #manage-panel { height: min(40dvh, 100%); max-height: min(40dvh, 100%); }
  body.plan-peek #plan-panel { height: min(40dvh, 100%); max-height: min(40dvh, 100%); }
  #manage-panel.hidden,
  #plan-panel.hidden { transform: translateY(110%); }
  
  body.kb-open #manage-panel,
  body.kb-open #plan-panel {
    bottom: var(--kb, 0px);
    height: calc(var(--vvh, 100dvh) - 6px);
    max-height: calc(var(--vvh, 100dvh) - 6px);
    padding-bottom: 0;
    transition: none;
  }
  .manage-actions { padding: 10px 16px calc(10px + var(--safe-bottom)); }
  #manage-panel::before,
  #plan-panel::before {
    content: ""; display: block; width: 40px; height: 4px;
    margin: 10px auto 0; border-radius: 999px;
    background: rgba(240, 236, 220, 0.2); flex-shrink: 0;
  }
  .manage-head { padding: 8px 16px 10px; }
  .manage-head h2 { font-size: 20px; }
  .manage-stepper { padding: 8px 16px 10px; }
  .manage-search-block { padding: 0 0 12px; }
  .manage-scroll { padding: 4px 16px calc(32px + var(--safe-bottom)); }
  #place-search { min-height: 52px; }
  #search-results,
  #plan-search-results { max-height: min(300px, max(132px, calc(var(--vvh, 100dvh) - 250px))); }
  #map-crosshair { top: 22%; }
  body.manage-peek #map-crosshair { top: 24%; }
  body.plan-picking #map-crosshair { top: 24%; }
  #map-pick-bar { bottom: calc(40dvh + 10px + var(--safe-bottom)); }
  .memory-item { flex-wrap: wrap; }
  .memory-item .actions { width: 100%; justify-content: flex-end; }
  .memory-item .actions button { min-height: 40px; padding: 8px 14px; }

  #lightbox-prev, #lightbox-next {
    top: auto; bottom: max(28px, calc(var(--safe-bottom) + 16px)); transform: none;
  }

  
  .story-editorial { padding-bottom: 14px; }
  #panel-title { font-size: clamp(32px, 9vw, 44px); }
}

@media (min-width: 901px) {
  .mobile-hero, .story-rail, .bottom-nav { display: none !important; }
  .mag-header { display: flex; }
  .desktop-stage { display: block; }
  .desktop-fabs { display: flex; }
  
  .leaflet-right { right: clamp(88px, calc(3.5vw + 60px), 108px); }
  .leaflet-bottom { bottom: clamp(28px, 3.5vh, 40px); }
  body.mode-plans .desktop-stage { display: none; }
  .plans-view {
    top: calc(var(--mag-h) + 18px);
    bottom: max(28px, var(--safe-bottom));
    left: clamp(40px, 5vw, 72px);
    right: clamp(40px, 5vw, 72px);
    padding: 0;
  }
  
  .plans-view::before { display: none; }
  .plans-chrome {
    max-width: 320px;
    align-self: flex-start;
    padding: 18px 22px 20px;
    background: linear-gradient(180deg, #1b2a3a, #101c29);
    border: 1px solid rgba(224, 192, 104, 0.5);
    border-radius: 10px;
    box-shadow: 0 18px 44px rgba(9, 17, 26, 0.28);
  }
  .plans-rail { max-width: 560px; }
  .plan-detail {
    left: clamp(40px, 5vw, 72px);
    right: auto;
    bottom: max(28px, var(--safe-bottom));
    width: min(400px, 36vw);
  }
  .plan-pin-wrap { width: 80px; }
  .plan-pin { width: 15px; height: 15px; }
  .plan-pin-label { max-width: 88px; }
  .plan-pin-place { font-size: 11.5px; }

  
  #map { opacity: 1; }
  body.mode-map #map,
  body.mode-plans #map { opacity: 1; }
  #map-veil { display: none; }
  body.mode-map #map-veil { opacity: 0; }

  
  .time-scrub {
    top: calc(var(--mag-h) + 16px);
    right: clamp(40px, 5vw, 72px);
    left: auto;
    bottom: auto;
    width: min(300px, 26vw);
    opacity: 0.38;
    z-index: 1050;
  }
  body.mode-map .time-scrub {
    top: calc(var(--mag-h) + 16px);
    right: clamp(40px, 5vw, 72px);
    left: auto;
    transform: none;
    width: min(340px, 30vw);
    opacity: 0.5;
  }
  .time-scrub-inner {
    padding: 4px 10px 5px 12px;
    border-radius: 10px;
  }
  .time-scrub-label { font-size: 13px; }

  .photo-pin-wrap,
  .photo-pin,
  .photo-pin-frame { width: 38px; height: 38px; }

  body.manage-open #map-crosshair { left: calc(50% - min(200px, 50vw)); }
  body.manage-open #map-pick-bar {
    left: calc(50% - min(200px, 50vw)); bottom: 28px;
  }
  #manage-panel {
    width: min(420px, 36vw);
  }
  .us-sheet {
    left: auto; right: max(28px, var(--safe-right));
    bottom: max(100px, calc(var(--safe-bottom) + 80px));
    width: min(360px, 32vw); border-radius: var(--radius);
    padding-bottom: 0; max-height: min(70vh, 520px);
  }
  .us-sheet.collapsed { transform: translateY(12px); opacity: 0; }

  
  #panel.story-magazine {
    flex-direction: row; background: var(--paper);
  }
  .story-top {
    position: absolute; top: 0; left: 0; right: 0;
    background: var(--slate);
    mix-blend-mode: normal;
  }
  .story-editorial {
    width: min(440px, 36vw); flex-shrink: 0;
    display: flex; flex-direction: column; justify-content: center;
    padding: 100px 44px 48px;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    max-height: none;
  }
  .story-hero { flex: 1; }
  
  #panel-title {
    font-size: 32px;
    top: -100px;
    margin: -100px -44px 0;
    padding: 100px 44px 12px;
  }
  .comments-section { max-width: 100%; }
  .comments-list { max-height: min(32vh, 260px); }
}

@media (min-width: 1280px) {
  .feature-card {
    width: min(620px, 48vw);
  }
  .feature-body { padding: 26px 28px 10px; min-height: 260px; }
  .feature-media { min-height: 260px; }
  #feature-title { font-size: 30px; }
}

@media (max-height: 480px) {
  .mobile-sub, .mobile-stats { display: none; }
  #mobile-brand { font-size: 30px; }
  .story-rail { height: 110px; bottom: calc(var(--nav-h) + var(--safe-bottom) + 52px); }
  .story-card { height: 92px; flex-basis: min(30vw, 108px); width: min(30vw, 108px); }
  .story-card-hud { height: 20px; font-size: 8.5px; }
  .story-editorial { padding-top: 4px; padding-bottom: 8px; }
  #panel-title { font-size: 28px; }
}

@media (max-width: 640px) {
  .story-track {
    gap: 8px;
    padding-left: max(18px, var(--safe-left));
    padding-right: max(18px, var(--safe-right));
  }
  .story-card {
    flex-basis: min(34vw, 122px);
    width: min(34vw, 122px);
    border-radius: 8px;
  }
  body.mode-map .story-card {
    flex-basis: min(30vw, 108px);
  }
  .plans-lead { max-width: min(82vw, 300px); }
  .plan-pin-label { max-width: 70px; }
  .plan-pin-place {
    max-width: 70px;
    -webkit-line-clamp: 1;
  }
  .plan-pin-date { display: none; }
  .plan-detail-actions .us-btn { flex: 1 1 110px; }
}

@media (max-width: 900px) {
  .photo-pin-wrap,
  .photo-pin,
  .photo-pin-frame { width: 32px; height: 32px; }
  #map,
  #map-veil { transition: none; }
  .plans-empty,
  .plans-add-btn,
  .time-scrub-inner,
  .ghost-btn,
  #manage-unlock,
  #member-pick {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .time-scrub-inner { background: rgba(16, 28, 41, 0.94); }
  .photo-pin,
  .story-card,
  .plan-pin { contain: layout paint style; }
}

body.module-loading::before {
  content: "";
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 42%;
  height: 2px;
  background: var(--blush-deep);
  box-shadow: 0 0 10px rgba(224, 192, 104, 0.4);
  animation: module-progress 0.8s var(--ease-out) infinite alternate;
}

@keyframes module-progress {
  from { transform: translateX(-20%); opacity: 0.55; }
  to { transform: translateX(160%); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
  .photo-pin.is-featured::before { display: none; }
}

.love-toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%) translateY(10px);
  z-index: 14000;
  max-width: min(88vw, 280px);
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.92);
  color: var(--paper-pure);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.love-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (max-width: 900px) {
  .love-toast {
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .love-toast { transition: none; }
}
