:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: rgba(17, 28, 46, 0.8);
  --panel: rgba(8, 18, 31, 0.82);
  --line: rgba(181, 214, 255, 0.16);
  --line-strong: rgba(181, 214, 255, 0.3);
  --text: #ecf3ff;
  --text-soft: rgba(236, 243, 255, 0.72);
  --accent: #72e1ff;
  --accent-strong: #4cc8eb;
  --success: #89ffbf;
  --error: #ff8e9a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(94, 196, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(114, 225, 255, 0.14), transparent 22%),
    linear-gradient(180deg, #091321 0%, #050c16 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

body.lightbox-open {
  overflow: hidden;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.auth-shell {
  width: min(100%, 560px);
}

.auth-panel {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(13, 24, 42, 0.92), rgba(8, 17, 31, 0.8)),
    rgba(8, 17, 31, 0.8);
  box-shadow: var(--shadow);
}

.site-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 32px;
  align-items: end;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(13, 24, 42, 0.92), rgba(8, 17, 31, 0.8)),
    rgba(8, 17, 31, 0.8);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-copy h1,
.section-head h2 {
  margin: 0;
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero-copy h1 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 6vw, 5.5rem);
}

.intro,
.section-copy,
.status {
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.6;
}

.intro {
  max-width: 52ch;
  margin: 18px 0 0;
}

.header-actions {
  display: grid;
  justify-items: start;
  gap: 16px;
}

.logout-link {
  color: var(--text-soft);
  font-size: 0.95rem;
  text-decoration: none;
}

.logout-link:hover {
  color: var(--text);
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 24px;
  border: 1px solid rgba(114, 225, 255, 0.38);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #031019;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
  box-shadow: 0 16px 34px rgba(76, 200, 235, 0.28);
}

.upload-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.05);
  box-shadow: 0 22px 40px rgba(76, 200, 235, 0.36);
}

.upload-button:active {
  transform: translateY(0);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255, 142, 154, 0.36);
  border-radius: 999px;
  background: rgba(255, 142, 154, 0.12);
  color: #ffd7dc;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.danger-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 142, 154, 0.18);
  border-color: rgba(255, 142, 154, 0.52);
}

.danger-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.status {
  margin: 0;
  min-height: 1.6em;
}

.status.is-success {
  color: var(--success);
}

.status.is-error {
  color: var(--error);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.auth-input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(4, 11, 20, 0.88);
  color: var(--text);
  font: inherit;
}

.auth-input:focus {
  outline: 2px solid rgba(114, 225, 255, 0.3);
  outline-offset: 2px;
  border-color: var(--line-strong);
}

.auth-submit {
  margin-top: 6px;
}

.auth-error {
  margin: 18px 0 0;
  color: var(--error);
  font-weight: 600;
}

.content {
  margin-top: 28px;
}

.gallery-section {
  padding: 32px 0 0;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.7fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}

.section-head h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.section-copy {
  margin: 0;
  max-width: 40ch;
}

.empty-state {
  display: none;
  padding: 22px 0;
  color: var(--text-soft);
  font-size: 1rem;
}

.empty-state.is-visible {
  display: block;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.gallery-item {
  position: relative;
  min-height: 280px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transform: translateY(0);
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.3);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.gallery-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
}

.gallery-meta {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(180deg, transparent, rgba(3, 8, 15, 0.92));
}

.gallery-name,
.gallery-time {
  display: block;
  line-height: 1.4;
}

.gallery-name {
  max-width: 65%;
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-time {
  font-size: 0.84rem;
  color: rgba(236, 243, 255, 0.68);
  text-align: right;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lightbox-scrim {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 14, 0.8);
  backdrop-filter: blur(12px);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: rgba(6, 14, 25, 0.96);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.44);
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.88);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.lightbox-image {
  display: block;
  width: 100%;
  max-height: calc(100vh - 140px);
  border-radius: 18px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.3);
}

.lightbox-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px 2px;
}

.lightbox-caption {
  display: grid;
  gap: 4px;
}

.lightbox-name {
  font-size: 1rem;
  font-weight: 600;
}

.lightbox-time {
  color: var(--text-soft);
  font-size: 0.92rem;
  text-align: right;
}

code {
  padding: 0.18rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-family: inherit;
  font-size: 0.92em;
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 14px;
  }

  .site-header,
  .section-head {
    grid-template-columns: 1fr;
  }

  .site-header {
    position: relative;
    top: 0;
    padding: 24px;
  }

  .hero-copy h1 {
    max-width: 10ch;
  }

  .gallery {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .lightbox {
    padding: 14px;
  }

  .lightbox-dialog {
    padding: 14px;
    border-radius: 22px;
  }

  .lightbox-image {
    max-height: calc(100vh - 120px);
  }

  .lightbox-meta {
    align-items: start;
    flex-direction: column;
  }

  .danger-button {
    width: 100%;
  }
}
