:root {
  color-scheme: dark;
  --bg: #0b0f12;
  --bg-soft: #11181c;
  --panel: rgba(255, 255, 255, .075);
  --panel-strong: rgba(255, 255, 255, .12);
  --surface: #f6f1e8;
  --surface-2: #ebe3d5;
  --text: #f7f1e8;
  --text-dark: #182126;
  --muted: rgba(247, 241, 232, .68);
  --muted-dark: #6d787e;
  --line: rgba(255, 255, 255, .14);
  --line-dark: rgba(24, 33, 38, .12);
  --accent: #f3a33b;
  --accent-2: #27b8c7;
  --danger: #e15041;
  --radius: 24px;
  --radius-sm: 14px;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 82% -10%, rgba(39, 184, 199, .18), transparent 28rem),
    radial-gradient(circle at 10% 8%, rgba(243, 163, 59, .16), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; }
button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  padding: 0 18px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .13);
}
button.primary {
  background: linear-gradient(135deg, var(--accent), #ffcf7b);
  border-color: transparent;
  color: #19120a;
  font-weight: 760;
  box-shadow: 0 16px 36px rgba(243, 163, 59, .22);
}
button.ghost {
  background: transparent;
}
button.icon {
  width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

input, textarea, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}
textarea { resize: vertical; min-height: 80px; }
select option { color: #111; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(39, 184, 199, .8);
  box-shadow: 0 0 0 4px rgba(39, 184, 199, .14);
}
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }

.tiny, .hint { color: var(--muted); }
.hint { line-height: 1.5; margin: 0 0 12px; }
.error { color: #ff9a8f; font-size: 14px; min-height: 20px; }
.notice { color: var(--accent-2); min-height: 20px; font-size: 14px; }
.section-label {
  color: rgba(247, 241, 232, .54);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 520px);
}
.auth-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: end;
  padding: clamp(30px, 5vw, 72px);
}
.auth-visual img,
.home-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.auth-visual img { object-position: center 38%; }
.auth-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 22%, rgba(243, 163, 59, .18), transparent 32rem),
    linear-gradient(90deg, rgba(7, 10, 12, .84), rgba(7, 10, 12, .34) 60%, rgba(7, 10, 12, .12)),
    linear-gradient(180deg, rgba(7, 10, 12, .08), rgba(7, 10, 12, .86));
}
.auth-brand {
  position: relative;
  max-width: 820px;
}
.auth-brand span,
.home-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
  backdrop-filter: blur(18px);
  color: rgba(255, 255, 255, .78);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.auth-visual h1,
.home-hero-copy h2 {
  margin: 0 0 22px;
  font-size: clamp(48px, 7vw, 104px);
  line-height: .92;
  font-weight: 820;
  text-wrap: balance;
}
.auth-visual p,
.home-hero-copy p {
  max-width: 650px;
  margin: 0;
  color: rgba(255, 255, 255, .78);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.48;
}
.auth-panel {
  display: grid;
  align-content: center;
  padding: clamp(28px, 4vw, 56px);
  background: rgba(11, 15, 18, .74);
  backdrop-filter: blur(22px);
  border-left: 1px solid var(--line);
}
.form { display: grid; gap: 16px; }
.form h2 { font-size: 30px; line-height: 1.05; margin: 0; font-weight: 780; }
.auth-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .075);
  padding: 24px;
  box-shadow: var(--shadow);
}

