:root {
  --bg: #000006;
  --panel: rgba(4, 4, 14, 0.90);
  --panel2: rgba(3, 3, 12, 0.92);

  --accent: #a7adff;
  --text: #e7e7ff;
  --muted: #7f80a8;

  --border: rgba(110, 110, 155, 0.52);
  --border2: rgba(120, 120, 170, 0.22);
}

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

html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.page {
  min-height: 100vh;
  transition: opacity 160ms ease-out;
}

/* =========================
   HERO VOID
   ========================= */

.void {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: #010012;
}

#void-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: #010012;
}

/* Void accept swallow — brief, subtle */
@keyframes voidAcceptSwallow {
  0%   { filter: brightness(1) contrast(1) saturate(1); }
  45%  { filter: brightness(0.88) contrast(1.08) saturate(1.10); }
  100% { filter: brightness(1) contrast(1) saturate(1); }
}
body.void-accept #void-canvas {
  animation: voidAcceptSwallow 460ms ease-out;
}
body.void-accept .void::after {
  opacity: 0.78;
  filter: contrast(1.28) saturate(1.30);
}


/* Scanlines only */
.void::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;

  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.045) 0px,
      rgba(255,255,255,0.045) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 8px
    );

  mix-blend-mode: overlay;
  opacity: 0.30;
  animation: shimmer 8s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { filter: hue-rotate(0deg) brightness(1); }
  50%      { filter: hue-rotate(10deg) brightness(1.03); }
}

/* Tendrils: dim + offset */
.tendrils {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  filter: blur(34px);
  opacity: 0.22;
  mix-blend-mode: screen;
}

.tendril {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  top: 50%;
  left: 50%;
  background: radial-gradient(circle, rgba(110, 110, 170, 0.22), transparent 72%);
}

.tendril:nth-child(1) { transform: translate(-65%, -55%); }
.tendril:nth-child(2) { transform: translate(-35%, -40%); }
.tendril:nth-child(3) { transform: translate(-55%, -30%); }
.tendril:nth-child(4) { transform: translate(-40%, -65%); }

