:root {
  --bg: #050508;
  --bg-card: rgba(12, 8, 24, 0.65);
  --cyan: #00f5ff;
  --purple: #b026ff;
  --red: #ff0040;
  --pink: #ff2d95;
  --green: #39ff14;
  --yellow: #ffe600;
  --text: #e8e8f0;
  --text-dim: #8a8aa8;
  --glass-border: rgba(0, 245, 255, 0.25);
  --glow-cyan: 0 0 20px rgba(0, 245, 255, 0.5), 0 0 40px rgba(0, 245, 255, 0.2);
  --glow-purple: 0 0 20px rgba(176, 38, 255, 0.5);
  --glow-red: 0 0 30px rgba(255, 0, 64, 0.7);
  --font-display: 'Orbitron', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --font-ui: 'Rajdhani', sans-serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

body.panic-active {
  --bg: #1a0005;
}

body.panic-active .card:not(.panic-card) {
  opacity: 0.3;
  filter: grayscale(0.5);
}

#matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.15;
  pointer-events: none;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: var(--glow-cyan);
  animation: float-particle 8s infinite ease-in-out;
  opacity: 0.6;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  opacity: 0.4;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
}

.surveillance-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 0, 64, 0.15);
  border-bottom: 1px solid rgba(255, 0, 64, 0.4);
  padding: 0.35rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-align: center;
  color: var(--red);
  letter-spacing: 0.05em;
}

.blink {
  animation: blink 1s infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero {
  position: relative;
  z-index: 10;
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(176, 38, 255, 0.2) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 900px;
}

.status-item {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  min-width: 140px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.status-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--glow-cyan);
}

.status-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--cyan);
}

.status-item.unstable .status-value { color: var(--yellow); }
.status-item.threat .status-value { color: var(--red); }

.status-trend.up { color: var(--red); font-size: 0.65rem; }

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  margin-left: 0.5rem;
  animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 0, 64, 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(255, 0, 64, 0); }
}

.main-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 8vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--cyan);
  text-shadow: var(--glow-cyan), 0 0 80px rgba(0, 245, 255, 0.3);
  margin-bottom: 0.5rem;
  animation: title-flicker 5s infinite;
}

@keyframes title-flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.85; }
  97% { opacity: 1; }
  98% { opacity: 0.9; }
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: var(--purple);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.rotating-msg {
  font-family: var(--font-mono);
  color: var(--pink);
  font-size: 1rem;
  min-height: 1.5em;
  margin-bottom: 2rem;
  animation: msg-glow 2s ease-in-out infinite alternate;
}

@keyframes msg-glow {
  from { text-shadow: 0 0 10px rgba(255, 45, 149, 0.5); }
  to { text-shadow: 0 0 20px rgba(255, 45, 149, 0.9); }
}

.loading-bar-container {
  width: 100%;
  max-width: 400px;
  margin-bottom: 2rem;
}

.loading-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.loading-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  box-shadow: var(--glow-cyan);
  transition: width 0.3s;
  animation: load-shimmer 2s infinite;
}

@keyframes load-shimmer {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

.loading-text {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
  margin-top: 0.5rem;
}

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 700px;
}

.nav-chip {
  padding: 0.5rem 1rem;
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  color: var(--cyan);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s;
}

.nav-chip:hover {
  background: rgba(0, 245, 255, 0.25);
  box-shadow: var(--glow-cyan);
  transform: scale(1.05);
}

.nav-chip.danger {
  border-color: rgba(255, 0, 64, 0.5);
  color: var(--red);
}

.nav-chip.danger:hover {
  box-shadow: var(--glow-red);
}

.container {
  position: relative;
  z-index: 10;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .container {
    grid-template-columns: repeat(2, 1fr);
  }
  .card.wide {
    grid-column: 1 / -1;
  }
}

.card {
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.4s, box-shadow 0.4s;
  animation: card-enter 0.6s ease backwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.25s; }
.card:nth-child(5) { animation-delay: 0.3s; }
.card:nth-child(6) { animation-delay: 0.35s; }
.card:nth-child(7) { animation-delay: 0.4s; }
.card:nth-child(8) { animation-delay: 0.45s; }

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 245, 255, 0.15), var(--glow-cyan);
  border-color: rgba(0, 245, 255, 0.4);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-icon { font-size: 1.5rem; }

.card-header h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  flex: 1;
  letter-spacing: 0.05em;
}

