:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: #1c2433;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(42, 125, 225, 0.14), transparent 32rem),
    linear-gradient(135deg, #f8fafc 0%, #eef3f8 48%, #f7f5ef 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app-panel[hidden],
.login-panel[hidden] {
  display: none;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 28px;
  align-items: center;
  min-height: calc(100vh - 80px);
}

.login-form {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(28, 36, 51, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 60px rgba(28, 36, 51, 0.08);
  backdrop-filter: blur(16px);
}

.login-form input {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(28, 36, 51, 0.14);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: #1c2433;
}

.login-form button,
.logout-button {
  min-height: 44px;
  border-radius: 8px;
  background: #1c2433;
  color: #fff;
  font-weight: 800;
}

.login-form button:disabled,
.logout-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-status {
  min-height: 20px;
  margin: 0;
  color: #657184;
  font-size: 13px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding: 36px 0 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #2c7be5;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 720px;
  font-size: clamp(38px, 7vw, 76px);
}

h2 {
  font-size: 28px;
}

.subtitle {
  max-width: 620px;
  margin: 18px 0 0;
  color: #566275;
  font-size: 18px;
  line-height: 1.7;
}

.hero-stats {
  min-width: 132px;
  border-left: 4px solid #2c7be5;
  padding: 8px 0 8px 18px;
}

.hero-side {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.logout-button {
  padding: 0 14px;
  background: #ffffff;
  color: #1c2433;
  border: 1px solid rgba(28, 36, 51, 0.12);
}

.hero-stats span {
  display: block;
  font-size: 42px;
  font-weight: 900;
}

.hero-stats small {
  color: #657184;
  font-weight: 700;
}

.settings-panel,
.upload-panel,
.gallery-section {
  border: 1px solid rgba(28, 36, 51, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 60px rgba(28, 36, 51, 0.08);
  backdrop-filter: blur(16px);
}

.settings-panel {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(260px, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
  padding: 22px;
}

.domain-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.domain-form input {
  min-width: 0;
  height: 44px;
  border: 1px solid rgba(28, 36, 51, 0.14);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: #1c2433;
}

.domain-form button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  background: #1c2433;
  color: #fff;
  font-weight: 800;
}

.domain-form button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.settings-note {
  grid-column: 2;
  margin: -8px 0 0;
  color: #657184;
  font-size: 13px;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 22px;
  padding: 22px;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 280px;
  place-items: center;
  border: 2px dashed #9db4d0;
  border-radius: 8px;
  background: #f8fbff;
  transition: 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-over {
  border-color: #2c7be5;
  background: #eef6ff;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-copy {
  display: grid;
  gap: 10px;
  padding: 28px;
  text-align: center;
  pointer-events: none;
}

.drop-copy strong {
  font-size: 24px;
}

.drop-copy span,
.status,
.result span,
.meta {
  color: #657184;
}

.preview-panel {
  display: grid;
  min-height: 280px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: #111827;
}

.preview-panel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-empty {
  color: #b7c0cc;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  grid-column: 1 / -1;
}

.primary,
.result button,
.pager button,
.copy-action,
.delete-action {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.primary {
  min-width: 136px;
  background: #1f7a54;
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 122, 84, 0.24);
}

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

.result {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 8px;
  background: #eef8f3;
  border: 1px solid #cde8dc;
}

.result div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.result a {
  overflow: hidden;
  color: #176b49;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result button,
.copy-action {
  padding: 0 14px;
  background: #ffffff;
  color: #1c2433;
  border: 1px solid rgba(28, 36, 51, 0.12);
}

.delete-action {
  width: 100%;
  background: #fff1f0;
  color: #b42318;
  border: 1px solid #ffd0cc;
}

.gallery-section {
  margin-top: 24px;
  padding: 22px;
}

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

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pager button {
  width: 42px;
  background: #1c2433;
  color: #fff;
  font-size: 24px;
}

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

.pager span {
  min-width: 72px;
  text-align: center;
  color: #566275;
  font-weight: 800;
}

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

.card {
  overflow: hidden;
  border: 1px solid rgba(28, 36, 51, 0.1);
  border-radius: 8px;
  background: #fff;
}

.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #111827;
  cursor: zoom-in;
}

.card-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.name {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  font-size: 13px;
}

.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.url-row input {
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(28, 36, 51, 0.14);
  border-radius: 8px;
  padding: 0 10px;
  color: #566275;
  background: #f8fafc;
}

.empty-gallery {
  padding: 42px;
  border: 1px dashed #b9c4d2;
  border-radius: 8px;
  color: #657184;
  text-align: center;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 54px 18px;
  background: rgba(9, 14, 23, 0.9);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(1100px, 94vw);
  max-height: 78vh;
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #111827;
  font-size: 28px;
}

.lightbox a {
  margin-top: 18px;
  color: #fff;
  font-weight: 800;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .hero,
  .login-panel,
  .settings-panel,
  .upload-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: start;
  }

  .hero-stats {
    width: 100%;
  }

  .hero-side {
    justify-items: stretch;
  }

  .section-head,
  .actions,
  .domain-form,
  .result {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .settings-note {
    grid-column: auto;
    margin: 0;
  }

  .section-head {
    flex-direction: column;
  }

  .pager {
    width: 100%;
    justify-content: space-between;
  }
}
