:root {
  --bg: #020403;
  --panel: rgba(0, 16, 7, 0.74);
  --panel-soft: rgba(7, 0, 18, 0.62);
  --green: #27ff68;
  --green-soft: rgba(39, 255, 104, 0.68);
  --green-dim: rgba(186, 255, 200, 0.7);
  --purple: #d58cff;
  --purple-soft: rgba(188, 83, 255, 0.55);
  --purple-dim: rgba(227, 184, 255, 0.78);
  --pink: #ff62a8;
  --line: rgba(39, 255, 104, 0.28);
  --line-purple: rgba(188, 83, 255, 0.42);
  --shadow-green: 0 0 24px rgba(39, 255, 104, 0.14);
  --shadow-purple: 0 0 28px rgba(188, 83, 255, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #000;
  color: var(--green);
  font-family: "Courier New", monospace;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 50% 12%, rgba(143, 0, 255, 0.25), transparent 28%),
    radial-gradient(circle at 12% 28%, rgba(39, 255, 104, 0.08), transparent 28%),
    radial-gradient(circle at 88% 42%, rgba(188, 83, 255, 0.14), transparent 32%),
    linear-gradient(to bottom, #020705 0%, #000 58%, #090015 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 1px solid var(--line-purple);
  background: rgba(80, 0, 130, 0.28);
  color: #f1d4ff;
  padding: 10px 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 0 0 14px rgba(188, 83, 255, 0.12);
}

button:hover:not(:disabled) {
  color: white;
  background: rgba(188, 83, 255, 0.32);
  box-shadow: 0 0 22px rgba(188, 83, 255, 0.26);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(39, 255, 104, 0.24);
  background: rgba(0, 0, 0, 0.38);
  color: #dfffe8;
  padding: 10px;
  outline: none;
}

label {
  color: var(--green-dim);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

#matrix-rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.22;
  z-index: 1;
  pointer-events: none;
}

.scanline-layer,
.screen-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scanline-layer {
  z-index: 90;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      rgba(0, 0, 0, 0.15) 2px,
      rgba(0, 0, 0, 0.15) 4px
    );
  mix-blend-mode: overlay;
  opacity: 0.48;
}

.screen-vignette {
  z-index: 91;
  background: radial-gradient(ellipse at center, transparent 44%, rgba(0, 0, 0, 0.74) 100%);
}

.page-shell {
  position: relative;
  z-index: 2;
  width: min(1240px, 94vw);
  margin: 0 auto;
  padding: 24px 0 46px;
}

.top-bar,
.hero-panel,
.setup-panel,
.agent-panel,
.department-panel,
.live-panel,
.protocol-panel,
.identity-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(0, 255, 90, 0.045), transparent),
    var(--panel);
  box-shadow:
    var(--shadow-green),
    inset 0 0 24px rgba(39, 255, 104, 0.065);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 13px;
}

.terminal-brand,
.top-status {
  color: rgba(186, 255, 200, 0.9);
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow:
    0 0 10px var(--purple),
    0 0 24px rgba(188, 83, 255, 0.72);
  animation: blink 1.35s infinite;
}

.status-online {
  color: #aaffbc;
  text-shadow: 0 0 10px rgba(39, 255, 104, 0.9);
}

.home-link {
  color: var(--purple);
  text-decoration: none;
  border: 1px solid var(--line-purple);
  background: rgba(80, 0, 130, 0.22);
  padding: 6px 10px;
}

.home-link:hover {
  color: white;
  background: rgba(188, 83, 255, 0.25);
}

.hero-panel {
  margin-top: 18px;
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 20px;
  align-items: stretch;
  border-color: var(--line-purple);
  background:
    radial-gradient(circle at 78% 12%, rgba(188, 83, 255, 0.24), transparent 34%),
    linear-gradient(rgba(0, 255, 90, 0.055), transparent),
    rgba(3, 8, 6, 0.82);
  box-shadow:
    var(--shadow-purple),
    inset 0 0 34px rgba(188, 83, 255, 0.09);
}

.eyebrow,
.section-kicker {
  display: block;
  margin: 0 0 8px;
  color: var(--purple);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  color: #aaffbc;
  font-size: clamp(38px, 6.4vw, 86px);
  line-height: 0.92;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 5px var(--green),
    0 0 26px rgba(39, 255, 104, 0.56);
}