.card-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.2rem 0.5rem;
  background: rgba(0, 245, 255, 0.2);
  color: var(--cyan);
  border-radius: 4px;
}

.card-tag.hot { background: rgba(255, 100, 0, 0.3); color: var(--yellow); }
.card-tag.danger { background: rgba(255, 0, 64, 0.3); color: var(--red); animation: tag-pulse 1s infinite; }

@keyframes tag-pulse {
  50% { opacity: 0.7; }
}

.card-body {
  padding: 1.25rem;
}

.card-body.center {
  text-align: center;
}

.input-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-grid.cols-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 500px) {
  .input-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
}

input[type="number"],
input[type="text"],
select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
  margin-top: 0.25rem;
}

.btn-neon {
  display: inline-block;
  width: 100%;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--bg);
  background: linear-gradient(135deg, var(--cyan), #00a8b0);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.3s;
  box-shadow: var(--glow-cyan);
}

.btn-neon:hover {
  transform: scale(1.02);
  box-shadow: 0 0 30px rgba(0, 245, 255, 0.8);
}

.btn-neon:active {
  transform: scale(0.98);
}

.btn-neon.btn-purple {
  background: linear-gradient(135deg, var(--purple), #6b0fff);
  box-shadow: var(--glow-purple);
  color: #fff;
}

.btn-neon.btn-small {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  margin: 0.25rem;
}

.btn-neon.btn-red {
  background: linear-gradient(135deg, var(--red), #990020);
  box-shadow: var(--glow-red);
}

.results {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  animation: fade-in 0.5s ease;
}

.results.hidden { display: none; }

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

.result-big {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  margin-bottom: 0.5rem;
}

.result-detail { color: var(--text-dim); margin: 0.5rem 0; }

.defcon-meter {
  margin-top: 1rem;
}

.defcon-meter span:first-child {
  font-size: 0.75rem;
  color: var(--red);
  letter-spacing: 0.1em;
}

.danger-bar {
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  margin: 0.5rem 0;
  overflow: hidden;
  border: 1px solid rgba(255, 0, 64, 0.3);
}

.danger-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--yellow), var(--red));
  transition: width 0.8s ease;
  box-shadow: var(--glow-red);
}

.danger-fill.critical {
  animation: danger-pulse 0.5s infinite;
}

@keyframes danger-pulse {
  50% { filter: brightness(1.5); }
}

#defcon-label {
  font-family: var(--font-mono);
  color: var(--red);
  font-weight: bold;
}

.siren-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 0, 64, 0.2) 0%, transparent 70%);
  animation: siren 1s infinite;
  border-radius: 16px;
}

.siren-glow.hidden { display: none; }

.card-body { position: relative; }

@keyframes siren {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.cooked-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
}

.cooked-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: url(#cookedGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1s ease;
  stroke: var(--orange, #ff6b00);
}

.ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--yellow);
}

.diagnosis {
  font-size: 1.25rem;
  color: var(--pink);
  font-weight: 700;
  margin: 0.5rem 0;
}

.ai-response {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--cyan);
  margin-top: 0.75rem;
  font-style: italic;
}

.funny-out {
  color: var(--purple);
  margin-top: 0.5rem;
  font-weight: 600;
}

.panic-card {
  border-color: rgba(255, 0, 64, 0.4);
}

.warning-text {
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.btn-panic {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 1.5rem 2rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #fff;
  background: var(--red);
  border: 3px solid #ff4466;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  animation: panic-btn-pulse 1.5s infinite;
  box-shadow: var(--glow-red);
}

@keyframes panic-btn-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 0, 64, 0.6); }
  50% { transform: scale(1.03); box-shadow: 0 0 40px rgba(255, 0, 64, 1); }
}

.panic-btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
  animation: panic-shine 2s infinite;
}

@keyframes panic-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  justify-content: center;
}

.slider-group label {
  margin-bottom: 1rem;
}

.dashboard-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dash-stat {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dash-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.dash-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--cyan);
}

.dash-input {
  width: 80px;
  margin-bottom: 0.5rem;
}

.mini-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.mini-bar div {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  transition: width 0.5s;
}

.danger-bar-mini div { background: linear-gradient(90deg, var(--yellow), var(--red)); }
.mental-bar div { background: linear-gradient(90deg, var(--purple), var(--pink)); }

.dash-status {
  font-family: var(--font-mono);
  color: var(--red);
  font-size: 0.9rem;
}

.dash-verdict {
  margin-top: 1rem;
  font-family: var(--font-mono);
  color: var(--pink);
  text-align: center;
}

