:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #0f141b;
  --panel-soft: #121923;
  --line: rgba(255, 255, 255, 0.1);
  --text: #e6eaf0;
  --muted: #9aa6b2;
  --primary: #6ea8fe;
  --primary-strong: #4d94ff;
  --danger: #f07878;
  --radius: 18px;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(110, 168, 254, 0.11), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 34px);
}

.site-footer {
  padding: 20px 12px 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.login-card {
  width: min(470px, 100%);
  margin: max(8vh, 40px) auto;
  padding: clamp(28px, 6vw, 52px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(15, 20, 27, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
}

.brand-mark {
  display: grid;
  width: 76px;
  aspect-ratio: 1;
  margin: 0 auto 24px;
  place-items: center;
  border: 1px solid rgba(110, 168, 254, 0.42);
  border-radius: 20px;
  background: linear-gradient(145deg, #17263a, #0b1119);
  color: var(--primary);
  font-size: 25px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(28px, 5vw, 40px);
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.login-card .muted {
  max-width: 35ch;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 750;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  border-color: transparent;
  background: var(--primary);
  color: #081019;
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

.button-quiet {
  background: rgba(255, 255, 255, 0.035);
}

.button-danger {
  border-color: rgba(240, 120, 120, 0.35);
  background: rgba(240, 120, 120, 0.1);
  color: #ffc2c2;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 23px;
}

:focus-visible {
  outline: 3px solid rgba(110, 168, 254, 0.75);
  outline-offset: 3px;
}

.app {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(15, 20, 27, 0.97);
  box-shadow: var(--shadow);
}

.topbar,
.content-heading,
.section-heading,
.account,
.content-actions,
.photo-actions {
  display: flex;
  align-items: center;
}

.topbar {
  min-height: 92px;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(23px, 4vw, 31px);
}

.account {
  gap: 14px;
}

.workspace {
  display: grid;
  min-height: calc(100vh - 160px);
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

.section-heading,
.content-heading {
  justify-content: space-between;
  gap: 14px;
}

.album-list {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.album-button {
  width: 100%;
  padding: 13px 14px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-button:hover,
.album-button[aria-current="true"] {
  border-color: rgba(110, 168, 254, 0.24);
  background: rgba(110, 168, 254, 0.09);
  color: var(--text);
}

.overview-button {
  margin-bottom: 28px;
  font-weight: 750;
}

.content {
  min-width: 0;
  padding: clamp(18px, 3vw, 30px);
}

.content-heading {
  margin-bottom: 24px;
}

.content-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: grid;
  min-height: 142px;
  align-content: space-between;
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(110, 168, 254, 0.06), transparent 65%),
    var(--panel-soft);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card-wide {
  grid-column: span 1;
}

.overview-note {
  margin: 18px 2px 0;
  font-size: 12px;
  line-height: 1.6;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.photo-card {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 240ms ease, opacity 180ms ease;
}

.photo-card:hover img {
  transform: scale(1.025);
}

.photo-card:disabled {
  cursor: wait;
}

.photo-state {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 18px;
  place-items: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent);
  text-align: center;
}

.photo-name {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  padding: 7px 9px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(4, 8, 13, 0.72);
  color: #fff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-content: center;
  gap: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  text-align: center;
}

.upload-status {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.progress-value {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease;
}

.load-more {
  margin: 24px auto 0;
}

dialog {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

dialog::backdrop {
  background: rgba(2, 5, 9, 0.78);
  backdrop-filter: blur(7px);
}

.dialog-card {
  display: grid;
  width: min(460px, calc(100vw - 28px));
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

label {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.photo-dialog {
  width: min(1100px, calc(100vw - 24px));
  max-width: none;
}

.photo-modal {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.photo-actions {
  justify-content: flex-end;
  gap: 9px;
  padding-bottom: 12px;
}

.photo-modal img {
  display: block;
  width: 100%;
  max-height: 75vh;
  border-radius: 12px;
  object-fit: contain;
  background: #080b0f;
}

.photo-modal p {
  margin: 12px 4px 2px;
  color: var(--muted);
  font-size: 13px;
}

.message {
  margin: 0;
  font-size: 13px;
}

.message-error {
  color: #ffaaaa;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(400px, calc(100vw - 40px));
  padding: 13px 16px;
  border: 1px solid rgba(240, 120, 120, 0.4);
  border-radius: 12px;
  background: #3b1f24;
  box-shadow: var(--shadow);
  color: #ffd8d8;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .shell {
    padding: 0;
  }

  .app {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    align-items: flex-start;
    padding: 16px;
  }

  .account {
    align-items: flex-end;
    flex-direction: column;
  }

  .account .muted {
    display: block;
    max-width: 48vw;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .album-list {
    display: flex;
    margin-top: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .overview-button {
    margin-bottom: 20px;
  }

  .album-button {
    width: auto;
    flex: 0 0 auto;
    max-width: 220px;
  }

  .content-heading {
    align-items: flex-end;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    min-height: 120px;
    padding: 16px;
  }

  .photo-actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
