:root {
  --background-color: #050a05;
  --text-color: #32ff32;
  --text-color-rgb: 50, 255, 50;
  --accent-color: #5fd7f5;
  --off-color: #e6d840;
  --error: #d40f9f;
}

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

body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'Courier New', Courier, monospace;
  padding: 0.5rem;
  line-height: 1.4;
}

h1 {
  font-size: 1.5rem;
  letter-spacing: 4px;
}

h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  border-left: 5px solid var(--text-color);
  padding-left: 0.5rem;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  display: block;
  margin: 0.25rem 0;
}

a:hover {
  background: var(--text-color);
  color: var(--background-color);
}

button {
  background-color: transparent;
  color: var(--accent-color);
  border: none;
  padding: 0.25rem;
  transition: 0.5s;
  cursor: pointer;
}

button:hover {
  background-color: var(--accent-color);
  color: var(--background-color);
  transition: 0.25s;
}

ul {
  list-style-type: none;
}

/* --- BENTO GRID LAYOUT --- */

.bento-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto;
  gap: 0.25rem;
  max-width: 800px;
  margin: 0 auto;
}

/* --- CARD --- */

.card {
  background: rgba(0, 15, 0, 0.9);
  border: 1px solid var(--text-color);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 5px rgba(var(--text-color-rgb), 0.2);
  transition: transform 0.2s ease;
  padding: 0.5rem;
}

.card:hover {
  transform: scale(1.01);
  background: rgba(0, 30, 0, 0.95);
  box-shadow:
    0 0 10px rgba(var(--text-color-rgb), 0.4),
    0 0 20px rgba(var(--text-color-rgb), 0.2),
    inset 0 0 20px rgba(var(--text-color-rgb), 0.1);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 1px solid var(--text-color);
  opacity: 0;
  pointer-events: none;
}

.card:hover::before {
  animation: glitch-border 0.3s infinite;
  opacity: 1;
}

@keyframes glitch-border {
  0%   { transform: translate(0); }
  20%  { transform: translate(-3px, 2px); color: #fff; }
  40%  { transform: translate(3px, -2px); }
  60%  { transform: translate(-1px, -1px); }
  80%  { transform: translate(2px, 2px); }
  100% { transform: translate(0); }
}

/* --- GRID AREAS --- */

header {
  grid-column: span 4;
}

nav {
  grid-column: span 1;
  grid-row: span 3;
  display: flex;
  flex-direction: column;
}

.nav-footer {
  margin-top: auto;
}

a.nav-active {
  color: var(--text-color);
  text-shadow: 0 0 6px var(--text-color);
  background: rgba(var(--text-color-rgb), 0.05);
}

main {
  grid-column: span 3;
  grid-row: span 3;
}

.small-box {
  grid-column: span 1;
}

.wide-box {
  grid-column: span 2;
}

/* --- UTILITY --- */

.blink {
  animation: blinker 1s linear infinite;
}

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

.status-bar {
  font-size: 0.7rem;
  color: #008800;
  margin-top: 10px;
}

/* --- TIMEZONE SLIDER --- */

.timezone-class {
  width: 100%;
  height: 30px;
  overflow: hidden;
  background: transparent;
  color: var(--text-color);
  font-family: monospace;
  padding: 10px 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timezone-slide {
  position: absolute;
  white-space: nowrap;
  animation: slide-timezone 3s ease-in-out;
  opacity: 0;
}

.timezone-slide.active {
  animation: slide-timezone 3s ease-in-out forwards;
}

@keyframes slide-timezone {
  0%   { transform: translateX(100%);  opacity: 0; }
  15%  { opacity: 1; }
  50%  { transform: translateX(0);     opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateX(-100%); opacity: 0; }
}

/* --- MATRIX RAIN --- */

#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

/* --- CRT OVERLAY --- */

.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
  animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0%   { opacity: 0.27861; }
  5%   { opacity: 0.34769; }
  10%  { opacity: 0.23604; }
  15%  { opacity: 0.90626; }
  20%  { opacity: 0.18128; }
  25%  { opacity: 0.83891; }
  30%  { opacity: 0.65583; }
  35%  { opacity: 0.67807; }
  40%  { opacity: 0.26559; }
  45%  { opacity: 0.84693; }
  50%  { opacity: 0.96019; }
  55%  { opacity: 0.08594; }
  60%  { opacity: 0.20313; }
  65%  { opacity: 0.71988; }
  70%  { opacity: 0.53455; }
  75%  { opacity: 0.37288; }
  80%  { opacity: 0.71428; }
  85%  { opacity: 0.70419; }
  90%  { opacity: 0.7003;  }
  95%  { opacity: 0.36108; }
  100% { opacity: 0.24387; }
}

/* --- GLITCH TEXT --- */

.glitch {
  position: relative;
  animation: glitch-skew 3s infinite;
}

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

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 #ff00ff;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: -2px 0 #ff00ff, 2px 2px #ff00ff;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0%   { clip: rect(31px,  9999px,  94px, 0); }
  10%  { clip: rect(112px, 9999px,  76px, 0); }
  20%  { clip: rect(85px,  9999px, 140px, 0); }
  30%  { clip: rect(120px, 9999px,  34px, 0); }
  40%  { clip: rect(26px,  9999px,  81px, 0); }
  50%  { clip: rect(68px,  9999px, 105px, 0); }
  60%  { clip: rect(15px,  9999px, 125px, 0); }
  70%  { clip: rect(95px,  9999px,  47px, 0); }
  80%  { clip: rect(54px,  9999px,  18px, 0); }
  90%  { clip: rect(38px,  9999px,  99px, 0); }
  100% { clip: rect(71px,  9999px,  62px, 0); }
}