.hero-text,
.panel-description,
.setup-panel p,
.protocol-step p,
.footer-note,
.department-card p,
.contribution-box small {
  color: var(--purple-dim);
  line-height: 1.52;
  font-size: 13px;
}

.hero-text {
  max-width: 850px;
  margin: 16px 0 0;
  line-height: 1.58;
  font-size: 14px;
}

.hero-readout {
  border: 1px solid rgba(188, 83, 255, 0.34);
  background:
    linear-gradient(rgba(188, 83, 255, 0.08), transparent),
    rgba(12, 0, 24, 0.58);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.hero-readout div,
.identity-item,
.stat-box,
.contribution-box,
.enemy-card,
.front-title,
.department-card,
.protocol-step {
  border: 1px solid rgba(39, 255, 104, 0.18);
  background: rgba(0, 0, 0, 0.28);
}

.hero-readout div {
  border-left: 2px solid var(--purple-soft);
  padding: 10px;
}

.hero-readout span,
.stat-box span,
.identity-item span,
.contribution-box span,
.department-card span,
.enemy-header span,
.front-title span {
  display: block;
  color: var(--green-dim);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero-readout strong,
.identity-item strong,
.contribution-box strong,
.front-title strong,
.enemy-header strong {
  display: block;
  margin-top: 6px;
  color: var(--purple);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.setup-panel {
  margin-top: 16px;
  padding: 18px;
  border-color: rgba(188, 83, 255, 0.34);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 420px);
  gap: 16px;
}

.setup-panel h2,
.panel-heading h2 {
  margin: 8px 0 9px;
  color: #aaffbc;
  font-size: clamp(18px, 2.3vw, 28px);
  line-height: 1.05;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-shadow:
    0 0 6px rgba(39, 255, 104, 0.72),
    0 0 18px rgba(39, 255, 104, 0.28);
}

.ship-form {
  display: grid;
  gap: 8px;
}

.dashboard-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.agent-panel,
.department-panel,
.live-panel,
.protocol-panel {
  padding: 16px;
}

.ship-panel {
  border-color: rgba(188, 83, 255, 0.58);
  background:
    radial-gradient(circle at 85% 0%, rgba(188, 83, 255, 0.16), transparent 32%),
    var(--panel);
}

.global-panel {
  border-color: rgba(39, 255, 104, 0.34);
  background:
    radial-gradient(circle at 80% 5%, rgba(39, 255, 104, 0.11), transparent 30%),
    rgba(0, 10, 4, 0.66);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.pill,
.live-badge {
  flex: none;
  display: inline-block;
  border: 1px solid var(--line-purple);
  padding: 6px 9px;
  background: rgba(80, 0, 130, 0.24);
  color: var(--purple);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  box-shadow: 0 0 14px rgba(188, 83, 255, 0.16);
}

.pill-control {
  color: #aaffbc;
  border-color: rgba(39, 255, 104, 0.36);
  background: rgba(0, 38, 12, 0.28);
}

.pill-ml {
  color: #ffd8ff;
}

.live-badge {
  color: #aaffbc;
  border-color: rgba(39, 255, 104, 0.45);
  animation: glowPulse 1.6s infinite;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 14px 0;
}

.stat-box {
  min-height: 78px;
  padding: 11px;
}

.stat-box strong {
  display: block;
  margin-top: 9px;
  color: #aaffbc;
  font-size: clamp(18px, 2.1vw, 28px);
  line-height: 1;
  text-shadow:
    0 0 9px rgba(39, 255, 104, 0.72),
    0 0 20px rgba(39, 255, 104, 0.34);
}

.enemy-card,
.front-title,
.contribution-box {
  padding: 12px;
  margin-top: 12px;
}

.enemy-header,
.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.meter-label {
  margin: 7px 0 5px;
  color: rgba(186, 255, 200, 0.78);
  font-size: 11px;
}

.meter-label strong {
  color: #aaffbc;
}

.meter-shell {
  width: 100%;
  height: 12px;
  border: 1px solid rgba(39, 255, 104, 0.22);
  background: rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  transition: width 0.18s linear;
}

.green-fill {
  background: linear-gradient(90deg, rgba(39, 255, 104, 0.62), rgba(170, 255, 188, 0.88));
  box-shadow: 0 0 9px rgba(39, 255, 104, 0.62);
}

.purple-fill {
  background: linear-gradient(90deg, rgba(188, 83, 255, 0.88), rgba(255, 98, 168, 0.68));
  box-shadow: 0 0 9px rgba(188, 83, 255, 0.62);
}

.enemy-fill {
  background: linear-gradient(90deg, rgba(255, 98, 168, 0.9), rgba(188, 83, 255, 0.74));
  box-shadow: 0 0 9px rgba(255, 98, 168, 0.56);
}

.front-meters {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.contribution-box strong {
  color: #aaffbc;
  font-size: 26px;
  text-shadow: 0 0 13px rgba(39, 255, 104, 0.48);
}

.action-row,
.action-grid,
.footer-actions {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

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

.action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.push-button {
  color: #aaffbc;
  border-color: rgba(39, 255, 104, 0.42);
  background: rgba(0, 48, 18, 0.34);
}

.secondary-button {
  color: #aaffbc;
  border-color: rgba(39, 255, 104, 0.34);
  background: rgba(0, 38, 12, 0.24);
}

.danger-button {
  color: #ffd7e8;
  border-color: rgba(255, 98, 168, 0.52);
  background: rgba(90, 0, 40, 0.24);
}

.department-panel {
  margin-top: 16px;
  border-color: rgba(188, 83, 255, 0.38);
}

.department-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.department-card {
  position: relative;
  padding: 13px;
  overflow: hidden;
}

.department-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  opacity: 0.12;
  background: linear-gradient(135deg, transparent, var(--purple), transparent);
}

.department-card h3 {
  position: relative;
  margin: 7px 0 8px;
  color: #aaffbc;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.department-card p,
.department-card button,
.department-card .dept-meta {
  position: relative;
}

.dept-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0;
}

.dept-meta div {
  border: 1px solid rgba(39, 255, 104, 0.15);
  background: rgba(0, 0, 0, 0.24);
  padding: 8px;
}

.dept-meta strong {
  display: block;
  margin-top: 4px;
  color: var(--purple);
}

.department-card button {
  width: 100%;
}

.lower-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
}

.feed-list {
  display: grid;
  gap: 7px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.feed-item {
  border-left: 2px solid var(--purple-soft);
  background: rgba(0, 0, 0, 0.3);
  padding: 9px 10px;
  color: rgba(186, 255, 200, 0.84);
  font-size: 11px;
  line-height: 1.42;
}

.feed-item strong {
  color: var(--purple);
}

.feed-item em {
  color: #aaffbc;
  font-style: normal;
}

.protocol-step {
  border-left: 2px solid var(--purple-soft);
  padding: 10px 11px;
  margin-top: 10px;
}

.protocol-step strong {
  color: #aaffbc;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.protocol-step p {
  margin: 5px 0 0;
  font-size: 12px;
}

.identity-panel {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: rgba(0, 10, 4, 0.45);
}

.identity-item {
  padding: 9px;
}

.footer-actions {
  grid-template-columns: repeat(2, minmax(0, 180px));
  justify-content: center;
}

.footer-note {
  margin: 18px auto 0;
  max-width: 920px;
  color: rgba(186, 255, 200, 0.62);
  text-align: center;
  font-size: 12px;
}

@keyframes blink {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0.28; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(39, 255, 104, 0.12); }
  50% { box-shadow: 0 0 18px rgba(39, 255, 104, 0.48); }
}

@media (max-width: 1050px) {
  .hero-panel,
  .dashboard-grid,
  .lower-grid,
  .setup-panel,
  .identity-panel {
    grid-template-columns: 1fr;
  }

  .hero-readout,
  .department-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .top-bar,
  .panel-heading,
  .enemy-header,
  .meter-label {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid,
  .hero-readout,
  .department-grid,
  .action-row,
  .action-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(96vw, 1240px);
  }

  .hero-copy h1 {
    font-size: 39px;
  }

  .footer-actions {
    grid-template-columns: 1fr;
  }
}
