:root {
  --bg0: #0c1016;
  --bg1: #151b24;
  --ink: #f3efe6;
  --muted: #a8b0bc;
  --brass: #d4b27a;
  --brass-deep: #b8914f;
  --danger: #e07060;
  --ok: #8fbf8a;
  --line: rgba(243, 239, 230, 0.12);
  --panel: rgba(21, 27, 36, 0.72);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Manrope", system-ui, sans-serif;
  --content-max: 1100px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg0);
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 90% 60% at 70% -10%, rgba(212, 178, 122, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 10% 90%, rgba(60, 90, 120, 0.25), transparent 50%),
    linear-gradient(165deg, #0c1016 0%, #121821 45%, #0a0e14 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

body.workspace-active main {
  max-width: none;
  padding: 0;
}

.hero {
  min-height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0 3rem;
  width: 100%;
  max-width: none;
  animation: rise 0.8s ease both;
}

.hero-intro {
  display: grid;
  gap: 1.75rem;
  margin: 0 0 2rem;
  align-items: start;
}

.hero-copy {
  min-width: 0;
  container-type: inline-size;
  container-name: hero-copy;
}

.brand-hero {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 10vw, 5.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--brass);
}

.hero h1 {
  margin: 0 0 1.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.15rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-lead-short {
  display: none;
}

.brand-inline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18em;
  letter-spacing: -0.03em;
  color: var(--brass);
}

.hero-cta-block {
  display: grid;
  gap: 0.7rem;
  justify-items: stretch;
  align-content: center;
  padding: 1rem 1.05rem 1.05rem;
  border: 1px solid rgba(212, 178, 122, 0.35);
  border-radius: 14px;
  background: rgba(21, 27, 36, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(243, 239, 230, 0.04),
    0 12px 28px rgba(0, 0, 0, 0.18);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

.hero-cta .btn-primary {
  width: 100%;
  justify-content: center;
}

.hero-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: none;
  text-align: center;
}

.hero-credit {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-credit a {
  color: var(--brass);
  text-decoration: none;
}

.hero-credit a:hover {
  text-decoration: underline;
}

.hero-credit-sep {
  margin: 0 0.35rem;
  opacity: 0.7;
}

#app-version {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

@media (max-width: 719px) {
  /* Brand + copy, then demos, then Try it (CTA lives in hero-intro in the DOM). */
  .hero {
    gap: 1.25rem;
  }

  .hero-intro {
    display: contents;
  }

  .brand-hero {
    order: 1;
    font-size: clamp(2.35rem, 11vw, 3.1rem);
    line-height: 0.9;
  }

  .hero-copy {
    order: 2;
  }

  .hero h1 {
    margin: 0 0 0.55rem;
    font-size: clamp(1.15rem, 4.6vw, 1.4rem);
    line-height: 1.12;
  }

  .hero-lead {
    font-size: 0.9rem;
    line-height: 1.35;
  }

  .hero-lead-full {
    display: none;
  }

  .hero-lead-short {
    display: inline;
  }

  .hero-demo {
    order: 3;
    margin-bottom: 0;
  }

  .hero-cta-block {
    order: 4;
    margin-top: -0.85rem;
  }

  .hero-credit {
    order: 5;
    margin-top: 0;
  }
}

@media (min-width: 720px) {
  /* 12-col: brand + copy 1–6, gap 7, CTA 8–12 (CTA top = subtitle top) */
  .hero-intro {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto;
    column-gap: 0;
    row-gap: 1.5rem;
    margin-bottom: 2.5rem;
    align-items: start;
  }

  .brand-hero {
    grid-column: 1 / span 6;
    grid-row: 1;
    margin-bottom: 0;
  }

  .hero-copy {
    grid-column: 1 / span 6;
    grid-row: 2;
  }

  .hero-cta-block {
    grid-column: 8 / span 5;
    grid-row: 2;
    align-self: start;
    width: auto;
    min-width: 0;
    padding: clamp(0.85rem, 1.4vw, 1.15rem);
  }

  .hero h1 {
    /* ~25% larger than prior fit; still one line in the 6-col copy width. */
    font-size: clamp(1.2rem, 100cqi / 21.5, 1.75rem);
    white-space: nowrap;
    max-width: 100%;
    margin-bottom: 1.6rem;
  }

  .hero-note {
    font-size: clamp(0.72rem, 0.95vw, 0.78rem);
  }
}

.hero-demo {
  --hero-demo-gap: 15px;
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.75rem;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--hero-demo-gap);
}

.hero-demo.is-mobile {
  --hero-demo-gap: 12px;
  flex-direction: column;
}

.hero-demo-col {
  display: flex;
  flex-direction: column;
  gap: var(--hero-demo-gap);
  flex: 0 0 auto;
  min-width: 0;
}

.hero-demo-pair {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--hero-demo-gap);
  min-width: 0;
}