@keyframes glitch-anim2 {
  0%   { clip: rect(65px,  9999px, 119px, 0); }
  10%  { clip: rect(52px,  9999px,  36px, 0); }
  20%  { clip: rect(79px,  9999px, 108px, 0); }
  30%  { clip: rect(2px,   9999px,  91px, 0); }
  40%  { clip: rect(44px,  9999px,   6px, 0); }
  50%  { clip: rect(103px, 9999px,  77px, 0); }
  60%  { clip: rect(21px,  9999px, 133px, 0); }
  70%  { clip: rect(86px,  9999px,  59px, 0); }
  80%  { clip: rect(39px,  9999px,  15px, 0); }
  90%  { clip: rect(96px,  9999px, 122px, 0); }
  100% { clip: rect(13px,  9999px,  84px, 0); }
}

@keyframes glitch-skew {
  0%   { transform: skew(0deg); }
  10%  { transform: skew(0deg); }
  11%  { transform: skew(-2deg); }
  12%  { transform: skew(0deg); }
  20%  { transform: skew(0deg); }
  21%  { transform: skew(1deg); }
  22%  { transform: skew(0deg); }
  100% { transform: skew(0deg); }
}

/* --- NEON PULSE --- */

.neon-pulse {
  animation: neon-glow 2s ease-in-out infinite alternate;
}

@keyframes neon-glow {
  from {
    text-shadow:
      0 0 5px var(--text-color),
      0 0 10px var(--text-color),
      0 0 15px var(--text-color),
      0 0 20px #00ff00,
      0 0 35px #00ff00;
  }
  to {
    text-shadow:
      0 0 10px var(--text-color),
      0 0 20px var(--text-color),
      0 0 30px var(--text-color),
      0 0 40px #00ff00,
      0 0 70px #00ff00,
      0 0 80px #00ff00;
  }
}

/* --- DATA STREAM --- */

.data-stream {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.3;
}

.data-line {
  position: absolute;
  font-size: 0.6rem;
  color: var(--text-color);
  white-space: nowrap;
  animation: stream-flow 8s linear infinite;
}

@keyframes stream-flow {
  0%   { transform: translateX(-100%); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateX(100%);  opacity: 0; }
}

/* --- CHROMATIC ABERRATION --- */

.chromatic:hover {
  animation: chromatic-aberration 0.3s ease-in-out;
}

