:root {
  --bg: #fff8f0;
  --bg-soft: #fffdf8;
  --text: #22172a;
  --muted: #725f7d;
  --purple: #6d35b8;
  --purple-dark: #45206f;
  --pink: #f36aaa;
  --gold: #f4b63f;
  --border: rgba(69, 32, 111, 0.14);
  --shadow: 0 22px 60px rgba(69, 32, 111, 0.14);
  --radius: 28px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(243, 106, 170, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(244, 182, 63, 0.2), transparent 32%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

.page-shell { min-height: 100vh; }
.memories-header { padding: 22px; }

.top-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.75);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 40px rgba(69, 32, 111, 0.08);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; display: block; }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; font-weight: 700; }

.hero {
  max-width: 1180px;
  margin: 28px auto 0;
  padding: 54px;
  border-radius: 38px;
  background:
    linear-gradient(135deg, rgba(109, 53, 184, 0.94), rgba(243, 106, 170, 0.88)),
    url("data:image/svg+xml,%3Csvg width='900' height='500' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,.24)' stroke-width='2'%3E%3Ccircle cx='130' cy='110' r='58'/%3E%3Ccircle cx='770' cy='370' r='86'/%3E%3Cpath d='M80 390 C260 250 370 460 560 260 S760 140 840 90'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  color: white;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 30px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 900;
}

.hero h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.95;
}

.hero-text {
  margin: 22px 0 0;
  max-width: 680px;
  font-size: 18px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.86);
}

.hero-card {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px);
  border-radius: 30px;
  padding: 26px;
}

.sparkle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 24px;
}

.hero-card h3 { margin: 18px 0 8px; font-size: 24px; }
.hero-card p { margin: 0; color: rgba(255, 255, 255, 0.82); line-height: 1.6; }

.content { max-width: 1180px; margin: 0 auto; padding: 0 22px 60px; }

.access-panel,
.admin-panel,
.gallery-section {
  margin-top: 24px;
  border: 1px solid var(--border);
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(18px);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 14px 50px rgba(69, 32, 111, 0.08);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

.access-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.access-panel h2,
.section-heading h2 {
  margin: 0;
  font-size: 28px;
  color: var(--purple-dark);
}

.access-panel p,
.section-note {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
  margin: 8px 0 0;
}

.access-tags {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.access-tag,
.gallery-stats span,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(109, 53, 184, 0.1);
  color: var(--purple);
  font-weight: 900;
  font-size: 13px;
  white-space: nowrap;
}

.access-tag.soft {
  background: rgba(244, 182, 63, 0.16);
  color: #7a5210;
}

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

.album-form {
  display: grid;
  gap: 18px;
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(109, 53, 184, 0.04);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--purple-dark);
  font-weight: 900;
  font-size: 13px;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 15px;
  background: white;
  color: var(--text);
  outline: none;
  min-width: 160px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(109, 53, 184, 0.55);
  box-shadow: 0 0 0 4px rgba(109, 53, 184, 0.1);
}

.form-actions,
.album-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  border-radius: 16px;
  min-height: 44px;
  padding: 0 17px;
  cursor: pointer;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.primary-btn {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: white;
  box-shadow: 0 12px 30px rgba(109, 53, 184, 0.25);
}

.secondary-btn {
  background: white;
  color: var(--purple);
  border-color: var(--border);
}

.danger-btn {
  background: rgba(211, 31, 115, 0.09);
  color: #a70f55;
  border-color: rgba(211, 31, 115, 0.18);
}

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

.albums-wrapper { display: grid; gap: 26px; }

.class-picker-section {
  display: grid;
  gap: 18px;
}

.class-picker-heading,
.selected-class-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.class-picker-heading h3 {
  margin: 0;
  color: var(--purple-dark);
  font-size: 26px;
}

.class-picker-heading .section-note,
.selected-class-heading .section-note {
  margin: 0;
  max-width: 390px;
  text-align: right;
}

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