.viva-output {
  margin-top: 1.5rem;
}

.viva-output.hidden { display: none; }

.viva-q, .viva-a {
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border-left: 3px solid var(--cyan);
}

.viva-a { border-left-color: var(--purple); }

.viva-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

.viva-q p, .viva-a p {
  margin-top: 0.5rem;
  font-size: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.footer kbd {
  background: rgba(0, 245, 255, 0.15);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--cyan);
}

.easter-hint { margin: 0.5rem 0; }
.surveillance-footer { color: var(--red); font-size: 0.7rem; margin-top: 0.5rem; }

/* Glitch effect */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}

.glitch::before {
  color: var(--red);
  animation: glitch-1 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
  color: var(--cyan);
  animation: glitch-2 3s infinite;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-3px, 2px); }
  94% { transform: translate(3px, -2px); }
}

@keyframes glitch-2 {
  0%, 90%, 100% { transform: translate(0); }
  91% { transform: translate(3px, 2px); }
  93% { transform: translate(-3px, -2px); }
}

body.glitch-active .main-title {
  animation: violent-glitch 0.3s infinite;
}

@keyframes violent-glitch {
  0% { transform: translate(0); filter: hue-rotate(0); }
  25% { transform: translate(-5px, 2px); filter: hue-rotate(90deg); }
  50% { transform: translate(5px, -2px); }
  75% { transform: translate(-2px, -5px); filter: hue-rotate(-90deg); }
  100% { transform: translate(0); }
}

/* Panic overlay */
.panic-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(80, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: panic-flash 0.5s infinite;
}

.panic-overlay.hidden { display: none; }

@keyframes panic-flash {
  0%, 100% { background: rgba(80, 0, 0, 0.95); }
  50% { background: rgba(120, 0, 0, 0.98); }
}

.panic-content {
  text-align: center;
  padding: 2rem;
  max-width: 500px;
}

.panic-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: #fff;
  margin-bottom: 1rem;
  text-shadow: 0 0 30px var(--red);
}

.panic-msg {
  font-size: 1.25rem;
  color: var(--yellow);
  margin-bottom: 1rem;
  animation: shake 0.5s infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.countdown-display {
  font-family: var(--font-mono);
  font-size: 3rem;
  color: var(--red);
  text-shadow: var(--glow-red);
  margin: 1rem 0;
}

.panic-timer-section {
  margin: 1.5rem 0;
}

.study-timer {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--cyan);
  margin: 0.5rem 0;
}

.panic-insult {
  font-style: italic;
  color: #ffaaaa;
  margin: 1rem 0;
  min-height: 1.5em;
}

.fake-ai {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cyan);
  margin-bottom: 1.5rem;
}

.btn-large {
  max-width: 280px;
  margin: 0 auto;
}

/* Terminal */
.terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.terminal-overlay.hidden { display: none; }

.terminal-window {
  width: 100%;
  max-width: 700px;
  background: #0a0a12;
  border: 1px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.3);
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #1a1a24;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--green);
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.term-dot.red { background: #ff5f56; }
.term-dot.yellow { background: #ffbd2e; }
.term-dot.green { background: #27c93f; }

.term-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}

.terminal-body {
  padding: 1rem;
  height: 300px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green);
  line-height: 1.6;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-top: 1px solid #333;
  gap: 0.5rem;
}

.terminal-input-line .prompt {
  font-family: var(--font-mono);
  color: var(--green);
  font-size: 0.85rem;
}

#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

#terminal-input:focus {
  outline: none;
  box-shadow: none;
}

/* Hack overlay */
.hack-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: #000;
  padding: 2rem;
  overflow: auto;
}

.hack-overlay.hidden { display: none; }

.hack-content pre {
  font-family: var(--font-mono);
  color: var(--green);
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.hidden { display: none !important; }

/* ─── Body layout (surveillance bar offset) ─── */

.page-home .hero {
  min-height: auto;
  padding: 2rem 1.5rem 1.5rem;
}

.hero-home {
  padding-bottom: 0.5rem !important;
}

/* ─── Visible neon SVG icons ─── */
.icon-box,
.module-icon,
.card-icon-wrap,
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(0, 245, 255, 0.12);
  border: 1px solid rgba(0, 245, 255, 0.35);
  box-shadow: var(--glow-cyan);
}

.module-icon,
.card-icon-wrap {
  width: 56px;
  height: 56px;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  margin-right: 0.35rem;
}

