:root {
  --bg: #04111f;
  --bg-soft: #071b32;
  --panel: rgba(7, 25, 44, 0.92);
  --panel-strong: rgba(8, 30, 54, 0.98);
  --line: rgba(117, 168, 212, 0.18);
  --line-strong: rgba(117, 168, 212, 0.28);
  --text: #d8ecff;
  --muted: #82a4c4;
  --green: #35e39a;
  --amber: #ffb84d;
  --red: #ff6b6b;
  --cyan: #56d9ff;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Mono", monospace;
  background:
    radial-gradient(circle at top left, rgba(44, 139, 255, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(17, 103, 194, 0.14), transparent 28%),
    linear-gradient(180deg, #020913 0%, #04101d 55%, #01060d 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 34px, 34px 100%;
  mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.8), transparent 90%);
}

.shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 20px;
}

.topbar,
.panel,
.decision-card,
.ticker {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand span {
  color: var(--muted);
  font-size: 0.74rem;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 35, 61, 0.78);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(53, 227, 154, 0.9);
}

.status-dot.updating {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 184, 77, 0.9);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-toggle,
.refresh-btn {
  border: 1px solid var(--line-strong);
  background: rgba(11, 34, 59, 0.88);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.mode-toggle {
  display: inline-flex;
  padding: 4px;
}

.mode-toggle button,
.refresh-btn {
  font: inherit;
  padding: 9px 12px;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.mode-toggle button.active {
  background: rgba(86, 217, 255, 0.12);
  color: var(--cyan);
}

.refresh-btn:hover,
.mode-toggle button:hover {
  background: rgba(86, 217, 255, 0.08);
}

.ticker-wrap {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.ticker-track {
  display: flex;
  width: max-content;
  gap: 10px;
  animation: ticker-scroll 34s linear infinite;
}

.ticker {
  min-width: 146px;
  padding: 10px 12px;
}

.ticker-label {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 6px;
}

.ticker-value {
  font-size: 1.05rem;
  font-weight: 600;
}

.change-up {
  color: var(--green);
}

.change-down {
  color: var(--red);
}

.change-flat {
  color: var(--amber);
}

.alert-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 184, 77, 0.4);
  background: linear-gradient(90deg, rgba(88, 46, 8, 0.86), rgba(35, 27, 8, 0.78));
  color: #ffd89b;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.decision-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 22px;
  align-items: center;
}

.ring-wrap {
  display: grid;
  place-items: center;
}

.ring {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(2, 11, 21, 0.95) 58%, transparent 59%),
    conic-gradient(var(--ring-color) calc(var(--score) * 1%), rgba(76, 112, 146, 0.18) 0);
  border: 1px solid var(--line-strong);
}

.ring-inner {
  text-align: center;
}

.ring-inner strong {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
}

.ring-inner span {
  color: var(--muted);
  font-size: 0.72rem;
}

.decision-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: 0.1em;
}

.decision-copy p,
.subtle,
.meta-line {
  color: var(--muted);
}

.decision-tag {
  display: inline-flex;
  padding: 7px 10px;
  font-size: 0.75rem;
  border: 1px solid var(--line-strong);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.score-card {
  padding: 22px;
}

.score-card h3,
.section-title {
  margin: 0 0 16px;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.score-lines {
  display: grid;
  gap: 14px;
}

.score-line {
  display: grid;
  gap: 6px;
}

.score-line header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
}

.bar {
  width: 100%;
  height: 8px;
  background: rgba(90, 123, 155, 0.18);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--green));
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  min-height: 165px;
  padding: 16px;
}

.panel header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.panel h4 {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.panel .value {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.panel .dir {
  font-size: 0.95rem;
}

.terminal-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.stack {
  display: grid;
  gap: 18px;
}

.heatmap-row {
  display: grid;
  grid-template-columns: 68px 1fr 62px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.heat-track {
  position: relative;
  height: 12px;
  background: rgba(86, 105, 122, 0.17);
  border: 1px solid rgba(118, 153, 188, 0.12);
}

.heat-bar {
  position: absolute;
  top: 0;
  bottom: 0;
}

.heat-bar.up {
  left: 50%;
  background: linear-gradient(90deg, rgba(53, 227, 154, 0.35), rgba(53, 227, 154, 0.95));
}

.heat-bar.down {
  right: 50%;
  background: linear-gradient(90deg, rgba(255, 107, 107, 0.95), rgba(255, 107, 107, 0.35));
}

.leaders-grid {
  display: grid;
  gap: 10px;
}

.leader-chip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(9, 31, 54, 0.55);
}

.notes {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.79rem;
}

.skeleton {
  background:
    linear-gradient(90deg, rgba(26, 58, 88, 0.4), rgba(70, 114, 145, 0.55), rgba(26, 58, 88, 0.4));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-block {
  height: 140px;
}

.error-card {
  padding: 20px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(53, 12, 17, 0.78);
  color: #ffc9c9;
}

@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 1180px) {
  .hero-grid,
  .terminal-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .decision-card {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .ticker {
    min-width: 128px;
  }

  .ring {
    width: 150px;
    height: 150px;
  }
}