.class-box {
  width: 100%;
  min-height: 158px;
  padding: 20px;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  box-shadow: 0 14px 42px rgba(69, 32, 111, 0.08);
  text-align: left;
  display: grid;
  align-content: start;
  gap: 9px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.class-box:hover,
.class-box.active {
  transform: translateY(-3px);
  border-color: rgba(109, 53, 184, 0.34);
  box-shadow: 0 22px 55px rgba(109, 53, 184, 0.16);
}

.class-box.active {
  background: linear-gradient(135deg, rgba(109, 53, 184, 0.12), rgba(243, 106, 170, 0.10));
}

.class-box-icon {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: white;
  font-size: 24px;
  font-weight: 950;
  box-shadow: 0 12px 30px rgba(109, 53, 184, 0.20);
}

.class-box-title {
  color: var(--purple-dark);
  font-size: 22px;
  font-weight: 950;
}

.class-box-count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.class-box-action {
  margin-top: 4px;
  color: var(--purple);
  font-size: 13px;
  font-weight: 950;
}

.week-grid {
  animation: memoriesFadeIn 0.22s ease both;
}

@keyframes memoriesFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.class-group { display: grid; gap: 14px; }
.class-heading { display: flex; align-items: center; justify-content: space-between; }
.class-heading h3 { margin: 0; color: var(--purple-dark); font-size: 24px; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.album-card {
  border: 1px solid var(--border);
  background: white;
  border-radius: 26px;
  padding: 20px;
  box-shadow: 0 16px 42px rgba(69, 32, 111, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.25s ease, border-color 0.25s ease;
  display: grid;
  gap: 14px;
}

.album-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 50px rgba(69, 32, 111, 0.16);
}

.album-card.inactive { opacity: 0.68; }

.album-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(109, 53, 184, 0.12), rgba(243, 106, 170, 0.12));
  font-size: 30px;
}

.album-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 900;
}

.inactive-pill {
  letter-spacing: 0;
  text-transform: none;
  color: #a70f55;
  background: rgba(211, 31, 115, 0.1);
  padding: 6px 9px;
  border-radius: 999px;
}

.album-body h3 { margin: 8px 0 6px; color: var(--purple-dark); font-size: 22px; }
.album-body p { margin: 0; color: var(--muted); font-weight: 750; }
.album-actions { margin-top: 4px; }
.open-link { flex: 1 1 auto; }

.empty-state {
  text-align: center;
  padding: 58px 20px;
  color: var(--muted);
}

.empty-state div { font-size: 48px; color: var(--pink); }
.empty-state h3 { margin: 10px 0 6px; color: var(--purple-dark); font-size: 24px; }
.empty-state p { margin: 0; line-height: 1.6; }

.hidden { display: none !important; }

body.dark-mode,
html.dark-mode body {
  color-scheme: dark;
  --bg: #07131b;
  --bg-soft: #0b1d28;
  --text: #f4fbff;
  --muted: #b8c9d6;
  --purple: #08a9d9;
  --purple-dark: #e4f7ff;
  --pink: #d31f73;
  --gold: #6fdfff;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  background:
    radial-gradient(circle at 12% 0%, rgba(8, 169, 217, 0.16), transparent 340px),
    radial-gradient(circle at 86% 10%, rgba(211, 31, 115, 0.12), transparent 360px),
    linear-gradient(180deg, #07131b 0%, #0b1d28 55%, #07131b 100%) !important;
  color: var(--text) !important;
}

html.dark-mode { background: #07131b !important; }
body.dark-mode .page-shell, html.dark-mode .page-shell { background: transparent !important; }

body.dark-mode .top-nav,
html.dark-mode .top-nav,
body.dark-mode .access-panel,
html.dark-mode .access-panel,
body.dark-mode .admin-panel,
html.dark-mode .admin-panel,
body.dark-mode .gallery-section,
html.dark-mode .gallery-section {
  background: rgba(12, 29, 40, 0.88) !important;
  border-color: rgba(111, 223, 255, 0.15) !important;
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.28) !important;
  backdrop-filter: blur(18px) saturate(1.15);
}

body.dark-mode .hero,
html.dark-mode .hero {
  background:
    radial-gradient(circle at 88% 8%, rgba(111, 223, 255, 0.20), transparent 260px),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.12), transparent 210px),
    linear-gradient(135deg, #082635 0%, #2d2a78 46%, #d31f73 130%) !important;
  border: 1px solid rgba(111, 223, 255, 0.14) !important;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.36) !important;
}

body.dark-mode .hero h1,
html.dark-mode .hero h1,
body.dark-mode .hero-card h3,
html.dark-mode .hero-card h3 { color: #ffffff !important; }

body.dark-mode .hero-text,
body.dark-mode .hero-card p,
html.dark-mode .hero-text,
html.dark-mode .hero-card p { color: rgba(255, 255, 255, 0.86) !important; }

body.dark-mode .hero-card,
html.dark-mode .hero-card {
  background: rgba(255, 255, 255, 0.11) !important;
  border-color: rgba(255, 255, 255, 0.20) !important;
}

body.dark-mode .access-panel h2,
html.dark-mode .access-panel h2,
body.dark-mode .section-heading h2,
html.dark-mode .section-heading h2,
body.dark-mode .class-heading h3,
html.dark-mode .class-heading h3,
body.dark-mode .album-body h3,
html.dark-mode .album-body h3,
body.dark-mode .empty-state h3,
html.dark-mode .empty-state h3,
body.dark-mode label,
html.dark-mode label { color: var(--text) !important; }

body.dark-mode .access-panel p,
html.dark-mode .access-panel p,
body.dark-mode .section-note,
html.dark-mode .section-note,
body.dark-mode .album-body p,
html.dark-mode .album-body p,
body.dark-mode .empty-state,
html.dark-mode .empty-state { color: var(--muted) !important; }

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: var(--text) !important;
}