.hero-demo.is-mobile .hero-demo-row {
  width: 100%;
  justify-content: flex-start;
}

.hero-demo-tile {
  margin: 0;
  border: none;
  border-radius: 10px;
  background: #07090c;
  box-shadow: inset 0 0 0 1px rgba(212, 178, 122, 0.35);
  overflow: hidden;
  position: relative;
  flex: 0 0 auto;
}

.hero-demo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  appearance: none;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.8rem 1.35rem;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--brass);
  color: #1a140c;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brass-deep);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--brass);
  color: var(--brass);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0.55rem 0.9rem;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line);
}

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

.workspace {
  padding: 0 0 2rem;
  animation: rise 0.45s ease both;
}

.workspace.hidden,
.hidden {
  display: none !important;
}

.control-deck {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 0 1.25rem;
  padding: 1.35rem 1.15rem;
  background: rgba(12, 16, 22, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
}

.deck-row {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.deck-brand-wrap {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.deck-brand {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--brass);
  /* Optical lift: Fraunces sits slightly low in its em box next to UI text. */
  transform: translateY(-0.12em);
}

.deck-copy {
  flex: 1 1 14rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.deck-status {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.deck-note {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

.deck-note[hidden] {
  display: none !important;
}

.deck-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  align-self: center;
  justify-content: flex-end;
}

.deck-frame-row {
  max-width: var(--content-max);
  margin: 0.85rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.5rem;
  align-items: center;
}

.deck-frame-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
}

.deck-frame-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.deck-frame-label-short {
  display: none;
}

.deck-frame-field select {
  appearance: none;
  color-scheme: dark;
  background-color: #0c1016;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.45rem 2rem 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.92rem;
  min-width: 7rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.deck-frame-field select option {
  background-color: #0c1016;
  color: var(--ink);
}

.deck-frame-field select:disabled {
  opacity: 0.55;
}

#gallery-view {
  min-width: 11.5rem;
}

@media (max-width: 719px) {
  .control-deck {
    padding: 0.85rem 1rem 1rem;
  }

  .deck-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "copy copy";
    gap: 0.85rem 0.65rem;
    align-items: center;
  }

  .deck-brand-wrap {
    grid-area: brand;
    align-self: center;
  }

  .deck-brand {
    font-size: 2.4rem;
    transform: translateY(-0.12em);
  }

  .deck-copy {
    grid-area: copy;
    flex: none;
    width: 100%;
    margin-top: 0.15rem;
  }

  .deck-actions {
    grid-area: actions;
    flex-wrap: nowrap;
    justify-self: end;
    align-self: center;
    gap: 0.35rem;
  }

  .deck-actions .btn-primary,
  .deck-actions .btn-secondary,
  .deck-actions .btn-ghost {
    padding: 0.42rem 0.62rem;
    font-size: 0.82rem;
  }

  .deck-frame-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    align-items: end;
    margin-top: 1rem;
  }

  .deck-frame-field {
    flex-direction: column;
    align-items: stretch;
    gap: 0.28rem;
    min-width: 0;
  }

  .deck-frame-label {
    font-size: 0.64rem;
    line-height: 1.2;
    white-space: normal;
  }

  .deck-frame-label-full {
    display: none;
  }

  .deck-frame-label-short {
    display: inline;
  }

  .deck-frame-field select {
    min-width: 0;
    width: 100%;
    font-size: 0.82rem;
    padding: 0.38rem 1.45rem 0.38rem 0.45rem;
  }

  #gallery-view {
    min-width: 0;
  }

  .deck-progress {
    margin-top: 0.55rem;
  }
}

