:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --text: #172033;
  --muted: #657386;
  --line: #dce3ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(22, 34, 51, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #edf3fb 0, var(--bg) 280px),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button:hover:not(:disabled) {
  border-color: #b8c4d4;
  background: #f8fafc;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.ghost {
  background: var(--panel-2);
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  margin-bottom: 18px;
}

.hero > div,
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero > div:first-child {
  padding: 28px;
}

.hero h1,
.panel h2 {
  margin: 6px 0 0;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
}

.hero p,
.panel-lead,
.hero-tips span {
  color: var(--muted);
  line-height: 1.65;
}

.hero p {
  max-width: 760px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-tips {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  padding: 14px 16px;
}

.hero-tips span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.hero-tips strong {
  margin-right: 8px;
  color: var(--text);
}

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

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-lead {
  margin: 8px 0 0;
  font-size: 14px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px 14px;
}

.metrics span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.drop-zone {
  position: relative;
  border: 1px dashed #aebac7;
  border-radius: 12px;
  background: #fbfdff;
}

.drop-zone.drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}

textarea {
  display: block;
  width: 100%;
  min-height: 390px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: #111827;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.drop-zone > span {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.toolbar {
  display: grid;
  grid-template-columns: 190px minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px;
}

label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

select,
input[type="file"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
}

select:focus,
input[type="file"]:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  white-space: nowrap;
}

.check span {
  margin: 0;
  color: var(--text);
}

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

.error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.error.info {
  color: var(--muted);
}

.output-panel {
  align-self: stretch;
}

.output-panel .panel-head {
  align-items: flex-start;
}

.output-panel .actions {
  max-width: 360px;
}

small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.result-summary div {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px 12px;
}

.result-summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.result-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.file-list {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px 14px;
}

.file-list strong {
  display: block;
  margin-bottom: 8px;
}

.file-list ul {
  display: grid;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
  margin: 0;
  padding-left: 18px;
}

.file-list li {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(160px, 1.1fr);
  gap: 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.file-list b {
  color: var(--text);
  font-weight: 600;
}

pre {
  min-height: 548px;
  max-height: 560px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101827;
  color: #dbeafe;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .hero,
  .workspace,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }

  pre {
    min-height: 300px;
    max-height: 560px;
  }

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

  .file-list li {
    grid-template-columns: 1fr;
  }

  .hero-tips span {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 14px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .result-summary {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1 1 140px;
  }

  .hero h1 {
    font-size: 30px;
  }
}
