:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #627086;
  --line: #dbe3ef;
  --accent: #2459d6;
  --accent-dark: #183f9b;
  --success: #166534;
  --warning: #9a3412;
  --error: #991b1b;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #e3edff 0, transparent 34rem), var(--bg);
}

button,
input,
select { font: inherit; }

button {
  border: 0;
  border-radius: 0.85rem;
  min-height: 48px;
  padding: 0.78rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

button:hover:not(:disabled) { background: var(--accent-dark); }
button:disabled { opacity: 0.48; cursor: not-allowed; }

.page {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.25rem 0 3rem;
}

.hero {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 1.25rem;
}

.site-title {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 850;
}

.card,
.drop-zone,
.support-notice {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  box-shadow: var(--shadow);
}

.settings span,
#statusText,
.drop-zone p,
.meta,
.download-note { color: var(--muted); }

.settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}

.settings span { font-size: 0.78rem; line-height: 1.35; font-weight: 500; }

.drop-zone {
  min-height: 250px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 2px dashed #aebfea;
  margin-bottom: 1rem;
  outline: none;
}

.drop-zone.dragging,
.drop-zone:focus-visible {
  border-color: var(--accent);
  background: #eef4ff;
}

.drop-zone > div { padding: 2rem; }
.drop-icon { font-size: 3.1rem; color: var(--accent); line-height: 1; }
.drop-zone h2 { margin: 0.35rem 0; font-size: clamp(1.45rem, 4vw, 2rem); }
.drop-zone p { margin: 0 0 1.1rem; }

.support-notice {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  color: #7c2d12;
  background: #fff7ed;
  border-color: #fed7aa;
  font-weight: 700;
  line-height: 1.45;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

#downloadFilesBtn,
#downloadZipBtn,
#clearBtn { background: #263241; }
#downloadFilesBtn:hover:not(:disabled),
#downloadZipBtn:hover:not(:disabled),
#clearBtn:hover:not(:disabled) { background: #111827; }
#statusText { grid-column: 1 / -1; font-weight: 750; min-height: 1.2rem; }
.download-note { grid-column: 1 / -1; margin: -0.25rem 0 0; font-size: 0.86rem; line-height: 1.45; }

.results { overflow: hidden; }
.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.preview {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 0.6rem;
  background: #e5e7eb;
}

.file-name {
  max-width: 290px;
  word-break: break-word;
  font-weight: 800;
}

.meta { margin-top: 0.25rem; font-size: 0.84rem; }
.status { font-weight: 850; }
.status.done { color: var(--success); }
.status.working { color: var(--accent); }
.status.warning { color: var(--warning); }
.status.error { color: var(--error); }

.download-link {
  display: inline-block;
  border: 0;
  border-radius: 0.7rem;
  background: #ecf2ff;
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 850;
  padding: 0.65rem 0.85rem;
}

.empty-row td {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1000px) {
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions button { width: 100%; }
}

@media (max-width: 700px) {
  .page {
    width: min(100% - 1rem, 1180px);
    padding: 1rem 0 2rem;
  }

  .hero { margin-bottom: 0.85rem; }

  .settings {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 0.9rem;
    border-radius: 1rem;
  }

  label { gap: 0.4rem; }
  input, select { min-height: 50px; font-size: 1rem; }

  .drop-zone {
    min-height: 190px;
    border-radius: 1rem;
  }

  .drop-zone > div { padding: 1.25rem; }
  .drop-icon { font-size: 2.35rem; }
  .drop-zone p { font-size: 0.95rem; }

  .support-notice {
    border-radius: 1rem;
    font-size: 0.92rem;
  }

  .actions {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .actions button { width: 100%; }
  .download-note { font-size: 0.82rem; }

  .results {
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .table-scroll { overflow: visible; }

  table,
  thead,
  tbody,
  tr,
  th,
  td { display: block; }

  table { min-width: 0; }
  thead { display: none; }

  tbody {
    display: grid;
    gap: 0.85rem;
  }

  tr {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.75rem;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 0.75rem;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  td:last-child { border-bottom: 0; }
  td[data-label="Preview"] { grid-template-columns: 1fr; }
  td[data-label="Preview"]::before { display: none; }

  .preview {
    width: 100%;
    height: 170px;
    border-radius: 0.85rem;
  }

  .file-name { max-width: none; }
  .download-link { width: 100%; text-align: center; }

  .empty-row td {
    display: block;
    padding: 1.25rem;
  }

  .empty-row td::before { display: none; }
}

@media (max-width: 420px) {
  .site-title { font-size: 1.45rem; }
  td { grid-template-columns: 6.5rem 1fr; }
  .preview { height: 145px; }
}