.app-shell { min-height: 100vh; }
.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 15, 18, .72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(22px);
}
.hamburger {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, .08);
}
.hamburger span {
  width: 18px;
  height: 2px;
  background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.wordmark {
  height: auto;
  border: 0;
  background: transparent;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 0;
}
.wordmark strong { font-size: 21px; font-weight: 820; line-height: 1; }
.wordmark span {
  color: rgba(247, 241, 232, .56);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-link { background: rgba(255, 255, 255, .07); }

.main { min-width: 0; }
.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 48px);
  position: sticky;
  top: 76px;
  z-index: 4;
  background: rgba(11, 15, 18, .58);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.topbar h1 { margin: 0; font-size: 22px; font-weight: 760; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 28px clamp(18px, 4vw, 54px) 62px; }

.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(0, 0, 0, .42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.menu-scrim.show { opacity: 1; pointer-events: auto; }
.drawer-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: min(430px, 94vw);
  height: 100dvh;
  max-height: 100dvh;
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  overflow: hidden;
  transform: translateX(-100%);
  transition: transform .24s ease;
  background: rgba(12, 18, 22, .92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}
.drawer-menu.show { transform: translateX(0); }
.drawer-menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.drawer-menu-head div { display: grid; gap: 4px; }
.drawer-menu-head strong { font-size: 30px; line-height: 1; }
.drawer-menu-head span { color: var(--muted); font-size: 13px; }
.main-menu {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.menu-item,
.album-row {
  min-height: auto;
  height: auto;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  display: grid;
  gap: 4px;
  padding: 12px;
}
.menu-item span,
.album-row { font-weight: 720; }
.menu-item small,
.album-row span { color: var(--muted); font-size: 12px; font-weight: 450; }
.menu-item.active,
.album-row.active {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .10);
}
.menu-albums {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
}
.album-list {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding-right: 4px;
}
.new-album,
.user-block {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 10px;
}
.sidebar-empty { color: var(--muted); padding: 12px; }

.home-hero {
  position: relative;
  min-height: clamp(600px, 78vh, 820px);
  display: flex;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
  margin: -28px calc(clamp(18px, 4vw, 54px) * -1) 34px;
  padding: clamp(28px, 5vw, 74px);
  border-radius: 0 0 38px 38px;
}
.home-hero img { object-position: center 40%; }
.home-hero-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 18%, rgba(243, 163, 59, .22), transparent 34rem),
    linear-gradient(90deg, rgba(6, 9, 11, .86), rgba(6, 9, 11, .40) 55%, rgba(6, 9, 11, .14)),
    linear-gradient(180deg, rgba(6, 9, 11, .05), rgba(6, 9, 11, .88));
}
.home-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 860px;
}
.home-hero-copy p { margin-bottom: 28px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; }
button.light {
  min-height: 48px;
  border-color: transparent;
  background: var(--surface);
  color: var(--text-dark);
}
.light-outline {
  min-height: 48px;
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .10);
  color: var(--text);
  backdrop-filter: blur(14px);
}
.hero-panel {
  position: absolute;
  right: clamp(22px, 4vw, 64px);
  bottom: clamp(22px, 4vw, 64px);
  z-index: 1;
  width: min(330px, 34vw);
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .10);
  backdrop-filter: blur(22px);
}
.hero-panel span,
.hero-panel small {
  color: rgba(247, 241, 232, .68);
  font-size: 12px;
}
.hero-panel span {
  letter-spacing: .10em;
  text-transform: uppercase;
}
.hero-panel strong { font-size: 25px; line-height: 1.1; }

.home-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 42px;
}
.home-stat,
.panel,
.album-card,
.info-grid,
.empty,
.upload,
.login-stage .auth-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .16);
  backdrop-filter: blur(18px);
}
.home-stat {
  min-height: 136px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
}
.home-stat span,
.info-row span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .10em;
  text-transform: uppercase;
}
.home-stat strong { font-size: clamp(25px, 3vw, 42px); line-height: 1.05; }
.home-stat small { color: var(--muted); font-size: 13px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.section-heading h3 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1;
}
.album-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.album-card {
  min-height: 172px;
  display: grid;
  align-content: end;
  gap: 8px;
  text-align: left;
  padding: 22px;
  background:
    radial-gradient(circle at 82% 18%, rgba(243, 163, 59, .24), transparent 34%),
    linear-gradient(145deg, rgba(39, 184, 199, .16), rgba(255, 255, 255, .06)),
    rgba(255, 255, 255, .075);
}
.album-card.active { border-color: rgba(39, 184, 199, .7); }
.album-card span { font-size: 24px; font-weight: 780; }
.album-card small { color: var(--muted); }

.album-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,.11), rgba(255,255,255,.05));
}
.album-hero h2,
.panel h2,
.profile-card h2 {
  margin: 8px 0;
  font-size: 30px;
  line-height: 1.1;
}
.album-hero p,
.profile-card p { margin: 0; color: var(--muted); }

.upload {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-style: dashed;
}
.upload.drag { border-color: rgba(39, 184, 199, .8); background: rgba(39, 184, 199, .12); }
.upload strong { display: block; font-size: 18px; margin-bottom: 6px; }
.upload span { color: var(--muted); }
.upload input { display: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.photo-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  min-width: 0;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  box-shadow: 0 14px 42px rgba(0,0,0,.18);
}
.photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.photo:hover img { transform: scale(1.035); }
.photo .meta {
  position: absolute;
  inset: auto 0 0;
  padding: 42px 12px 12px;
  color: white;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.68));
  font-size: 12px;
  text-align: left;
}
.photo-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  background: rgba(8, 10, 12, .58);
  border-color: rgba(255,255,255,.28);
  color: white;
  backdrop-filter: blur(12px);
  font-size: 22px;
}
.photo-delete:hover { background: rgba(225, 80, 65, .95); }

.workspace, .profile-layout { display: grid; gap: 18px; }
.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}
.panel { padding: 22px; }
.admin-layout .panel:last-child { grid-column: 1 / -1; }
.user-list {
  display: grid;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}
