:root {
  color-scheme: dark;
  --bg: #10131a;
  --panel: #171c25;
  --panel-2: #1f2632;
  --line: #303a49;
  --text: #eef3f8;
  --muted: #9aa8b8;
  --accent: #5ab7ff;
  --accent-2: #7de0b2;
  --danger: #ff7171;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: #121822;
}

.brand {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
  color: var(--muted);
}

.topbar p,
.note,
.muted {
  color: var(--muted);
}

.pill,
.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.45fr);
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 40px) 40px;
}

.surface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

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

.deck-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f141c;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 150px;
  resize: vertical;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
}

.quick-row,
.check-row,
.option-grid,
.metrics {
  display: grid;
  gap: 10px;
}

.quick-row {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}

.option-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
}

.check-row {
  margin-top: 16px;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.run {
  width: 100%;
  margin-top: 18px;
  border-color: #327bb0;
  background: #126499;
  font-weight: 700;
}

.note {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.summary.empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.score {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #121822;
}

.score-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #0a0d13;
}

.bar i {
  display: block;
  height: 100%;
  min-width: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.score strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

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

.metrics span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--muted);
  background: #121822;
}

.metrics b {
  color: var(--text);
}

.tables {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 18px;
  margin-top: 20px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: #111721;
}

td {
  color: var(--text);
}

.warning-list {
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
}

.warning-list p + p {
  margin-top: 8px;
}

.log {
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0f141c;
  color: #c7d4e3;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.error {
  border: 1px solid rgba(255, 113, 113, 0.55);
  border-radius: 8px;
  padding: 12px;
  color: var(--danger);
  background: rgba(255, 113, 113, 0.08);
}

@media (max-width: 980px) {
  .layout,
  .tables,
  .score-row,
  .metrics {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .quick-row,
  .option-grid {
    grid-template-columns: 1fr;
  }
}
