:root {
  --bg: #07070c;
  --surface: #0f0f17;
  --surface-2: #14141e;
  --red: #ff003c;
  --red-glow: #ff2d5e;
  --red-dim: #8a0020;
  --text: #e8e8f0;
  --text-dim: #8a8a98;
  --text-faint: #3a3a48;
  --border: rgba(255, 0, 60, 0.18);
  --border-bright: rgba(255, 0, 60, 0.5);
  --grid: rgba(255, 0, 60, 0.04);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', system-ui, -apple-system, sans-serif;
  font-weight: 500;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* === Grid overlay === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 1;
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 80%);
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 80%);
}

/* === Canvas background === */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.9;
}

/* === Vignette + ambient glow === */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 15% 15%, rgba(255,0,60,0.09), transparent 45%),
    radial-gradient(ellipse at 85% 85%, rgba(255,0,60,0.06), transparent 50%),
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
}

/* === Scanline === */
/* === HUD Header === */
.hud-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 2rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 7, 12, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
}
.hud-header > div {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hud-label { color: var(--text-dim); }
.hud-value { color: var(--red); text-shadow: 0 0 8px rgba(255,0,60,0.5); }

.status-dot {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--red), 0 0 4px #fff;
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.3; transform: scale(0.8); }
}

main {
  position: relative;
  z-index: 5;
  padding-top: 3.5rem;
}

/* === Hero === */
.hero {
  min-height: calc(100vh - 3.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem clamp(1.5rem, 5vw, 5rem);
  position: relative;
}
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, var(--red), transparent);
  opacity: 0.7;
}
.hero::before {
  top: 12%;
  left: -5%;
  width: 35%;
}
.hero::after {
  bottom: 18%;
  right: -5%;
  width: 35%;
  background: linear-gradient(-90deg, var(--red), transparent);
}

.hero-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.25em;
  margin-bottom: 2rem;
}
.hero-meta .bracket {
  color: var(--red);
  margin: 0 0.4rem;
  text-shadow: 0 0 8px rgba(255,0,60,0.5);
}

.hero-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(4.5rem, 15vw, 15rem);
  line-height: 0.88;
  letter-spacing: 0.03em;
  color: var(--text);
  position: relative;
  text-shadow:
    0 0 30px rgba(255,0,60,0.35),
    0 0 60px rgba(255,0,60,0.2);
}
.hero-title::before,
.hero-title::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
}
.hero-title::before {
  color: var(--red);
  animation: glitch-a 7s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 42%, 0 42%);
}
.hero-title::after {
  color: #00e5ff;
  animation: glitch-b 7s infinite;
  clip-path: polygon(0 62%, 100% 62%, 100% 100%, 0 100%);
}
@keyframes glitch-a {
  0%, 88%, 100% { transform: translate(0); opacity: 0; }
  89% { transform: translate(-5px, 2px); opacity: 0.85; }
  90% { transform: translate(3px, -1px); opacity: 0.85; }
  91% { transform: translate(-2px, 1px); opacity: 0.85; }
  92% { transform: translate(0); opacity: 0; }
  95% { transform: translate(-3px, -1px); opacity: 0.6; }
  96% { transform: translate(0); opacity: 0; }
}
@keyframes glitch-b {
  0%, 88%, 100% { transform: translate(0); opacity: 0; }
  89% { transform: translate(4px, -2px); opacity: 0.6; }
  90% { transform: translate(-3px, 2px); opacity: 0.6; }
  91% { transform: translate(2px, -1px); opacity: 0.6; }
  92% { transform: translate(0); opacity: 0; }
  95% { transform: translate(3px, 1px); opacity: 0.4; }
  96% { transform: translate(0); opacity: 0; }
}

.hero-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(0.9rem, 1.4vw, 1.2rem);
  color: var(--red);
  letter-spacing: 0.45em;
  margin-top: 1.5rem;
  text-shadow: 0 0 12px rgba(255,0,60,0.55);
}

.hero-desc {
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  color: var(--text-dim);
  max-width: 560px;
  margin-top: 2.5rem;
  line-height: 1.65;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 3rem;
  padding: 1rem 2.2rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--red);
  position: relative;
  width: fit-content;
  transition: color 0.25s, box-shadow 0.3s;
  overflow: hidden;
  z-index: 0;
}
.cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--red);
  transform: translateX(-101%);
  transition: transform 0.45s cubic-bezier(0.77, 0, 0.175, 1);
  z-index: -1;
}
.cta:hover {
  color: var(--bg);
  box-shadow: 0 0 35px rgba(255,0,60,0.6), inset 0 0 20px rgba(255,0,60,0.3);
}
.cta:hover::before { transform: translateX(0); }
.cta svg { transition: transform 0.3s; }
.cta:hover svg { transform: translateX(4px); }

