:root {
  color-scheme: light;
  --bg: #fffaf4;
  --panel: #ffffff;
  --panel-soft: #fff2e5;
  --ink: #2b2523;
  --muted: #716761;
  --line: #eaded2;
  --rose: #e84f6a;
  --rose-dark: #ba2d47;
  --mint: #279b76;
  --sky: #2f87b8;
  --sun: #e6a430;
  --lavender: #8e69d5;
  --peach: #f39b7f;
  --aqua: #6fcbb5;
  --gold: #d9a12c;
  --shadow: 0 18px 48px rgba(79, 52, 39, .14);
  --shadow-soft: 0 9px 24px rgba(79, 52, 39, .1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fffaf4 0%, #fff6ed 42%, #eef8f4 100%);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  background:
    repeating-linear-gradient(135deg, rgba(232, 79, 106, .035) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(45deg, rgba(39, 155, 118, .03) 0 1px, transparent 1px 22px);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .18));
}

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

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  isolation: isolate;
}

#app-nav {
  display: contents;
}

.app-shell.has-sidebar {
  display: grid;
  grid-template-areas:
    "sidebar ad"
    "sidebar main";
  grid-template-columns: minmax(228px, 256px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 48px;
  background: rgba(255, 250, 244, .86);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 32px rgba(97, 65, 49, .08);
  backdrop-filter: blur(14px);
}

.public-topbar {
  justify-content: space-between;
}

.mobile-topbar {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform .2s ease;
}

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

.brand-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 12px rgba(232, 79, 106, .18));
}

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

.nav-links a,
.nav-links button {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.nav-links a:hover,
.nav-links a.active,
.nav-links button:hover {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.side-nav {
  grid-area: sidebar;
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 24px 18px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 250, 244, .96), rgba(255, 246, 237, .92));
  box-shadow: 10px 0 34px rgba(97, 65, 49, .08);
  backdrop-filter: blur(18px);
}

.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  color: var(--ink);
  font-weight: 900;
}

.side-nav-sections {
  display: grid;
  gap: 18px;
}

.side-nav-section {
  display: grid;
  gap: 7px;
}

.side-nav-section h2 {
  padding: 0 10px;
  color: #a38d81;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.side-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px 10px 30px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.side-nav-link::before {
  position: absolute;
  left: 12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #eaded2;
  content: "";
}

.side-nav-link:hover,
.side-nav-link.active {
  border-color: #eed8dc;
  background:
    linear-gradient(135deg, rgba(255, 241, 245, .95), rgba(232, 249, 243, .86));
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transform: translateX(2px);
}

.side-nav-link.active::before {
  background: var(--rose);
  box-shadow: 0 0 0 5px rgba(232, 79, 106, .12);
}

.side-nav-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.side-logout,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.side-logout:hover,
.icon-button:hover {
  border-color: #e8bdc3;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.mobile-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-backdrop {
  display: none;
}

.free-ad-region,
.app-ad-region {
  grid-area: ad;
  display: grid;
  width: min(1120px, calc(100% - 32px));
  min-height: 94px;
  align-items: center;
  margin: 14px auto 0;
  padding: 12px 16px;
  border: 1px solid #f0d6dc;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(255, 248, 241, .9));
  box-shadow: var(--shadow-soft);
}

.app-ad-region {
  position: relative;
  width: min(728px, calc(100% - 48px));
  min-height: 0;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.app-shell.has-sidebar .app-ad-region {
  width: min(728px, calc(100% - 48px));
  margin-top: 14px;
}

.app-ad-region .free-ad-label {
  display: none;
}

.free-ad-label {
  justify-self: start;
  margin-bottom: 8px;
  color: #9d887f;
  font-size: 11px;
  font-weight: 800;
}

.free-ad-slot {
  display: grid;
  width: 100%;
  min-height: 50px;
  place-items: center;
  overflow: hidden;
}

.free-ad-slot iframe,
.free-ad-slot img,
.free-ad-slot ins,
.free-ad-slot > :not(script) {
  max-width: 100%;
}

.app-ad-slot,
.lp-ad-slot {
  min-height: 50px;
}

.container {
  grid-area: main;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.app-shell.has-sidebar .container {
  width: min(1120px, calc(100% - 48px));
}

.page-head {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 780px;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 250, 244, .88));
  box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.card:hover {
  border-color: #e8bdc3;
  box-shadow: 0 24px 64px rgba(79, 52, 39, .17);
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 247, 239, .86));
  box-shadow: var(--shadow-soft);
}

.upload-card {
  padding: clamp(24px, 2.4vw, 34px);
}

.upload-card > .lead,
.upload-card p.lead {
  max-width: none;
}

.section {
  margin-top: 26px;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(79, 52, 39, .08);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(79, 52, 39, .14);
}

.btn.primary {
  border-color: var(--rose);
  background: linear-gradient(135deg, var(--rose), var(--peach));
  color: #fff;
}

.btn.secondary {
  border-color: #b7dfd1;
  background: #eaf8f2;
  color: #12664c;
}