body.dark-mode input::placeholder,
html.dark-mode input::placeholder { color: rgba(184, 201, 214, 0.72) !important; }

body.dark-mode .primary-btn,
html.dark-mode .primary-btn {
  background: linear-gradient(135deg, #08a9d9, #007aa7) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 26px rgba(8, 169, 217, 0.24) !important;
}

body.dark-mode .secondary-btn,
html.dark-mode .secondary-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: var(--text) !important;
}

body.dark-mode .danger-btn,
html.dark-mode .danger-btn {
  background: rgba(211, 31, 115, 0.15) !important;
  border-color: rgba(211, 31, 115, 0.22) !important;
  color: #ff8fc2 !important;
}

body.dark-mode .access-tag,
body.dark-mode .gallery-stats span,
html.dark-mode .access-tag,
html.dark-mode .gallery-stats span {
  background: rgba(8, 169, 217, 0.18) !important;
  color: #6fdfff !important;
}

body.dark-mode .access-tag.soft,
html.dark-mode .access-tag.soft {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text) !important;
}

body.dark-mode .album-form,
html.dark-mode .album-form {
  background: rgba(8, 169, 217, 0.07) !important;
  border-color: rgba(111, 223, 255, 0.18) !important;
}

body.dark-mode .album-card,
html.dark-mode .album-card {
  background: rgba(16, 42, 56, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24) !important;
}

body.dark-mode .class-box,
html.dark-mode .class-box {
  background: rgba(16, 42, 56, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22) !important;
  color: var(--text) !important;
}

body.dark-mode .class-box:hover,
body.dark-mode .class-box.active,
html.dark-mode .class-box:hover,
html.dark-mode .class-box.active {
  border-color: rgba(111, 223, 255, 0.26) !important;
  background: linear-gradient(135deg, rgba(8, 169, 217, 0.16), rgba(211, 31, 115, 0.12)) !important;
  box-shadow: 0 24px 66px rgba(0, 0, 0, 0.34) !important;
}

body.dark-mode .class-picker-heading h3,
body.dark-mode .class-box-title,
html.dark-mode .class-picker-heading h3,
html.dark-mode .class-box-title { color: var(--text) !important; }

body.dark-mode .class-box-count,
html.dark-mode .class-box-count { color: var(--muted) !important; }

body.dark-mode .class-box-action,
html.dark-mode .class-box-action { color: #6fdfff !important; }

body.dark-mode .album-card:hover,
html.dark-mode .album-card:hover { box-shadow: 0 24px 66px rgba(0, 0, 0, 0.34) !important; }

body.dark-mode .album-icon,
html.dark-mode .album-icon {
  background: rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18) !important;
}

body.dark-mode .inactive-pill,
html.dark-mode .inactive-pill {
  color: #ff8fc2 !important;
  background: rgba(211, 31, 115, 0.16) !important;
}

body.dark-mode .empty-state div,
html.dark-mode .empty-state div { color: #6fdfff !important; }

@media (max-width: 900px) {
  .hero,
  .access-panel {
    grid-template-columns: 1fr;
    display: block;
  }

  .hero { padding: 34px; }
  .hero-card { margin-top: 24px; }
  .form-grid,
  .album-grid,
  .class-picker-grid { grid-template-columns: 1fr 1fr; }
  .access-tags { justify-content: flex-start; margin-top: 18px; }
}

@media (max-width: 620px) {
  .memories-header { padding: 12px; }
  .content { padding: 0 12px 46px; }
  .top-nav,
  .section-heading,
  .class-picker-heading,
  .selected-class-heading { align-items: flex-start; flex-direction: column; }
  .hero { padding: 28px; border-radius: 28px; }
  .form-grid,
  .album-grid,
  .class-picker-grid { grid-template-columns: 1fr; }
  input,
  select,
  textarea { width: 100%; min-width: 0; }
  .primary-btn,
  .secondary-btn,
  .danger-btn { width: 100%; }
  .album-card,
  .class-box { padding: 18px; }
  .class-picker-heading .section-note,
  .selected-class-heading .section-note { text-align: left; }
  .brand img { width: 42px; height: 42px; }
}