@keyframes chromatic-aberration {
  0%, 100% { text-shadow: 0 0 0 transparent; }
  25%       { text-shadow: -2px 0 #ff00ff, 2px 0 #00ffff; }
  50%       { text-shadow: -3px 0 #ff00ff, 3px 0 #00ffff; }
  75%       { text-shadow: -2px 0 #ff00ff, 2px 0 #00ffff; }
}

/* --- DISTORTION --- */

.distortion {
  animation: distort 10s ease-in-out infinite;
}

@keyframes distort {
  0%, 100% { filter: hue-rotate(0deg); }
  50%       { filter: hue-rotate(5deg); }
}

/* --- DIGITAL NOISE --- */

.noise {
  position: relative;
}

.noise::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  animation: noise-anim 0.2s infinite;
}

@keyframes noise-anim {
  0%, 100% { transform: translate(0, 0); }
  10%  { transform: translate(-5%, -5%); }
  20%  { transform: translate(-10%, 5%); }
  30%  { transform: translate(5%, -10%); }
  40%  { transform: translate(-5%, 15%); }
  50%  { transform: translate(-10%, 5%); }
  60%  { transform: translate(15%, 0); }
  70%  { transform: translate(0, 10%); }
  80%  { transform: translate(-15%, 0); }
  90%  { transform: translate(10%, 5%); }
}

/* --- HOLOGRAM --- */

.hologram {
  position: relative;
  animation: hologram-flicker 4s ease-in-out infinite;
}

@keyframes hologram-flicker {
  0%, 100% { opacity: 1; }
  50%  { opacity: 0.8; }
  51%  { opacity: 1; }
  52%  { opacity: 0.9; }
  53%  { opacity: 1; }
}

/* --- VAPOR PULSE --- */

.vapor-pulse {
  color: #33ff00;
  font-family: monospace;
  font-size: 2rem;
  text-shadow: 0 0 8px rgba(51, 255, 0, 0.8);
  animation: liquid-bleed 4s infinite ease-in-out;
}

@keyframes liquid-bleed {
  0%, 100% { filter: blur(0px); transform: scale(1);    opacity: 1; }
  50%       { filter: blur(2px); transform: scale(1.02); opacity: 0.8; }
}

/* --- TERMINAL CURSOR --- */

.terminal-cursor::after {
  content: "█";
  animation: cursor-blink 1s step-end infinite;
}

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

/* --- DATA STREAM LINE POSITIONS (default: 4-line layout) --- */

.data-stream .data-line:nth-child(1) { top: 10%; animation-delay: 0s; }
.data-stream .data-line:nth-child(2) { top: 30%; animation-delay: 2s; }
.data-stream .data-line:nth-child(3) { top: 50%; animation-delay: 4s; }
.data-stream .data-line:nth-child(4) { top: 70%; animation-delay: 6s; }

/* --- TEXT COLOR UTILITIES --- */

.text-green   { color: var(--text-color); }
.text-accent  { color: var(--accent-color); }
.text-warning { color: var(--off-color); }
.text-dim     { color: #555; }
.text-dimmer  { color: #333; }
.text-muted   { color: #888; }

/* --- FOOTER BAR --- */

.footer-bar {
  grid-column: span 4;
  font-size: 0.7rem;
  color: #555;
  text-align: center;
  padding: 0.5rem;
  letter-spacing: 0.2em;
}

/* --- SYSTEM CARD --- */

.system-card-body {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.9;
  align-items: baseline;
}

.system-row {
  display: contents;
}

.system-label {
  color: #555;
}

.system-card-body .vapor-pulse {
  font-size: inherit;
}

/* --- RESPONSIVE --- */

@media (max-width: 640px) {
  .bento-container {
    grid-template-columns: repeat(2, 1fr);
  }

  header        { grid-column: span 2; }
  nav           { grid-column: span 2; grid-row: span 1; }
  main          { grid-column: span 2; grid-row: span 1; }
  .wide-box     { grid-column: span 2; }
  .small-box    { grid-column: span 1; }
  .footer-bar   { grid-column: span 2; }
}