/* === Section Header === */
.section-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.section-tag {
  font-family: 'Share Tech Mono', monospace;
  color: var(--red);
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  text-shadow: 0 0 8px rgba(255,0,60,0.4);
}
.section-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--red-dim), transparent);
}

/* === Projects === */
.projects {
  padding: 5rem clamp(1.5rem, 5vw, 5rem);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  position: relative;
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  padding: 2rem;
  transition: transform 0.35s, border-color 0.35s, box-shadow 0.35s;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}
.card:hover {
  border-color: var(--red);
  transform: translateY(-6px);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(255, 0, 60, 0.18);
}
.card:hover::before { opacity: 1; }

/* Corner brackets */
.card-corners::before,
.card-corners::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--red);
  transition: width 0.35s, height 0.35s;
}
.card-corners::before {
  top: -1px; left: -1px;
  border-right: none; border-bottom: none;
}
.card-corners::after {
  bottom: -1px; right: -1px;
  border-left: none; border-top: none;
}
.card:hover .card-corners::before,
.card:hover .card-corners::after {
  width: 22px; height: 22px;
}

/* Card entry animation — sci-fi reveal sweep */
.card.card-enter {
  animation: card-enter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: var(--card-enter-delay, 0ms);
}
.card.card-enter .card-corners::before,
.card.card-enter .card-corners::after {
  animation: card-corner-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  animation-delay: calc(var(--card-enter-delay, 0ms) + 280ms);
}
.card.card-enter::before {
  /* Reuse the existing top-line pseudo as a sweep flash on entry. */
  opacity: 1;
  animation: card-flashline 0.7s ease-out both;
  animation-delay: var(--card-enter-delay, 0ms);
}

@keyframes card-enter {
  0% {
    opacity: 0;
    transform: translateY(14px);
    clip-path: inset(0 100% 0 0);
    filter: blur(2px);
  }
  35% {
    opacity: 1;
    filter: blur(0);
  }
  60% {
    transform: translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0);
    filter: blur(0);
  }
}

@keyframes card-corner-pop {
  0%   { opacity: 0; width: 4px; height: 4px; }
  60%  { opacity: 1; width: 28px; height: 28px; }
  100% { opacity: 1; width: 14px; height: 14px; }
}

@keyframes card-flashline {
  0%   { opacity: 0; transform: scaleX(0.1); transform-origin: left; }
  40%  { opacity: 1; transform: scaleX(1);   transform-origin: left; }
  100% { opacity: 0; transform: scaleX(1);   transform-origin: left; }
}

@media (prefers-reduced-motion: reduce) {
  .card.card-enter,
  .card.card-enter .card-corners::before,
  .card.card-enter .card-corners::after,
  .card.card-enter::before {
    animation: none;
  }
}

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--red);
  letter-spacing: 0.25em;
  margin-bottom: 1rem;
}
.pulse {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--red);
  animation: blink 1.8s infinite;
}

.card-id {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.2em;
}

.card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}
.card h3 .dim { color: var(--text-dim); font-weight: 500; }

.card p {
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  flex: 1;
}

.card-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.card-tags span {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
  letter-spacing: 0.12em;
  transition: color 0.3s, border-color 0.3s;
}
.card:hover .card-tags span {
  color: var(--text);
  border-color: var(--border-bright);
}

.card-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
}
.locked { color: var(--text-faint); }

.card-empty {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.card-empty:hover { transform: translateY(-3px); }
.empty-marker { font-family: 'Share Tech Mono', monospace; }
.empty-marker .plus {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  color: var(--red);
  margin-bottom: 0.75rem;
  text-shadow: 0 0 25px rgba(255,0,60,0.55);
  font-weight: 700;
}
.empty-marker p {
  color: var(--text-dim);
  letter-spacing: 0.22em;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.empty-marker .dim { font-size: 0.72rem; color: var(--text-faint); letter-spacing: 0.15em; }

/* === About === */
.about {
  padding: 5rem clamp(1.5rem, 5vw, 5rem);
}
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 4rem;
  align-items: center;
}
.about-text p {
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
  color: var(--text-dim);
  line-height: 1.8;
  margin-bottom: 1rem;
}
.about-text p:first-child { color: var(--text); }

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.stat {
  padding: 2rem 1rem;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}
.stat::before,
.stat::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
}
.stat::before {
  top: -1px; left: -1px;
  border-top: 1px solid var(--red);
  border-left: 1px solid var(--red);
}
.stat::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid var(--red);
  border-right: 1px solid var(--red);
}
.stat-label {
  display: block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.18em;
  margin-bottom: 0.6rem;
}
.stat-value {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  color: var(--red);
  font-weight: 700;
  text-shadow: 0 0 22px rgba(255,0,60,0.55);
}