.content {
  position: relative;
  z-index: 4;
  max-width: 590px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

h1 {
  font-size: clamp(1.9rem, 2.5vw + 1rem, 3.0rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.subtitle {
  font-size: 0.96rem;
  color: var(--muted);
  max-width: 450px;
  margin: 0 auto 1.75rem;
}

.void-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.void-input {
  resize: vertical;
  min-height: 92px;
  max-height: 220px;
  padding: 0.85rem 0.95rem;

  border-radius: 0.9rem;
  border: 1px solid var(--border);

  background: rgba(2, 2, 8, 0.92);
  color: var(--text);
  font-size: 0.95rem;

  outline: none;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out, background 0.15s ease-out, transform 0.12s ease-out;
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  box-shadow: 0 0 0 1000px rgba(3, 3, 12, 0.98) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
}

input:autofill,
textarea:autofill,
select:autofill {
  box-shadow: 0 0 0 1000px rgba(3, 3, 12, 0.98) inset;
  -webkit-text-fill-color: var(--text);
}

.void-input::placeholder { color: rgba(150, 150, 190, 0.72); }

.void-input:focus {
  border-color: rgba(167, 173, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(120, 130, 255, 0.35);
  background: rgba(3, 3, 12, 0.98);
}

.void-input.shake {
  animation: inputShake 0.32s ease-out;
  border-color: rgba(255, 110, 170, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 110, 170, 0.18);
}

@keyframes inputShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.void-button {
  align-self: center;
  padding: 0.68rem 1.7rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;

  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;

  background: radial-gradient(circle at 20% 0%, #ffffff, #b0b6ff);
  color: #030314;

  box-shadow:
    0 0 22px rgba(160, 160, 255, 0.35),
    0 0 4px rgba(255, 255, 255, 0.75);

  transition: transform 0.09s ease-out, box-shadow 0.12s ease-out, filter 0.12s ease-out;
}

.void-button:hover { transform: translateY(-1px) scale(1.01); filter: brightness(1.04); }
.void-button:active { transform: translateY(1px) scale(0.99); }

.void-response {
  min-height: 1.4em;
  font-size: 0.98rem;
  color: var(--accent);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.void-response.bump {
  opacity: 0;
  transform: translateY(6px);
}

/* Lore flash: subtle */
body.lore-flash .void::after {
  opacity: 0.62;
  filter: contrast(1.25) saturate(1.35);
  animation: shimmer 1.1s ease-in-out infinite;
}

body.lore-flash {
  animation: loreJitter 0.28s ease-out;
}

@keyframes loreJitter {
  0% { transform: translate(0,0); }
  25% { transform: translate(-1px,1px); }
  50% { transform: translate(1px,-1px); }
  100% { transform: translate(0,0); }
}

.below {
  margin-top: 1.25rem;
  opacity: 0.85;
  text-decoration: none;
  color: inherit;
  display: inline-block;
}

.hint {
  font-size: 0.82rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(180, 180, 215, 0.78);
}

.arrow {
  margin-top: 0.4rem;
  font-size: 1.5rem;
  opacity: 0.8;
  animation: bob 1.3s ease-in-out infinite;
}

@keyframes bob { 0%,100%{transform:translateY(0);} 50%{transform:translateY(7px);} }

/* =========================
   PURGE OVERLAY
   ========================= */

.purge-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.purge-overlay-text {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: clamp(0.95rem, 1.2vw + 0.5rem, 1.35rem);
  color: rgba(240, 240, 255, 0.92);
  text-shadow: 0 0 24px rgba(255, 80, 140, 0.22);
  animation: abortPulse 1.25s ease-in-out infinite;
}

.purge-overlay-sub {
  display: block;
  margin-top: 0.6rem;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: rgba(210, 210, 245, 0.72);
}

@keyframes abortPulse {
  0%, 100% { opacity: 0.62; filter: blur(0px); }
  50% { opacity: 1; filter: blur(0.2px); }
}

/* =========================
   MODULES
   ========================= */

.modules {
  position: relative;
  overflow: hidden;
  padding: 3.2rem 1.25rem 2.4rem;

  background:
    radial-gradient(circle at 10% 30%, rgba(90,100,255,0.05), transparent 62%),
    radial-gradient(circle at 90% 70%, rgba(255,60,120,0.045), transparent 68%),
    linear-gradient(to bottom, rgba(1,1,12,0.98), rgba(1,1,10,0.95));
  border-top: 1px solid var(--border2);
}

.modules::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.23;
  mix-blend-mode: overlay;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.05) 0px,
      rgba(255,255,255,0.05) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 10px
    );
}

.modules-inner { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; }

.modules h2 {
  text-align: center;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: rgba(210, 210, 245, 0.9);
  margin-bottom: 1.6rem;
}

.feature {
  background: var(--panel2);
  border: 1px solid rgba(110, 110, 155, 0.34);
  border-radius: 1.2rem;
  padding: 1.1rem 1.1rem 1.0rem;
  box-shadow: 0 0 34px rgba(0,0,0,0.28);
  margin-bottom: 1.1rem;
}

.feature-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.feature h3 {
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.feature p {
  color: rgba(195, 195, 230, 0.78);
  font-size: 0.92rem;
  line-height: 1.35;
}

.feature-badge {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(160, 160, 255, 0.32);
  background: rgba(8, 8, 22, 0.55);
  color: rgba(220, 220, 255, 0.9);
  white-space: nowrap;
}

.ticket-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 0.85rem 0.9rem;
  align-items: end;
}

.ticket-receipt {
  margin-top: 0.85rem;
  padding: 0.85rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(120,120,170,0.22);
  background: rgba(2,2,10,0.70);

  color: rgba(220, 220, 255, 0.92);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.35;

  min-height: 6.4em;
  white-space: pre-wrap;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 0.9rem;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(110, 110, 155, 0.34);
  border-radius: 1.1rem;
  padding: 1rem 1rem 0.95rem;
  box-shadow: 0 0 30px rgba(0,0,0,0.28);
}

.card h3 {
  font-size: 0.86rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.card p {
  color: rgba(195, 195, 230, 0.78);
  font-size: 0.9rem;
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.field { text-align: left; }
.field-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(190, 190, 225, 0.75);
  margin-bottom: 0.35rem;
}

.field-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(110,110,155,0.45);
  background: rgba(2,2,10,0.85);
  color: rgba(235,235,255,0.92);
  outline: none;
}

.field-input:focus {
  border-color: rgba(167,173,255,0.75);
  box-shadow: 0 0 0 1px rgba(120,130,255,0.25);
}

.field-range {
  width: 100%;
  accent-color: #a7adff;
  margin-top: 0.2rem;
}

.severity-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  font-size: 0.68rem;
  color: rgba(175,175,210,0.65);
  margin-top: 0.35rem;
}
.severity-labels span { text-align: center; line-height: 1.2; }

.field-check {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  color: rgba(220,220,245,0.85);
  font-size: 0.9rem;
}
.field-check input { accent-color: #a7adff; }

.chip {
  display: inline-block;
  padding: 0.52rem 0.92rem;
  border-radius: 999px;
  border: 1px solid rgba(160, 160, 255, 0.30);
  background: rgba(5, 5, 18, 0.78);
  color: rgba(230, 230, 255, 0.92);
  cursor: pointer;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-size: 0.73rem;
  transition: transform 0.08s ease-out, border-color 0.12s ease-out, background 0.12s ease-out, filter 0.12s ease-out;
  touch-action: manipulation;
  user-select: none;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(200, 200, 255, 0.55);
  background: rgba(6, 6, 22, 0.86);
}

.chip:active { transform: translateY(1px); }
.chip-wide { width: 100%; }

.chip-danger {
  border-color: rgba(255, 60, 120, 0.45);
  background: rgba(30, 6, 16, 0.78);
}
.chip-danger:hover { border-color: rgba(255, 90, 150, 0.75); filter: brightness(1.08); }

.card-out {
  min-height: 2.4em;
  margin-top: 0.65rem;
  color: rgba(185, 190, 255, 0.95);
  font-size: 0.9rem;
  opacity: 0.95;
}

.purge-meta {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: rgba(180, 180, 215, 0.72);
  display: flex;
  gap: 0.9rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(120, 120, 170, 0.18);
  text-align: center;
}
.fineprint {
  font-size: 0.78rem;
  color: rgba(170, 170, 205, 0.68);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}
.backtop {
  color: rgba(210, 210, 245, 0.9);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.backtop:hover { text-decoration: underline; }

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

/* =========================
   STATES: Void submit pulse + interaction corruption
   ========================= */

body.void-pulse .void::after {
  opacity: 0.58;
  filter: contrast(1.22) saturate(1.25);
}

body.void-pulse {
  animation: pulseJitter 0.38s ease-out;
}

@keyframes pulseJitter {
  0% { transform: translate(0,0); }
  25% { transform: translate(-1px,1px); }
  50% { transform: translate(1px,-1px); }
  100% { transform: translate(0,0); }
}

body.interaction-corrupt {
  filter: saturate(1.08) contrast(1.03);
}

.flinch {
  animation: flinch 0.55s ease-out;
}

@keyframes flinch {
  0% { transform: translate(0,0); filter: none; }
  18% { transform: translate(-1px, 1px); filter: contrast(1.04) saturate(1.05); }
  40% { transform: translate(1px, -1px); }
  100% { transform: translate(0,0); filter: none; }
}

/* =========================
   STATES: Purge
   ========================= */

body.purge-holding .void::after {
  opacity: 0.52;
  animation: shimmer 1.2s ease-in-out infinite;
  filter: contrast(1.18) saturate(1.18);
}

body.purge-holding {
  animation: microshake var(--shake-speed, 0.20s) infinite;
}

@keyframes microshake {
  0% { transform: translate(0,0); }
  25% { transform: translate(calc(var(--shake-x, 1px) * -1), 0); }
  50% { transform: translate(var(--shake-x, 1px), var(--shake-y, 1px)); }
  75% { transform: translate(0, calc(var(--shake-y, 1px) * -1)); }
  100% { transform: translate(0,0); }
}

body.purge-blast .void { animation: blast 0.35s ease-out; }
@keyframes blast {
  0% { filter: contrast(1) saturate(1) brightness(1); }
  55% { filter: contrast(1.28) saturate(1.28) brightness(1.07); }
  100% { filter: contrast(1) saturate(1) brightness(1); }
}

body.purge-spike .void {
  filter: contrast(1.35) saturate(1.42) brightness(1.08);
}

body.purge-haunt {
  filter: saturate(1.14) contrast(1.05);
}

/* takeover: hide UI and show overlay */
body.purge-takeover { overflow: hidden; }
body.purge-takeover .modules { display: none; }
body.purge-takeover #hero-content {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}
body.purge-takeover .purge-overlay {
  opacity: 1;
  transform: scale(1);
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 1040px) {
  .cards { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
  .ticket-grid { grid-template-columns: 1fr; }
}

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

@media (max-width: 600px) {
  .content { padding: 1.5rem; }
  .subtitle { font-size: 0.9rem; }
  .purge-meta { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
}


/* Prevent purge overlay flash before CSS/JS boots */
.purge-overlay[hidden] { display: none !important; }

/* System status + mini actions */
.system-status{
  margin: 0.15rem auto 1.05rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(190, 190, 225, 0.72);
  opacity: 0.95;
}
.system-status b{ color: rgba(235,235,255,0.92); font-weight: 600; }

.mini-actions{
  display:flex;
  justify-content:center;
  margin-top: 0.25rem;
}
.mini-actions-left{
  justify-content:flex-start;
  margin-top: 0.0rem;
  margin-bottom: 0.45rem;
}
.mini-btn{
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(160, 160, 255, 0.26);
  background: rgba(5, 5, 18, 0.62);
  color: rgba(230, 230, 255, 0.90);
  cursor: pointer;
  font-size: 0.72rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.mini-btn:hover{
  border-color: rgba(200, 200, 255, 0.55);
  background: rgba(6, 6, 22, 0.78);
  transform: translateY(-1px);
}
.mini-btn:active{ transform: translateY(1px); }