.icon-box svg,
.module-icon svg,
.card-icon-wrap svg,
.nav-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--cyan);
  filter: drop-shadow(0 0 6px rgba(0, 245, 255, 0.8));
}

.nav-icon svg {
  width: 16px;
  height: 16px;
}

.icon-hot,
.module-icon.icon-hot,
.card-icon-wrap.icon-hot {
  background: rgba(255, 107, 0, 0.15);
  border-color: rgba(255, 230, 0, 0.4);
  box-shadow: 0 0 20px rgba(255, 107, 0, 0.4);
}

.icon-hot svg { stroke: var(--yellow); filter: drop-shadow(0 0 6px rgba(255, 230, 0, 0.8)); }

.icon-purple,
.module-icon.icon-purple,
.card-icon-wrap.icon-purple {
  background: rgba(176, 38, 255, 0.15);
  border-color: rgba(176, 38, 255, 0.4);
  box-shadow: var(--glow-purple);
}

.icon-purple svg { stroke: var(--purple); filter: drop-shadow(0 0 6px rgba(176, 38, 255, 0.8)); }

.icon-red,
.module-icon.icon-red,
.card-icon-wrap.icon-red {
  background: rgba(255, 0, 64, 0.15);
  border-color: rgba(255, 0, 64, 0.5);
  box-shadow: var(--glow-red);
}

.icon-red svg { stroke: var(--red); filter: drop-shadow(0 0 8px rgba(255, 0, 64, 0.9)); }

.icon-cyan svg { stroke: var(--cyan); }

/* ─── Home hub grid ─── */
.hub-main {
  position: relative;
  z-index: 10;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.hub-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  color: var(--cyan);
  margin-bottom: 0.5rem;
}

.hub-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.module-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 520px) {
  .module-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .module-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.35s, box-shadow 0.35s, border-color 0.35s;
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.module-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 16px 48px rgba(0, 245, 255, 0.2), var(--glow-cyan);
  border-color: rgba(0, 245, 255, 0.5);
}

.module-card:hover::before {
  opacity: 1;
}

.module-card.module-danger {
  border-color: rgba(255, 0, 64, 0.35);
}

.module-card.module-danger:hover {
  box-shadow: var(--glow-red);
  border-color: rgba(255, 0, 64, 0.6);
}

.module-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 1rem;
}

.module-icon svg {
  width: 40px;
  height: 40px;
}

.module-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cyan);
  margin-bottom: 0.35rem;
}

.module-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0.75rem;
  flex: 1;
}

.module-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.2rem 0.5rem;
  background: rgba(0, 245, 255, 0.2);
  color: var(--cyan);
  border-radius: 4px;
}

.module-tag.hot { background: rgba(255, 100, 0, 0.3); color: var(--yellow); }
.module-tag.danger { background: rgba(255, 0, 64, 0.3); color: var(--red); animation: tag-pulse 1s infinite; }

/* ─── Tool pages ─── */
.page-nav {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.nav-home {
  display: inline-flex;
  align-items: center;
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
  transition: text-shadow 0.3s;
}

.nav-home:hover {
  text-shadow: var(--glow-cyan);
}

.nav-divider {
  color: var(--text-dim);
}

.nav-current {
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

.page-main {
  position: relative;
  z-index: 10;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.page-card {
  animation: card-enter 0.5s ease;
}

.page-card-wide {
  max-width: 900px;
}

.card-header h1 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  flex: 1;
  letter-spacing: 0.05em;
}

.panic-bar {
  background: rgba(255, 0, 64, 0.25);
  color: var(--red);
}

.footer a {
  color: var(--cyan);
  text-decoration: none;
}

.footer a:hover {
  text-shadow: var(--glow-cyan);
}

.page-panic .page-main {
  max-width: 480px;
}

.page-main-wide {
  max-width: 820px;
}

/* Marks info banner */
.marks-info {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 245, 255, 0.08);
  border-left: 3px solid var(--cyan);
  border-radius: 0 8px 8px 0;
  line-height: 1.5;
}

.marks-info strong {
  color: var(--cyan);
}

.max-hint {
  font-size: 0.75rem;
  color: var(--purple);
  font-weight: 400;
}

.min-marks-box {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(176, 38, 255, 0.12);
  border: 1px solid rgba(176, 38, 255, 0.35);
  border-radius: 8px;
  font-size: 1rem;
}

.min-marks-box .highlight {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--yellow);
  text-shadow: 0 0 15px rgba(255, 230, 0, 0.5);
}