/* === Footer === */
footer {
  position: relative;
  z-index: 5;
  padding: 2rem clamp(1.5rem, 5vw, 5rem);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-sig {
  color: var(--red);
  text-shadow: 0 0 8px rgba(255,0,60,0.4);
}

/* === Responsive === */
@media (max-width: 820px) {
  .hud-header { padding: 0.75rem 1rem; font-size: 0.68rem; letter-spacing: 0.1em; }
  .hud-center { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}
@media (max-width: 520px) {
  .hud-header > div { gap: 0.4rem; }
  .hero-meta { font-size: 0.72rem; letter-spacing: 0.18em; }
  .hero-subtitle { letter-spacing: 0.3em; }
  .about-stats { grid-template-columns: 1fr; }
  .stat-value { font-size: 2rem; }
  .section-header { gap: 0.8rem; }
}

/* === Custom cursor (desktop only) === */
@media (hover: hover) and (pointer: fine) {
  body, a, button, .cta, .card, input, .modal-btn { cursor: none; }
}

.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 30px;
  height: 30px;
  pointer-events: none;
  z-index: 9998;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform, width, height;
  transition: width 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              height 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  mix-blend-mode: plus-lighter;
}

.cur-bracket {
  position: absolute;
  width: 7px;
  height: 7px;
  transition: width 0.25s, height 0.25s, border-color 0.25s;
}
.br-tl { top: 0;    left: 0;    border-top: 1px solid var(--red); border-left: 1px solid var(--red); }
.br-tr { top: 0;    right: 0;   border-top: 1px solid var(--red); border-right: 1px solid var(--red); }
.br-bl { bottom: 0; left: 0;    border-bottom: 1px solid var(--red); border-left: 1px solid var(--red); }
.br-br { bottom: 0; right: 0;   border-bottom: 1px solid var(--red); border-right: 1px solid var(--red); }

.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 5px;
  height: 5px;
  background: var(--red);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50%, -50%, 0);
  box-shadow: 0 0 10px var(--red), 0 0 3px #fff;
  will-change: transform;
}

.cursor.active {
  width: 52px;
  height: 52px;
}
.cursor.active .cur-bracket {
  width: 11px;
  height: 11px;
  border-color: var(--red-glow);
}
.cursor.down {
  width: 22px;
  height: 22px;
}

@media (hover: none), (pointer: coarse) {
  .cursor, .cursor-dot { display: none; }
}

/* === Auth status (HUD) === */
.auth-status {
  --auth-color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.3rem 0.85rem;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  position: relative;
  transition: border-color 0.25s, background 0.25s;
}
.auth-status:hover {
  background: rgba(255, 0, 60, 0.06);
  border-color: var(--border);
}
.auth-status .hud-label { color: var(--text-dim); }
.auth-status .auth-text {
  color: var(--auth-color);
  text-shadow: 0 0 10px color-mix(in srgb, var(--auth-color) 55%, transparent);
  transition: color 0.3s, text-shadow 0.3s;
}