.deck-actions .btn-primary,
.deck-actions .btn-secondary,
.deck-actions .btn-ghost {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
}

.deck-progress {
  max-width: var(--content-max);
  margin: 0.65rem auto 0;
}

.deck-progress.hidden {
  display: none !important;
}

.progress-track {
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brass-deep), var(--brass));
  transition: width 0.25s ease;
}

.results {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(28rem, 100%);
  padding: 1.35rem 1.4rem 1.25rem;
  background: #151b24;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}

.modal-card-wide {
  width: min(44rem, 100%);
  max-height: min(90vh, 52rem);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-card-wide.advanced-open {
  max-height: min(94vh, 58rem);
}

.download-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex: 0 0 auto;
  margin: 0;
}

.download-modal-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.download-modal-header .modal-title {
  margin: 0;
}

.download-zip-note {
  display: block;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.download-title-short {
  display: none;
}

.download-modal-header .modal-actions {
  flex: 0 0 auto;
  margin: 0;
}

.modal-card-wide .advanced-options {
  margin: 1.15rem 0 1.15rem;
}

.modal-card-wide .modal-status {
  margin: 0 0 0.65rem;
}

.download-preview-scroll {
  flex: 1 1 auto;
  min-height: 11rem;
  max-height: min(50vh, 28rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem;
}

.download-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: min-content;
  gap: 0.65rem;
  margin: 0;
  align-content: start;
}

@media (min-width: 720px) {
  .download-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

.modal-card-wide.advanced-open .download-preview-scroll {
  max-height: min(40vh, 22rem);
}

.download-preview-grid .crop-item {
  margin: 0;
  min-width: 0;
  aspect-ratio: var(--export-aspect, 1.6);
  overflow: hidden;
}

.download-preview-grid .crop-preview,
.download-preview-grid canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.advanced-options {
  flex: 0 0 auto;
  margin: 0 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 9, 12, 0.45);
}

.advanced-options summary {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.advanced-options summary::-webkit-details-marker {
  display: none;
}

.advanced-options summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.advanced-options[open] summary {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.advanced-options[open] summary::before {
  transform: rotate(90deg);
}

.advanced-body {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 0.65rem 0.9rem;
  padding: 0.65rem 0.75rem 0.75rem;
  overflow-x: auto;
}

.advanced-field {
  display: grid;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.advanced-quality {
  width: 9.5rem;
}

.advanced-aspect {
  width: 6.5rem;
}

.advanced-size {
  width: 10.5rem;
}

.advanced-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
  font-size: 0.72rem;
  color: var(--ink);
  white-space: nowrap;
}

.advanced-label strong {
  font-variant-numeric: tabular-nums;
  color: var(--brass);
}

.advanced-field input[type="range"] {
  width: 100%;
  accent-color: var(--brass);
}

.advanced-field select {
  width: 100%;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color-scheme: dark;
  background-color: #0c1016;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
}

.advanced-field select option {
  background-color: #0c1016;
  color: var(--ink);
}

.advanced-reset {
  flex: 0 0 auto;
  align-self: end;
  margin-left: auto;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
}

.advanced-reset:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--brass);
}

.advanced-reset:disabled {
  opacity: 0.4;
  cursor: default;
}

.modal-status {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.modal-status.hidden {
  display: none !important;
}

.modal-title {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.modal-copy {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.modal-check {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0 0 1.15rem;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
}

.modal-check input {
  accent-color: var(--brass);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.picker-hint-card {
  width: min(30rem, 100%);
}

.picker-hint-card .modal-copy {
  margin-bottom: 0.85rem;
}

.picker-hint-card .modal-title strong {
  font-weight: 700;
  color: var(--brass);
}

.picker-hint-panel.hidden {
  display: none !important;
}

.picker-hint-window {
  display: grid;
  gap: 0.2rem;
  padding: 0.45rem;
  margin: 0 0 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(7, 9, 12, 0.45);
}

.picker-hint-row {
  display: grid;
  grid-template-columns: 2.15rem minmax(0, 1fr) 1.15rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.45rem;
  border-radius: 8px;
}

.picker-hint-row:nth-child(1) {
  animation: picker-row-select 7s ease-in-out infinite;
}

.picker-hint-row:nth-child(2) {
  animation: picker-row-select 7s ease-in-out infinite 0.55s;
}

.picker-hint-row:nth-child(3) {
  animation: picker-row-select 7s ease-in-out infinite 1.1s;
}

.picker-hint-row:nth-child(4) {
  animation: picker-row-select 7s ease-in-out infinite 1.65s;
}

.picker-hint-name {
  color: var(--ink);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-hint-thumb {
  display: block;
  width: 2.15rem;
  height: 1.35rem;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(243, 239, 230, 0.12);
}

.picker-hint-check {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  background: var(--brass);
  opacity: 1;
  position: relative;
}

.picker-hint-check::after {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 0.2rem;
  width: 0.32rem;
  height: 0.52rem;
  border: solid #1a140c;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.picker-hint-row .picker-hint-check {
  animation: picker-check-pop 7s ease-in-out infinite;
}

.picker-hint-row:nth-child(2) .picker-hint-check {
  animation-delay: 0.55s;
}

.picker-hint-row:nth-child(3) .picker-hint-check {
  animation-delay: 1.1s;
}

.picker-hint-row:nth-child(4) .picker-hint-check {
  animation-delay: 1.65s;
}

.picker-hint-keys {
  list-style: none;
  margin: 0 0 1.15rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.picker-hint-keys li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.picker-hint-plus {
  color: var(--muted);
  opacity: 0.7;
}

.picker-hint-card kbd,
.picker-hint-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(212, 178, 122, 0.35);
  background: rgba(212, 178, 122, 0.1);
  color: var(--brass);
  font: 600 0.78rem/1.2 var(--font-ui);
}

.picker-hint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 1.15rem;
}

.picker-hint-tile {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  animation: picker-tile-select 6.5s ease-in-out infinite;
}

.picker-hint-tile .picker-hint-thumb {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.picker-hint-tile .picker-hint-check {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  animation: picker-check-pop 6.5s ease-in-out infinite;
}

.picker-hint-tile:nth-child(2) {
  animation-delay: 0.5s;
}

.picker-hint-tile:nth-child(2) .picker-hint-check {
  animation-delay: 0.5s;
}

.picker-hint-tile:nth-child(3) {
  animation-delay: 1s;
}

.picker-hint-tile:nth-child(3) .picker-hint-check {
  animation-delay: 1s;
}

.picker-hint-tile:nth-child(4) {
  animation-delay: 1.5s;
}

.picker-hint-tile:nth-child(4) .picker-hint-check {
  animation-delay: 1.5s;
}

.picker-hint-card .modal-actions {
  justify-content: stretch;
}

.picker-hint-card .modal-actions .btn-primary {
  width: 100%;
  justify-content: center;
}

@keyframes picker-row-select {
  0%,
  12% {
    background: transparent;
  }
  22%,
  82% {
    background: rgba(212, 178, 122, 0.14);
  }
  92%,
  100% {
    background: transparent;
  }
}

@keyframes picker-tile-select {
  0%,
  12% {
    border-color: transparent;
  }
  22%,
  82% {
    border-color: var(--brass);
  }
  92%,
  100% {
    border-color: transparent;
  }
}

@keyframes picker-check-pop {
  0%,
  12% {
    opacity: 0;
    transform: scale(0.6);
  }
  22%,
  82% {
    opacity: 1;
    transform: scale(1);
  }
  92%,
  100% {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* ZIP download on all viewports (individual save kept in DOM but unused). */
#download-individual-btn {
  display: none;
}

@media (max-width: 719px) {
  #download-modal .advanced-options {
    display: none;
  }

  #download-modal .download-modal-header {
    margin-bottom: 1.15rem;
  }

  #download-modal .download-modal-header .modal-title {
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .download-title-full {
    display: none;
  }

  .download-title-short {
    display: inline;
  }

  #download-modal .download-preview-scroll {
    max-height: min(68vh, 36rem);
  }
}

@media (min-width: 720px) {
  .download-modal-header {
    align-items: flex-start;
  }
}

/* CSS multi-column = ragged heights. Avoid display:grid here: default
   align-items:stretch equalizes row height and shows the dark tile
   background as black padding under shorter images. */
.preview-columns {
  column-count: 2;
  column-gap: 1rem;
}

@media (min-width: 720px) {
  .preview-columns {
    column-count: 3;
  }
}

@media (min-width: 1000px) {
  .preview-columns {
    column-count: 4;
  }
}

.preview-item {
  break-inside: avoid;
  margin: 0 0 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: #07090c;
  border: 1px solid var(--line);
  animation: rise 0.35s ease both;
}

.preview-item-debug {
  cursor: pointer;
}

.preview-item-debug:hover {
  border-color: var(--brass);
}

.preview-item-collected {
  outline: 2px solid var(--brass);
  outline-offset: -2px;
}

.preview-item img,
.preview-item canvas {
  display: block;
  width: 100%;
  height: auto;
}

.preview-placeholder {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-group {
  margin-bottom: 2rem;
  animation: rise 0.4s ease both;
}

.download-preview-grid .crop-item {
  position: relative;
}

.result-group-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  margin: 0 0 0.85rem;
}

.result-group-header .result-group-title {
  margin: 0;
}

.result-group-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.result-group-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.crop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}

.crop-preview-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  align-content: start;
}

@media (min-width: 720px) {
  .crop-preview-grid:not(.is-portrait) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .crop-preview-grid:not(.is-portrait) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.crop-preview-grid.is-portrait {
  justify-content: start;
}

.crop-preview-grid .crop-item {
  margin: 0;
  min-width: 0;
  aspect-ratio: var(--export-aspect, 1.6);
  overflow: hidden;
}

.crop-preview-grid .crop-preview,
.crop-preview-grid canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.crop-item {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #07090c;
  border: 1px solid var(--line);
}

.crop-preview {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  background: #07090c;
}

.failed-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.failed-list li {
  margin-bottom: 0.35rem;
}

/* Admin */
.lead {
  color: var(--muted);
}

.status {
  min-height: 1.5rem;
  margin: 0.75rem 0;
}

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

.session-list {
  display: grid;
  gap: 1rem;
}

.session-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.25rem;
}

.session-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-family: var(--font-ui);
  font-weight: 600;
  word-break: break-all;
}

.session-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.session-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-page {
  min-height: 100vh;
}

.admin-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.admin-period-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-period-select {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px),
    calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.metrics-section-note {
  margin: -0.35rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.metrics-actions {
  white-space: nowrap;
  width: 1%;
}

.button-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.82rem;
}

.button-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.button-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

.admin-header h1 {
  margin: 0.15rem 0 0.35rem;
}

.admin-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metrics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.5rem;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-value {
  margin: 0.35rem 0 0;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
}

.metric-value-sm {
  font-size: 1rem;
  font-weight: 600;
}

.metrics-section {
  margin-top: 1.75rem;
}

.metrics-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.metrics-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.metrics-table th,
.metrics-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.metrics-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metrics-table tr:last-child td {
  border-bottom: none;
}

.metrics-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.metrics-empty {
  color: var(--muted);
  text-align: center;
}

.metrics-footnote {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: lowercase;
}

button.danger,
.button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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