:root {
  --bg: #12110e;
  --bg-2: #1a1914;
  --ink: #f3efe4;
  --muted: #9c9584;
  --line: #2c2a23;
  --gold: #c4a35a;
  --gold-2: #e0c37a;
  --danger: #c45c4a;
  --ok: #6f9e6b;
  --focus: #e0c37a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}

.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { color: var(--gold-2); text-decoration: none; }

#nav { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: center; }
#nav a, #nav button.link {
  color: var(--muted);
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
#nav a:hover, #nav button.link:hover { color: var(--ink); }

main { width: min(1100px, calc(100% - 2.5rem)); margin: 2.2rem auto 4rem; }

.hero {
  padding: 3.2rem 0 2.4rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin: 0 0 0.8rem;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; margin: 0 0 0.75rem; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: 1.6rem; }
.lede { color: var(--muted); font-size: 1.15rem; max-width: 36rem; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #16140f;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 2px;
}

.btn:hover { background: var(--gold-2); border-color: var(--gold-2); text-decoration: none; color: #16140f; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold-2); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin: 2.4rem 0;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 1.25rem 1.3rem;
}

.card p { color: var(--muted); margin: 0.4rem 0 0; }

.panel {
  width: min(460px, 100%);
  margin: 1.5rem auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 1.6rem 1.5rem 1.7rem;
}

.panel.wide { width: min(960px, 100%); }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 0.9rem 0 0.3rem; }

input, select {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.6rem 0.7rem;
  font: inherit;
  border-radius: 2px;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.2rem; }

.msg { margin-top: 0.9rem; font-size: 0.92rem; color: var(--danger); min-height: 1.2em; }
.msg.ok { color: var(--ok); }

.meta { color: var(--muted); margin: 0 0 1.2rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.65rem 0.45rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }

.table-wrap { overflow-x: auto; }

td .btn { padding: 0.3rem 0.55rem; font-size: 0.82rem; }

.stack { display: grid; gap: 1.4rem; }

.hidden { display: none !important; }

footer.site {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 1.4rem 1.5rem 2rem;
  font-size: 0.9rem;
}

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

/* Dropzone */
.dropzone {
  border: 2px dashed var(--line);
  background: var(--bg);
  padding: 2.2rem 1.5rem;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
  margin: 1.2rem 0;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: var(--gold);
  background: rgba(196, 163, 90, 0.04);
  outline: none;
}
.dropzone-icon {
  width: 44px;
  height: 44px;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.dropzone-title {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}
.dropzone-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Batch Bar */
.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.9rem 1.2rem;
  border-radius: 4px;
  margin-bottom: 1.4rem;
}
.batch-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.batch-badge {
  background: var(--gold);
  color: #16140f;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
}
.batch-note {
  color: var(--muted);
  font-size: 0.9rem;
}
.batch-actions {
  display: flex;
  gap: 0.6rem;
}

/* Progress Bar */
.progress-wrap {
  margin-bottom: 1.4rem;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.8rem 1rem;
  border-radius: 4px;
}
.progress-bar {
  height: 8px;
  width: 100%;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* Gallery */
.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
  margin-top: 1.8rem;
  margin-bottom: 1.2rem;
}
.gallery-head h2 { margin: 0; font-size: 1.35rem; }
.gallery-count { color: var(--muted); font-size: 0.88rem; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}

.photo-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}
.photo-card:hover { border-color: #4a4538; }

.photo-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #090908;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-img-fallback {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #11100d;
}

.photo-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  background: rgba(18, 17, 14, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--line);
  color: var(--muted);
}
.photo-badge.done {
  background: rgba(111, 158, 107, 0.9);
  color: #fff;
  border-color: transparent;
}
.photo-badge.processing {
  background: rgba(196, 163, 90, 0.9);
  color: #16140f;
  border-color: transparent;
}
.photo-badge.failed {
  background: rgba(196, 92, 74, 0.9);
  color: #fff;
  border-color: transparent;
}

.compare-badge {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
  background: rgba(18, 17, 14, 0.85);
  color: var(--gold-2);
  border: 1px solid var(--line);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  pointer-events: none;
}

.shimmer-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(196, 163, 90, 0.15), transparent);
  animation: shimmer 1.8s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.photo-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}
.photo-title {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
.photo-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}
.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
}
.photo-actions .btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

/* Model Select in Admin */
.model-select-group {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0;
}
.model-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.9rem 1.1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.model-option-card:hover { border-color: var(--gold); }
.model-option-card input[type="radio"] {
  width: auto;
  margin-top: 0.25rem;
  cursor: pointer;
}
.model-option-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0 0 0.2rem;
}
.model-option-desc {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

@media (max-width: 640px) {
  .top { flex-direction: column; align-items: flex-start; }
  th:nth-child(4), td:nth-child(4) { display: none; }
  .photo-grid { grid-template-columns: 1fr; }
}
