/* ======================================================
   LAST CHANCE — Experience layer
   ====================================================== */

/* ---------- Particles canvas ---------- */
#particles {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Telemetry sidebar ---------- */
.telemetry {
  position: fixed;
  right: 16px;
  top: 120px;
  bottom: 120px;
  width: 280px;
  z-index: 50;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--cyan);
  opacity: 0.55;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(125, 249, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  mix-blend-mode: screen;
}
.telemetry::before {
  content: '◉ LIVE TELEMETRY · NET 7F-Δ';
  position: absolute;
  top: 6px; left: 12px;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
}
.telemetry .row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; animation: telemFade 0.4s forwards; }
.telemetry .row.warn { color: var(--gold); }
.telemetry .row.err  { color: var(--danger); }
.telemetry .row.dim  { color: var(--ink-dim); }
@keyframes telemFade {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 0.9; transform: none; }
}
@media (max-width: 1280px) { .telemetry { display: none; } }

/* ---------- Mute / audio button ---------- */
.audio-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 80;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(125, 249, 255, 0.4);
  color: var(--cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}
.audio-btn:hover { background: var(--cyan); color: var(--bg); box-shadow: var(--shadow-blue); }
.audio-btn .bars { display: inline-flex; gap: 2px; align-items: end; height: 14px; }
.audio-btn .bars span {
  width: 2px; height: 100%;
  background: currentColor;
  animation: barPulse 1s ease-in-out infinite;
}
.audio-btn .bars span:nth-child(2) { animation-delay: 0.15s; height: 70%; }
.audio-btn .bars span:nth-child(3) { animation-delay: 0.3s; height: 90%; }
.audio-btn.muted .bars span { animation: none; height: 4px; }
@keyframes barPulse {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* ---------- Glitch hover (RGB split) ---------- */
.glitch-hover {
  position: relative;
  transition: text-shadow 0.2s;
}
.glitch-hover:hover {
  text-shadow:
    -2px 0 var(--danger),
    2px 0 var(--cyan),
    0 0 12px rgba(125, 249, 255, 0.4);
  animation: glitchShake 0.4s steps(4) infinite;
}
@keyframes glitchShake {
  0%, 100% { transform: translate(0,0); }
  25% { transform: translate(-1px, 0.5px); }
  50% { transform: translate(1px, -0.5px); }
  75% { transform: translate(-0.5px, 1px); }
}

/* ---------- Command palette ---------- */
.cmdp {
  position: fixed; inset: 0;
  z-index: 9500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(2, 5, 11, 0.7);
  backdrop-filter: blur(8px);
}
.cmdp.open { display: flex; animation: cmdpIn 0.18s ease-out; }
@keyframes cmdpIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.cmdp-box {
  width: min(680px, 92vw);
  background: rgba(8, 10, 18, 0.95);
  padding: 0;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
}
.cmdp-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(125, 249, 255, 0.2);
}
.cmdp-bar .prompt { color: var(--cyan); font-weight: 700; }
.cmdp-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  caret-color: var(--cyan);
}
.cmdp-hint { color: var(--ink-dim); font-size: 11px; letter-spacing: 0.15em; }
.cmdp-log {
  max-height: 50vh;
  overflow-y: auto;
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.cmdp-log .line { padding: 2px 0; }
.cmdp-log .line .cmd { color: var(--cyan); }
.cmdp-log .line.err { color: var(--danger); }
.cmdp-log .line.ok  { color: var(--cyan); }
.cmdp-log .line.warn{ color: var(--gold); }
.cmdp-log .line.dim { color: var(--ink-dim); }

/* ---------- Lore fragments ---------- */
.lore-frag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 10px;
  padding: 3px 8px;
  border: 1px dashed rgba(125, 249, 255, 0.5);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(125, 249, 255, 0.05);
  vertical-align: middle;
  animation: fragBlink 2.5s ease-in-out infinite;
}
.lore-frag:hover {
  background: var(--cyan);
  color: var(--bg);
  border-style: solid;
  box-shadow: var(--shadow-blue);
}
.lore-frag.found { opacity: 0.4; animation: none; }
@keyframes fragBlink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(125, 249, 255, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(125, 249, 255, 0); }
}

