:root {
  color-scheme: dark;
  --bg: #010104;
  --panel-bg: rgba(10, 8, 15, 0.9);
  --panel-border: rgba(255, 255, 255, 0.12);
  --accent: #ff003c;
  --accent-2: #6c52ff;
  --accent-3: #04d9ff;
  --text: #f8f5ff;
  --muted: rgba(248, 245, 255, 0.65);
  --shadow: 0 35px 65px rgba(0, 0, 0, 0.65);
  --glow-red: rgba(255, 70, 84, 0.35);
  --glow-cyan: rgba(105, 255, 221, 0.4);
  font-size: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 20%, rgba(244, 67, 54, 0.05), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(108, 82, 255, 0.2), transparent 45%),
    linear-gradient(120deg, #010104, #050312 55%, #030308);
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -2;
}

.starfield,
.blood-mist,
.scanlines {
  position: absolute;
  inset: 0;
}

.starfield {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 5px 5px;
  opacity: 0.2;
  animation: drift 50s linear infinite;
}

.blood-mist {
  background: radial-gradient(circle at 30% 20%, rgba(255, 0, 64, 0.3), transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(93, 16, 80, 0.25), transparent 45%);
  filter: blur(50px);
  mix-blend-mode: screen;
}

.sigils {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 2px);
  background-size: 140px 140px;
  opacity: 0.05;
  mix-blend-mode: screen;
  animation: rotateSigils 120s linear infinite;
}

.noise {
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"%3E%3Cfilter id="n" x="0" y="0" width="1" height="1"%3E%3CfeTurbulence baseFrequency="0.9" numOctaves="3" seed="2"/%3E%3C/ filter%3E%3Crect width="200" height="200" filter="url(%23n)" opacity="0.12"/%3E%3C/svg%3E');
  mix-blend-mode: soft-light;
  opacity: 0.08;
}

.vignette {
  background: radial-gradient(circle at center, transparent 55%, rgba(0, 0, 0, 0.85));
}

.scanlines {
  background-image: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, 0.25) 2px 4px);
  opacity: 0.25;
}

@keyframes drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-40px);
  }
}

@keyframes rotateSigils {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.grid-shell {
  width: min(1280px, 94vw);
  margin: 2vh auto 5vh;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 1.8rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(120%);
  position: relative;
  overflow: hidden;
}

.panel::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.panel.hero {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  background: linear-gradient(120deg, rgba(244, 67, 54, 0.22), rgba(12, 5, 25, 0.95));
}

.hero h1 {
  font-size: clamp(2.5rem, 4vw, 3.4rem);
  margin-bottom: 0.5rem;
  font-family: 'Cinzel Decorative', 'Space Grotesk', serif;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero h1::before,
.hero h1::after {
  content: attr(data-glitch);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  mix-blend-mode: screen;
  opacity: 0.4;
  pointer-events: none;
}

.hero h1::before {
  color: var(--accent);
  transform: translate(-2px, -2px);
  animation: glitch 4s infinite alternate;
}

.hero h1::after {
  color: var(--accent-3);
  transform: translate(2px, 1px);
  animation: glitch 3s infinite alternate;
}

@keyframes glitch {
  0% {
    clip-path: inset(20% 0 60% 0);
  }
  20% {
    clip-path: inset(40% 0 30% 0);
  }
  40% {
    clip-path: inset(10% 0 70% 0);
  }
  60% {
    clip-path: inset(60% 0 5% 0);
  }
  80% {
    clip-path: inset(30% 0 30% 0);
  }
  100% {
    clip-path: inset(15% 0 45% 0);
  }
}

.hero .lede {
  color: var(--muted);
  max-width: 46ch;
}

.connect-form {
  flex: 1 1 300px;
  display: grid;
  gap: 0.75rem;
}

.connect-form label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.connect-form input {
  margin-top: 0.35rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 5, 10, 0.65);
  color: var(--text);
  font-size: 1rem;
}

.connect-form button {
  margin-top: 0.5rem;
  padding: 0.95rem 1.25rem;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  background: linear-gradient(120deg, #f26d6d, #6a5fff, #55ffd5);
  color: #040308;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.connect-form button:hover {
  transform: translateY(-2px);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

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

.nav {
  grid-column: 1 / -1;
  margin: 2rem auto 0;
  width: min(1280px, 94vw);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 1rem;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand strong {
  font-size: 1.2rem;
  letter-spacing: 0.05em;
}

.glyph {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--glow-red), rgba(255, 255, 255, 0.05));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.panel.status {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.25rem;
  background: rgba(8, 6, 16, 0.85);
  box-shadow: inset 0 0 40px rgba(255, 0, 60, 0.08);
  padding: 1rem 1.25rem;
  align-items: center;
  height: 300px;
}

.panel.command-deck {
  grid-column: 1 / -1;
}

.panel.status .label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.panel.status .value {
  font-size: 1.05rem;
  font-weight: 600;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-head h2 {
  margin: 0;
}

.deck-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text);
  padding: 0.35rem 1rem;
  cursor: pointer;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pill.ghost {
  border-color: rgba(255, 255, 255, 0.35);
}

.pill.is-active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.command-card {
  padding: 1.1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(145deg, rgba(5, 5, 12, 0.85), rgba(15, 10, 33, 0.75));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}

.command-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background: var(--accent, #f26d6d);
  filter: blur(32px);
}

.command-card::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.command-card > * {
  z-index: 1;
}

.command-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.command-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.command-card p {
  margin: 0;
  color: var(--muted);
}

.command-card button {
  margin-top: 0.5rem;
  border: none;
  border-radius: 12px;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  color: var(--text);
  transition: transform 0.15s ease, background 0.2s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.command-card button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
}

.command-card button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.activity-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-height: 340px;
  overflow-y: auto;
}

.activity-log li {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.activity-log span {
  font-size: 0.85rem;
  color: var(--muted);
}

.clock {
  font-family: 'Space Grotesk', monospace;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.timeline-body {
  min-height: 200px;
  display: grid;
  gap: 1rem;
}

.timeline-card {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at top right, rgba(255, 0, 60, 0.2), transparent 45%),
    rgba(255, 255, 255, 0.02);
}

.toast-stack {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 99;
}

.toast {
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  background: rgba(5, 5, 10, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}

.toast.success {
  border-color: rgba(104, 255, 210, 0.6);
}

.toast.error {
  border-color: rgba(255, 100, 130, 0.6);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .panel {
    padding: 1.25rem;
  }

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

  .nav {
    flex-direction: column;
    gap: 0.75rem;
    position: static;
  }

  .toast-stack {
    right: 1rem;
    left: 1rem;
  }
}
