@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;700&family=Manrope:wght@200..800&display=swap');

:root {
  --bg-a: #05070d;
  --bg-b: #0a1220;
  --bg-c: #0d1627;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.16);
  --line-soft: rgba(255, 255, 255, 0.08);
  --ink: #f4f8ff;
  --muted: #afbdd3;
  --accent-hsl: 190 95% 62%;
  --hero-weight: 640;
  --ok: #36d39a;
  --warn: #f4bb54;
  --risk: #ff6f6f;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-glass: 0 22px 65px rgba(2, 8, 20, 0.5);
  --shadow-soft: 0 12px 34px rgba(2, 8, 20, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: 'Manrope', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 120% at 10% 0%, rgba(46, 104, 255, 0.15) 0%, transparent 42%),
    radial-gradient(120% 120% at 90% 10%, rgba(40, 220, 200, 0.1) 0%, transparent 48%),
    linear-gradient(145deg, var(--bg-a), var(--bg-b) 42%, var(--bg-c));
}

body[data-mood='lift'] {
  background:
    radial-gradient(120% 120% at 10% 0%, rgba(42, 190, 132, 0.18) 0%, transparent 42%),
    radial-gradient(120% 120% at 90% 10%, rgba(46, 104, 255, 0.12) 0%, transparent 48%),
    linear-gradient(145deg, var(--bg-a), #0c1424 42%, #102237);
}

body[data-mood='watch'] {
  background:
    radial-gradient(120% 120% at 10% 0%, rgba(239, 168, 79, 0.16) 0%, transparent 42%),
    radial-gradient(120% 120% at 90% 10%, rgba(46, 104, 255, 0.1) 0%, transparent 48%),
    linear-gradient(145deg, var(--bg-a), #161827 42%, #1f2430);
}

body[data-mood='risk'] {
  background:
    radial-gradient(120% 120% at 10% 0%, rgba(239, 92, 92, 0.18) 0%, transparent 42%),
    radial-gradient(120% 120% at 90% 10%, rgba(103, 126, 182, 0.12) 0%, transparent 48%),
    linear-gradient(145deg, #09080d, #171220 42%, #1f1a27);
}

.ambient-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.ambient-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(65px);
  opacity: 0.4;
  transition: opacity 280ms ease;
}

.glow-a {
  width: 42vw;
  height: 42vw;
  left: -8vw;
  top: -10vw;
  background: radial-gradient(circle, hsla(var(--accent-hsl), 0.75) 0%, transparent 62%);
}

.glow-b {
  width: 36vw;
  height: 36vw;
  right: -10vw;
  top: 8vh;
  background: radial-gradient(circle, rgba(64, 130, 255, 0.58) 0%, transparent 62%);
}

.ambient-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 20%, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.12) 72%, transparent 100%);
}

.ambient-rings {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.9;
  border: 2px solid hsla(var(--accent-hsl), 0.65);
  animation: ringOut 1.6s ease-out forwards;
}

.ring-ok {
  border-color: rgba(54, 211, 154, 0.75);
}

.ring-warn {
  border-color: rgba(244, 187, 84, 0.75);
}

.ring-err {
  border-color: rgba(255, 111, 111, 0.78);
}

@keyframes ringOut {
  to {
    transform: translate(-50%, -50%) scale(28);
    opacity: 0;
  }
}

.command-island {
  position: sticky;
  top: 14px;
  z-index: 20;
  width: min(920px, 94vw);
  margin: 18px auto 8px;
  display: grid;
  gap: 8px;
}

.island-core,
.island-expand,
.glass,
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-soft);
}

.island-core {
  width: 100%;
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font: inherit;
}

.brand-mark {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  font-size: 0.68rem;
}

