:root {
  --bg: #050507;
  --soft: rgba(255,255,255,0.08);
  --text: #f8f2ea;
  --muted: rgba(248,242,234,0.72);
  --line: rgba(255,255,255,0.14);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 30% 15%, #241814 0%, #08080b 35%, #020203 100%);
  color: var(--text);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}
button, input { font: inherit; }
.screen {
  min-height: 100vh; min-height: 100svh;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.screen.active { display: flex; }
.glass {
  width: min(92vw, 460px); padding: 34px;
  border: 1px solid var(--line); border-radius: 28px;
  background: linear-gradient(145deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 120px rgba(0,0,0,.55);
  text-align: center;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .22em; font-size: 12px;
  color: var(--muted); margin: 0 0 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.centre { text-align: center; }
h1 {
  font-size: clamp(44px, 10vw, 84px);
  line-height: .92; margin: 0; letter-spacing: -0.06em;
}
h2 {
  font-size: clamp(42px, 7vw, 76px);
  letter-spacing: -0.06em; margin: 0 0 28px; text-align: center;
}
.subtitle, .muted { color: var(--muted); font-size: 18px; line-height: 1.45; }
.hero { text-align: center; transform: translateY(-2vh); }
.hero .subtitle { margin: 20px 0 38px; font-size: clamp(20px, 4vw, 28px); }
.password-form { display: grid; gap: 12px; margin-top: 24px; }
input {
  width: 100%; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(0,0,0,.34); color: var(--text);
  padding: 15px 18px; outline: none; text-align: center;
}
button, .primary-link {
  border: 0; border-radius: 999px; background: rgba(255,255,255,0.92);
  color: #111; padding: 14px 22px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.primary { min-width: 160px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.error { min-height: 20px; color: #ffb4b4; font-family: ui-sans-serif, system-ui; font-size: 14px; }
.hub-screen { align-items: flex-start; overflow: auto; }
.hub { width: min(100%, 1060px); padding-block: 8vh; }
.tiles, .story-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.featured { margin-bottom: 34px; }
.tile {
  min-height: 210px; padding: 28px; border-radius: 30px;
  border: 1px solid var(--line); background: rgba(255,255,255,.07);
  color: var(--text); display: flex; flex-direction: column; gap: 12px;
  align-items: flex-start; text-align: left;
}
.tile span { font-size: 28px; }
.tile strong { font-size: 26px; letter-spacing: -0.04em; }
.tile small, .section-heading p, .story-card small {
  color: var(--muted); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.story-section { width: 100%; margin-top: 34px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding-inline: 4px; }
.section-heading h3 { font-size: clamp(26px, 4vw, 42px); letter-spacing: -0.05em; margin: 0; }
.section-heading p { margin: 0; font-size: 14px; }
.story-card {
  position: relative; min-height: 190px; overflow: hidden; border: 1px solid var(--line);
  border-radius: 30px; background: rgba(255,255,255,.07); color: var(--text);
  padding: 22px; cursor: pointer; text-align: left; isolation: isolate;
}
.story-card::before {
  content: ""; position: absolute; inset: 0; background-image: var(--cover);
  background-size: cover; background-position: center; opacity: .34; transform: scale(1.04); z-index: -2;
}
.story-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.12), rgba(0,0,0,.78)); z-index: -1;
}
.story-card .badge {
  display: inline-flex; padding: 7px 11px; border-radius: 999px;
  background: rgba(0,0,0,.42); border: 1px solid var(--line);
  backdrop-filter: blur(10px); font-size: 12px; color: rgba(255,255,255,.82);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.story-card strong { display: block; margin-top: 54px; font-size: 26px; line-height: 1; letter-spacing: -0.04em; }
.story-card small { display: block; margin-top: 10px; color: rgba(255,255,255,.74); }
.empty-state {
  grid-column: 1 / -1; padding: 24px; border: 1px dashed var(--line);
  border-radius: 26px; color: var(--muted); text-align: center; font-family: ui-sans-serif, system-ui;
}
.slideshow-screen { position: fixed; inset: 0; overflow: hidden; background: #000; padding: 0; }
#slideImage {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; opacity: 0; transform: scale(1.035);
  transition: opacity .55s ease, transform 2.8s ease;
}
#slideImage.show { opacity: 1; transform: scale(1.075); }
.slideshow-screen::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.45), transparent 28%, transparent 58%, rgba(0,0,0,.7));
  pointer-events: none;
}
.caption {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  width: min(86vw, 720px); text-align: center; font-size: clamp(18px, 3.5vw, 34px);
  line-height: 1.15; z-index: 4; text-shadow: 0 2px 22px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .4s ease;
}
.caption.visible { opacity: 1; }
.cue {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  z-index: 5; padding: 10px 16px; border-radius: 999px;
  background: rgba(0,0,0,.36); border: 1px solid var(--line);
  font-family: ui-sans-serif, system-ui; color: rgba(255,255,255,.84); font-size: 14px;
  backdrop-filter: blur(10px); animation: cueFade 5s forwards;
}
@keyframes cueFade { 0%,72% { opacity: 1; } 100% { opacity: 0; pointer-events: none; } }
.topbar, .controls { position: absolute; z-index: 7; display: flex; align-items: center; gap: 12px; }
.topbar { top: max(18px, env(safe-area-inset-top)); right: 18px; left: 18px; justify-content: space-between; }
.controls { left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); }
.icon-btn, .save-btn, .story-title {
  background: rgba(0,0,0,.34); color: white; border: 1px solid var(--line); backdrop-filter: blur(12px);
}
.icon-btn { width: 46px; height: 46px; padding: 0; font-size: 24px; }
.save-btn { white-space: nowrap; font-family: ui-sans-serif, system-ui; }
.story-title { font-family: ui-sans-serif, system-ui; border-radius: 999px; padding: 10px 15px; max-width: 62vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.16); z-index: 8; }
.progress span { display: block; height: 100%; width: 0; background: rgba(255,255,255,.8); }
.progress.run span { animation: progress var(--duration, 2400ms) linear forwards; }
@keyframes progress { to { width: 100%; } }
.save-dialog { width: min(92vw, 430px); border: 1px solid var(--line); border-radius: 24px; background: rgba(12,12,15,.94); color: var(--text); padding: 26px; }
.save-dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(5px); }
.dialog-actions { display: grid; gap: 10px; margin-top: 20px; }
.dialog-actions button { background: rgba(255,255,255,.1); color: var(--text); border: 1px solid var(--line); }
.collection-links { max-height: 220px; overflow: auto; display: grid; gap: 8px; margin-top: 14px; font-family: ui-sans-serif, system-ui; }
.collection-links a { color: var(--text); border-bottom: 1px solid var(--line); padding: 8px 0; }
@media (max-width: 760px) {
  .tiles, .story-grid, .featured { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 6px; }
  .story-card, .tile { min-height: 160px; }
  .controls { width: calc(100vw - 24px); justify-content: center; }
  .save-btn { padding-inline: 16px; font-size: 14px; }
}

