:root {
  color-scheme: dark;
  --bg: #1b1b1e;
  --bg-2: #1e1e1e;
  --panel: #1e1e1e;
  --panel-2: #252525;
  --line: rgba(255, 255, 255, 0.1);
  --line-bright: rgba(255, 255, 255, 0.2);
  --text: #e8e8e8;
  --muted: #999;
  --soft: #ccc;
  --yellow: #ff6b35;
  --orange: #ff6b35;
  --cyan: #00d4ff;
  --green: #82e07c;
  --red: #ff5c5c;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Outfit",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
  letter-spacing: 0;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1700px;
  margin: 0 auto;
}

.side-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px 20px;
  background:
    linear-gradient(180deg, rgba(246, 199, 68, 0.06), transparent 24%),
    rgba(10, 14, 17, 0.92);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid var(--yellow);
  background: #141b20;
  transform: skew(-9deg);
}

.brand-mark span {
  width: 24px;
  height: 24px;
  display: block;
  border: 5px solid var(--text);
  border-left-color: transparent;
  transform: rotate(45deg);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--yellow);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--soft);
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
}

.nav-tab:hover,
.nav-tab.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(246, 199, 68, 0.16), rgba(255, 255, 255, 0.03));
  border-color: rgba(246, 199, 68, 0.45);
}

.tab-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #111;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--yellow);
}

.status-tile {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(79, 215, 232, 0.1), transparent 50%),
    rgba(255, 255, 255, 0.035);
}

.status-tile p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-tile strong,
.status-tile span {
  display: block;
}

.status-tile strong {
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 1.05rem;
}

.status-tile span {
  color: var(--soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

.site-links {
  display: grid;
  gap: 8px;
}

.site-links a {
  display: block;
  min-height: 38px;
  padding: 9px 12px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.site-links a:hover {
  color: #111;
  border-color: var(--yellow);
  background: var(--yellow);
}

.ghost-button,
.primary-button,
.icon-button,
.quick-questions button {
  border: 1px solid var(--line-bright);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.ghost-button {
  min-height: 42px;
}

.ghost-button:hover,
.quick-questions button:hover {
  border-color: var(--yellow);
  background: rgba(246, 199, 68, 0.12);
}

.workspace {
  width: min(1420px, 100%);
  padding: 28px;
}

.hero-band {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: stretch;
  overflow: hidden;
  min-height: 210px;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  background:
    linear-gradient(115deg, rgba(9, 13, 16, 0.94) 0%, rgba(13, 18, 21, 0.84) 46%, rgba(246, 199, 68, 0.16) 100%),
    url("../img/rhodes-terminal.png") center / cover,
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 14px);
}

.hero-band::after {
  content: "01";
  position: absolute;
  right: 34px;
  bottom: -34px;
  color: rgba(255, 255, 255, 0.06);
  font-size: 9rem;
  font-weight: 900;
  line-height: 1;
}

.hero-band h2 {
  max-width: 820px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.98;
}

.hero-band p:not(.eyebrow) {
  max-width: 860px;
  margin-bottom: 0;
  color: var(--soft);
  font-size: clamp(0.98rem, 1.7vw, 1.12rem);
  line-height: 1.75;
}

.signal-board {
  position: relative;
  z-index: 1;
  width: min(300px, 28vw);
  min-width: 220px;
  display: grid;
  gap: 10px;
  align-content: center;
}

.signal-board span {
  display: block;
  padding: 16px;
  color: #111;
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  font-weight: 900;
  background: var(--yellow);
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, 0.25);
}

.signal-board span:nth-child(2) {
  background: var(--cyan);
}

.signal-board span:nth-child(3) {
  background: var(--text);
}

.quick-questions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.quick-questions button {
  min-height: 42px;
  padding: 9px 12px;
  text-align: left;
}

.control-strip,
.target-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(10, 14, 17, 0.68);
}

.control-strip {
  grid-template-columns: minmax(260px, 1.8fr) minmax(150px, 0.6fr) minmax(150px, 0.6fr);
}

.target-controls {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.rule-hint {
  margin: -8px 0 18px;
  padding: 12px 14px;
  color: var(--soft);
  line-height: 1.65;
  border-left: 4px solid var(--yellow);
  background: rgba(246, 199, 68, 0.08);
}

label {
  min-width: 0;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: #0d1215;
}

input:focus,
select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(246, 199, 68, 0.14);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding-top: 20px;
}

.check-row input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--yellow);
}

.check-row span {
  margin: 0;
  color: var(--soft);
}