.brand-title {
  margin-right: auto;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.island-expand {
  max-height: 0;
  overflow: hidden;
  border-radius: 18px;
  padding: 0 14px;
  opacity: 0;
  transition: max-height 240ms ease, opacity 240ms ease, padding 240ms ease;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.command-island.expanded .island-expand {
  max-height: 120px;
  padding: 12px 14px;
  opacity: 1;
}

.app-shell {
  position: relative;
  z-index: 5;
  width: min(1180px, 94vw);
  margin: 14px auto 40px;
  display: grid;
  gap: 12px;
}

.glass,
.panel {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
}

.meta-pill,
.hero-pill,
.meta-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none;
}

.meta-link:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.28);
}

.hero-card,
.card,
.panel,
.alerts {
  padding: clamp(14px, 3vw, 24px);
}

.hero-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero-value {
  margin-top: 10px;
  font-family: 'Manrope', sans-serif;
  font-weight: var(--hero-weight);
  font-variation-settings: 'wght' var(--hero-weight);
  font-size: clamp(2.1rem, 8vw, 4.8rem);
  letter-spacing: -0.04em;
  line-height: 1;
  text-wrap: balance;
  transition: font-variation-settings 240ms ease;
}

.hero-meta {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-pill {
  background: rgba(255, 255, 255, 0.1);
}

.hero-pill.is-up {
  color: #a2ffd9;
  border-color: rgba(70, 217, 157, 0.45);
}

.hero-pill.is-down {
  color: #ffc0c0;
  border-color: rgba(255, 110, 110, 0.46);
}

.micro-trend {
  margin-top: 10px;
  height: 40px;
}

.micro-trend svg {
  width: 100%;
  height: 100%;
  opacity: 0.95;
}

.ai-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.ai-label {
  margin: 0 0 3px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.ai-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #e9f1ff;
}

.resolve-btn,
.inline-action,
.sim-form button,
.mini-resolve,
.story-controls button,
.story-controls a {
  border: 1px solid hsla(var(--accent-hsl), 0.42);
  background: linear-gradient(150deg, hsla(var(--accent-hsl), 0.28), hsla(var(--accent-hsl), 0.14));
  color: #f7fbff;
  border-radius: 999px;
  padding: 8px 13px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 180ms ease, filter 180ms ease;
}

.resolve-btn:hover,
.inline-action:hover,
.sim-form button:hover,
.mini-resolve:hover,
.story-controls button:hover,
.story-controls a:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 6px 11px;
}

.status-chip.live {
  position: relative;
  color: #f4fbff;
  border-color: hsla(var(--accent-hsl), 0.48);
}

.status-chip.live::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  border: 1px solid hsla(var(--accent-hsl), 0.35);
  animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.85;
  }
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.ok {
  background: var(--ok);
}

.dot.warn {
  background: var(--warn);
}

.dot.err {
  background: var(--risk);
}

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

.kpi-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 14px;
  display: grid;
  gap: 6px;
}

.kpi-card p,
.tv-card h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-card strong,
.story-kpi,
.tv-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  letter-spacing: -0.02em;
}

.kpi-card span {
  color: var(--muted);
  font-size: 0.81rem;
}

.critical-card {
  position: relative;
  overflow: hidden;
}

.critical-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: radial-gradient(circle at 20% 30%, rgba(255, 105, 105, 0.2), transparent 60%);
  pointer-events: none;
}

