:root {
  color-scheme: dark;
  --background: oklch(0.105 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.155 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.18 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.985 0 0);
  --primary-foreground: oklch(0.145 0 0);
  --secondary: oklch(0.205 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.205 0 0);
  --muted-foreground: oklch(0.69 0 0);
  --accent: oklch(0.245 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --input: oklch(1 0 0 / 9%);
  --ring: oklch(0.74 0 0);
  --success: oklch(0.76 0.16 154);
  --success-surface: oklch(0.76 0.16 154 / 12%);
  --warning: oklch(0.8 0.15 82);
  --warning-surface: oklch(0.8 0.15 82 / 12%);
  --destructive: oklch(0.7 0.18 24);
  --destructive-surface: oklch(0.7 0.18 24 / 12%);
  --radius: 0.75rem;
  font-family:
    Inter, Pretendard, "Noto Sans KR", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--foreground);
  background:
    linear-gradient(180deg, oklch(0.13 0 0 / 38%) 0, transparent 22rem),
    var(--background);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  text-rendering: optimizeLegibility;
}

button,
select {
  font: inherit;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px oklch(from var(--ring) l c h / 32%);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-180%);
  padding: 0.65rem 0.9rem;
  color: var(--primary-foreground);
  background: var(--primary);
  border-radius: calc(var(--radius) - 0.15rem);
  font-size: 0.8rem;
  font-weight: 650;
  text-decoration: none;
}

.skip-link:focus {
  transform: none;
}

.topbar,
main,
footer {
  width: min(1440px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.25rem 0 1.5rem;
}

.brand-lockup {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.brand-mark {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary-foreground);
  background: var(--primary);
  border-radius: calc(var(--radius) + 0.1rem);
}

.brand-mark svg,
.icon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand-mark svg {
  width: 1.45rem;
  height: 1.45rem;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  font-weight: 680;
  letter-spacing: -0.045em;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 640;
  letter-spacing: -0.02em;
}

.eyebrow,
.empty-kicker {
  margin-bottom: 0.42rem;
  color: var(--muted-foreground);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.subtitle {
  margin: 0.45rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.76rem;
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
}

.run-picker {
  display: grid;
  gap: 0.35rem;
  color: var(--muted-foreground);
  font-size: 0.7rem;
  font-weight: 620;
}

select,
button {
  min-height: 2.55rem;
  color: var(--foreground);
  background: var(--input);
  border: 0;
  border-radius: calc(var(--radius) - 0.1rem);
  transition:
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

select {
  width: min(29rem, 52vw);
  padding: 0 2.6rem 0 0.9rem;
}

button {
  padding: 0 0.9rem;
  cursor: pointer;
}

select:hover,
button:hover {
  background: var(--accent);
}

button:active {
  transform: translateY(1px);
}

.icon-button {
  display: inline-flex;
  align-self: flex-end;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 620;
}

.icon-button svg {
  width: 1rem;
  height: 1rem;
}

main {
  padding: 0.5rem 0 2rem;
}

.notice {
  display: flex;
  min-height: 2.6rem;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: var(--muted-foreground);
  background: oklch(1 0 0 / 4%);
  border-radius: calc(var(--radius) - 0.1rem);
  font-size: 0.78rem;
}

.notice::before {
  width: 0.42rem;
  height: 0.42rem;
  flex: 0 0 auto;
  background: var(--success);
  border-radius: 999px;
  content: "";
}

.notice[data-kind="error"] {
  color: var(--destructive);
  background: var(--destructive-surface);
}

.notice[data-kind="error"]::before {
  background: var(--destructive);
}

.empty-state {
  max-width: 42rem;
  margin: 12vh auto;
  padding: 3rem;
  text-align: center;
  background: var(--card);
  border-radius: calc(var(--radius) + 0.35rem);
}

.empty-state p:last-child {
  margin: 1rem auto 0;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.hero-grid,
.model-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.metric-card,
.model-card,
.panel {
  color: var(--card-foreground);
  background: var(--card);
  border: 0;
  box-shadow: none;
}

.metric-card {
  min-height: 8.15rem;
  padding: 1.05rem;
  border-radius: var(--radius);
}

.metric-card.emphasis {
  color: var(--primary-foreground);
  background: var(--primary);
}

.metric-card > span {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.68rem;
  font-weight: 620;
}

.metric-card.emphasis > span {
  color: oklch(0.42 0 0);
}

.metric-card strong {
  display: block;
  margin-top: 1.05rem;
  overflow: hidden;
  font-size: 1.45rem;
  font-weight: 660;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted-foreground);
}

.metric-card.emphasis small {
  color: oklch(0.38 0 0);
}

.status-label::before {
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.4rem;
  vertical-align: 0.05rem;
  background: currentColor;
  border-radius: 999px;
  content: "";
}

.status-label[data-tone="success"] {
  color: oklch(0.42 0.12 150) !important;
}

.status-label[data-tone="warning"] {
  color: oklch(0.48 0.12 78) !important;
}

.status-label[data-tone="destructive"] {
  color: oklch(0.5 0.16 24) !important;
}

.progress-track {
  height: 0.32rem;
  margin-top: 0.85rem;
  overflow: hidden;
  background: var(--muted);
  border-radius: 999px;
}

#progress-bar {
  width: 0;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width 400ms ease;
}

.panel {
  margin-top: 0.7rem;
  padding: 1rem;
  border-radius: var(--radius);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.panel-heading .eyebrow {
  margin-bottom: 0.2rem;
}

.badge {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  padding: 0.25rem 0.55rem;
  color: var(--muted-foreground);
  background: var(--muted);
  border: 0;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 620;
}

.badge[data-tone="success"] {
  color: var(--success);
  background: var(--success-surface);
}

.badge[data-tone="warning"] {
  color: var(--warning);
  background: var(--warning-surface);
}

.badge[data-tone="destructive"] {
  color: var(--destructive);
  background: var(--destructive-surface);
}

.badge[data-tone="active"] {
  color: var(--primary-foreground);
  background: var(--primary);
}

.mono {
  max-width: 48vw;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.model-card {
  padding: 0.95rem;
  background: var(--secondary);
  border-radius: calc(var(--radius) - 0.1rem);
}

.model-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.model-card h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
}

.model-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.8rem;
  margin: 1rem 0 0;
  font-size: 0.73rem;
}

dt {
  color: var(--muted-foreground);
}

dd {
  margin: 0;
  text-align: right;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 0.65fr);
  gap: 0.7rem;
}

.two-column > .panel {
  min-width: 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.28rem;
  font-size: 0.74rem;
}

th,
td {
  padding: 0.64rem 0.52rem;
  text-align: right;
  border: 0;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted-foreground);
  font-size: 0.65rem;
  font-weight: 600;
}

