/* 시나리오 케이스 화면. 디자인 시스템과 무관한 내부 도구라 색은 여기 변수로 둔다.
   회색조 바탕과 글자에 색은 상태에만 쓴다(실패·빠짐 빨강, 통과 초록, 실행해보기 주황). */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --card: #fff;
  --line: #ececef;
  --line-strong: #dfe0e4;
  --text: #1d1f23;
  --muted: #8a8f98;
  --faint: #b4b8bf;
  --group: #f7f8fa;
  --evidence: #fbfbfc;
  --red: #d6322e;
  --red-text: #7a3431;
  --red-bg: #fdf2f1;
  --orange: #f07b1d;
  --orange-bg: #fff6ef;
  --green: #2f9e5b;
  --link: #2a62c9;
  --sans: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b;
    --card: #1f2024;
    --line: #2c2d32;
    --line-strong: #3a3b41;
    --text: #e6e7ea;
    --muted: #9a9ea6;
    --faint: #6c7078;
    --group: #25262b;
    --evidence: #222327;
    --red: #ff6b66;
    --red-text: #ffb4b0;
    --red-bg: #2e1e1e;
    --orange: #f59a4c;
    --orange-bg: #2c2117;
    --green: #5cc27f;
    --link: #79a6ff;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.top {
  padding: 22px 32px 0;
}

.top h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 32px 20px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
}

.stat .k,
.stat .s {
  color: var(--muted);
  font-size: 12.5px;
}

.stat .v {
  margin: 2px 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat .v.when {
  margin: 6px 0 4px;
  font-size: 18px;
}

.stat .v small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 0 32px 40px;
}

.nav {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 10px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.nav .area {
  padding: 10px 18px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.nav a {
  display: block;
  padding: 4px 18px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.4;
}

.nav a:hover {
  background: var(--group);
  text-decoration: none;
}

.nav a.fail {
  color: var(--red);
}

.tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.tools input[type='search'] {
  width: 320px;
  height: 34px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}

.chip {
  height: 34px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.chip[aria-pressed='true'] {
  border-color: var(--text);
  font-weight: 600;
}

.area-title {
  margin: 22px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.area-title:first-child {
  margin-top: 0;
}

.empty {
  padding: 14px 20px;
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

.card {
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  scroll-margin-top: 16px;
}

.card h2 {
  margin: 0;
  padding: 16px 20px 14px;
  font-size: 15px;
  font-weight: 700;
}

.card h2 .arrow {
  color: var(--muted);
  font-weight: 500;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

th {
  padding-top: 8px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: 20px;
}

th:last-child,
td:last-child {
  padding-right: 16px;
}

td.n {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

td.v {
  color: var(--faint);
}

td.v.ch {
  color: var(--text);
  font-weight: 600;
}

th.run,
td.run,
th.ev,
td.ev {
  text-align: center;
}

tr.group td {
  padding-top: 5px;
  padding-bottom: 5px;
  background: var(--group);
  color: var(--muted);
  font-size: 12px;
}

tr.missing td {
  background: var(--red-bg);
}

tr.missing td.v.ch {
  color: var(--red);
}

tr.missing td.res,
tr.gray td.res {
  color: var(--muted);
}

tr.gray td.v.ch {
  color: var(--muted);
  font-weight: 500;
}

tr.failed td.n {
  color: var(--red);
  font-weight: 700;
}

.dash {
  color: var(--faint);
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  background: var(--red-bg);
  border-radius: 4px;
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}

.run-button {
  display: inline-block;
  height: 28px;
  padding: 0 10px;
  background: var(--card);
  border: 1px solid var(--orange);
  border-radius: 6px;
  color: var(--orange);
  font: inherit;
  font-size: 12.5px;
  line-height: 26px;
  white-space: nowrap;
  cursor: pointer;
}

.run-button:hover {
  background: var(--orange-bg);
  text-decoration: none;
}

.run-button:disabled {
  border-color: var(--line-strong);
  color: var(--muted);
  cursor: progress;
}

.evidence-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.15s;
}

.evidence-button:hover {
  background: var(--group);
}

.evidence-button[aria-expanded='true'] {
  transform: rotate(180deg);
}

tr.evidence td {
  padding: 0;
  background: var(--evidence);
}

.evidence-box {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.8fr;
  gap: 28px;
  padding: 16px 20px 18px 60px;
  font-size: 13px;
}

.evidence-box h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.evidence-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-box li {
  margin: 2px 0;
}

.evidence-box .scenario {
  margin: 0 0 6px;
}

.evidence-box .note {
  margin: 6px 0 0;
  color: var(--muted);
}

.evidence-box .ok::before,
.evidence-box .bad::before,
.evidence-box .todo::before {
  margin-right: 6px;
}

.evidence-box .ok::before {
  content: '✓';
  color: var(--green);
}

.evidence-box .todo::before {
  content: '·';
  color: var(--muted);
}

.evidence-box .bad {
  color: var(--red);
  font-weight: 600;
}

.evidence-box .bad::before {
  content: '✕';
  font-weight: 700;
}

.evidence-box .code li {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.evidence-box .code a {
  color: var(--text);
}

.evidence-box .code .loc {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-box details summary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  list-style: none;
  cursor: pointer;
}

.evidence-box details summary::-webkit-details-marker {
  display: none;
}

.fail-box {
  grid-column: 1 / -1;
  padding: 8px 12px;
  background: var(--red-bg);
  border-left: 3px solid var(--red);
  border-radius: 0 6px 6px 0;
}

.fail-box .error {
  margin-top: 2px;
  color: var(--red-text);
}

@media (width <= 900px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px;
  }

  .top {
    padding: 22px 16px 0;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 16px 40px;
  }

  .nav {
    position: static;
    max-height: none;
  }

  .tools input[type='search'] {
    width: 100%;
  }

  .card {
    overflow-x: auto;
  }

  .card table {
    min-width: 760px;
  }

  .evidence-box {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-left: 20px;
  }
}