/* =========================
   CONSTELLATION THEME V1
   ========================= */

body {
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12) 1px, transparent 2px),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 1px, transparent 2px),
    radial-gradient(circle at 40% 70%, rgba(255,255,255,0.10) 1px, transparent 2px),
    radial-gradient(circle at 70% 80%, rgba(255,255,255,0.08) 1px, transparent 2px),
    linear-gradient(180deg,#08111f,#101b2f,#151c2f);
  background-size:
    300px 300px,
    400px 400px,
    500px 500px,
    600px 600px,
    100% 100%;
  background-attachment: fixed;
}

.hero,
header,
.welcome-card {
  background: rgba(10,15,25,0.72) !important;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
}

h1,h2,h3 {
  color: #f6f3e8;
}

.album-card,
.memory-card,
.photo-card {
  background: rgba(17,24,39,0.85) !important;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.25s ease;
}

.album-card:hover,
.memory-card:hover,
.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 25px rgba(255,255,255,0.08);
}

.album-card img,
.memory-card img,
.photo-card img {
  border-radius: 12px;
}

.site-title::after {
  content: " ✦";
  color: #d7c18b;
}


/* =========================
   CONSTELLATION PHASE 2
   Homepage motif + dashboard
   ========================= */

#constellationHero {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  margin: 24px auto 28px;
  min-height: 330px;
  border-radius: 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(214,184,113,.18), transparent 22%),
    radial-gradient(circle at 20% 70%, rgba(255,255,255,.08), transparent 26%),
    linear-gradient(145deg, #050811, #0b1324 58%, #06070c);
  border: 1px solid rgba(214,184,113,.28);
  box-shadow: 0 28px 90px rgba(0,0,0,.45);
}

.starfield {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,232,181,.95) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(255,255,255,.65) 0 1px, transparent 1.7px);
  background-size: 43px 43px, 77px 77px;
  opacity: .42;
}

.constellationLines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .9;
}

.constellationLines polyline {
  fill: none;
  stroke: rgba(214,184,113,.78);
  stroke-width: 1.4;
}

.constellationLines circle {
  fill: #e3c37c;
  filter: drop-shadow(0 0 8px rgba(227,195,124,.75));
}

.memoryDashboard {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 48px));
  text-align: center;
  padding: 28px 30px;
  border-radius: 26px;
  background: rgba(5,8,17,.68);
  border: 1px solid rgba(214,184,113,.38);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}

.dashboardKicker {
  margin: 0 0 10px;
  color: #d6b871;
  text-transform: uppercase;
  letter-spacing: .26em;
  font-size: 12px;
}

.memoryDashboard h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: .95;
  color: #f7f0df;
}

.memoryDashboard p:last-child {
  margin: 14px 0 0;
  color: rgba(247,240,223,.76);
  font-size: 15px;
}

@media (max-width: 760px) {
  #constellationHero {
    min-height: 300px;
    margin-top: 18px;
    border-radius: 24px;
  }

  .memoryDashboard {
    padding: 22px 20px;
  }
}