.auth-icon {
  position: relative;
  width: 14px;
  height: 14px;
  color: var(--auth-color);
  transition: color 0.3s;
}
.auth-icon::before,
.auth-icon::after {
  content: '';
  position: absolute;
  transition: all 0.3s;
}
/* Locked: padlock */
.auth-status[data-state="locked"] { --auth-color: var(--text-dim); }
.auth-status[data-state="locked"] .auth-icon::before {
  top: 0; left: 50%;
  width: 8px; height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  transform: translateX(-50%);
}
.auth-status[data-state="locked"] .auth-icon::after {
  bottom: 0; left: 50%;
  width: 11px; height: 7px;
  background: currentColor;
  transform: translateX(-50%);
}
/* Setup: warning triangle */
.auth-status[data-state="setup"] { --auth-color: #ffb347; }
.auth-status[data-state="setup"] .auth-icon::before {
  inset: 1px;
  background: transparent;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 11px solid currentColor;
  width: 0; height: 0;
}
.auth-status[data-state="setup"] .auth-icon::after {
  content: '!';
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 8px;
  color: var(--bg);
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  line-height: 1;
}
/* Authenticated: solid ring + pulse */
.auth-status[data-state="authenticated"] { --auth-color: #35ff7a; }
.auth-status[data-state="authenticated"] .auth-icon::before {
  inset: 2px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor, inset 0 0 4px currentColor;
  animation: blink 1.8s ease-in-out infinite;
}
.auth-status[data-state="authenticated"] .auth-icon::after {
  inset: 5px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

/* === Auth modal === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 9, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  position: relative;
  width: min(480px, 92vw);
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--red);
  padding: 2.25rem 2.25rem 1.75rem;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.85),
    0 0 60px rgba(255, 0, 60, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transform: scale(0.94) translateY(10px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s, border-color 0.4s, box-shadow 0.4s;
}
.modal-backdrop:not([hidden]) .modal-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-panel .corner {
  position: absolute;
  width: 16px;
  height: 16px;
  transition: width 0.35s, height 0.35s, border-color 0.4s;
}
.modal-panel .corner.tl { top: -1px; left: -1px; border-top: 1px solid var(--red); border-left: 1px solid var(--red); }
.modal-panel .corner.tr { top: -1px; right: -1px; border-top: 1px solid var(--red); border-right: 1px solid var(--red); }
.modal-panel .corner.bl { bottom: -1px; left: -1px; border-bottom: 1px solid var(--red); border-left: 1px solid var(--red); }
.modal-panel .corner.br { bottom: -1px; right: -1px; border-bottom: 1px solid var(--red); border-right: 1px solid var(--red); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
}
.modal-state {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--red);
  text-shadow: 0 0 8px rgba(255, 0, 60, 0.5);
}

.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
  text-shadow: 0 0 20px rgba(255, 0, 60, 0.35);
}
.modal-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.auth-prompt {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 1px solid var(--border-bright);
  padding: 0.6rem 0 0.8rem;
  font-family: 'Share Tech Mono', monospace;
  position: relative;
}
.auth-prompt[hidden] { display: none; }
.prompt-mark {
  color: var(--red);
  font-size: 1.2rem;
  text-shadow: 0 0 8px rgba(255, 0, 60, 0.6);
}
.auth-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  padding: 0.25rem 0;
}
.auth-input::placeholder {
  color: var(--text-faint);
  letter-spacing: 0.18em;
}
.caret {
  width: 10px;
  height: 20px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  animation: caret-blink 1.1s steps(2, start) infinite;
}
@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.auth-feedback {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  min-height: 1.1em;
  color: var(--text-faint);
  transition: color 0.2s;
}
.auth-feedback.error { color: #ff4060; text-shadow: 0 0 8px rgba(255, 0, 60, 0.5); }
.auth-feedback.success { color: #35ff7a; text-shadow: 0 0 10px rgba(53, 255, 122, 0.5); }
.auth-feedback.info { color: var(--text-dim); }

.auth-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}
.modal-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--border-bright);
  background: transparent;
  color: var(--text);
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.25s;
  position: relative;
}
.modal-btn:hover {
  background: rgba(255, 0, 60, 0.12);
  border-color: var(--red);
}
.modal-btn.transmit {
  border-color: var(--red);
  color: var(--red);
}
.modal-btn.transmit:hover {
  background: var(--red);
  color: var(--bg);
  box-shadow: 0 0 24px rgba(255, 0, 60, 0.55);
}

/* Shake on failure */
.modal-panel.shake { animation: shake 0.45s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-10px); }
  30% { transform: translateX(10px); }
  45% { transform: translateX(-7px); }
  60% { transform: translateX(7px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}

/* Success flash (green) */
.modal-panel.success {
  border-color: #35ff7a;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.85),
    0 0 80px rgba(53, 255, 122, 0.55);
}
.modal-panel.success .corner {
  border-color: #35ff7a !important;
  width: 24px;
  height: 24px;
}

/* === Danger / Purge confirm modal === */
.modal-panel.danger {
  border-color: rgba(255, 0, 60, 0.85);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.9),
    0 0 60px rgba(255, 0, 60, 0.45),
    inset 0 0 80px rgba(255, 0, 60, 0.05);
  background:
    linear-gradient(135deg, rgba(40, 0, 8, 0.9), rgba(10, 0, 2, 0.95)),
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 8px,
      rgba(255, 0, 60, 0.05) 8px,
      rgba(255, 0, 60, 0.05) 16px
    );
  animation: danger-pulse 1.6s ease-in-out infinite;
}
@keyframes danger-pulse {
  0%, 100% {
    box-shadow:
      0 30px 80px rgba(0, 0, 0, 0.9),
      0 0 60px rgba(255, 0, 60, 0.45),
      inset 0 0 80px rgba(255, 0, 60, 0.05);
  }
  50% {
    box-shadow:
      0 30px 80px rgba(0, 0, 0, 0.9),
      0 0 100px rgba(255, 0, 60, 0.7),
      inset 0 0 80px rgba(255, 0, 60, 0.1);
  }
}
.modal-panel.danger .corner {
  border-color: var(--red) !important;
  width: 24px;
  height: 24px;
}
.modal-title.danger {
  color: var(--red);
  text-shadow: 0 0 18px rgba(255, 0, 60, 0.8);
  letter-spacing: 0.18em;
}
.modal-state.danger {
  color: var(--red);
  border-color: rgba(255, 0, 60, 0.6);
  background: rgba(255, 0, 60, 0.08);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
.confirm-warn {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  margin: 1.4rem 0 1.6rem;
  border: 1px solid rgba(255, 0, 60, 0.45);
  background:
    linear-gradient(90deg, rgba(255, 0, 60, 0.12), transparent 80%),
    repeating-linear-gradient(
      -45deg,
      transparent 0,
      transparent 6px,
      rgba(255, 0, 60, 0.06) 6px,
      rgba(255, 0, 60, 0.06) 12px
    );
  position: relative;
}
.confirm-warn::before,
.confirm-warn::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  box-shadow: 0 0 12px rgba(255, 0, 60, 0.7);
}
.confirm-warn::before { left: 0; }
.confirm-warn::after  { right: 0; }
.confirm-warn-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--red);
  border: 1px solid var(--red);
  background: rgba(255, 0, 60, 0.08);
  text-shadow: 0 0 12px rgba(255, 0, 60, 0.9);
  transform: rotate(0deg);
  animation: warn-flicker 2.2s ease-in-out infinite;
}
@keyframes warn-flicker {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 0, 60, 0); }
  50%      { box-shadow: 0 0 18px rgba(255, 0, 60, 0.7); }
}
.confirm-warn-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.confirm-warn-body strong {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: var(--text);
  text-transform: uppercase;
}
.modal-btn.transmit.danger {
  border-color: var(--red);
  color: var(--red);
  position: relative;
  overflow: hidden;
}
.modal-btn.transmit.danger::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent 0,
    transparent 6px,
    rgba(255, 0, 60, 0.18) 6px,
    rgba(255, 0, 60, 0.18) 12px
  );
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.modal-btn.transmit.danger:hover {
  background: var(--red);
  color: var(--bg);
  box-shadow: 0 0 28px rgba(255, 0, 60, 0.75);
  letter-spacing: 0.32em;
}
.modal-btn.transmit.danger:hover::before { opacity: 1; }

