:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --text: #0f1115;
  --muted: #68707d;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-strong: #0f1115;
  --border: #e3e7ee;
  --border-strong: #c8d0dc;
  --accent: #12a37f;
  --accent-dark: #04755f;
  --blue: #2f5be8;
  --blue-dark: #2245bd;
  --danger: #be2b35;
  --danger-soft: #fff1f2;
  --shadow: 0 22px 60px rgba(23, 31, 45, 0.1);
  --shadow-soft: 0 12px 32px rgba(23, 31, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #eef2f7 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.auth-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 420px);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 22px;
  font-size: 2rem;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-stack label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.form-stack input {
  width: 100%;
  padding: 13px 14px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

.form-stack input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 143, 112, 0.15);
}

.primary-button,
.secondary-button,
.copy-button,
.delete-button,
.delete-text-button,
.overlay-icon-button,
.modal-close,
.modal-nav,
.modal-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 750;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.primary-button {
  margin-top: 8px;
  color: #ffffff;
  background: var(--surface-strong);
  box-shadow: 0 10px 22px rgba(15, 17, 21, 0.15);
}

.primary-button:hover,
.secondary-button:hover,
.copy-button:hover,
.delete-button:hover,
.delete-text-button:hover,
.overlay-icon-button:hover,
.modal-close:hover,
.modal-nav:hover,
.modal-action-icon:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
}

.secondary-button {
  padding: 0 18px;
  color: var(--surface);
  background: var(--surface-strong);
  box-shadow: 0 10px 22px rgba(15, 17, 21, 0.12);
}

.dashboard-view {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 28px;
}

.topbar h1 {
  margin-bottom: 8px;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.upload-section {
  margin-bottom: 34px;
}

.dropzone {
  position: relative;
  display: flex;
  min-height: 188px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px;
  text-align: left;
  background: rgba(255, 255, 255, 0.86);
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  outline: none;
  box-shadow: var(--shadow-soft);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.dropzone:hover,
.dropzone:focus,
.dropzone.drag-over {
  background: #f2fbf8;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(18, 163, 127, 0.14);
}

.dropzone.is-uploading {
  border-color: var(--blue);
  background: #f4f7ff;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone-icon {
  display: grid;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  place-items: center;
  color: #ffffff;
  background: var(--surface-strong);
  border-radius: 8px;
  box-shadow: 0 14px 26px rgba(15, 17, 21, 0.16);
}

.dropzone-title {
  margin-bottom: 4px;
  font-size: 1.08rem;
  font-weight: 800;
}

.dropzone-subtitle,
.status-text,
.empty-gallery {
  margin-bottom: 0;
  color: var(--muted);
}

.status-text {
  min-height: 24px;
  margin-top: 12px;
  font-weight: 650;
}

.error-text {
  min-height: 24px;
  margin-bottom: 0;
  color: var(--danger);
  font-weight: 650;
}

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

.gallery-count {
  padding: 5px 10px;
  color: var(--muted);
  background: #eef2f7;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 236px));
  gap: 16px;
  align-items: start;
}

.image-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.image-card:hover {
  border-color: #d3dae6;
  box-shadow: 0 18px 42px rgba(23, 31, 45, 0.12);
  transform: translateY(-2px);
}

.preview-wrap {
  position: relative;
  aspect-ratio: 1.35 / 1;
  overflow: hidden;
  background: #e9edf4;
  border-radius: 8px;
}

.preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 180ms ease, transform 180ms ease;
}

.image-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: rgba(5, 8, 12, 0.34);
  opacity: 0;
  transition: opacity 180ms ease;
}

.overlay-actions {
  display: flex;
  gap: 10px;
}

.overlay-icon-button {
  width: 46px;
  height: 46px;
  color: #ffffff;
  background: rgba(15, 17, 21, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.preview-wrap:hover img {
  filter: brightness(0.72);
  transform: scale(1.03);
}

.preview-wrap:hover .image-overlay {
  opacity: 1;
}

.copy-button {
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  color: #ffffff;
  background: var(--blue);
  font-size: 0.9rem;
}

.copy-button:hover {
  background: var(--blue-dark);
}

.delete-button {
  width: 38px;
  min-height: 38px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #ffd2d7;
}

.delete-text-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #ffd2d7;
  font-size: 0.9rem;
}

.empty-gallery {
  padding: 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  min-width: 160px;
  padding: 12px 14px;
  color: #ffffff;
  background: var(--surface-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-open {
  overflow: hidden;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 17, 0.58);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  overflow: hidden;
  background: #0f1115;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  min-height: 38px;
  color: #ffffff;
  background: rgba(15, 17, 21, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.modal-image-wrap {
  display: grid;
  height: min(720px, calc(100vh - 44px));
  min-height: 420px;
  place-items: center;
  background: #0f1115;
}

.modal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 46px;
  height: 54px;
  color: #ffffff;
  background: rgba(15, 17, 21, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  transform: translateY(-50%);
}

.modal-nav:hover {
  transform: translateY(calc(-50% - 1px));
}

.modal-nav:disabled {
  cursor: not-allowed;
  opacity: 0.36;
  transform: translateY(-50%);
}

.modal-nav-prev {
  left: 14px;
}

.modal-nav-next {
  right: 14px;
}

.modal-toolbar {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  color: #ffffff;
  background: rgba(15, 17, 21, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.modal-details {
  min-width: 0;
}

.modal-counter {
  margin-bottom: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
}

.modal-filename {
  overflow: hidden;
  max-width: min(58vw, 620px);
  margin-bottom: 0;
  color: #ffffff;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.modal-action-icon {
  width: 42px;
  height: 42px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.modal-action-icon:hover {
  background: rgba(255, 255, 255, 0.18);
}

.modal-action-icon:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.modal-action-danger {
  color: #ff9aa2;
  background: rgba(190, 43, 53, 0.16);
  border-color: rgba(255, 154, 162, 0.3);
}

.modal-action-danger:hover {
  background: rgba(190, 43, 53, 0.28);
}

@media (max-width: 680px) {
  .auth-card {
    padding: 24px;
  }

  .dashboard-view {
    width: min(100% - 24px, 1120px);
    padding-top: 18px;
  }

  .topbar {
    flex-direction: column;
  }

  .secondary-button {
    width: 100%;
  }

  .dropzone {
    min-height: 178px;
    flex-direction: column;
    padding: 22px;
    text-align: center;
  }

  .image-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.18);
  }

  .overlay-icon-button {
    width: 46px;
    height: 46px;
  }

  .modal-image-wrap {
    height: calc(100vh - 24px);
    min-height: 360px;
  }

  .modal-nav {
    width: 42px;
    height: 48px;
  }

  .modal-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions {
    width: 100%;
  }

  .modal-action-icon {
    flex: 1;
  }

  .modal-filename {
    max-width: calc(100vw - 70px);
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
}