tbody td {
  background: var(--secondary);
}

tbody tr:hover td {
  background: var(--accent);
}

tbody td:first-child {
  border-radius: calc(var(--radius) - 0.25rem) 0 0
    calc(var(--radius) - 0.25rem);
}

tbody td:last-child {
  border-radius: 0 calc(var(--radius) - 0.25rem)
    calc(var(--radius) - 0.25rem) 0;
}

.value-positive {
  color: var(--success);
}

.value-negative {
  color: var(--destructive);
}

.value-risk {
  color: var(--warning);
}

.muted {
  color: var(--muted-foreground);
}

.timing-list {
  display: grid;
  gap: 0.5rem;
}

.timing-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.42rem 1rem;
  padding: 0.72rem;
  background: var(--secondary);
  border-radius: calc(var(--radius) - 0.2rem);
}

.timing-row small {
  grid-column: 1 / -1;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.event-list {
  display: grid;
  gap: 0.45rem;
  max-height: 24rem;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  scrollbar-color: var(--accent) transparent;
}

.event-list li {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.7rem;
  padding: 0.68rem;
  background: var(--secondary);
  border-radius: calc(var(--radius) - 0.2rem);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
}

.event-list time {
  color: var(--muted-foreground);
}

.provenance {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0.14rem 1rem;
  margin: 0;
  padding: 0.28rem;
  background: var(--secondary);
  border-radius: calc(var(--radius) - 0.2rem);
  font-size: 0.73rem;
}

.provenance dt,
.provenance dd {
  padding: 0.48rem;
}

.provenance dd {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: left;
}

footer {
  padding: 1rem 0 2rem;
  color: var(--muted-foreground);
  font-size: 0.7rem;
  text-align: center;
}

@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding-top: 1.25rem;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .run-picker {
    flex: 1;
  }

  select {
    width: 100%;
  }

  .hero-grid,
  .model-grid {
    grid-template-columns: 1fr;
  }

  .empty-state {
    padding: 2rem 1rem;
  }

  .event-list li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media (max-width: 430px) {
  .topbar,
  main,
  footer {
    width: min(100% - 1rem, 1440px);
  }

  .brand-mark {
    width: 2.35rem;
    height: 2.35rem;
  }

  .icon-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .icon-button {
    width: 2.55rem;
    padding: 0;
  }

  .panel {
    padding: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
