:root {
  --bg: #050816;
  --bg-2: #0a1020;
  --panel: rgba(8, 12, 28, 0.78);
  --panel-border: rgba(144, 202, 249, 0.18);
  --text: #edf7ff;
  --muted: #8fa4be;
  --accent: #81f6b8;
  --accent-rgb: 129, 246, 184;
  --warning: #ffd280;
  --danger: #ff7f96;
  --stage-min-height: min(72vh, 56rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(var(--accent-rgb), 0.14), transparent 34%),
    radial-gradient(circle at bottom, rgba(92, 167, 255, 0.14), transparent 38%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  min-height: 100vh;
  transition:
    background 320ms ease,
    color 320ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 100% 0.42rem;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 92%);
  opacity: 0.26;
}

body[data-severity="minor"],
body[data-severity="maintenance"] {
  --accent: #ffd280;
  --accent-rgb: 255, 210, 128;
}

body[data-severity="major"],
body[data-severity="critical"] {
  --accent: #ff7f96;
  --accent-rgb: 255, 127, 150;
}

.app-shell {
  width: min(100%, 94rem);
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.topbar,
.hud-panel,
.stage-panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2.5rem 5rem rgba(0, 0, 0, 0.24);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: 1.5rem;
}

.eyebrow,
.stage-kicker,
.hud-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

.topbar h1,
.stage-title,
.hud-block strong,
.component-heading {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.75rem, 3vw, 2.6rem);
}

.status-chip {
  white-space: nowrap;
  padding: 0.72rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  gap: 1.25rem;
  flex: 1;
}

.stage-panel {
  border-radius: 2rem;
  padding: 1.25rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  min-height: var(--stage-min-height);
}

.stage-copy {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stage-title {
  font-size: clamp(1.25rem, 2.2vw, 2rem);
}

.stage-subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 58ch;
}

.stage-frame {
  --mona-spot-x: 50%;
  --mona-spot-y: 50%;
  position: relative;
  overflow: hidden;
  border-radius: 1.7rem;
  min-height: 24rem;
  background:
    radial-gradient(
      circle at var(--mona-spot-x) var(--mona-spot-y),
      rgba(var(--accent-rgb), 0.16),
      transparent 42%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    rgba(3, 7, 20, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stage-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at var(--mona-spot-x) var(--mona-spot-y),
      rgba(255, 104, 207, 0.22),
      transparent 23%
    ),
    radial-gradient(
      circle at var(--mona-spot-x) var(--mona-spot-y),
      rgba(132, 75, 255, 0.28),
      transparent 39%
    ),
    radial-gradient(
      circle at var(--mona-spot-x) var(--mona-spot-y),
      rgba(var(--accent-rgb), 0.16),
      transparent 52%
    );
  filter: blur(36px);
  opacity: 0.95;
}

.ascii-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  contain: layout paint style;
  user-select: none;
}

.ascii-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family:
    "SFMono-Regular", ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Monaco,
    Consolas, monospace;
  font-size: inherit;
  line-height: 0.86;
  letter-spacing: 0.02em;
  white-space: pre;
  background: transparent;
}

.ascii-layer--fur {
  color: #854bff;
  text-shadow:
    0 0 0.45rem rgba(132, 75, 255, 0.62),
    0 0 1.9rem rgba(210, 45, 255, 0.32);
}

.ascii-layer--face {
  color: #ff68cf;
  text-shadow:
    0 0 0.45rem rgba(255, 104, 207, 0.72),
    0 0 1.6rem rgba(255, 45, 205, 0.32);
}

.ascii-layer--whites {
  color: #fff7ff;
  text-shadow: 0 0 0.55rem rgba(255, 255, 255, 0.5);
}

.ascii-layer--features {
  color: #19095d;
  text-shadow:
    0 0 0.18rem rgba(25, 9, 93, 0.65),
    0 0 0.8rem rgba(70, 24, 160, 0.28);
}

.ascii-layer--whiskers {
  color: #765cff;
  text-shadow:
    0 0 0.35rem rgba(118, 92, 255, 0.75),
    0 0 1.2rem rgba(118, 92, 255, 0.35);
}

.ascii-layer--shine {
  color: #ffffff;
  text-shadow:
    0 0 0.45rem rgba(255, 255, 255, 0.78),
    0 0 1rem rgba(255, 216, 255, 0.35);
}

.hud-panel {
  border-radius: 1.7rem;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hud-block {
  display: grid;
  gap: 0.35rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.hud-block strong,
.component-heading {
  font-size: 1rem;
  color: var(--text);
}

.component-panel {
  display: grid;
  gap: 0.7rem;
}

.component-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
}

.component-list li::marker {
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.qa-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  width: min(22rem, calc(100vw - 2rem));
  padding: 1rem;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 1.2rem;
  background: rgba(5, 8, 22, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1.4rem 4rem rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.qa-panel[hidden] {
  display: none;
}

.qa-panel__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.qa-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.qa-panel__close,
.qa-grid button {
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
}

.qa-panel__close {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
}

.qa-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.qa-grid button {
  padding: 0.62rem 0.7rem;
  border-radius: 0.75rem;
  text-align: left;
  cursor: pointer;
}

.qa-grid button:hover,
.qa-grid button[aria-pressed="true"],
.qa-panel__close:hover {
  border-color: rgba(var(--accent-rgb), 0.44);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

.qa-hint {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

kbd {
  padding: 0.1rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.78em;
}

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

  .hud-panel {
    order: 2;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 1rem;
  }

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

  .stage-panel,
  .hud-panel {
    border-radius: 1.35rem;
  }

  .ascii-stage {
    font-size: clamp(0.38rem, 1.75vw, 0.62rem);
  }
}

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

  .ascii-stage,
  .status-chip,
  body {
    transition: none !important;
  }
}