.user-row {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.user-row div { display: grid; gap: 3px; }
.user-row span,
.user-row small { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 10px; }
.row-actions button,
.user-row > button { min-height: 34px; white-space: nowrap; }

.info-grid { display: grid; overflow: hidden; }
.info-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.info-row {
  min-height: 78px;
  padding: 16px;
  display: grid;
  gap: 7px;
  align-content: center;
  border-bottom: 1px solid var(--line);
}
.info-row:last-child { border-bottom: 0; }
.info-row strong { font-size: 18px; }
.profile-card { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.avatar {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(243, 163, 59, .26), rgba(39, 184, 199, .24));
  border: 1px solid var(--line);
  font-size: 26px;
  font-weight: 800;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
}
.settings-row div { display: grid; gap: 5px; }
.settings-row span { color: var(--muted); font-size: 14px; }
.empty { min-height: 34vh; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; }
.login-stage { min-height: calc(100vh - 150px); display: grid; place-items: center; padding: 30px; }
.login-stage .auth-form { width: min(480px, 100%); }

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 20;
  width: min(540px, 100vw);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  transform: translateX(100%);
  transition: transform .2s ease;
  background: rgba(12, 18, 22, .96);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-body { overflow: auto; padding: 18px; display: grid; gap: 18px; align-content: start; }
.drawer img { width: 100%; max-height: 46vh; object-fit: contain; border-radius: 16px; background: rgba(255,255,255,.06); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; font-size: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
.timestamps { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.timestamp { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px; font-size: 12px; color: var(--muted); }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  height: 100dvh;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) 88px;
  background: rgba(3, 5, 6, .96);
  color: white;
}
.viewer-top {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.viewer-top div { display: grid; gap: 4px; min-width: 0; }
.viewer-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-top span { color: rgba(255,255,255,.62); font-size: 13px; }
.viewer-close { background: rgba(255,255,255,.08); }
.viewer-stage { min-height: 0; display: grid; place-items: center; padding: 26px clamp(72px, 9vw, 150px); overflow: hidden; }
.viewer-stage img {
  width: auto;
  height: auto;
  max-width: min(100%, 1580px);
  max-height: min(74dvh, calc(100dvh - 220px));
  object-fit: contain;
  box-shadow: 0 24px 70px rgba(0,0,0,.38);
}
.viewer-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 61;
  width: 54px;
  height: 74px;
  padding: 0;
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: white;
  font-size: 42px;
}
.viewer-nav.prev { left: 18px; }
.viewer-nav.next { right: 18px; }
.viewer-controls {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}
.viewer-controls label { min-width: 150px; color: rgba(255,255,255,.70); }
.viewer-controls button,
.viewer-controls select { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: white; }

body.dark {
  color-scheme: dark;
}

@media (max-width: 850px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { min-height: 58vh; }
  .auth-visual img { object-position: 62% center; }
  .auth-panel { border-left: 0; }
  .site-header { height: 68px; }
  .header-link { display: none; }
  .topbar { position: static; min-height: 66px; }
  .content { padding: 18px; }
  .drawer-menu { width: min(360px, 94vw); padding: 16px; gap: 12px; }
  .drawer-menu-head strong { font-size: 24px; }
  .main-menu { gap: 5px; padding-bottom: 10px; }
  .menu-item { padding: 10px; }
  .menu-item small { display: none; }
  .menu-albums { gap: 8px; }
  .new-album { padding-top: 10px; gap: 8px; }
  .new-album textarea { min-height: 48px; }
  .user-block { padding-top: 10px; }
  .home-hero {
    min-height: 76vh;
    margin: -18px -18px 24px;
    padding: 22px;
    border-radius: 0 0 26px 26px;
  }
  .home-hero img { object-position: 62% center; }
  .home-kicker { min-height: 30px; margin-bottom: 14px; font-size: 10px; }
  .home-hero-copy h2 { font-size: clamp(38px, 12vw, 58px); }
  .home-hero-copy p { font-size: 16px; }
  .hero-panel {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    margin-top: 18px;
    padding: 16px;
  }
  .home-board { grid-template-columns: 1fr; }
  .home-stat { min-height: 108px; }
  .section-heading { align-items: start; }
  .album-cards { grid-template-columns: 1fr; }
  .album-card { min-height: 136px; }
  .upload, .album-hero, .settings-row { align-items: stretch; flex-direction: column; }
  .admin-layout, .info-grid.compact { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .viewer { grid-template-rows: 64px minmax(0, 1fr) auto; }
  .viewer-stage { padding: 18px 14px; }
  .viewer-stage img { max-width: 100%; max-height: calc(100dvh - 236px); }
  .viewer-nav {
    top: auto;
    bottom: 86px;
    transform: none;
    width: 48px;
    height: 48px;
    font-size: 32px;
  }
  .viewer-nav.prev { left: 16px; }
  .viewer-nav.next { right: 16px; }
  .viewer-controls { flex-wrap: wrap; justify-content: stretch; }
  .viewer-controls button,
  .viewer-controls label { flex: 1 1 150px; }
  .timestamp, .kv { grid-template-columns: 1fr; }
}