.lore-modal, .pill-modal {
  position: fixed; inset: 0;
  z-index: 9600;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(2, 5, 11, 0.85);
  backdrop-filter: blur(10px);
}
.lore-modal.open, .pill-modal.open { display: flex; animation: cmdpIn 0.25s ease-out; }
.lore-box {
  width: min(640px, 100%);
  padding: 0;
  background: rgba(8, 10, 18, 0.95);
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
}
.lore-head {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(125, 249, 255, 0.25);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-transform: uppercase;
}
.lore-body {
  padding: 24px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
}
.lore-body .stamp { color: var(--ink-dim); font-size: 11px; letter-spacing: 0.15em; }
.lore-body .redact {
  display: inline-block;
  background: var(--ink);
  color: var(--ink);
  user-select: none;
  padding: 0 4px;
}
.lore-close {
  background: transparent;
  border: 1px solid rgba(125, 249, 255, 0.4);
  color: var(--cyan);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.2em;
  padding: 6px 12px;
  cursor: pointer;
}
.lore-close:hover { background: var(--cyan); color: var(--bg); }

/* ---------- Pill choice ---------- */
.pill-box {
  width: min(880px, 100%);
  padding: 48px 32px;
  background: rgba(8, 10, 18, 0.96);
  font-family: 'Orbitron', sans-serif;
  text-align: center;
}
.pill-title {
  font-size: clamp(24px, 4vw, 40px);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.pill-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  margin-bottom: 40px;
}
.pill-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.pill-choice {
  padding: 32px 24px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.25s;
  font-family: 'Orbitron', sans-serif;
}
.pill-choice h4 {
  font-size: 22px;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}
.pill-choice p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
  line-height: 1.5;
}
.pill-stay { border-color: rgba(255, 59, 107, 0.4); }
.pill-stay:hover {
  background: rgba(255, 59, 107, 0.1);
  border-color: var(--danger);
  box-shadow: 0 0 30px rgba(255, 59, 107, 0.3);
}
.pill-stay h4 { color: var(--danger); }
.pill-take { border-color: rgba(125, 249, 255, 0.4); }
.pill-take:hover {
  background: rgba(125, 249, 255, 0.1);
  border-color: var(--cyan);
  box-shadow: var(--shadow-blue);
}
.pill-take h4 { color: var(--cyan); }
@media (max-width: 640px) { .pill-choices { grid-template-columns: 1fr; } }

/* In-grid takeover (stay chose) */
.in-grid-takeover {
  position: fixed; inset: 0;
  z-index: 9800;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 24px;
  color: var(--danger);
  font-family: 'Orbitron', sans-serif;
  text-align: center;
  animation: cmdpIn 0.25s ease-out;
}
.in-grid-takeover .cam {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #888 70%, #333 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
  animation: camWatch 1s ease-in-out infinite alternate;
  color: #000;
}
@keyframes camWatch {
  from { box-shadow: 0 0 40px rgba(255,255,255,0.3); }
  to   { box-shadow: 0 0 60px rgba(255, 59, 107, 0.6); }
}
.in-grid-takeover h3 { font-size: clamp(20px, 3vw, 36px); letter-spacing: 0.1em; }
.in-grid-takeover p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.2em;
}
body.in-grid main, body.in-grid > .nav, body.in-grid > footer {
  filter: grayscale(1) brightness(0.4);
  pointer-events: none;
}

/* Portal flash on "take" */
.portal-flash {
  position: fixed; inset: 0;
  z-index: 9900;
  pointer-events: none;
  background: radial-gradient(circle at center, var(--cyan) 0%, transparent 60%);
  animation: portalFlash 0.9s ease-out forwards;
}
@keyframes portalFlash {
  0% { opacity: 0; transform: scale(0.2); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: scale(3); }
}