/* === Module card — dynamic extras === */
.card-link {
  color: var(--red);
  text-decoration: none;
  letter-spacing: 0.18em;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  transition: text-shadow 0.2s, letter-spacing 0.2s;
}
.card-link:hover {
  text-shadow: 0 0 12px rgba(255, 0, 60, 0.7);
  letter-spacing: 0.22em;
}

.card-delete {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 7, 12, 0.6);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  z-index: 3;
  padding: 0;
}
.card:hover .card-delete { opacity: 1; }
.card:hover .card-id { opacity: 0; }
.card-id { transition: opacity 0.2s; }
.card-delete:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(255, 0, 60, 0.15);
  box-shadow: 0 0 12px rgba(255, 0, 60, 0.45);
}

/* Empty card is now a <button>, reset native button styling */
button.card-empty {
  font: inherit;
  text-align: center;
  color: inherit;
  width: 100%;
}

/* Status tint for the pulse badge */
.card[data-status="active"] .pulse { background: #35ff7a; box-shadow: 0 0 10px #35ff7a; }
.card[data-status="active"] .card-status span:last-child { color: #35ff7a; }
.card[data-status="archived"] .pulse { background: var(--text-faint); box-shadow: none; animation: none; }
.card[data-status="archived"] .card-status span:last-child { color: var(--text-faint); }

/* === Module modal form fields === */
.module-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}
.field-row {
  display: flex;
  gap: 0.9rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  font-family: 'Share Tech Mono', monospace;
  min-width: 0;
}
.field-grow { flex: 2; }
.field > span {
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  color: var(--text-dim);
}
.field input,
.field select,
.field textarea {
  background: rgba(7, 7, 12, 0.55);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  padding: 0.55rem 0.75rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.field textarea {
  resize: vertical;
  min-height: 72px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1.45;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 14px rgba(255, 0, 60, 0.28), inset 0 0 10px rgba(255, 0, 60, 0.05);
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-faint);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--red) 50%),
    linear-gradient(-45deg, transparent 50%, var(--red) 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
  cursor: inherit;
}
.field select option {
  background: var(--surface);
  color: var(--text);
}