.inline-action {
  margin-top: 4px;
  justify-self: start;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 10px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.card-head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.trend-canvas {
  min-height: 300px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  padding: 10px;
}

.trend-canvas svg {
  width: 100%;
  height: 100%;
}

.trend-pulse {
  fill: hsla(var(--accent-hsl), 0.86);
  animation: trendPulse 2.4s ease-in-out infinite;
}

@keyframes trendPulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

.node-graph {
  min-height: 282px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  padding: 8px;
}

.node-graph svg {
  width: 100%;
  height: 100%;
}

.graph-edge {
  stroke: rgba(171, 198, 237, 0.28);
  stroke-width: 1.6;
}

.graph-node circle {
  fill: rgba(255, 255, 255, 0.11);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.2;
}

.graph-node.node-ok circle {
  fill: rgba(54, 211, 154, 0.2);
  stroke: rgba(104, 238, 190, 0.42);
}

.graph-node.node-warn circle {
  fill: rgba(244, 187, 84, 0.18);
  stroke: rgba(250, 209, 126, 0.42);
}

.graph-node.node-risk circle {
  fill: rgba(255, 111, 111, 0.18);
  stroke: rgba(255, 159, 159, 0.45);
}

.node-label,
.node-value {
  text-anchor: middle;
  pointer-events: none;
  fill: #eef5ff;
}

.node-label {
  font-size: 11px;
  opacity: 0.9;
}

.node-value {
  font-size: 12px;
  font-weight: 700;
}

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

.kpi-item {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 9px;
}

.kpi-item .label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.kpi-item .value {
  display: block;
  margin-top: 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.96rem;
}

.copilot-lab {
  border-radius: var(--radius-lg);
}

.sim-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.sim-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
}

.sim-form input::placeholder {
  color: #97a6bf;
}

.sim-result {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: #e0ebff;
}

.alerts {
  padding-top: 14px;
}

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

.alert-item {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.alert-item .sev {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  border-radius: 8px;
  padding: 4px 6px;
}

.sev.critical {
  color: #ffb5b5;
  background: rgba(255, 111, 111, 0.2);
}

.sev.warning {
  color: #ffdba0;
  background: rgba(244, 187, 84, 0.24);
}

.sev.info {
  color: #b8d7ff;
  background: rgba(95, 161, 255, 0.2);
}

.alert-item .msg {
  font-size: 0.84rem;
  line-height: 1.28rem;
}

.alert-item .time {
  font-size: 0.74rem;
  color: var(--muted);
}

.mini-resolve {
  padding: 6px 10px;
  font-size: 0.7rem;
}

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

.mode-story .story-shell,
.mode-tv .tv-wrap {
  position: relative;
  z-index: 5;
  width: min(1120px, 94vw);
  margin: 20px auto 40px;
  display: grid;
  gap: 10px;
}

.story-top,
.tv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.story-title,
.tv-header h1 {
  margin: 0;
  font-size: 1.2rem;
}

.story-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.story-slide {
  min-height: 320px;
  display: grid;
  align-content: center;
  gap: 10px;
}

.story-slide h2 {
  margin: 0;
  font-size: clamp(1.3rem, 4vw, 2.1rem);
}

.story-slide p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.55rem;
}

.story-kpi {
  font-size: clamp(1.8rem, 5vw, 2.9rem);
}

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

.tv-card {
  min-height: 180px;
}

.tv-value {
  margin-top: 10px;
  font-size: clamp(1.8rem, 4.6vw, 2.8rem);
}

.tv-meta {
  margin-top: 8px;
  color: var(--muted);
}

.atmo {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 1;
}

.atmo-a {
  width: 280px;
  height: 280px;
  left: -40px;
  top: -40px;
  background: rgba(80, 165, 255, 0.55);
}

.atmo-b {
  width: 240px;
  height: 240px;
  right: -30px;
  top: 20vh;
  background: rgba(70, 217, 157, 0.5);
}

.atmo-c {
  width: 260px;
  height: 260px;
  right: 20vw;
  bottom: -60px;
  background: rgba(200, 145, 255, 0.35);
}

@media (max-width: 1050px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .command-island,
  .app-shell,
  .mode-story .story-shell,
  .mode-tv .tv-wrap {
    width: 95vw;
  }

  .island-core {
    flex-wrap: wrap;
    border-radius: 18px;
  }

  .brand-title {
    margin-right: 0;
  }

  .ai-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .domain-grid {
    grid-template-columns: 1fr;
  }

  .alert-item {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .sim-form {
    grid-template-columns: 1fr;
  }

  .tv-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .tv-grid {
    grid-template-columns: 1fr;
  }

  .meta-pill,
  .meta-link {
    font-size: 0.7rem;
  }
}