.tab-panel {
  display: none;
  animation: fadeUp 0.2s ease-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 14px;
}

.section-heading h3 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.5vw, 2.1rem);
}

.section-heading > p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

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

.metric-card {
  min-height: 142px;
  padding: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
    var(--panel);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card span {
  margin-bottom: 16px;
  font-size: 0.82rem;
}

.metric-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--yellow);
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.95;
}

.metric-card small {
  font-size: 0.82rem;
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.75fr);
  gap: 12px;
}

.chart-panel,
.table-panel,
.rules-document article {
  border: 1px solid var(--line);
  background: rgba(21, 29, 34, 0.86);
}

.chart-panel,
.table-panel {
  min-height: 340px;
  padding: 16px;
}

.chart-panel.wide {
  min-height: 420px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-title h4 {
  margin-bottom: 0;
}

.panel-title span {
  color: var(--muted);
  font-size: 0.82rem;
}

.bar-chart,
.cdf-chart,
.count-chart {
  min-height: 262px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(30, minmax(5px, 1fr));
  gap: 4px;
  align-items: end;
  height: 286px;
  padding-top: 18px;
}

.bar {
  position: relative;
  min-height: 2px;
  background: linear-gradient(180deg, var(--yellow), var(--orange));
}

.bar::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: -23px;
  display: none;
  color: var(--muted);
  font-size: 0.68rem;
  transform: translateX(-50%);
}

.bar:nth-child(5n)::after,
.bar:first-child::after,
.bar:last-child::after {
  display: block;
}

.cdf-chart {
  display: grid;
  gap: 9px;
  align-content: stretch;
}

.cdf-row,
.count-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 76px;
  gap: 10px;
  align-items: center;
  color: var(--soft);
  font-size: 0.86rem;
}

.track {
  height: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
}

.count-chart {
  display: grid;
  gap: 12px;
  align-content: start;
}

.count-row {
  grid-template-columns: 86px minmax(0, 1fr) 86px;
}

.data-table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row span:first-child {
  color: var(--soft);
}

.table-row span:last-child {
  color: var(--yellow);
  font-weight: 800;
}

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

.rules-document article {
  padding: 18px;
}

.rules-document h4 {
  margin-bottom: 10px;
  color: var(--yellow);
}

.rules-document p {
  margin-bottom: 0;
  color: var(--soft);
  line-height: 1.8;
}

.rules-document .official-line {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.rules-document q {
  color: var(--text);
}

.source-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-top: 14px;
  padding: 6px 10px;
  color: #111;
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
  background: var(--yellow);
}

.source-link:hover {
  background: var(--cyan);
}

.notice-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.notice-modal.show {
  display: grid;
}

.notice-window {
  width: min(820px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line-bright);
  background: #10161a;
  box-shadow: var(--shadow);
}

.notice-header,
.notice-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.notice-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.notice-header h2 {
  margin-bottom: 0;
}

.notice-content {
  overflow: auto;
  padding: 20px;
}

.notice-content h3 {
  margin: 18px 0 8px;
  color: var(--yellow);
}

.notice-content h3:first-child {
  margin-top: 0;
}

.notice-content p {
  color: var(--soft);
  line-height: 1.85;
}

.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  font-size: 1.45rem;
  line-height: 1;
}

.icon-button:hover {
  color: #111;
  background: var(--yellow);
}

.primary-button {
  min-width: 130px;
  min-height: 42px;
  color: #111;
  font-weight: 900;
  border-color: var(--yellow);
  background: var(--yellow);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    height: auto;
    padding: 18px;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .status-tile {
    margin-top: 0;
  }

  .hero-band,
  .analysis-layout,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

  .signal-board {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-strip,
  .target-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-questions,
  .metric-grid,
  .metric-grid.compact,
  .rules-document {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .workspace {
    padding: 14px;
  }

  .side-panel {
    gap: 14px;
  }

  .brand-block {
    align-items: flex-start;
  }

  .nav-tabs,
  .quick-questions,
  .control-strip,
  .target-controls,
  .metric-grid,
  .metric-grid.compact,
  .rules-document {
    grid-template-columns: 1fr;
  }

  .nav-tab {
    min-height: 42px;
  }

  .hero-band {
    min-height: 0;
    padding: 22px;
  }

  .hero-band::after {
    display: none;
  }

  .signal-board {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 118px;
  }

  .bar-chart {
    grid-template-columns: repeat(20, minmax(5px, 1fr));
    overflow: hidden;
  }

  .notice-actions,
  .notice-header {
    align-items: flex-start;
  }

  .notice-actions {
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }
}