@media (max-width: 520px) {
  .field-row { flex-direction: column; gap: 0.95rem; }
}

/* === Routing — archive vs. detail vs. runtime === */
body.view-detail .hero,
body.view-detail .projects,
body.view-detail .about { display: none; }

body.view-runtime .hero,
body.view-runtime .projects,
body.view-runtime .about,
body.view-runtime .module-detail,
body.view-runtime header,
body.view-runtime footer { display: none; }
body.view-runtime { overflow: hidden; }
body.view-runtime main { padding: 0; max-width: none; }

/* === Immersive Mode (Plexus runtime: hide all hub chrome, peek HUD on top edge) === */
body.view-runtime #bg-canvas,
body.view-runtime .vignette { display: none !important; }

body.view-runtime .runtime-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(-100%);
  transition: transform 0.28s ease;
  z-index: 100;
  background: rgba(7, 7, 12, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 0, 60, 0.25);
}
body.view-runtime .immersive-hotzone {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  z-index: 99;
  background: transparent;
}
body.view-runtime .immersive-hotzone:hover ~ .runtime-hud,
body.view-runtime .runtime-hud:hover,
body.view-runtime .runtime-hud:focus-within {
  transform: translateY(0);
}

/* === Module detail view === */
.module-detail {
  position: relative;
  z-index: 5;
  cursor: pointer;
  padding: 3rem clamp(1.5rem, 5vw, 5rem) 5rem;
  min-height: calc(100vh - 3.5rem);
}
/* Re-set cursor for the actual content so only the empty backdrop hints "click to dismiss" */
.module-detail .detail-panel,
.module-detail .detail-topbar,
.module-detail .gated-lock { cursor: auto; }
.module-detail .detail-back,
.module-detail .deploy-btn,
.module-detail .modal-btn { cursor: pointer; }

.detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  flex-wrap: wrap;
}
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, letter-spacing 0.2s, background 0.2s;
}
.detail-back:hover {
  color: var(--red);
  border-color: var(--border);
  background: rgba(255, 0, 60, 0.06);
  letter-spacing: 0.24em;
}
.detail-back svg { transition: transform 0.2s; }
.detail-back:hover svg { transform: translateX(-3px); }

.detail-breadcrumb {
  color: var(--text-dim);
  letter-spacing: 0.18em;
}
.detail-breadcrumb .bracket {
  color: var(--red);
  margin: 0 0.6rem;
  text-shadow: 0 0 8px rgba(255, 0, 60, 0.5);
}
.detail-breadcrumb .dim { color: var(--text-faint); }

.detail-panel {
  position: relative;
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  padding: clamp(2rem, 4vw, 3.5rem);
  max-width: 980px;
  margin: 0 auto;
  animation: lock-appear 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.detail-panel > .corner {
  position: absolute;
  width: 20px;
  height: 20px;
  transition: width 0.4s, height 0.4s;
}
.detail-panel > .corner.tl { top: -1px; left: -1px; border-top: 1px solid var(--red); border-left: 1px solid var(--red); }
.detail-panel > .corner.tr { top: -1px; right: -1px; border-top: 1px solid var(--red); border-right: 1px solid var(--red); }
.detail-panel > .corner.bl { bottom: -1px; left: -1px; border-bottom: 1px solid var(--red); border-left: 1px solid var(--red); }
.detail-panel > .corner.br { bottom: -1px; right: -1px; border-bottom: 1px solid var(--red); border-right: 1px solid var(--red); }

.detail-header { margin-bottom: 2.5rem; }
.detail-meta-inline {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.detail-id {
  font-family: 'Share Tech Mono', monospace;
  color: var(--text-faint);
  letter-spacing: 0.25em;
  font-size: 0.85rem;
}

.detail-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(255, 0, 60, 0.3);
  word-break: break-word;
}
.detail-title .dim { color: var(--text-dim); font-weight: 500; }

.detail-grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.field-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  color: var(--text-dim);
}
.detail-desc {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.65;
  max-width: 70ch;
  white-space: pre-wrap;
}
.detail-url {
  color: var(--red);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  word-break: break-all;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  transition: color 0.2s, border-color 0.2s, text-shadow 0.2s;
  align-self: flex-start;
  max-width: 100%;
}
.detail-url:hover {
  color: var(--red-glow);
  border-color: var(--red);
  text-shadow: 0 0 10px rgba(255, 0, 60, 0.6);
}