.btn.warning {
  border-color: #f3d198;
  background: #fff6dd;
  color: #805000;
}

.btn.danger {
  border-color: #f0b4b7;
  background: #fff0f0;
  color: #a12631;
}

.btn.ghost {
  background: transparent;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.auth-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff7ef;
}

.auth-mode {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-mode.active {
  border-color: #f0bcc6;
  background: #fff;
  color: var(--rose-dark);
  box-shadow: var(--shadow-soft);
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.check-label {
  color: #4e4540;
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #e97f93;
  box-shadow: 0 0 0 4px rgba(232, 79, 106, .14);
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.form-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.check-label {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.bot-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .68);
  background: linear-gradient(180deg, #fff8f0, #f8efe7);
  color: #624f46;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(79, 52, 39, .06);
}

.pill.mint {
  background: linear-gradient(180deg, #f2fff8, #e8f7ef);
  color: #156f53;
}

.pill.sky {
  background: linear-gradient(180deg, #f3fbff, #e7f3fb);
  color: #17658d;
}

.pill.rose {
  background: linear-gradient(180deg, #fff5f7, #ffe9ee);
  color: #b72f4a;
}

.pill.lavender {
  background: linear-gradient(180deg, #f7f1ff, #eee4ff);
  color: #6842b5;
}

.media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f5ece4;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .62);
}

.media::before {
  display: block;
  content: "";
}

.media.square::before {
  padding-top: 100%;
}

.media.wide::before {
  padding-top: 62.5%;
}

.media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease, filter .5s ease;
}

.media::after {
  pointer-events: none;
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 45%),
    linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, .44) 48%, transparent 62%);
  opacity: .58;
  transform: translateX(-22%);
}

.card:hover .media img,
.history-item:hover .media img,
.album-strip a:hover img {
  transform: scale(1.035);
  filter: saturate(1.06);
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 24px;
  border: 1px dashed #dfcfc1;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .8), rgba(255, 247, 239, .9)),
    repeating-linear-gradient(135deg, rgba(232, 79, 106, .07) 0 1px, transparent 1px 14px);
  text-align: center;
}

.empty-state div {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 800;
  animation: toast-in .24s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hide {
  display: none !important;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 18px;
  align-items: start;
}

.usage-meter {
  display: grid;
  gap: 8px;
}

.meter-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #f2e3d6;
  box-shadow: inset 0 1px 2px rgba(79, 52, 39, .12);
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--aqua), var(--gold));
  box-shadow: 0 0 16px rgba(39, 155, 118, .22);
}

.notice {
  padding: 13px 14px;
  border: 1px solid #f0d398;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff9e8, #fff0c5);
  color: #6f4b00;
  line-height: 1.55;
}

.safe-note {
  border-left: 4px solid var(--mint);
  padding: 12px 14px;
  background: linear-gradient(180deg, #f3fff8, #e6f6ef);
  color: #315347;
  line-height: 1.6;
}

.celebration-field {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  overflow: hidden;
}

.spark {
  position: absolute;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--rose);
  font-size: 20px;
  font-weight: 900;
  filter: drop-shadow(0 8px 12px rgba(232, 79, 106, .2));
  animation: sparkle-burst 1100ms ease-out forwards;
}

.spark.mint {
  color: var(--mint);
}

.spark.gold {
  color: var(--gold);
}

.spark.lavender {
  color: var(--lavender);
}

@keyframes sparkle-burst {
  0% {
    opacity: 0;
    transform: translate3d(0, 22px, 0) scale(.55) rotate(0deg);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--spark-x), var(--spark-y), 0) scale(1.35) rotate(var(--spark-r));
  }
}

@media (max-width: 860px) {
  .app-shell.has-sidebar {
    display: block;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 250, 244, .9);
    box-shadow: 0 10px 32px rgba(97, 65, 49, .08);
    backdrop-filter: blur(14px);
  }

  .mobile-topbar .brand-icon {
    width: 46px;
    height: 46px;
  }

  .mobile-topbar .brand span {
    font-size: 16px;
  }

  .side-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: min(318px, calc(100vw - 48px));
    height: 100vh;
    transform: translateX(-105%);
    transition: transform .24s ease;
  }

  .app-shell.nav-open .side-nav {
    transform: translateX(0);
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 42;
    display: block;
    border: 0;
    background: rgba(43, 37, 35, .24);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .app-shell.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-shell.has-sidebar .app-ad-region {
    width: calc(100% - 24px);
    margin-top: 10px;
  }

  .app-ad-slot {
    width: 100%;
    min-height: clamp(50px, calc((100vw - 24px) * .15625), 68px);
  }

  .app-shell.has-sidebar .container {
    width: min(100% - 24px, 1120px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 24px;
  }

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

  .grid.two,
  .grid.three,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 24px, 1120px);
    padding-top: 20px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 24px;
  }

  .nav-links a,
  .nav-links button {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .public-topbar .nav-links {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-topbar .nav-links a {
    text-align: center;
  }

  .mobile-nav-actions .pill {
    display: none;
  }

  .btn {
    width: 100%;
  }
}
