:root {
  color-scheme: light;
  --paper: #fff7f3;
  --paper-strong: #fffdfb;
  --ink: #25303b;
  --muted: #726d75;
  --line: rgba(68, 45, 58, 0.13);
  --shadow: 0 24px 70px rgba(68, 45, 58, 0.14);
  --coral: #d85f6f;
  --teal: #0f8f8f;
  --leaf: #5d8b62;
  --sun: #d99f3a;
  --berry: #a44667;
  --night: #2b314d;
  --rose: #f1a5aa;
  --dusk: #6d5e92;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(122deg, rgba(216, 95, 111, 0.13), transparent 38%),
    linear-gradient(238deg, rgba(15, 143, 143, 0.1), transparent 42%),
    linear-gradient(90deg, rgba(15, 143, 143, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(164, 70, 103, 0.055) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px 28px 56px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  min-height: 76px;
  margin: 0 -12px 22px;
  padding: 12px;
  background: rgba(255, 247, 243, 0.91);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background:
    linear-gradient(135deg, var(--berry), var(--coral) 40%, var(--sun) 68%, var(--teal));
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(221, 93, 79, 0.2);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav-links a {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.95rem;
  border-radius: 999px;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

.top-actions,
.story-actions,
.data-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-field {
  position: relative;
}

.search-field input {
  width: 250px;
  height: 44px;
  padding: 0 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.search-field input:focus {
  border-color: rgba(15, 143, 143, 0.46);
  box-shadow: 0 0 0 4px rgba(15, 143, 143, 0.12);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.segmented {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.primary-button {
  gap: 8px;
  padding: 0 16px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--berry), var(--coral) 58%, var(--sun));
  box-shadow: 0 14px 32px rgba(164, 70, 103, 0.21);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.segmented:hover {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.segmented:focus-visible {
  outline: 3px solid rgba(229, 173, 63, 0.42);
  outline-offset: 2px;
}

.secondary-button,
.ghost-button,
.segmented {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.secondary-button {
  gap: 7px;
  font-weight: 700;
}

.ghost-button {
  color: var(--muted);
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  font-weight: 800;
}

.icon-button.active,
.secondary-button.active {
  color: #fff;
  background: var(--coral);
  border-color: var(--coral);
}

.auth-status {
  max-width: 120px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(360px, 0.72fr);
  gap: 28px;
  align-items: stretch;
  min-height: 640px;
  padding: 20px 0 46px;
}

.featured-media {
  position: relative;
  height: clamp(420px, 52vw, 620px);
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 18%, rgba(216, 95, 111, 0.28), transparent 34%),
    radial-gradient(circle at 80% 78%, rgba(15, 143, 143, 0.26), transparent 38%),
    var(--night);
  border: 1px solid rgba(31, 41, 51, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.featured-media::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(180deg, rgba(31, 41, 51, 0) 42%, rgba(43, 49, 77, 0.54)),
    linear-gradient(90deg, rgba(164, 70, 103, 0.24), rgba(31, 41, 51, 0) 48%),
    linear-gradient(20deg, rgba(216, 95, 111, 0.16), transparent 38%);
}

.featured-media img,
.featured-media video {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.media-ribbon {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
  background: rgba(31, 41, 51, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  backdrop-filter: blur(12px);
}

.featured-story {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  padding: 18px 0;
}

.couple-signature {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 253, 251, 0.7);
  border: 1px solid rgba(164, 70, 103, 0.14);
  border-radius: var(--radius);
}

.couple-signature strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.couple-signature span {
  color: var(--muted);
  font-size: 0.86rem;
}

.section-kicker {
  color: var(--berry);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.featured-story h1 {
  margin: 10px 0 12px;
  font-size: 3.1rem;
  line-height: 1.08;
}

.featured-story p {
  margin: 20px 0;
  color: #3a4650;
  font-size: 1.06rem;
  line-height: 1.9;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill,
.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.86rem;
  white-space: nowrap;
}

.tag-pill {
  color: #fff;
  background: linear-gradient(135deg, var(--dusk), var(--berry));
  border-color: transparent;
}

.story-actions {
  margin: 6px 0 18px;
}

.smart-note label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.stat-tile {
  min-height: 90px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-tile strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
}

.stat-tile span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.anniversary-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.anniversary-control input {
  max-width: 160px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
}

.filter-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 30px;
  border-top: 1px solid rgba(31, 41, 51, 0.08);
}

.filter-rail {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  min-height: 38px;
  padding: 0 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.filter-chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--berry), var(--coral));
  border-color: transparent;
}

.sort-control {
  display: flex;
  padding: 3px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.segmented.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 7px 18px rgba(31, 41, 51, 0.08);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-size: 2rem;
  line-height: 1.18;
}

.section-heading.compact h2 {
  font-size: 1.45rem;
}

.map-section,
.timeline-section,
.gallery-section,
.lower-grid {
  padding: 44px 0;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.map-board {
  position: relative;
  isolation: isolate;
  min-height: 470px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 42%),
    #eee6db;
  border: 1px solid rgba(68, 45, 58, 0.12);
  border-radius: var(--radius);
  box-shadow: 0 18px 45px rgba(31, 41, 51, 0.09);
}

.map-board::before {
  display: none;
  position: absolute;
  inset: 36px 48px;
  content: "";
  background:
    linear-gradient(45deg, transparent 48%, rgba(31, 41, 51, 0.1) 49%, rgba(31, 41, 51, 0.1) 51%, transparent 52%),
    linear-gradient(-18deg, transparent 44%, rgba(15, 143, 143, 0.2) 45%, rgba(15, 143, 143, 0.2) 47%, transparent 48%),
    linear-gradient(105deg, transparent 56%, rgba(221, 93, 79, 0.18) 57%, rgba(221, 93, 79, 0.18) 59%, transparent 60%);
  opacity: 0.78;
}

.map-board::after {
  display: none;
  position: absolute;
  right: 36px;
  bottom: 34px;
  width: 150px;
  height: 86px;
  content: "";
  background: repeating-linear-gradient(
    90deg,
    rgba(31, 41, 51, 0.12) 0 1px,
    transparent 1px 18px
  );
  border-top: 2px solid rgba(31, 41, 51, 0.18);
}

.map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(68, 45, 58, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(68, 45, 58, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 22% 18%, rgba(217, 159, 58, 0.11), transparent 28%),
    radial-gradient(circle at 74% 78%, rgba(164, 70, 103, 0.09), transparent 33%),
    #eee6db;
  background-size: 54px 54px, 54px 54px, auto, auto, auto;
}

.map-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-water {
  fill: url(#mapWater);
}

.map-shore {
  fill: none;
  stroke: rgba(76, 121, 126, 0.28);
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.map-park {
  fill: url(#mapPark);
  opacity: 0.72;
}

.map-district {
  fill: rgba(255, 253, 251, 0.5);
  stroke: rgba(68, 45, 58, 0.12);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
}

.map-district.soft {
  fill: rgba(255, 247, 243, 0.46);
}

.map-contour {
  fill: none;
  stroke: rgba(68, 45, 58, 0.1);
  stroke-dasharray: 1.2 2.2;
  stroke-width: 0.55;
  vector-effect: non-scaling-stroke;
}

.map-road {
  fill: none;
  stroke: rgba(255, 253, 251, 0.82);
  stroke-linecap: round;
  stroke-width: 0.9;
  filter: drop-shadow(0 1px 0 rgba(68, 45, 58, 0.11));
  vector-effect: non-scaling-stroke;
}

.map-road.major {
  stroke: rgba(255, 253, 251, 0.95);
  stroke-width: 1.55;
}

.map-road.minor {
  stroke: rgba(255, 253, 251, 0.66);
}

.map-memory-route {
  fill: none;
  stroke: rgba(164, 70, 103, 0.82);
  stroke-dasharray: 2.8 3.2;
  stroke-linecap: round;
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

.map-memory-route.glow {
  stroke: rgba(255, 247, 243, 0.86);
  stroke-dasharray: none;
  stroke-width: 3.2;
}

.map-compass {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #795465;
  background: rgba(255, 253, 251, 0.72);
  border: 1px solid rgba(68, 45, 58, 0.14);
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(31, 41, 51, 0.06);
}

.map-compass span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-top: 3px solid #a44667;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
}

.map-scale {
  position: absolute;
  right: 22px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-scale span {
  width: 88px;
  height: 7px;
  background: repeating-linear-gradient(
    90deg,
    rgba(68, 45, 58, 0.42) 0 14px,
    rgba(255, 253, 251, 0.72) 14px 28px
  );
  border: 1px solid rgba(68, 45, 58, 0.22);
}

.map-pin {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #fff;
  background: #a44667;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(68, 45, 58, 0.2);
  cursor: pointer;
}

.map-pin::after {
  position: absolute;
  bottom: -12px;
  left: 50%;
  width: 2px;
  height: 14px;
  content: "";
  background: rgba(31, 41, 51, 0.22);
  transform: translateX(-50%);
}

.map-pin.active {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--berry), var(--coral));
  box-shadow: 0 0 0 8px rgba(164, 70, 103, 0.1), 0 16px 28px rgba(68, 45, 58, 0.24);
}

.map-label {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  min-width: max-content;
  padding: 5px 8px;
  color: var(--ink);
  background: rgba(255, 253, 251, 0.88);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  transform: translateX(-50%);
}

.place-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.place-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 8px;
  text-align: left;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.place-item img,
.place-item video {
  width: 64px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}

.place-item strong {
  display: block;
  font-size: 0.98rem;
}

.place-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.place-item.active {
  border-color: rgba(15, 143, 143, 0.42);
  box-shadow: 0 0 0 4px rgba(15, 143, 143, 0.1);
}

.film-strip {
  display: grid;
  grid-auto-columns: minmax(210px, 260px);
  grid-auto-flow: column;
  gap: 12px;
  min-height: 238px;
  padding: 12px;
  overflow-x: auto;
  background:
    linear-gradient(90deg, rgba(164, 70, 103, 0.24), transparent 34%, rgba(15, 143, 143, 0.18)),
    #202833;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scrollbar-width: none;
  scroll-behavior: auto;
  scroll-snap-type: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.film-strip::-webkit-scrollbar {
  display: none;
}

.film-frame {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 214px;
  overflow: hidden;
  color: #fff;
  background: #111821;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  scroll-snap-align: start;
}

.film-frame::before,
.film-frame::after {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 9px;
  content: "";
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.72) 0 8px,
    transparent 8px 18px
  );
  opacity: 0.55;
}

.film-frame::before {
  top: 8px;
}

.film-frame::after {
  bottom: 8px;
}

.film-frame img,
.film-frame video {
  width: 100%;
  height: 155px;
  object-fit: cover;
}

.film-frame figcaption {
  position: relative;
  z-index: 1;
  padding: 11px 12px 17px;
}

.film-frame strong,
.film-frame span {
  display: block;
}

.film-frame span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.film-frame.active {
  border-color: var(--sun);
  box-shadow: 0 0 0 3px rgba(229, 173, 63, 0.3);
}

.time-axis {
  position: relative;
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding: 18px 8px 4px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.time-axis::before {
  position: absolute;
  top: 28px;
  right: 18px;
  left: 18px;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, rgba(164, 70, 103, 0.18), rgba(216, 95, 111, 0.42), rgba(15, 143, 143, 0.26));
}

.time-dot {
  position: relative;
  display: grid;
  flex: 0 0 112px;
  gap: 5px;
  min-height: 72px;
  padding: 22px 10px 10px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  scroll-snap-align: center;
}

.time-dot::before {
  position: absolute;
  top: 5px;
  left: 12px;
  width: 14px;
  height: 14px;
  content: "";
  background: #fff;
  border: 3px solid rgba(164, 70, 103, 0.42);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(255, 247, 243, 0.84);
}

.time-dot span,
.time-dot em {
  position: relative;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-dot span {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.time-dot em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.time-dot.active {
  background: rgba(255, 253, 251, 0.82);
  box-shadow: 0 10px 22px rgba(31, 41, 51, 0.08);
}

.time-dot.active::before {
  background: linear-gradient(135deg, var(--berry), var(--coral));
  border-color: #fff;
}

.album-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(255, 253, 251, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.album-detail {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  width: 100%;
  gap: 14px;
  align-items: center;
}

.album-detail-cover {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--night);
  border-radius: 6px;
}

.album-detail-cover img,
.album-detail-cover video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-detail-body {
  display: grid;
  gap: 4px;
}

.album-detail-body strong {
  color: var(--ink);
  font-size: 1.24rem;
}

.album-detail-body span {
  color: var(--muted);
  font-size: 0.9rem;
}

.album-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.danger-action {
  color: #a9364b;
}

.album-toolbar strong,
.album-toolbar span {
  display: block;
}

.album-toolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.folder-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 253, 251, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 35px rgba(31, 41, 51, 0.08);
}

.folder-open {
  display: grid;
  width: 100%;
  gap: 12px;
  padding: 10px;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.folder-card:hover {
  transform: translateY(-1px);
}

.folder-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.folder-delete,
.folder-rename,
.folder-add {
  color: #fff;
  background: rgba(37, 48, 59, 0.62);
  border-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.folder-add {
  width: auto;
  padding: 0 9px;
  background: rgba(164, 70, 103, 0.78);
  font-size: 0.82rem;
  font-weight: 800;
}

.folder-cover {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(164, 70, 103, 0.22), rgba(15, 143, 143, 0.16)),
    var(--night);
  border-radius: 6px;
}

.folder-cover span {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.folder-cover span:first-child:nth-last-child(1) {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

.folder-cover img,
.folder-cover video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.folder-body {
  display: grid;
  gap: 5px;
  padding: 0 2px 2px;
}

.folder-body strong {
  color: var(--ink);
  font-size: 1.06rem;
}

.folder-body span {
  color: var(--muted);
  font-size: 0.86rem;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.memory-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: rgba(255, 253, 251, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 35px rgba(31, 41, 51, 0.08);
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--night);
  cursor: pointer;
}

.card-media img,
.card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease;
}

.memory-card:hover .card-media img,
.memory-card:hover .card-media video {
  transform: scale(1.035);
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 27px;
  padding: 5px 8px;
  color: #fff;
  background: rgba(31, 41, 51, 0.58);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.card-body {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.card-body h3 {
  margin: 0;
  font-size: 1.12rem;
}

.card-body p {
  display: -webkit-box;
  min-height: 54px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tiny-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.tiny-button.active {
  color: #fff;
  background: var(--coral);
  border-color: var(--coral);
}

.tiny-button.danger:hover,
.danger-action:hover,
.folder-delete:hover {
  color: #fff;
  background: #a9364b;
  border-color: #a9364b;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.76fr);
  gap: 18px;
}

.tool-panel {
  padding: 18px;
  background: rgba(255, 253, 251, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stack-form,
.wish-form,
.memory-form {
  display: grid;
  gap: 12px;
}

.stack-form input,
.stack-form textarea,
.wish-form input,
.memory-form input,
.memory-form textarea,
.memory-form select {
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.smart-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 239, 236, 0.74));
  border: 1px solid rgba(216, 95, 111, 0.18);
  border-radius: var(--radius);
}

.smart-tips {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 7px;
}

.smart-tips span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--berry);
  background: rgba(216, 95, 111, 0.1);
  border: 1px solid rgba(216, 95, 111, 0.18);
  border-radius: 999px;
  font-size: 0.82rem;
}

.optional-details {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 253, 251, 0.58);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.optional-details summary {
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.optional-details[open] {
  background: rgba(255, 253, 251, 0.82);
}

.optional-details[open] summary {
  margin-bottom: 12px;
}

.upload-status {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--muted);
  background: rgba(255, 253, 251, 0.86);
  border: 1px solid rgba(216, 95, 111, 0.22);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.upload-track {
  height: 9px;
  overflow: hidden;
  background: rgba(68, 45, 58, 0.11);
  border-radius: 999px;
}

.upload-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--berry), var(--coral), var(--sun));
  border-radius: inherit;
  transition: width 180ms ease;
}

.memory-form.is-submitting {
  pointer-events: auto;
}

.stack-form textarea,
.memory-form textarea {
  resize: vertical;
}

.stack-form input:focus,
.stack-form textarea:focus,
.wish-form input:focus,
.memory-form input:focus,
.memory-form textarea:focus,
.memory-form select:focus {
  border-color: rgba(15, 143, 143, 0.48);
  box-shadow: 0 0 0 4px rgba(15, 143, 143, 0.12);
}

.wish-form {
  grid-template-columns: minmax(0, 1fr) 132px 42px;
  align-items: center;
}

.capsule-list,
.wish-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.capsule-item,
.wish-item {
  padding: 12px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.capsule-item {
  display: grid;
  gap: 8px;
}

.capsule-item strong,
.wish-item strong {
  display: block;
}

.capsule-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.capsule-item.locked p {
  filter: blur(4px);
  user-select: none;
}

.capsule-meta,
.wish-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.wish-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.wish-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.wish-item.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(31, 41, 51, 0.18);
  border-radius: var(--radius);
}

.modal,
.lightbox,
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: rgba(31, 41, 51, 0.56);
  backdrop-filter: blur(18px);
}

.modal.open,
.lightbox.open,
.auth-screen.open {
  display: grid;
}

.modal,
.auth-screen {
  place-items: center;
  padding: 24px;
}

.auth-screen {
  z-index: 110;
  background:
    linear-gradient(135deg, rgba(164, 70, 103, 0.42), rgba(15, 143, 143, 0.32)),
    rgba(31, 41, 51, 0.62);
}

.auth-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 22px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-panel h2 {
  margin: 5px 0 0;
  font-size: 1.9rem;
}

.auth-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-panel input {
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.auth-panel input:focus {
  border-color: rgba(216, 95, 111, 0.48);
  box-shadow: 0 0 0 4px rgba(216, 95, 111, 0.12);
}

.modal-panel {
  width: min(820px, 100%);
  max-height: min(820px, 92vh);
  padding: 22px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 4px 0 0;
  font-size: 1.7rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.memory-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-row {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: flex-start;
  gap: 9px !important;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.modal-actions {
  justify-content: flex-end;
  padding-top: 6px;
}

.lightbox {
  place-items: center;
  padding: 78px 86px 54px;
}

.lightbox-content {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(1120px, 100%);
  height: min(780px, 100%);
}

.lightbox-media {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: rgba(15, 18, 24, 0.72);
  border-radius: var(--radius);
}

.lightbox-media img,
.lightbox-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-caption {
  display: grid;
  gap: 8px;
  padding: 16px 0 0;
  color: #fff;
}

.lightbox-caption h3 {
  margin: 0;
  font-size: 1.35rem;
}

.lightbox-caption p {
  max-width: 860px;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.65;
}

.lightbox-thumbs {
  display: flex;
  max-width: min(860px, 100%);
  gap: 8px;
  padding-top: 4px;
  overflow-x: auto;
}

.lightbox-thumbs button {
  flex: 0 0 74px;
  height: 54px;
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  cursor: pointer;
}

.lightbox-thumbs button.active {
  border-color: var(--sun);
}

.lightbox-thumbs img,
.lightbox-thumbs video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox-close {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  z-index: 2;
  width: 50px;
  height: 66px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.24);
  font-size: 2rem;
  transform: translateY(-50%);
}

.lightbox-nav:hover {
  transform: translateY(-50%);
}

.lightbox-nav.prev {
  left: 24px;
}

.lightbox-nav.next {
  right: 24px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  max-width: min(360px, calc(100vw - 48px));
  padding: 13px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .nav-links {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .search-field,
  .search-field input {
    width: 100%;
  }

  .memory-stage,
  .map-layout,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .memory-stage {
    min-height: 0;
  }

  .featured-story {
    padding: 0;
  }

  .place-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-grid,
  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 14px 14px 44px;
  }

  .topbar {
    margin: 0 -4px 12px;
    padding: 10px 4px;
  }

  .brand {
    min-width: 0;
  }

  .nav-links a {
    padding: 9px 10px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 42px;
  }

  .top-actions .primary-button {
    grid-column: 1 / -1;
  }

  .auth-status {
    display: none;
  }

  #logoutBtn {
    grid-column: 1 / -1;
  }

  .memory-stage {
    gap: 18px;
    padding-top: 8px;
  }

  .featured-media,
  .featured-media img,
  .featured-media video {
    height: 360px;
  }

  .featured-story h1 {
    font-size: 2.25rem;
  }

  .stats-grid,
  .memory-grid,
  .folder-grid,
  .place-list,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .album-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .album-detail {
    grid-template-columns: 1fr;
  }

  .album-detail-cover {
    width: 100%;
  }

  .album-detail-actions {
    justify-content: stretch;
  }

  .album-detail-actions > * {
    flex: 1;
  }

  .smart-note {
    grid-template-columns: 1fr;
  }

  .filter-band,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-control {
    width: max-content;
  }

  .section-heading h2 {
    font-size: 1.65rem;
  }

  .map-board {
    min-height: 390px;
  }

  .time-dot {
    flex-basis: 98px;
  }

  .wish-form {
    grid-template-columns: 1fr 42px;
  }

  .wish-form input[type="month"] {
    grid-column: 1 / -1;
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    padding: 16px;
  }

  .lightbox {
    padding: 72px 12px 42px;
  }

  .lightbox-nav {
    top: auto;
    bottom: 18px;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    transform: none;
  }

  .lightbox-nav:hover {
    transform: none;
  }

  .lightbox-nav.prev {
    left: 18px;
  }

  .lightbox-nav.next {
    right: 18px;
  }

  .lightbox-thumbs button {
    flex-basis: 62px;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