/* ---------- Urgency layer ---------- */
body.urg-warn .scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 59, 107, 0.04) 0px,
    rgba(255, 59, 107, 0.04) 1px,
    transparent 1px,
    transparent 3px
  );
}
body.urg-alert .scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 59, 107, 0.12) 0px,
    rgba(255, 59, 107, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: alertFlash 1.5s ease-in-out infinite;
}
@keyframes alertFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Hero intro animation ---------- */
body.intro-active .chance-flying {
  animation: flyIn 1.6s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
body.intro-active .portal-ring.r1 { animation: spin 1.2s linear, spin 30s linear infinite 1.2s; }
body.intro-active .hero-title .line {
  opacity: 0;
  animation: lineIn 0.6s ease-out forwards;
}
body.intro-active .hero-title .line:nth-child(1) { animation-delay: 0.2s; }
body.intro-active .hero-title .line:nth-child(2) { animation-delay: 0.5s; }
@keyframes flyIn {
  0% { transform: translate(200px, -120px) rotate(25deg) scale(0.4); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: translate(0,0) rotate(-4deg) scale(1); opacity: 1; }
}
@keyframes lineIn {
  from { opacity: 0; transform: translateY(20px); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* ---------- Scroll-snap storytelling ---------- */
html.snap-scroll { scroll-snap-type: y proximity; }
html.snap-scroll .section,
html.snap-scroll .hero { scroll-snap-align: start; scroll-snap-stop: normal; }

/* ---------- Decrypt text ---------- */
.decrypt {
  font-family: inherit;
  letter-spacing: 0.02em;
}

/* ---------- Parallax helpers ---------- */
[data-parallax] { will-change: transform; transition: transform 0.05s linear; }

/* ============ RULES OF LAST CHANCE ============ */
.section.rules { padding-top: 7rem; padding-bottom: 7rem; }
.section.rules .section-head { text-align: center; max-width: 900px; margin: 0 auto 4rem; }
.section.rules .section-head h2 { font-family: 'Orbitron', sans-serif; font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 900; letter-spacing: 0.02em; margin: 0.5rem 0 1rem; }
.section.rules .section-head .lede { color: rgba(220,230,240,0.7); font-size: 1.05rem; max-width: 720px; margin: 0 auto; }

.rules-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.rules-grid > li { display: block; }
.rules-grid > li.rule-final { grid-column: 1 / -1; }

.rule-card {
  padding: 2rem 1.75rem 1.75rem;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
  color: rgba(230,240,250,0.88);
  position: relative;
}
.rule-card .rule-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: #22d3ee;
  opacity: 0.75;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed rgba(34,211,238,0.25);
  width: fit-content;
}
.rule-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin: 0.25rem 0 0.5rem;
  color: #fff;
}
.rule-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(220,230,240,0.78);
}
.rule-card .rule-foot {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.85rem;
  font-style: italic;
  color: rgba(180,200,220,0.7);
  letter-spacing: 0.01em;
}
.rule-card .rule-foot.accent { color: #ff5b78; font-style: normal; font-weight: 600; letter-spacing: 0.04em; }

.rule-final .rule-card {
  min-height: 220px;
  text-align: center;
  align-items: center;
}
.rule-final .rule-card .rule-num { color: #ff5b78; border-color: rgba(255,91,120,0.3); }
.rule-final .rule-card h3 { font-size: 1.6rem; }
.rule-final .rule-card p { max-width: 720px; }

.rules-seal {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 900px;
  margin: 3.5rem auto 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  color: rgba(180,200,220,0.5);
  text-transform: uppercase;
}
.rules-seal .seal-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(34,211,238,0.4), transparent); }
.rules-seal .seal-text { white-space: nowrap; }

@media (max-width: 640px) {
  .rules-grid { grid-template-columns: 1fr; }
  .rule-card { min-height: auto; }
}
