:root {
  --bg: #07100e;
  --bg-soft: #0b1714;
  --panel: rgba(15, 31, 27, 0.86);
  --panel-strong: #10241f;
  --line: rgba(151, 220, 192, 0.16);
  --line-strong: rgba(151, 220, 192, 0.3);
  --text: #edf7f2;
  --muted: #9ab5aa;
  --green: #66e6b5;
  --green-soft: #9bf1d0;
  --gold: #f5c96a;
  --coral: #ff8d72;
  --blue: #79b8ff;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  --radius: 20px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 5%, rgba(52, 159, 121, 0.16), transparent 31rem),
    radial-gradient(circle at 90% 16%, rgba(245, 201, 106, 0.09), transparent 27rem),
    linear-gradient(180deg, #07100e 0%, #07120f 55%, #050b09 100%);
  font-family: var(--sans);
  line-height: 1.55;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

a {
  color: var(--green);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  color: #07100e;
  background: var(--green);
  transform: translateY(-160%);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 14, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font: 10px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid var(--green);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(102, 230, 181, 0.22);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
}

.brand-mark::before {
  inset: 7px;
  border: 1px solid rgba(102, 230, 181, 0.55);
  border-radius: 50%;
}

.brand-mark::after {
  inset: 14px;
  border-radius: 50%;
  background: var(--gold);
}

.model-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.primary-nav {
  position: sticky;
  top: 76px;
  z-index: 19;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 9px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 14, 0.88);
  scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
  display: none;
}

.primary-nav button {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.primary-nav button:hover,
.primary-nav button:focus-visible {
  color: var(--text);
  border-color: var(--line-strong);
}

.primary-nav button.active {
  color: #07100e;
  background: var(--green);
}

main {
  width: min(1500px, 100%);
  min-height: calc(100vh - 220px);
  margin: 0 auto;
  padding: 42px clamp(20px, 5vw, 72px) 80px;
}

.view[hidden] {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  align-items: center;
  min-height: 440px;
  padding: clamp(28px, 6vw, 78px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(120deg, rgba(22, 55, 44, 0.84), rgba(8, 22, 18, 0.86)),
    radial-gradient(circle at 85% 50%, rgba(102, 230, 181, 0.13), transparent 24rem);
  box-shadow: var(--shadow);
}

.hero h1,
.section-heading h1 {
  margin: 0;
  font-weight: 660;
  letter-spacing: -0.035em;
}

.hero h1 {
  max-width: 870px;
  font-size: clamp(42px, 5.2vw, 78px);
  line-height: 1.06;
}

.hero-copy {
  max-width: 780px;
  margin: 28px 0 0;
  color: #bad0c7;
  font-size: clamp(16px, 1.5vw, 20px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font: 11px/1.3 var(--mono);
  letter-spacing: 0.15em;
}

.hero-orbit {
  position: relative;
  width: min(32vw, 390px);
  aspect-ratio: 1;
  margin: auto;
}

.orbit,
.core {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orbit {
  border: 1px solid rgba(102, 230, 181, 0.42);
}

.orbit::after {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 9px;
  height: 9px;
  content: "";
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px var(--gold);
}

.orbit-a {
  width: 35%;
  height: 35%;
  animation: orbit 9s linear infinite;
}

.orbit-b {
  width: 63%;
  height: 63%;
  animation: orbit 16s linear infinite reverse;
}

.orbit-c {
  width: 92%;
  height: 92%;
  animation: orbit 24s linear infinite;
}

.core {
  width: 11%;
  height: 11%;
  background: radial-gradient(circle at 36% 33%, #fff3b8, var(--gold) 42%, #a87218);
  box-shadow: 0 0 42px rgba(245, 201, 106, 0.45);
}

@keyframes orbit {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.notice {
  display: flex;
  gap: 18px;
  margin: 22px 0;
  padding: 17px 20px;
  border: 1px solid rgba(245, 201, 106, 0.25);
  border-radius: 14px;
  color: #d8c99c;
  background: rgba(245, 201, 106, 0.06);
}

.notice strong {
  flex: 0 0 auto;
  color: var(--gold);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.stat-card {
  min-height: 120px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(13, 29, 25, 0.78);
}

.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 9px;
  color: var(--text);
  font-size: clamp(24px, 2.4vw, 36px);
  font-weight: 620;
  line-height: 1;
}

.stat-card em {
  display: block;
  margin-top: 10px;
  color: var(--green);
  font: normal 10px/1.4 var(--mono);
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.14);
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel h2 {
  font-size: 22px;
}

.pipeline {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 15px 5px;
  border-bottom: 1px solid var(--line);
}

.pipeline li:last-child {
  border-bottom: 0;
}

.pipeline li > span {
  color: var(--gold);
  font: 12px/1.6 var(--mono);
}

.pipeline strong,
.pipeline small {
  display: block;
}

.pipeline small {
  margin-top: 4px;
  color: var(--muted);
}

.chart-shell {
  width: 100%;
  min-height: 270px;
  overflow: hidden;
}

.chart-shell.large {
  min-height: 410px;
}

.chart {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart text {
  fill: var(--muted);
  font: 11px var(--mono);
}

.chart .axis {
  stroke: rgba(151, 220, 192, 0.18);
  stroke-width: 1;
}

.chart .line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.chart .area {
  fill: rgba(102, 230, 181, 0.12);
}

.chart .reference {
  fill: none;
  stroke: rgba(245, 201, 106, 0.55);
  stroke-dasharray: 6 7;
}

.chart .point {
  fill: var(--gold);
  stroke: #07100e;
  stroke-width: 1.5;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.mini-row strong {
  color: var(--text);
}

.config-panel {
  margin-top: 18px;
}

details summary {
  cursor: pointer;
  color: var(--green-soft);
}

pre {
  max-height: 520px;
  margin: 20px 0 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #b9d2c8;
  background: #07100e;
  font: 12px/1.65 var(--mono);
}

.section-heading {
  margin-bottom: 26px;
}

.section-heading h1 {
  font-size: clamp(36px, 4vw, 58px);
}

.section-heading p:not(.eyebrow) {
  max-width: 750px;
  margin: 10px 0 0;
  color: var(--muted);
}

.search-field,
.select-field {
  display: grid;
  gap: 7px;
  min-width: 190px;
  color: var(--muted);
  font-size: 12px;
}

.search-field input,
.select-field select {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: #0b1915;
}

.search-field input:focus,
.select-field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(102, 230, 181, 0.1);
}

.unit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.7fr);
  gap: 18px;
  align-items: start;
}

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

.unit-card {
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  text-align: left;
  background: rgba(14, 31, 26, 0.74);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.unit-card:hover,
.unit-card:focus-visible,
.unit-card.active {
  border-color: rgba(102, 230, 181, 0.62);
  background: rgba(18, 43, 35, 0.92);
  transform: translateY(-2px);
}

.unit-card-id {
  color: var(--gold);
  font: 11px/1.3 var(--mono);
}

.unit-card h3 {
  margin: 10px 0 8px;
  font-size: 18px;
}

.unit-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.unit-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font: 10px/1.4 var(--mono);
}

.sticky-detail {
  position: sticky;
  top: 146px;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

.detail-title {
  margin: 4px 0 16px;
  font-size: 28px;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.detail-metric {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.detail-metric small,
.detail-metric strong {
  display: block;
}

.detail-metric small {
  color: var(--muted);
  font-size: 10px;
}

.detail-metric strong {
  margin-top: 4px;
  font-size: 18px;
}

.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #bed4ca;
  background: rgba(102, 230, 181, 0.045);
  font: 11px/1.25 var(--mono);
}

.chip strong {
  color: var(--green);
}

.subheading {
  margin: 24px 0 10px;
  color: var(--muted);
  font: 11px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.relationship-list {
  display: grid;
  gap: 7px;
}

.relationship-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.relationship-row code {
  color: var(--gold);
  font-family: var(--mono);
}

.relationship-row span {
  color: var(--muted);
}

.relationship-row strong {
  color: var(--green);
  font: 11px var(--mono);
}

.unit-history {
  display: block;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.recent-news-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.recent-news-row small,
.recent-news-row strong,
.recent-news-row a,
.recent-news-row span {
  display: block;
}

.recent-news-row small {
  color: var(--muted);
  font-size: 10px;
}

.recent-news-row strong,
.recent-news-row a {
  margin: 3px 0;
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
}

.recent-news-row a:hover {
  color: var(--green);
}

.recent-news-row span {
  color: var(--muted);
  font: 10px/1.4 var(--mono);
}

.recent-news-row code {
  color: var(--gold);
  font: 10px/1.4 var(--mono);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
}

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

.relationship-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-bottom: 8px;
  color: var(--muted);
}

.relationship-summary strong {
  color: var(--text);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  color: var(--muted);
  font: 10px/1.4 var(--mono);
  background: var(--panel-strong);
}

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

.prediction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.prediction-section {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prediction-section > .subheading,
.prediction-section > .empty-state {
  grid-column: 1 / -1;
}

.prediction-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.rank {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(245, 201, 106, 0.4);
  border-radius: 50%;
  color: var(--gold);
  font: 14px var(--mono);
}

.prediction-card h3 {
  margin: 0;
}

.score-bar {
  position: relative;
  height: 5px;
  margin: 14px 0;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
}

.score-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.contribution {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.article-header {
  margin-bottom: 18px;
}

.article-header h2 {
  margin: 0 0 8px;
  font-size: clamp(25px, 3vw, 38px);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font: 11px/1.4 var(--mono);
}

.article-body {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  color: #c5d8d0;
}

.trace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.sentence-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: sentences;
}

.sentence-list li {
  position: relative;
  padding: 10px 10px 10px 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #bfd2ca;
  background: rgba(255, 255, 255, 0.02);
  counter-increment: sentences;
}

.sentence-list li::before {
  position: absolute;
  left: 12px;
  color: var(--gold);
  content: counter(sentences, decimal-leading-zero);
  font: 10px var(--mono);
}

.forecast-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.forecast-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.forecast-block h4 {
  margin: 0 0 8px;
}

.case-list {
  display: grid;
  gap: 9px;
}

.case-row {
  display: grid;
  grid-template-columns: 190px 110px 1fr 1fr;
  gap: 15px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.case-row time,
.case-row code {
  color: var(--gold);
  font-family: var(--mono);
}

.case-row small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(20px, 5vw, 72px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 11px/1.4 var(--mono);
}

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .unit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .unit-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 860px) {
  .model-status { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero-orbit { width: min(70vw, 320px); margin-top: 30px; }
  .two-column,
  .unit-layout,
  .trace-grid,
  .prediction-grid,
  .prediction-section { grid-template-columns: 1fr; }
  .sticky-detail { position: static; max-height: none; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .control-row.compact { justify-content: flex-start; }
  .case-row { grid-template-columns: 1fr 80px; }
  .case-row > :nth-child(n+3) { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .topbar { min-height: 66px; }
  .primary-nav { top: 66px; }
  main { padding-top: 24px; }
  .hero { min-height: auto; padding: 30px 22px; border-radius: 20px; }
  .hero h1 { font-size: 39px; }
  .notice { flex-direction: column; gap: 5px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 105px; padding: 16px; }
  .unit-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .detail-metrics { grid-template-columns: repeat(2, 1fr); }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
