:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #edf3f8;
  --text: #18202c;
  --muted: #657284;
  --line: #dbe3ec;
  --accent: #176c72;
  --accent-strong: #0f565d;
  --danger: #a93b3b;
  --danger-soft: #f8e9e8;
  --warn: #8d5b12;
  --warn-soft: #fff2d8;
  --ok: #237352;
  --ok-soft: #e5f4ee;
  --shadow: 0 18px 48px rgba(31, 47, 69, .12);
  --radius: 8px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #ffffff 0, var(--bg) 480px),
    var(--bg);
  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 {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  min-height: 42px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}

button:hover {
  border-color: #b8c7d7;
  transform: translateY(-1px);
}

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

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1240px;
  padding: 22px clamp(18px, 4vw, 36px);
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
}

.brand-mark {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--accent);
  display: inline-flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand-mark svg {
  height: 24px;
  width: 24px;
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

main {
  margin: 0 auto;
  max-width: 1240px;
  padding: 0 clamp(18px, 4vw, 36px) 48px;
}

.hero {
  display: grid;
  gap: clamp(24px, 5vw, 52px);
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  min-height: 420px;
  padding: 54px 0 36px;
}

.hero-copy {
  align-self: center;
  max-width: 690px;
}

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

h1 {
  font-size: clamp(42px, 7vw, 78px);
  letter-spacing: 0;
  line-height: .96;
  margin-bottom: 22px;
}

.hero-copy p {
  color: var(--muted);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.55;
  margin-bottom: 22px;
  max-width: 650px;
}

.hero-notice {
  background: var(--warn-soft);
  border: 1px solid #f2d39a;
  border-radius: var(--radius);
  color: var(--warn);
  font-size: 14px;
  font-weight: 700;
  max-width: 620px;
  padding: 13px 15px;
}

.upload-panel {
  align-self: center;
}

.drop-zone {
  align-items: center;
  background: var(--panel);
  border: 2px dashed #b8c7d7;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--accent);
  display: flex;
  flex-direction: column;
  min-height: 360px;
  justify-content: center;
  padding: 34px;
  text-align: center;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.drop-zone.is-dragover {
  background: #eefafa;
  border-color: var(--accent);
  transform: translateY(-2px);
}

.drop-zone input {
  block-size: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  inline-size: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.drop-zone svg {
  height: 74px;
  margin-bottom: 22px;
  width: 74px;
}

.drop-zone h2 {
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.drop-zone p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 22px;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 0 18px;
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.controls,
.status-board,
.layout,
.export-panel {
  margin-top: 22px;
}

.controls {
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  padding: 18px;
}

.control-block label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.control-block p {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.range-row {
  align-items: center;
  display: flex;
  gap: 12px;
}

input[type="range"] {
  accent-color: var(--accent);
  inline-size: 100%;
}

output {
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  min-width: 34px;
  padding: 5px 8px;
  text-align: center;
}

input[type="search"] {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  min-height: 42px;
  padding: 0 12px;
  width: 100%;
}

.bulk-actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-board {
  align-items: center;
  background: #15202d;
  border-radius: var(--radius);
  color: #fff;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(180px, .7fr) minmax(180px, 1fr) minmax(320px, 1.2fr);
  padding: 18px;
}

.status-label {
  color: #9eb0c3;
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#statusText {
  display: block;
  font-size: 17px;
  margin-top: 2px;
}

progress {
  appearance: none;
  background: #2c3a4a;
  border: 0;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
  width: 100%;
}

progress::-webkit-progress-bar {
  background: #2c3a4a;
}

progress::-webkit-progress-value {
  background: #7ed8c6;
}

progress::-moz-progress-bar {
  background: #7ed8c6;
}

.stats-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid div {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}

.stats-grid span {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.stats-grid small {
  color: #afbdcc;
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-top: 5px;
}

.layout {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: 290px minmax(0, 1fr);
}

.review-sidebar,
.export-panel,
.photo-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.review-sidebar {
  padding: 20px;
  position: sticky;
  top: 14px;
}

.review-sidebar h2,
.export-panel h2 {
  font-size: 22px;
  line-height: 1.1;
  margin-bottom: 12px;
}

.review-sidebar ol {
  color: var(--muted);
  margin: 0 0 20px;
  padding-left: 20px;
}

.review-sidebar li + li {
  margin-top: 9px;
}

.privacy-box,
.error-box {
  border-radius: var(--radius-sm);
  padding: 14px;
}

.privacy-box {
  background: var(--ok-soft);
  color: #1f5f46;
}

.privacy-box h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.privacy-box p,
.error-box p {
  font-size: 13px;
  margin: 0;
}

.error-box {
  background: var(--danger-soft);
  color: var(--danger);
  margin-top: 14px;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 2px 0 12px;
}

.section-heading:not(:first-child) {
  margin-top: 28px;
}

.section-heading h2 {
  font-size: 25px;
  line-height: 1.1;
  margin-bottom: 4px;
}

.section-heading p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 0;
}

.group-list {
  display: grid;
  gap: 14px;
}

.empty-state {
  background: rgba(255, 255, 255, .62);
  border: 1px dashed #cad6e3;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  padding: 18px;
}

.photo-group {
  overflow: hidden;
}

.group-header {
  align-items: center;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 15px 16px;
}

.group-header h3 {
  font-size: 17px;
  line-height: 1.2;
  margin-bottom: 3px;
}

.group-header p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}

.group-auto-button {
  white-space: nowrap;
}

.photo-grid,
.unique-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  padding: 14px;
}

.unique-grid {
  padding: 0;
}

.photo-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.photo-card.is-keeper {
  border-color: #87c9b3;
  box-shadow: 0 0 0 2px rgba(35, 115, 82, .12);
}

.photo-card.is-delete {
  border-color: #e3a6a2;
  box-shadow: 0 0 0 2px rgba(169, 59, 59, .1);
}

.thumb-wrap {
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(45deg, #edf1f5 25%, transparent 25%),
    linear-gradient(-45deg, #edf1f5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf1f5 75%),
    linear-gradient(-45deg, transparent 75%, #edf1f5 75%),
    #f8fafc;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  overflow: hidden;
  position: relative;
}

.thumb-wrap img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.card-status {
  background: rgba(21, 32, 45, .82);
  border-radius: 99px;
  bottom: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  left: 8px;
  padding: 4px 8px;
  position: absolute;
}

.photo-card.is-delete .card-status {
  background: var(--danger);
}

.photo-card.is-keeper .card-status {
  background: var(--ok);
}

.card-body {
  padding: 12px;
}

.card-body h4 {
  font-size: 14px;
  line-height: 1.25;
  margin-bottom: 9px;
  overflow-wrap: anywhere;
}

dl {
  display: grid;
  gap: 6px;
  margin: 0 0 11px;
}

dl div {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

dt,
dd {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

dd {
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

.card-actions {
  display: grid;
  gap: 8px;
}

.card-actions label {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.card-actions input {
  accent-color: var(--accent);
}

.export-panel {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 20px;
}

.export-panel p {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 940px) {
  .hero,
  .controls,
  .status-board,
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
    padding-top: 32px;
  }

  .review-sidebar {
    position: static;
  }
}

@media (max-width: 620px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .header-actions {
    width: 100%;
  }

  h1 {
    font-size: 40px;
  }

  .drop-zone {
    min-height: 300px;
    padding: 24px 18px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-header,
  .export-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .group-auto-button,
  .export-actions button,
  .bulk-actions button {
    width: 100%;
  }

  .photo-grid,
  .unique-grid {
    grid-template-columns: 1fr;
  }
}

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