.detail-timestamps {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.detail-timestamps > div { display: flex; flex-direction: column; gap: 0.4rem; }

.detail-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* === DEPLOY block — the launch pad === */
.detail-deploy {
  margin-top: 2.5rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid rgba(255, 0, 60, 0.5);
  background:
    linear-gradient(135deg, rgba(255, 0, 60, 0.08), transparent 60%),
    repeating-linear-gradient(
      -45deg,
      transparent 0,
      transparent 10px,
      rgba(255, 0, 60, 0.04) 10px,
      rgba(255, 0, 60, 0.04) 20px
    );
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.detail-deploy::before,
.detail-deploy::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  box-shadow: 0 0 16px rgba(255, 0, 60, 0.7);
}
.detail-deploy::before { left: 0; }
.detail-deploy::after  { right: 0; }
.deploy-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text-dim);
}
.deploy-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  color: var(--text);
  text-transform: uppercase;
}
.deploy-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--red);
  letter-spacing: 0.14em;
}
.deploy-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.22em;
  padding: 1rem 1.75rem;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-transform: uppercase;
  position: relative;
  transition: all 0.25s ease;
  text-shadow: 0 0 8px rgba(255, 0, 60, 0.5);
}
.deploy-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg, transparent 0, transparent 6px,
    rgba(255, 0, 60, 0.18) 6px, rgba(255, 0, 60, 0.18) 12px
  );
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.deploy-btn-bracket { color: var(--red); opacity: 0.7; }
.deploy-btn:hover {
  background: var(--red);
  color: var(--bg);
  letter-spacing: 0.32em;
  box-shadow: 0 0 32px rgba(255, 0, 60, 0.7);
  text-shadow: none;
}
.deploy-btn:hover::before { opacity: 1; }
.deploy-btn:hover .deploy-btn-bracket { color: var(--bg); }

/* === Runtime view (fullscreen module stage) === */
.module-runtime {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: transparent;
  display: flex;
  flex-direction: column;
}
.module-runtime[hidden] { display: none; }
.runtime-hud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,0,60,0.06), transparent);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  z-index: 2;
}
.runtime-exit,
.runtime-briefing {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.45rem 0.8rem;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-transform: uppercase;
}
.runtime-exit:hover,
.runtime-briefing:hover {
  color: var(--red);
  border-color: rgba(255, 0, 60, 0.4);
  background: rgba(255, 0, 60, 0.05);
  letter-spacing: 0.16em;
}
.runtime-id {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: var(--text);
  text-transform: uppercase;
}
.runtime-id .pulse {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 0, 60, 0.8);
  animation: pulse 1.6s ease-in-out infinite;
}
.runtime-stage {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: transparent;
}
.runtime-empty[hidden] { display: none !important; }
.runtime-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
}
.runtime-empty h2 {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.2em;
  color: var(--red);
  font-size: 2rem;
  margin: 0;
  text-shadow: 0 0 20px rgba(255, 0, 60, 0.6);
}
.runtime-empty p { max-width: 40ch; }

.detail-empty {
  text-align: center;
  padding: 3rem 0 2rem;
}
.detail-empty .lock-icon { margin: 0 auto 1.5rem; }
.detail-empty .lock-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.8rem;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: color 0.25s, box-shadow 0.3s;
  margin-top: 1rem;
}
.detail-empty .lock-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--red);
  transform: translateX(-101%);
  transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
  z-index: -1;
}
.detail-empty .lock-cta:hover {
  color: var(--bg);
  box-shadow: 0 0 30px rgba(255, 0, 60, 0.55);
}
.detail-empty .lock-cta:hover::before { transform: translateX(0); }

