:root {
  color-scheme: light;
  --ink: #1e2428;
  --muted: #667077;
  --line: #d8dee2;
  --panel: #ffffff;
  --page: #f6f4ef;
  --accent: #176b5d;
  --accent-2: #b6542d;
  --soft: #edf7f4;
  --danger: #b83232;
  --warn: #8a5a05;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: var(--page);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 750;
}

h2 {
  font-size: 16px;
  font-weight: 720;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.early-access-note {
  max-width: 760px;
  padding: 9px 11px;
  border: 1px solid #e0c47b;
  border-radius: 7px;
  background: #fff8e8;
  color: var(--warn);
  font-size: 13px;
}

.status-stack {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status-pill {
  min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.status-pill.ok {
  color: var(--accent);
  border-color: #9fc9bf;
  background: var(--soft);
}

.status-pill.warn {
  color: var(--warn);
  border-color: #e0c47b;
  background: #fff8e8;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
  gap: 14px;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.6fr) minmax(420px, 1.4fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.source-panel,
.normalized-panel {
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 420px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--ink);
  background: #fbfcfc;
  line-height: 1.5;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.text-input {
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.button-row.compact {
  margin-top: 0;
  justify-content: flex-end;
}

button,
.file-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  cursor: pointer;
}

button:hover,
.file-button:hover {
  border-color: #aeb8bd;
}

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

.small-button {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 5px;
}

.file-button input {
  display: none;
}

.hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfc;
}

.metric strong {
  display: block;
  font-size: 22px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.issue-list {
  max-height: 240px;
  overflow: auto;
}

.issue {
  border-left: 3px solid var(--warn);
  padding: 8px 10px;
  background: #fff8e8;
  margin-bottom: 8px;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
}

.issue-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}

.issue.fail {
  border-left-color: var(--danger);
  background: #fff0f0;
}

.issue code {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  white-space: pre-wrap;
}

.output-panel {
  margin-top: 14px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

pre {
  min-height: 260px;
  max-height: 460px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfc;
  white-space: pre-wrap;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

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

  .topbar {
    flex-direction: column;
  }
}
