:root {
  color-scheme: dark;
  --bg: #0d0f10;
  --panel: #171a1f;
  --panel-strong: #1f242b;
  --line: #303840;
  --line-strong: #43505c;
  --text: #f4f7fb;
  --muted: #aab5bf;
  --soft: #77838e;
  --accent: #2bd4a8;
  --accent-dark: #0f8d72;
  --accent-contrast: #06221c;
  --warning: #ffbd59;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

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

.app-card {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 34px);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.subtitle {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.local-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(43, 212, 168, 0.42);
  border-radius: 999px;
  background: rgba(43, 212, 168, 0.1);
  color: #bff7e9;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.notice-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.notice {
  margin: 0;
  border: 1px solid rgba(43, 212, 168, 0.28);
  border-radius: 8px;
  background: rgba(43, 212, 168, 0.08);
  color: #dffcf5;
  padding: 12px 14px;
  line-height: 1.5;
}

.notice-warning {
  border-color: rgba(255, 189, 89, 0.34);
  background: rgba(255, 189, 89, 0.09);
  color: #ffe3b2;
}

.drop-zone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 164px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: clamp(18px, 3vw, 30px);
  outline: none;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.drop-zone.is-active,
.drop-zone:focus-visible {
  border-color: var(--accent);
  background: #1d2828;
}

.drop-zone.is-active {
  transform: translateY(-1px);
}

.drop-icon {
  width: 58px;
  height: 58px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  position: relative;
}

.drop-icon::before,
.drop-icon::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 999px;
}

.drop-icon::before {
  width: 24px;
  height: 2px;
  left: 15px;
  top: 28px;
}

.drop-icon::after {
  width: 2px;
  height: 24px;
  left: 26px;
  top: 17px;
}

.drop-copy h2,
.empty-state h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

.drop-copy p,
.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.button {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  color: var(--text);
  background: #2a3038;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.button-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.button-primary:hover:not(:disabled) {
  background: #45e0b8;
}

.button-secondary {
  background: var(--warning);
  color: #2e1d03;
}

.button-secondary:hover:not(:disabled) {
  background: #ffd080;
}

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

.button-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.button-small {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.messages {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 10px 12px;
  line-height: 1.45;
}

.message-success {
  border-color: rgba(43, 212, 168, 0.32);
  color: #c7fff1;
}

.message-error {
  border-color: rgba(255, 107, 107, 0.36);
  color: #ffd0d0;
}

.message-warning {
  border-color: rgba(255, 189, 89, 0.36);
  color: #ffe0ad;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin: 22px 0 0;
}

.progress-block {
  min-width: 0;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

#fileCount {
  color: var(--soft);
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0c0e;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.output-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 16px;
}

.output-panel h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.output-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.empty-state {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 22px;
  text-align: center;
}

.empty-state.is-hidden {
  display: none;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.image-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121519;
}

.preview-frame {
  aspect-ratio: 4 / 3;
  margin: 0;
  background: #08090a;
}

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

.image-info {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.image-info h3 {
  margin: 0;
  min-height: 2.8em;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.4;
}

.file-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.file-details div {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.file-details dt {
  color: var(--soft);
  font-size: 0.78rem;
}

.file-details dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-ready {
  color: #d7e0e7;
}

.status-cleaning {
  background: rgba(255, 189, 89, 0.16);
  color: #ffe0a8;
}

.status-cleaned {
  background: rgba(43, 212, 168, 0.16);
  color: #bdf8e9;
}

.status-error {
  background: rgba(255, 107, 107, 0.14);
  color: #ffcdcd;
}

.card-error {
  margin: 0;
  color: #ffc7c7;
  font-size: 0.84rem;
  line-height: 1.45;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .app-header,
  .control-panel,
  .output-panel,
  .drop-zone {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .local-badge {
    justify-self: start;
  }

  .drop-zone {
    text-align: center;
    justify-items: center;
  }

  .actions,
  .output-actions,
  .button {
    width: 100%;
  }

  .actions,
  .output-actions {
    justify-content: stretch;
  }

  .progress-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }
}
