:root {
  --paper: #f6efe3;
  --paper-2: #fffaf0;
  --ink: #2f2923;
  --muted: #756b5e;
  --line: rgba(58, 48, 38, .16);
  --accent: #b86b4b;
  --accent-dark: #7f412e;
  --sage: #81906f;
  --blue: #6c879a;
  --shadow: 0 18px 45px rgba(73, 55, 37, .16), 0 2px 0 rgba(255,255,255,.7) inset;
  --serif: 'Libre Baskerville', Georgia, serif;
  --sans: 'Source Sans 3', system-ui, sans-serif;
  --hand: 'Kalam', cursive;
  font-family: var(--sans);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(184, 107, 75, .12), transparent 28rem),
    radial-gradient(circle at 88% 22%, rgba(129, 144, 111, .18), transparent 25rem),
    linear-gradient(135deg, #f4eadb 0%, #fff8eb 46%, #eadfcf 100%);
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(93,72,51,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93,72,51,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 72%);
}
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)' opacity='.45'/%3E%3C/svg%3E");
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.container { position: relative; width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }
.scrapbook-card {
  position: relative;
  background: rgba(255, 250, 240, .88);
  border: 1px solid rgba(92, 70, 48, .14);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.tape {
  position: absolute;
  width: 90px;
  height: 30px;
  top: -15px;
  background: rgba(225, 205, 165, .72);
  border: 1px solid rgba(120, 98, 62, .12);
  box-shadow: 0 4px 9px rgba(60,40,25,.08);
  transform: rotate(-4deg);
}
.tape-left { left: 34px; }
.tape-right { right: 34px; transform: rotate(5deg); }
h1, h2, h3 { margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font-family: var(--serif); font-size: clamp(2rem, 4.4vw, 4.2rem); line-height: 1.04; letter-spacing: -.045em; }
h2 { font-family: var(--serif); font-size: clamp(1.45rem, 2.6vw, 2.35rem); line-height: 1.1; letter-spacing: -.035em; }
h3 { font-family: var(--serif); font-size: 1.35rem; }
p { line-height: 1.6; }
.muted { color: var(--muted); margin: 6px 0 0; }
.small-label { margin: 0 0 10px; color: var(--accent-dark); font-family: var(--hand); font-size: 1.05rem; font-weight: 700; }
.alert, .success { padding: 12px 14px; border-radius: 14px; font-weight: 700; }
.alert { color: #7a251d; background: rgba(180,58,42,.10); border: 1px solid rgba(180,58,42,.26); }
.success { color: #425c29; background: rgba(129,144,111,.14); border: 1px solid rgba(129,144,111,.28); }
.primary-button, .logout {
  border: 1px solid rgba(69, 48, 32, .18);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 20px;
  background: var(--ink);
  color: #fffaf0;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.primary-button:hover, .logout:hover { transform: translateY(-2px); background: var(--accent-dark); box-shadow: 0 12px 24px rgba(73,55,37,.18); }

/* Login */
.container:has(.login-page) {
  width: min(1240px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: clamp(18px, 4vw, 44px) 0;
}
.login-page {
  position: relative;
  isolation: isolate;
  min-height: min(780px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, .78fr);
  gap: clamp(22px, 4vw, 52px);
  align-items: center;
  border-radius: 34px;
  padding: clamp(18px, 3vw, 34px);
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255,255,255,.38), rgba(255,250,240,.16)),
    radial-gradient(circle at 18% 16%, rgba(238, 195, 124, .32), transparent 24rem),
    radial-gradient(circle at 86% 76%, rgba(129, 144, 111, .26), transparent 24rem),
    linear-gradient(135deg, #f5ebd7 0%, #fbf5e7 42%, #d9d0b8 100%);
  box-shadow: 0 28px 90px rgba(75, 56, 34, .18), inset 0 0 0 1px rgba(255,255,255,.58);
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: .34;
  background-image: var(--login-hero-image, none), url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)' opacity='.42'/%3E%3C/svg%3E");
  background-size: var(--login-hero-image-size, cover), 240px 240px;
  background-position: center;
  mix-blend-mode: multiply;
}
.login-page::after {
  content: '';
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 33px;
  background: linear-gradient(90deg, rgba(255,255,255,.40), transparent 48%, rgba(255,255,255,.28));
  pointer-events: none;
}
.login-glow {
  position: absolute;
  z-index: -1;
  width: 340px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(24px);
  opacity: .42;
  pointer-events: none;
}
.login-glow-one { left: -110px; top: -100px; background: #eebc76; }
.login-glow-two { right: -130px; bottom: -110px; background: #8fa179; }
.album-intro {
  min-height: 610px;
  display: grid;
  align-content: space-between;
  gap: 28px;
  padding: clamp(18px, 3vw, 32px);
}
.album-intro-copy { max-width: 660px; }
.album-intro .small-label, .login-box .small-label { margin-bottom: 12px; }
.album-intro h1 { font-size: clamp(3.1rem, 7vw, 6.8rem); letter-spacing: -.07em; max-width: 760px; }
.login-subtitle { max-width: 560px; margin: 18px 0 0; color: #5f5547; font-size: clamp(1.1rem, 1.7vw, 1.35rem); line-height: 1.55; }
.login-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 28px 0 0;
  list-style: none;
}
.login-badges li {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(92, 70, 48, .15);
  border-radius: 999px;
  background: rgba(255, 250, 240, .62);
  box-shadow: 0 8px 20px rgba(73,55,37,.08);
  color: #4b4034;
  font-weight: 800;
  backdrop-filter: blur(8px);
}
.polaroid-collage {
  position: relative;
  min-height: 320px;
  width: min(620px, 100%);
  margin-top: 8px;
}
.hero-polaroid {
  position: absolute;
  display: grid;
  align-content: end;
  width: clamp(128px, 15vw, 184px);
  height: clamp(168px, 19vw, 238px);
  padding: 10px 10px 26px;
  border: 1px solid rgba(83, 63, 41, .10);
  border-radius: 4px;
  background:
    linear-gradient(to bottom, var(--photo-tone-a), var(--photo-tone-b)) content-box,
    #fffdf7;
  box-shadow: 0 20px 44px rgba(72, 52, 31, .20), 0 2px 0 rgba(255,255,255,.86) inset;
  transition: transform .18s ease, box-shadow .18s ease;
}
.hero-polaroid::before {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  top: 14px;
  height: 58%;
  border-radius: 3px;
  background:
    radial-gradient(circle at 26% 24%, rgba(255,255,255,.45), transparent 26%),
    linear-gradient(135deg, rgba(255,255,255,.16), transparent 45%);
}
.hero-polaroid::after {
  content: '';
  position: absolute;
  width: 68px;
  height: 23px;
  left: 50%;
  top: -12px;
  translate: -50% 0;
  rotate: -4deg;
  background: rgba(228, 205, 157, .74);
  border: 1px solid rgba(120, 98, 62, .10);
}
.hero-polaroid span {
  position: relative;
  z-index: 1;
  justify-self: center;
  color: #5d4b3c;
  font-family: var(--hand);
  font-size: 1.04rem;
  font-weight: 700;
}
.hero-polaroid:hover { transform: translateY(-7px) rotate(0deg) scale(1.015); box-shadow: 0 28px 58px rgba(72,52,31,.24); }
.hero-polaroid-one { --photo-tone-a: #ddb083; --photo-tone-b: #8ba083; left: 4%; bottom: 6px; rotate: -8deg; z-index: 2; }
.hero-polaroid-two { --photo-tone-a: #efe0b6; --photo-tone-b: #bc7959; left: 28%; top: 12px; rotate: 6deg; z-index: 3; }
.hero-polaroid-three { --photo-tone-a: #a5b6a2; --photo-tone-b: #ead4ad; right: 8%; bottom: 28px; rotate: 9deg; z-index: 2; }
.hero-polaroid-four { --photo-tone-a: #9d8871; --photo-tone-b: #d8c6a4; left: 51%; bottom: -4px; rotate: -3deg; z-index: 4; }
.hero-polaroid-five { --photo-tone-a: #caa47b; --photo-tone-b: #7f8f73; right: 0; top: 34px; rotate: -7deg; z-index: 1; }
.login-box {
  position: relative;
  border-radius: 30px;
  padding: clamp(26px, 4vw, 44px);
  background: rgba(255, 253, 247, .78);
  border: 1px solid rgba(92, 70, 48, .14);
  box-shadow: 0 28px 70px rgba(72,52,31,.20), 0 1px 0 rgba(255,255,255,.82) inset;
  backdrop-filter: blur(18px);
  animation: login-card-in .55s ease both;
}
.login-box::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 22px;
  border: 1px solid rgba(184, 107, 75, .10);
  pointer-events: none;
}
.login-card-header { position: relative; }
.login-box h2 { margin-bottom: 8px; }
.login-box .muted { max-width: 34ch; }
.login-form { display: grid; gap: 12px; margin-top: 24px; }
.login-form label { margin-top: 4px; }
.input-shell {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  min-height: 54px;
  border: 1px solid rgba(69, 48, 32, .16);
  border-radius: 17px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 22px rgba(73,55,37,.06), inset 0 1px 0 rgba(255,255,255,.92);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.input-shell:focus-within {
  border-color: rgba(184,107,75,.68);
  box-shadow: 0 0 0 4px rgba(184,107,75,.13), 0 14px 28px rgba(73,55,37,.10);
  transform: translateY(-1px);
}
.input-shell span {
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-weight: 900;
}
.input-shell input {
  border: 0;
  border-radius: 17px;
  padding-left: 0;
  background: transparent;
  box-shadow: none;
}
.input-shell input:focus { box-shadow: none; }
.login-submit {
  min-height: 52px;
  margin-top: 10px;
  border-radius: 17px;
  background: linear-gradient(135deg, #2f2923, #6f3d2d 55%, #a65f43);
  box-shadow: 0 16px 32px rgba(127, 65, 46, .22);
}
.login-submit:hover { background: linear-gradient(135deg, #2f2923, #7f412e 48%, #b86b4b); }
.login-box .alert {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 20px 0 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(180,58,42,.13), rgba(255,250,240,.66));
}
.login-box .alert span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(122,37,29,.12);
}
.security-note {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 20px 0 0;
  color: #6e6254;
  font-size: .93rem;
  line-height: 1.45;
}
.security-note span { color: var(--accent-dark); font-weight: 900; }
@keyframes login-card-in {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
form { display: grid; gap: 15px; margin-top: 20px; }
label { display: grid; gap: 7px; color: var(--ink); font-weight: 800; font-size: .92rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(69, 48, 32, .18);
  border-radius: 13px;
  padding: 12px 13px;
  background: rgba(255,255,255,.72);
  color: var(--ink);
  outline: none;
}
textarea { resize: vertical; min-height: 82px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(184,107,75,.13); }

/* App */
.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;
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { font-family: var(--hand); font-size: 1.55rem; font-weight: 700; text-decoration: none; }
.brand-with-logo { display: inline-flex; align-items: center; gap: 10px; }
.brand-with-logo img, .app-logo-mark img { width: 42px; height: 42px; display: block; }
.app-logo-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(255,253,247,.72);
  border: 1px solid rgba(92,70,48,.12);
  box-shadow: 0 12px 26px rgba(73,55,37,.12), inset 0 1px 0 rgba(255,255,255,.8);
  margin-bottom: 18px;
}
.login-logo-mark img { width: 46px; height: 46px; }
.dashboard-hero {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  padding: clamp(22px, 4vw, 42px);
  background:
    radial-gradient(circle at 78% 18%, rgba(255,255,255,.58), transparent 18rem),
    radial-gradient(circle at 14% 86%, rgba(184, 107, 75, .16), transparent 22rem),
    linear-gradient(135deg, rgba(255,250,240,.94), rgba(239,226,204,.86));
  border: 1px solid rgba(92, 70, 48, .14);
  box-shadow: var(--shadow);
}
.dashboard-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .18;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='dashgrain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23dashgrain)' opacity='.4'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.dashboard-topbar { position: relative; z-index: 1; margin-bottom: clamp(30px, 5vw, 58px); }
.dashboard-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  align-items: end;
  gap: clamp(24px, 5vw, 58px);
}
.dashboard-copy p:not(.small-label) { max-width: 650px; color: var(--muted); font-size: clamp(1.04rem, 1.8vw, 1.22rem); }
.dashboard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
}
.dashboard-badges li, .section-count, .count-pill, .video-badge, .filter-button {
  border: 1px solid rgba(92, 70, 48, .14);
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  color: #4b4034;
  font-weight: 800;
}
.dashboard-badges li { padding: 8px 13px; box-shadow: 0 8px 18px rgba(73,55,37,.07); }
.dashboard-collage { position: relative; min-height: 265px; }
.dash-polaroid {
  position: absolute;
  width: 160px;
  height: 205px;
  padding: 9px 9px 34px;
  border: 1px solid rgba(73,55,37,.10);
  border-radius: 5px;
  background: linear-gradient(135deg, #d8b28a, #91a17e) content-box, #fffdf7;
  box-shadow: 0 18px 38px rgba(73,55,37,.20), 0 1px 0 rgba(255,255,255,.8) inset;
  transition: transform .16s ease, box-shadow .16s ease;
}
.dash-polaroid:hover { transform: translateY(-5px) rotate(0deg) scale(1.015); box-shadow: 0 24px 48px rgba(73,55,37,.24); }
.dash-polaroid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dash-polaroid span { position: absolute; left: 12px; right: 12px; bottom: 9px; text-align: center; color: #5d4b3c; font-family: var(--hand); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-polaroid::after { content: ''; position: absolute; width: 62px; height: 22px; top: -11px; left: 50%; translate: -50% 0; rotate: -5deg; background: rgba(228,205,165,.7); border: 1px solid rgba(120,98,62,.12); }
.dash-polaroid-1 { left: 14px; bottom: 16px; rotate: -7deg; z-index: 2; }
.dash-polaroid-2 { left: 128px; top: 4px; rotate: 6deg; z-index: 3; }
.dash-polaroid-3 { right: 8px; bottom: 4px; rotate: 3deg; z-index: 1; }
.dash-polaroid-placeholder:nth-child(odd) { background: linear-gradient(135deg, #d9c0a0, #8ea077) content-box, #fffdf7; }
.dash-polaroid-placeholder:nth-child(even) { background: linear-gradient(135deg, #e5d2a7, #b8795c) content-box, #fffdf7; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 26px;
}
.stat-card {
  border-radius: 22px;
  padding: 18px;
  background: rgba(255,250,240,.82);
  border: 1px solid rgba(92,70,48,.12);
  box-shadow: 0 12px 28px rgba(73,55,37,.10), inset 0 1px 0 rgba(255,255,255,.78);
}
.stat-card span, .stat-card small { display: block; color: var(--muted); font-weight: 800; }
.stat-card strong { display: block; margin: 5px 0 2px; font-family: var(--serif); font-size: clamp(1.55rem, 3vw, 2.2rem); line-height: 1.05; overflow-wrap: anywhere; }
.stat-card-current strong { font-size: clamp(1.16rem, 2vw, 1.42rem); }
.memory-widgets {
  display: grid;
  grid-template-columns: 1.05fr .95fr 1fr;
  gap: 16px;
  margin: 0 0 28px;
}
.memory-widget {
  min-height: 220px;
  border-radius: 24px;
  padding: 20px;
  background: rgba(255,250,240,.82);
  border: 1px solid rgba(92,70,48,.12);
  box-shadow: 0 14px 32px rgba(73,55,37,.10), inset 0 1px 0 rgba(255,255,255,.72);
}
.widget-heading h2 { font-size: clamp(1.22rem, 2.2vw, 1.65rem); }
.favorite-strip, .anniversary-list { display: grid; gap: 10px; margin-top: 14px; }
.favorite-chip {
  position: relative;
  min-height: 96px;
  display: grid;
  align-content: end;
  gap: 2px;
  overflow: hidden;
  border-radius: 18px;
  padding: 14px;
  color: #fffaf0;
  text-decoration: none;
  background:
    linear-gradient(to top, rgba(47,41,35,.82), rgba(47,41,35,.12)),
    var(--favorite-image),
    linear-gradient(135deg, #d8b28a, #91a17e);
  background-size: cover;
  background-position: center;
  box-shadow: 0 12px 24px rgba(73,55,37,.14);
}
.favorite-chip strong, .favorite-chip span { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favorite-chip span { opacity: .82; font-size: .82rem; font-weight: 800; }
.favorite-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,.54);
  border: 1px solid rgba(92,70,48,.12);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}
.anniversary-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.50);
  border: 1px solid rgba(92,70,48,.10);
}
.anniversary-item span { color: var(--accent-dark); font-weight: 900; font-size: .82rem; }
.chronicle-list { list-style: none; display: grid; gap: 10px; padding: 0; margin: 14px 0 0; }
.chronicle-list li {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 0 0 0 22px;
}
.chronicle-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-dark);
  box-shadow: 0 0 0 5px rgba(184,107,75,.12);
}
.chronicle-list span { color: var(--muted); font-size: .76rem; font-weight: 900; }
.chronicle-list strong { font-size: .94rem; overflow-wrap: anywhere; }
.chronicle-list small { color: var(--muted); font-weight: 700; }
.upload-panel { margin: 24px 0 36px; border-radius: 26px; padding: clamp(22px, 3vw, 34px); }
.dashboard-upload {
  background: rgba(255,250,240,.86);
  border: 1px solid rgba(92,70,48,.14);
  box-shadow: var(--shadow);
}
.upload-intro { max-width: 720px; }
.flash-stack { margin-top: 16px; }
.dashboard-upload-form {
  grid-template-columns: minmax(260px, 1.25fr) minmax(190px, .8fr) minmax(190px, .85fr) auto;
  align-items: stretch;
  gap: 14px;
}
.dropzone-field { gap: 10px; }
.dropzone-box {
  position: relative;
  min-height: 116px;
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1.5px dashed rgba(127,65,46,.34);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.74), rgba(246,239,227,.80));
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.dropzone-box:hover, .dropzone-box:focus-within { transform: translateY(-2px); border-color: rgba(127,65,46,.62); box-shadow: 0 16px 30px rgba(73,55,37,.12); }
.dropzone-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: #fffaf0; font-size: 1.45rem; }
.dropzone-copy { display: grid; gap: 3px; }
.dropzone-copy small { color: var(--muted); font-weight: 700; }
.dropzone-box input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-choice-card { display: grid; align-content: end; min-height: 116px; padding: 16px; border-radius: 22px; background: rgba(255,255,255,.45); border: 1px solid rgba(92,70,48,.10); }
.upload-choice-new { background: rgba(129,144,111,.10); }
.upload-submit { align-self: end; min-height: 54px; padding-inline: 24px; background: linear-gradient(135deg, var(--ink), var(--accent-dark)); box-shadow: 0 14px 26px rgba(73,55,37,.16); }
.section-title { margin: 30px 0 16px; }
.section-title h2 { margin-top: -4px; }
.section-title-row { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.section-count, .count-pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; font-size: .84rem; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.album-create-card {
  margin: -4px 0 18px;
  border-radius: 22px;
  padding: 16px;
  background: rgba(255,250,240,.74);
  border: 1px solid rgba(92,70,48,.12);
  box-shadow: 0 10px 24px rgba(73,55,37,.08);
}
.album-create-form { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; margin: 0; }
.album-card {
  position: relative;
  border-radius: 24px;
  padding: 12px;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.dashboard-album-card { background: rgba(255,250,240,.82); border: 1px solid rgba(92,70,48,.12); box-shadow: 0 10px 24px rgba(73,55,37,.10); }
.album-card:hover { transform: translateY(-5px); box-shadow: 0 22px 45px rgba(73,55,37,.18); }
.dashboard-album-card.is-active { border-color: rgba(127,65,46,.48); box-shadow: 0 0 0 4px rgba(184,107,75,.12), 0 18px 38px rgba(73,55,37,.16); }
.album-open-link { display: block; color: inherit; text-decoration: none; }
.album-cover { height: 176px; border-radius: 18px; overflow: hidden; margin-bottom: 13px; background: linear-gradient(135deg, #dfc7a5, #b7c0a0); display: grid; place-items: center; color: rgba(47,41,35,.55); font-size: 2.2rem; font-family: var(--hand); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .22s ease; }
.album-card:hover .album-cover img { transform: scale(1.04); }
.album-card-meta { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.album-card strong { display: block; font-family: var(--serif); font-size: 1.08rem; line-height: 1.18; }
.album-card small { color: var(--muted); font-weight: 800; white-space: nowrap; }
.album-details { display: flex; gap: 10px; margin: 12px 0 0; }
.album-details div { flex: 1; border-radius: 14px; padding: 8px 10px; background: rgba(255,255,255,.46); border: 1px solid rgba(92,70,48,.08); }
.album-details dt { color: var(--muted); font-size: .72rem; font-weight: 900; }
.album-details dd { margin: 2px 0 0; font-weight: 900; }
.album-menu { position: absolute; right: 20px; top: 20px; z-index: 5; }
.album-menu summary {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  border-radius: 999px;
  background: rgba(47,41,35,.72);
  color: #fffaf0;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 8px 18px rgba(47,41,35,.16);
  backdrop-filter: blur(10px);
}
.album-menu summary::-webkit-details-marker { display: none; }
.album-menu-panel {
  position: absolute;
  right: 0;
  top: 42px;
  width: min(280px, calc(100vw - 40px));
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,253,247,.96);
  border: 1px solid rgba(92,70,48,.14);
  box-shadow: 0 18px 44px rgba(73,55,37,.20);
}
.album-menu-panel a, .album-menu-panel button {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(73,55,37,.12);
  border-radius: 12px;
  background: rgba(246,239,227,.68);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  display: grid;
  place-items: center;
  padding: 7px 10px;
}
.album-menu-panel form { margin: 0; gap: 7px; }
.album-menu-panel input { padding: 8px 10px; border-radius: 10px; }
.album-menu-panel .warning-action { color: #835226; background: rgba(218,158,80,.12); }
.album-menu-panel .danger-link { color: #8b463d; background: rgba(180,58,42,.08); }
.media-heading-row { align-items: center; }
.media-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; align-items: center; }
.search-shell { display: block; min-width: min(300px, 100%); }
.search-shell input { min-height: 42px; border-radius: 999px; padding-inline: 16px; background: rgba(255,255,255,.72); }
.filter-buttons { display: flex; gap: 7px; padding: 4px; border-radius: 999px; background: rgba(255,250,240,.78); border: 1px solid rgba(92,70,48,.10); }
.filter-button { min-height: 34px; padding: 0 13px; cursor: pointer; background: transparent; }
.filter-button.is-active { background: var(--ink); color: #fffaf0; border-color: var(--ink); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; padding-top: 10px; }
.polaroid, .media-card {
  margin: 0;
  background: rgba(255,253,247,.94);
  padding: 10px;
  border-radius: 24px;
  box-shadow: 0 14px 30px rgba(73,55,37,.12);
  border: 1px solid rgba(73,55,37,.08);
  transition: transform .16s ease, box-shadow .16s ease;
}
.polaroid:hover, .media-card:hover { transform: translateY(-5px); box-shadow: 0 22px 42px rgba(73,55,37,.17); }
.tilt-left, .tilt-right { transform: none; }
.media-preview { position: relative; overflow: hidden; border-radius: 18px; background: #efe4d1; }
.media-quick-actions {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.media-quick-actions form { margin: 0; }
.favorite-button, .cover-button {
  min-height: 30px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 999px;
  background: rgba(47,41,35,.68);
  color: #fffaf0;
  box-shadow: 0 8px 18px rgba(47,41,35,.18);
  cursor: pointer;
  font-weight: 900;
  backdrop-filter: blur(10px);
  transition: transform .16s ease, background .16s ease;
}
.favorite-button { width: 32px; padding: 0; font-size: 1rem; }
.cover-button { padding: 0 9px; font-size: .7rem; }
.favorite-button:hover, .cover-button:hover { transform: translateY(-1px); background: rgba(47,41,35,.84); }
.favorite-button.is-active, .favorite-button.is-favorite { background: rgba(184,107,75,.92); color: #fff; }
.search-empty[hidden], [data-media-card][hidden] { display: none !important; }
.polaroid img, .polaroid video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; filter: contrast(1.02) saturate(.98); background: #efe4d1; }
.polaroid video { object-fit: contain; }
.polaroid a { display: block; cursor: zoom-in; }
.video-badge { position: absolute; z-index: 2; top: 10px; left: 10px; min-height: 28px; padding: 0 10px; display: inline-flex; align-items: center; background: rgba(47,41,35,.84); color: #fffaf0; border-color: rgba(255,255,255,.16); font-size: .78rem; }
.polaroid figcaption { display: grid; gap: 9px; padding: 13px 4px 4px; }
.media-card-text { display: grid; gap: 3px; min-width: 0; }
.polaroid figcaption strong { font-family: var(--sans); font-size: 1rem; font-weight: 900; overflow-wrap: anywhere; }
.polaroid figcaption span { font-size: .78rem; color: var(--muted); font-weight: 700; overflow-wrap: anywhere; }
.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.reaction-row form { margin: 0; }
.reaction-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(73,55,37,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  color: var(--ink);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 900;
}
.reaction-button:hover { background: rgba(255,250,240,.92); }
.comment-panel {
  border-radius: 16px;
  background: rgba(246,239,227,.42);
  border: 1px solid rgba(73,55,37,.09);
  padding: 8px 10px;
}
.comment-panel summary {
  cursor: pointer;
  font-weight: 900;
  color: #5e4c3d;
  list-style: none;
}
.comment-panel summary::-webkit-details-marker { display: none; }
.comment-list { display: grid; gap: 8px; margin-top: 10px; }
.comment-item {
  display: grid;
  gap: 5px;
  border-radius: 13px;
  padding: 9px;
  background: rgba(255,255,255,.58);
}
.comment-item div { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.comment-item p { margin: 0; color: #4b4034; font-size: .86rem; line-height: 1.35; overflow-wrap: anywhere; }
.comment-item small { color: var(--muted); font-size: .7rem; font-weight: 800; }
.comment-item form, .comment-form { margin: 0; }
.comment-delete {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #8b463d;
  font-size: .72rem;
  font-weight: 900;
  cursor: pointer;
  padding: 0;
}
.comment-form { display: grid; gap: 7px; margin-top: 10px; }
.comment-form input, .comment-form textarea { padding: 8px 9px; border-radius: 10px; font-size: .82rem; }
.comment-form textarea { min-height: 70px; }
.comment-form button {
  justify-self: start;
  border: 1px solid rgba(73,55,37,.12);
  border-radius: 999px;
  background: var(--ink);
  color: #fffaf0;
  cursor: pointer;
  font-size: .76rem;
  font-weight: 900;
  padding: 7px 11px;
}
.media-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.media-actions form { margin: 0; }
.text-button, .media-actions summary, .danger-button, .inline-form button, .media-actions form > button {
  border: 1px solid rgba(73,55,37,.14);
  border-radius: 999px;
  background: rgba(246,239,227,.64);
  color: var(--ink);
  cursor: pointer;
  font-size: .7rem;
  font-weight: 800;
  padding: 5px 8px;
  text-decoration: none;
  list-style: none;
}
.text-button:hover, .media-actions summary:hover, .inline-form button:hover { background: rgba(255,255,255,.86); }
.media-actions summary::-webkit-details-marker { display: none; }
.danger-button { background: transparent; color: #8b463d; border-color: rgba(139,70,61,.14); opacity: .78; }
.danger-button:hover { opacity: 1; background: rgba(180,58,42,.08); }
.inline-form { display: flex; gap: 5px; align-items: center; margin-top: 7px; }
.inline-form input { width: 128px; padding: 5px 7px; border-radius: 9px; font-size: .74rem; }
.empty { grid-column: 1 / -1; border-radius: 24px; padding: 48px 24px; text-align: center; }
.dashboard-empty { background: rgba(255,250,240,.80); border: 1px solid rgba(92,70,48,.12); box-shadow: var(--shadow); }
.empty-illustration { position: relative; width: 116px; height: 92px; margin: 0 auto 18px; }
.empty-illustration::before, .empty-illustration::after, .empty-illustration span { content: ''; position: absolute; border-radius: 8px; background: #fffdf7; border: 1px solid rgba(73,55,37,.10); box-shadow: 0 12px 24px rgba(73,55,37,.12); }
.empty-illustration::before { width: 72px; height: 88px; left: 8px; top: 0; rotate: -9deg; background: linear-gradient(135deg, #e4c79f, #91a17e) content-box, #fffdf7; padding: 7px 7px 20px; }
.empty-illustration::after { width: 72px; height: 88px; right: 6px; top: 5px; rotate: 7deg; background: linear-gradient(135deg, #dfb394, #b8795c) content-box, #fffdf7; padding: 7px 7px 20px; }
.empty-illustration span { width: 54px; height: 18px; left: 31px; top: -8px; background: rgba(228,205,165,.74); rotate: -3deg; }
.empty-action { margin-top: 12px; }
.error-card { max-width: 600px; margin: 14vh auto; border-radius: 20px; padding: 34px; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.lightbox[aria-hidden="false"] { opacity: 1; pointer-events: auto; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(38, 30, 23, .68);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
}
.lightbox-frame {
  position: relative;
  width: min(980px, 94vw);
  max-height: 92vh;
  background: #fffdf7;
  padding: 14px 14px 22px;
  border: 1px solid rgba(73,55,37,.12);
  box-shadow: 0 30px 90px rgba(30, 22, 15, .42);
  transform: scale(.96) rotate(-.4deg);
  transition: transform .18s ease;
}
.lightbox[aria-hidden="false"] .lightbox-frame { transform: scale(1) rotate(-.4deg); }
.lightbox-frame img {
  display: block;
  width: 100%;
  max-height: calc(92vh - 96px);
  object-fit: contain;
  background: #eee2cf;
}
.lightbox-frame p {
  margin: 12px 42px 0 4px;
  font-family: var(--hand);
  font-size: 1.08rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.lightbox-close {
  position: absolute;
  right: -14px;
  top: -14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(73,55,37,.18);
  background: var(--ink);
  color: #fffaf0;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(73,55,37,.22);
}
body.lightbox-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 920px) {
  .login-page { grid-template-columns: 1fr; min-height: auto; }
  .album-intro { min-height: 560px; }
  .polaroid-collage { min-height: 300px; }
  .login-box { max-width: 620px; width: 100%; justify-self: center; }
  .dashboard-hero-grid { grid-template-columns: 1fr; }
  .dashboard-collage { min-height: 245px; max-width: 460px; width: 100%; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .memory-widgets { grid-template-columns: 1fr; }
  .dashboard-upload-form, .upload-form { grid-template-columns: 1fr 1fr; }
  .dropzone-field { grid-column: 1 / -1; }
  .upload-submit { grid-column: 1 / -1; }
  .media-heading-row { align-items: stretch; flex-direction: column; }
  .media-toolbar { justify-content: flex-start; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 22px, 1120px); padding-top: 14px; }
  .container:has(.login-page) { width: min(100% - 18px, 1120px); padding: 9px 0 24px; }
  h1 { font-size: 2rem; }
  .login-page { border-radius: 24px; padding: 14px; gap: 14px; }
  .login-page::after { border-radius: 23px; }
  .album-intro { min-height: auto; padding: 18px 6px 8px; }
  .album-intro h1 { font-size: clamp(2.5rem, 15vw, 3.8rem); }
  .login-subtitle { font-size: 1.02rem; }
  .login-badges { gap: 8px; margin-top: 20px; }
  .login-badges li { min-height: 32px; padding: 0 11px; font-size: .88rem; }
  .polaroid-collage { min-height: 245px; margin: 12px auto 0; }
  .hero-polaroid { width: 118px; height: 154px; padding-bottom: 20px; }
  .hero-polaroid-four { left: 44%; }
  .hero-polaroid-five { display: none; }
  .login-box { border-radius: 24px; padding: 24px 18px; }
  .topbar, .upload-form { display: grid; grid-template-columns: 1fr; }
  .dashboard-hero { border-radius: 24px; padding: 18px; }
  .dashboard-topbar { margin-bottom: 30px; }
  .dashboard-collage { min-height: 210px; }
  .dash-polaroid { width: 126px; height: 166px; padding-bottom: 28px; }
  .dash-polaroid-1 { left: 0; }
  .dash-polaroid-2 { left: 92px; }
  .dash-polaroid-3 { right: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; border-radius: 18px; }
  .dashboard-upload { border-radius: 22px; padding: 18px; }
  .dashboard-upload-form, .upload-form { grid-template-columns: 1fr; }
  .dropzone-box { grid-template-columns: 1fr; min-height: 132px; text-align: center; justify-items: center; }
  .upload-choice-card { min-height: auto; }
  .section-title-row { display: grid; align-items: start; }
  .section-count { justify-self: start; }
  .album-grid { grid-template-columns: 1fr; }
  .album-create-form { grid-template-columns: 1fr; }
  .album-cover { height: 190px; }
  .album-menu { right: 16px; top: 16px; }
  .album-menu-panel { position: fixed; left: 14px; right: 14px; top: auto; bottom: 18px; width: auto; }
  .media-toolbar { display: grid; justify-content: stretch; }
  .search-shell { min-width: 0; }
  .filter-buttons { overflow-x: auto; }
  .logout, .primary-button { width: 100%; }
  .photo-grid { grid-template-columns: 1fr; gap: 14px; }
  .polaroid { padding: 8px; transform: none !important; }
}


/* Role-aware family management and no-reload interactions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-pill,
.role-note {
  border: 1px solid rgba(122, 86, 55, 0.18);
  background: rgba(255, 250, 241, 0.72);
  color: #6d513d;
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.family-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.admin-card {
  background: rgba(255, 252, 246, 0.9);
  border: 1px solid rgba(122, 86, 55, 0.14);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(74, 51, 34, 0.08);
  padding: 1.25rem;
}

.admin-card-wide {
  grid-column: 1 / -1;
}

.stack-form,
.admin-list,
.admin-list-item {
  display: grid;
  gap: 0.75rem;
}

.admin-list-item {
  border-top: 1px solid rgba(122, 86, 55, 0.12);
  padding-top: 0.75rem;
}

.admin-list-item small,
.admin-list-item code {
  display: block;
  color: #7b6757;
  overflow-wrap: anywhere;
}

.media-card.is-favorite-card,
.media-card:has(.favorite-button.is-active) {
  border-color: rgba(177, 91, 91, 0.34);
  box-shadow: 0 18px 48px rgba(177, 91, 91, 0.16);
}

.favorite-button,
.reaction-button,
.comment-delete {
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.favorite-button:active,
.reaction-button:active,
.comment-delete:active {
  transform: scale(0.96);
}

.comment-item {
  position: relative;
}

.comment-form textarea {
  min-height: 4rem;
}

@media (max-width: 720px) {
  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .admin-card {
    border-radius: 18px;
    padding: 1rem;
  }
}


/* Stability/UX polish */
button:disabled,
.primary-button:disabled {
  opacity: 0.58;
  cursor: progress;
  transform: none !important;
}

.form-error {
  margin: 0.35rem 0 0;
  color: #8d2f2f;
  background: rgba(255, 239, 236, 0.95);
  border: 1px solid rgba(141, 47, 47, 0.18);
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  font-size: 0.92rem;
  line-height: 1.35;
}

.media-error {
  margin-top: 0.75rem;
}

.invite-copy-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.invite-copy-row code {
  flex: 1 1 260px;
  background: rgba(255, 250, 241, 0.9);
  border: 1px solid rgba(122, 86, 55, 0.14);
  border-radius: 14px;
  padding: 0.65rem;
}

.invite-copy-row button,
.admin-list-item button,
.admin-list-item select {
  min-height: 42px;
}

.invite-status {
  border-radius: 16px;
  padding: 0.85rem;
}

.invite-status-open {
  background: rgba(238, 248, 235, 0.72);
  border: 1px solid rgba(68, 126, 77, 0.16);
}

.invite-status-benutzt,
.invite-status-abgelaufen,
.user-status-inactive {
  background: rgba(244, 241, 236, 0.72);
  color: #786a5c;
}

.comment-panel[open] {
  border-color: rgba(122, 86, 55, 0.18);
}

.comment-form button,
.reaction-button,
.favorite-button,
.comment-delete,
.media-actions a,
.media-actions button {
  min-height: 40px;
}

@media (max-width: 680px) {
  .dashboard-topbar,
  .topbar-actions,
  .media-actions,
  .reaction-row,
  .invite-copy-row {
    align-items: stretch;
  }

  .topbar-actions > *,
  .media-actions > *,
  .invite-copy-row > *,
  .comment-form button,
  .album-menu-panel button,
  .album-menu-panel input {
    width: 100%;
  }

  .comment-panel summary,
  .reaction-button,
  .favorite-button {
    min-height: 44px;
  }

  .admin-list-item {
    overflow-wrap: anywhere;
  }
}


/* PWA install prompt */
.install-prompt {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 22px;
  border: 1px solid rgba(124, 92, 63, 0.18);
  background: rgba(255, 250, 241, 0.96);
  box-shadow: 0 18px 50px rgba(74, 51, 34, 0.18);
  color: #5a432f;
}

.install-prompt[hidden] {
  display: none;
}

.install-prompt p {
  margin: 0.2rem 0 0;
  color: #7b6757;
}

.install-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.install-actions button {
  min-height: 42px;
}

@media (min-width: 821px) and (pointer: fine) {
  .install-prompt {
    display: none;
  }
}

@media (max-width: 620px) {
  .install-prompt {
    align-items: stretch;
    flex-direction: column;
    border-radius: 18px;
  }

  .install-actions,
  .install-actions button {
    width: 100%;
  }
}