.detail-panel[data-status="active"] .pulse {
  background: #35ff7a;
  box-shadow: 0 0 10px #35ff7a;
}
.detail-panel[data-status="active"] .card-status span:last-child { color: #35ff7a; }
.detail-panel[data-status="archived"] .pulse {
  background: var(--text-faint);
  box-shadow: none;
  animation: none;
}
.detail-panel[data-status="archived"] .card-status span:last-child { color: var(--text-faint); }

/* Cards hint at being links with a "→" in the footer */
.card:not(.card-empty) .card-footer::after {
  content: '→';
  float: right;
  color: var(--text-faint);
  font-family: 'Share Tech Mono', monospace;
  transition: color 0.25s, transform 0.25s;
  display: inline-block;
}
.card:not(.card-empty):hover .card-footer::after {
  color: var(--red);
  transform: translateX(4px);
}

@media (max-width: 520px) {
  .detail-timestamps { gap: 1.5rem; }
  .detail-actions { justify-content: stretch; }
  .detail-actions .modal-btn { flex: 1; }
}

/* === Gated sections (auth-protected content) === */

/* Default = locked. JS flips body to .is-authed once session is live. */
.gated-body { display: none; }
.gated-lock { display: block; }
body.is-authed .gated-body { display: block; }
body.is-authed .gated-lock { display: none; }

.gated-lock {
  position: relative;
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  overflow: hidden;
  min-height: 320px;
  animation: lock-appear 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes lock-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gated-lock::after {
  /* Faint diagonal "restricted" hatch pattern */
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0,
    transparent 22px,
    rgba(255, 0, 60, 0.03) 22px,
    rgba(255, 0, 60, 0.03) 44px
  );
  pointer-events: none;
}

/* Vertical scan line sliding across the panel */
.lock-scan {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  left: 0;
  background: linear-gradient(180deg, transparent, var(--red), transparent);
  box-shadow: 0 0 18px var(--red);
  opacity: 0.55;
  animation: lock-scan 3.8s linear infinite;
}
@keyframes lock-scan {
  0%   { left: -2%; }
  100% { left: 102%; }
}

.gated-lock .card-corners::before,
.gated-lock .card-corners::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 1px solid var(--red);
  transition: width 0.4s, height 0.4s;
}
.gated-lock .card-corners::before {
  top: -1px; left: -1px;
  border-right: none; border-bottom: none;
}
.gated-lock .card-corners::after {
  bottom: -1px; right: -1px;
  border-left: none; border-top: none;
}
.gated-lock:hover .card-corners::before,
.gated-lock:hover .card-corners::after {
  width: 28px; height: 28px;
}

.lock-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--red);
  letter-spacing: 0.28em;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

/* Padlock icon (CSS only) */
.lock-icon {
  position: relative;
  width: 44px;
  height: 54px;
  margin: 0 auto 1.4rem;
  color: var(--red);
  filter: drop-shadow(0 0 12px rgba(255, 0, 60, 0.65));
  z-index: 1;
}
.lock-icon .lock-shackle {
  position: absolute;
  top: 0; left: 50%;
  width: 24px; height: 22px;
  border: 2.5px solid currentColor;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  transform: translateX(-50%);
}
.lock-icon .lock-body {
  position: absolute;
  bottom: 0; left: 50%;
  width: 38px; height: 28px;
  background: currentColor;
  transform: translateX(-50%);
  box-shadow: inset 0 0 0 2px rgba(7, 7, 12, 0.25);
}
.lock-icon .lock-body::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 4px; height: 10px;
  background: var(--bg);
  transform: translate(-50%, -40%);
  border-radius: 2px;
}

.lock-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 0.6rem;
  color: var(--text);
  text-shadow: 0 0 20px rgba(255, 0, 60, 0.3);
  position: relative;
  z-index: 1;
}
.lock-desc {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 1.8rem;
  position: relative;
  z-index: 1;
}

.lock-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.8rem;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: color 0.25s, box-shadow 0.3s;
}
.lock-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--red);
  transform: translateX(-101%);
  transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
  z-index: -1;
}
.lock-cta:hover {
  color: var(--bg);
  box-shadow: 0 0 30px rgba(255, 0, 60, 0.55);
}
.lock-cta:hover::before { transform: translateX(0); }
.lock-cta svg { transition: transform 0.25s; }
.lock-cta:hover svg { transform: translateX(3px); }

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