/* Subject-wise attendance */
.subjects-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.subject-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 0.5rem;
  align-items: end;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: 10px;
}

@media (max-width: 600px) {
  .subject-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .subject-row .subject-name {
    grid-column: 1 / -1;
  }
  .subject-row .btn-remove-subject {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
}

.subject-name {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  width: 100%;
}

.subject-field {
  font-size: 0.7rem;
  min-width: 72px;
}

.subject-field input {
  width: 100%;
  margin-top: 0.25rem;
}

.btn-remove-subject {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 0, 64, 0.5);
  background: rgba(255, 0, 64, 0.15);
  color: var(--red);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  align-self: center;
}

.btn-remove-subject:hover {
  background: rgba(255, 0, 64, 0.35);
  box-shadow: var(--glow-red);
}

.btn-add-subject {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  background: rgba(0, 245, 255, 0.08);
  border: 2px dashed rgba(0, 245, 255, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-add-subject:hover {
  background: rgba(0, 245, 255, 0.18);
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

.btn-add-subject .add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: 50%;
  background: rgba(0, 245, 255, 0.2);
  border: 1px solid var(--cyan);
}

.subject-breakdown {
  margin: 1rem 0;
  text-align: left;
}

.breakdown-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
}

.subject-result {
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border-left: 3px solid var(--cyan);
}

.subject-result.danger {
  border-left-color: var(--red);
  color: #ffaaaa;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE & TOUCH OPTIMIZATION
   ═══════════════════════════════════════════════════════════ */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --touch-min: 48px;
}

body {
  padding-top: calc(2.25rem + var(--safe-top));
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Prevent iOS zoom on input focus — 16px minimum */
input[type="number"],
input[type="text"],
select,
.subject-name {
  font-size: max(16px, 1rem);
}

/* Better touch feedback */
a,
button,
.module-card,
input[type="range"],
label.checkbox-label,
label.sound-toggle {
  -webkit-tap-highlight-color: rgba(0, 245, 255, 0.2);
}

.btn-neon,
.btn-panic,
.btn-add-subject,
.btn-remove-subject,
.module-card,
.nav-home {
  min-height: var(--touch-min);
}

@media (max-width: 768px) {
  /* Surveillance bar — shorter on phones */
  .surveillance-bar {
    font-size: 0.55rem;
    padding: 0.4rem 0.5rem;
    padding-top: calc(0.4rem + var(--safe-top));
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero,
  .page-home .hero {
    padding: 1.25rem 1rem 1rem;
    min-height: auto;
  }

  .hero-glow {
    width: 280px;
    height: 280px;
  }

  .status-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
  }

  .status-item {
    min-width: unset;
    width: 100%;
    padding: 0.65rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .status-label {
    font-size: 0.65rem;
  }

  .status-value {
    font-size: 1.2rem;
  }

  .main-title {
    font-size: clamp(1.15rem, 5.5vw, 1.75rem);
    letter-spacing: 0.06em;
    line-height: 1.25;
    padding: 0 0.25rem;
    word-break: break-word;
  }

  .main-title.glitch::before,
  .main-title.glitch::after {
    letter-spacing: 0.06em;
  }

  .subtitle {
    font-size: 0.95rem;
    padding: 0 0.5rem;
    margin-bottom: 1rem;
  }

  .rotating-msg {
    font-size: 0.9rem;
    padding: 0 0.75rem;
    margin-bottom: 1.25rem;
  }

  .loading-bar-container {
    padding: 0 0.5rem;
    margin-bottom: 1.25rem;
  }

  .hub-main {
    padding: 0.75rem 1rem calc(2rem + var(--safe-bottom));
  }

  .hub-title {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
  }

  .hub-sub {
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    padding: 0 0.25rem;
  }

  .module-grid {
    gap: 0.85rem;
  }

  .module-card {
    padding: 1.25rem 1rem;
    min-height: auto;
    /* Active state for touch (no hover on mobile) */
  }

  .module-card:active {
    transform: scale(0.98);
    box-shadow: var(--glow-cyan);
    border-color: rgba(0, 245, 255, 0.5);
  }

  .module-card:hover {
    transform: none;
  }

  .module-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 0.75rem;
  }

  .module-icon svg {
    width: 36px;
    height: 36px;
  }

  .module-name {
    font-size: 0.8rem;
  }

  .module-desc {
    font-size: 0.75rem;
  }

  /* Sticky nav on tool pages */
  .page-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    padding: 0.65rem 1rem;
    padding-top: calc(0.65rem + var(--safe-top));
    font-size: 0.7rem;
    gap: 0.35rem;
  }

  .nav-home {
    min-height: 44px;
    padding: 0.35rem 0.5rem;
  }

  .nav-current {
    flex: 1;
    min-width: 0;
    font-size: 0.65rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-current .nav-icon {
    display: none;
  }

  .page-main,
  .page-main-wide {
    padding: 1rem 1rem calc(2rem + var(--safe-bottom));
    max-width: 100%;
  }

  .card:hover {
    transform: none;
  }

  .card-header {
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    gap: 0.5rem;
  }

  .card-icon-wrap {
    width: 44px;
    height: 44px;
  }

  .card-icon-wrap svg {
    width: 24px;
    height: 24px;
  }

  .card-header h1,
  .card-header h2 {
    font-size: 0.8rem;
    width: 100%;
    order: 2;
    flex: 1 1 100%;
    line-height: 1.3;
  }

  .card-tag {
    order: 3;
    margin-left: auto;
  }

  .card-body {
    padding: 1rem;
  }

  .btn-neon {
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
    min-height: 52px;
  }

  .btn-neon.btn-small {
    display: block;
    width: 100%;
    margin: 0.35rem 0;
    min-height: 48px;
  }

  .btn-panic {
    max-width: 100%;
    padding: 1.25rem 1rem;
    font-size: 1rem;
    letter-spacing: 0.08em;
    min-height: 56px;
  }

  .result-big {
    font-size: 2rem;
  }

  .countdown-display {
    font-size: 2.25rem;
  }

  .panic-content {
    padding: 1rem;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .panic-title {
    font-size: 1.35rem;
  }

  .panic-msg {
    font-size: 1rem;
  }

  .study-timer {
    font-size: 1.5rem;
  }

  .panic-timer-section .btn-neon.btn-small {
    display: inline-block;
    width: calc(50% - 0.5rem);
    margin: 0.25rem;
    vertical-align: top;
  }

  .sound-toggle,
  .checkbox-label {
    font-size: 0.85rem;
    text-align: left;
    padding: 0.5rem 0;
    min-height: 44px;
  }

  .sound-toggle input,
  .checkbox-label input {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  input[type="range"] {
    height: 32px;
    margin-top: 0.5rem;
  }

  .marks-info {
    font-size: 0.8rem;
    padding: 0.65rem 0.75rem;
  }

  .min-marks-box {
    font-size: 0.9rem;
    padding: 0.85rem;
  }

  .min-marks-box .highlight {
    font-size: 1.25rem;
    display: block;
    margin-top: 0.25rem;
  }

  /* Subject rows — single column stack */
  .subject-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 0.65rem;
    padding: 1rem;
  }

  .subject-row .subject-name {
    grid-column: 1;
  }

  .subject-field {
    min-width: unset;
  }

  .subject-row .btn-remove-subject {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    height: 44px;
    justify-self: stretch;
    font-size: 1rem;
  }

  .btn-add-subject {
    min-height: 52px;
    font-size: 0.75rem;
  }

  .subject-result {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .dashboard-grid {
    gap: 1rem;
  }

  .dash-value {
    font-size: 1.5rem;
  }

  .footer {
    padding: 1.5rem 1rem calc(1.5rem + var(--safe-bottom));
    font-size: 0.75rem;
  }

  .easter-hint {
    font-size: 0.7rem;
    line-height: 1.6;
  }

  .terminal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .terminal-window {
    max-width: 100%;
    width: 100%;
    max-height: 85dvh;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
  }

  .terminal-body {
    height: 50dvh;
    min-height: 200px;
  }

  .term-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .hack-overlay {
    padding: 1rem;
    padding-top: calc(1rem + var(--safe-top));
  }

  .cooked-ring {
    width: 140px;
    height: 140px;
  }

  .input-grid.cols-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .main-title {
    letter-spacing: 0.04em;
    font-size: 1.05rem;
  }

  .surveillance-bar {
    font-size: 0.5rem;
  }
}

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

  #matrix-canvas,
  #particles {
    display: none;
  }
}

/* Lighter effects on mobile — applied via class from JS */
body.is-mobile #matrix-canvas {
  opacity: 0.08;
}

body.is-mobile .particle {
  display: none;
}

body.is-mobile .scanlines {
  opacity: 0.25;
}
