:root {
  --matrix: #75ff8a;
  --matrix-dim: #2ca74b;
  --matrix-soft: rgba(117, 255, 138, 0.18);
  --bg: #020503;
  --panel: #040b06;
  --font: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: radial-gradient(circle at 20% 0%, #0a1610 0%, var(--bg) 45%);
  color: var(--matrix);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

.shell-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.device-shell {
  width: 100vw;
  height: 100dvh;
  border: 0;
  border-radius: 0;
  background: #020604;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.device-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0,
    rgba(0, 0, 0, 0.1) 1px,
    rgba(117, 255, 138, 0.01) 1px,
    rgba(117, 255, 138, 0.01) 3px
  );
  mix-blend-mode: screen;
  opacity: 0.42;
  animation: crtDrift 0.22s steps(2, end) infinite;
}

@keyframes crtDrift {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(1px);
  }
}

.display-area {
  flex: 1;
  min-height: 0;
  position: relative;
  background: linear-gradient(180deg, #041009 0%, #020604 100%);
  overflow: hidden;
}

#bg-grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  padding: 16px;
  z-index: 1;
}

.screen.is-active {
  display: block;
}

.hidden {
  display: none !important;
}

#screen-splash {
  padding: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(24, 78, 56, 0.26), #010301 54%);
}

#splash-grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

.splash-content {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.splash-geo-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#splash-geo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.86;
}

.avatar-geometric {
  width: clamp(122px, 20vw, 176px);
  height: clamp(122px, 20vw, 176px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.36), 0 0 24px rgba(255, 255, 255, 0.18);
  position: relative;
  z-index: 2;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  isolation: isolate;
  opacity: 0;
}

.avatar-logo {
  width: 92%;
  height: 92%;
  display: block;
  object-fit: contain;
  object-position: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  filter: none;
  box-shadow: none;
  opacity: 1;
  mix-blend-mode: screen;
  pointer-events: none;
}

.splash-name {
  margin: 4px 0 0;
  color: #c7ffd1;
  font-size: clamp(0.82rem, 2vw, 1.04rem);
  letter-spacing: 0.04em;
  text-transform: none;
  text-align: left;
  line-height: 1.45;
  white-space: pre-line;
}

.splash-login-btn {
  border: 0;
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 14px 34px;
  font-size: clamp(0.86rem, 2vw, 1.03rem);
  cursor: pointer;
  position: relative;
  overflow: visible;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.18);
  opacity: 0;
}

#screen-splash.is-active .avatar-geometric,
#screen-splash.is-active .splash-login-btn {
  animation: splashFadeIn 1.5s ease 1s forwards;
}

@keyframes splashFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.splash-login-btn::before,
.splash-login-btn::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  pointer-events: none;
  animation: acidTrail 1.9s ease-out infinite;
}

.splash-login-btn::after {
  inset: -11px;
  border-color: rgba(255, 255, 255, 0.45);
  animation-delay: -0.95s;
}

@keyframes acidTrail {
  0% {
    transform: scale(0.96);
    opacity: 0.6;
  }
  70% {
    transform: scale(1.2);
    opacity: 0.18;
  }
  100% {
    transform: scale(1.33);
    opacity: 0;
  }
}

.panel {
  width: 100%;
  height: 100%;
  border: 1px solid #2ca74b;
}

.panel-terminal {
  padding: 18px;
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
}

.panel-terminal::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 0, 90, 0.04), transparent 40%, rgba(0, 255, 180, 0.04));
  mix-blend-mode: screen;
  animation: rgbSplit 0.14s steps(2, end) infinite;
}

@keyframes rgbSplit {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-1px);
  }
  100% {
    transform: translateX(1px);
  }
}

.boot-screen {
  margin: 0;
  font-size: clamp(0.92rem, 2.2vw, 1.1rem);
  line-height: 1.36;
  white-space: pre-wrap;
  color: #75ff8a;
  text-shadow: 0 0 8px rgba(117, 255, 138, 0.34);
}

#screen-glitch {
  background: #000;
  padding: 0;
}

.glitch-layer {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(117, 255, 138, 0.03) 2px,
    rgba(117, 255, 138, 0.03) 4px
  );
  animation: scan 0.2s steps(2, end) infinite;
}

.glitch-bars {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 0, 95, 0.1) 0 2%,
    transparent 2% 4%,
    rgba(117, 255, 138, 0.12) 4% 6%,
    transparent 6% 10%
  );
  background-size: 280% 100%;
  animation: glitchSlide 0.12s steps(3, end) infinite;
  mix-blend-mode: screen;
}

#screen-glitch::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0 35%, rgba(255, 30, 90, 0.25) 35% 42%, transparent 42% 100%);
  animation: glitchBreak 0.08s steps(2, end) infinite;
}

body.meltdown-full #screen-meltdown {
  inset: 0;
  z-index: 20;
}

#screen-meltdown {
  padding: 0;
  background: #000;
}

#meltdown-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.meltdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

.meltdown-title {
  margin: 0 0 8px;
  color: #ff365c;
  font-size: clamp(1.2rem, 3vw, 1.9rem);
  letter-spacing: 0.12em;
  text-shadow: 0 0 18px rgba(255, 54, 92, 0.9);
  animation: meltdownAlert 0.2s steps(2, end) infinite;
}

@keyframes meltdownAlert {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  40% {
    opacity: 0.3;
    transform: translateX(2px);
  }
  100% {
    opacity: 1;
    transform: translateX(-2px);
  }
}

@keyframes scan {
  to {
    transform: translateY(4px);
  }
}

@keyframes glitchSlide {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 280% 0;
  }
}

@keyframes glitchBreak {
  0% {
    transform: translate(0, 0);
    opacity: 0.35;
  }
  50% {
    transform: translate(8px, -4px);
    opacity: 0.8;
  }
  100% {
    transform: translate(-6px, 3px);
    opacity: 0.2;
  }
}

@keyframes trippyGlitchHue {
  0% {
    filter: hue-rotate(0deg) saturate(1.4) contrast(1.1);
  }
  100% {
    filter: hue-rotate(360deg) saturate(1.8) contrast(1.2);
  }
}

@keyframes trippyGlitchShift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  25% {
    transform: translate3d(-5px, 2px, 0) scale(1.01);
  }
  50% {
    transform: translate3d(4px, -3px, 0) scale(1);
  }
  75% {
    transform: translate3d(-3px, -2px, 0) scale(1.008);
  }
  100% {
    transform: translate3d(3px, 2px, 0) scale(1);
  }
}

body.trippy-mode {
  --matrix: #ff66f4;
  --matrix-dim: #5af6ff;
  --matrix-soft: rgba(255, 102, 244, 0.34);
  background: radial-gradient(circle at 20% 0%, #330059 0%, #03010c 48%);
}

body.trippy-mode #screen-splash {
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 40, 220, 0.28), transparent 36%),
    radial-gradient(circle at 82% 30%, rgba(40, 245, 255, 0.26), transparent 38%),
    radial-gradient(circle at 50% 88%, rgba(255, 200, 40, 0.2), transparent 40%),
    #040117;
}

body.trippy-mode #splash-grid-canvas,
body.trippy-mode #splash-geo-canvas {
  filter: saturate(1.85) contrast(1.3) brightness(1.16);
}

body.trippy-mode #screen-glitch {
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 60, 220, 0.2), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(60, 235, 255, 0.2), transparent 45%),
    #070016;
}

body.trippy-mode #screen-glitch .glitch-layer {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 30, 210, 0.2) 0 2px,
      rgba(70, 230, 255, 0.16) 2px 4px,
      rgba(110, 130, 255, 0.16) 4px 6px,
      rgba(90, 255, 160, 0.14) 6px 8px,
      transparent 8px 10px
    );
  mix-blend-mode: screen;
  animation: scan 0.12s steps(2, end) infinite, trippyGlitchHue 1.3s linear infinite;
}

body.trippy-mode #screen-glitch .glitch-bars {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 70, 235, 0.26) 0 2.2%,
    rgba(70, 230, 255, 0.24) 2.2% 4.4%,
    rgba(120, 120, 255, 0.24) 4.4% 6.8%,
    rgba(100, 255, 150, 0.2) 6.8% 9.2%,
    rgba(255, 220, 90, 0.2) 9.2% 12%,
    transparent 12% 15%
  );
  background-size: 330% 100%;
  mix-blend-mode: screen;
  animation: glitchSlide 0.08s steps(3, end) infinite, trippyGlitchHue 1.1s linear infinite;
}

body.trippy-mode #screen-glitch::after {
  background:
    linear-gradient(180deg, transparent 0 25%, rgba(255, 60, 210, 0.34) 25% 34%, transparent 34% 100%),
    linear-gradient(90deg, rgba(70, 235, 255, 0.2), rgba(255, 230, 90, 0.2));
  animation: glitchBreak 0.06s steps(2, end) infinite, trippyGlitchHue 0.9s linear infinite,
    trippyGlitchShift 0.22s steps(2, end) infinite;
}

.terminal-body {
  height: 100%;
  overflow-y: auto;
  font-size: clamp(1rem, 2.4vw, 1.22rem);
  line-height: 1.48;
  display: flex;
  flex-direction: column;
  color: #75ff8a;
}

.terminal-lines {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.terminal-static-header {
  flex: 0 0 auto;
  margin-bottom: 4px;
}

.terminal-header-line {
  margin: 0 0 2px;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-line {
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-rule {
  height: 6px;
  border-top: 2px solid #75ff8a;
  border-bottom: 2px solid #75ff8a;
  margin: 4px 0 10px;
  opacity: 0.95;
}

.terminal-line.dim {
  color: #5bd977;
}

.about-title {
  font-size: inherit;
  line-height: inherit;
}

.typed-char {
  color: rgba(117, 255, 138, 0.66);
  text-shadow: 0 0 4px rgba(117, 255, 138, 0.24);
  transition: color 250ms linear, text-shadow 250ms linear;
}

.typed-char.trail-2 {
  color: rgba(117, 255, 138, 0.82);
  text-shadow: 0 0 7px rgba(117, 255, 138, 0.45);
}

.typed-char.trail-1 {
  color: rgba(171, 255, 186, 0.94);
  text-shadow: 0 0 12px rgba(171, 255, 186, 0.76);
}

.typed-char.hot {
  color: #f2fff4;
  text-shadow: 0 0 18px rgba(232, 255, 236, 1);
}

.blinking-cursor {
  animation: blinkCursor 0.9s steps(1, end) infinite;
}

@keyframes blinkCursor {
  0%,
  48% {
    opacity: 1;
  }
  49%,
  100% {
    opacity: 0;
  }
}

.terminal-nav {
  margin-top: 8px;
}

.terminal-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  border: 0;
  background: transparent;
  color: #5bd977;
  font-family: inherit;
  font-size: clamp(1.03rem, 2.3vw, 1.3rem);
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
}

.menu-item.stagger-hidden {
  opacity: 0;
  transform: translateY(3px);
}

.menu-item.stagger-visible {
  animation: menuFadeIn 220ms ease forwards;
}

.menu-item.active {
  color: #020604;
  background: #75ff8a;
  text-shadow: none;
  box-shadow: 0 0 10px rgba(117, 255, 138, 0.22);
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.contact-panel {
  margin-top: 14px;
  border-top: 1px solid rgba(117, 255, 138, 0.22);
  padding-top: 10px;
  width: min(440px, 46vw);
  max-width: 100%;
  align-self: flex-start;
  font-size: inherit;
  line-height: inherit;
}

.contact-back-btn {
  border: 0;
  background: transparent;
  color: #75ff8a;
  font-family: inherit;
  font-size: clamp(1.03rem, 2.3vw, 1.3rem);
  line-height: inherit;
  letter-spacing: 0.02em;
  padding: 0 0 10px;
  cursor: pointer;
}

.contact-back-btn:hover,
.contact-back-btn:focus,
.contact-back-btn:focus-visible {
  color: #020604;
  background: #75ff8a;
  text-shadow: none;
  box-shadow: 0 0 10px rgba(117, 255, 138, 0.22);
  outline: none;
}

.contact-form {
  display: grid;
  gap: 7px;
}

.contact-label {
  color: #75ff8a;
  font-size: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-input {
  width: 100%;
  border: 1px solid rgba(117, 255, 138, 0.36);
  background: rgba(0, 0, 0, 0.3);
  color: #75ff8a;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  padding: 9px 10px;
}

.contact-input:focus {
  outline: none;
  border-color: rgba(117, 255, 138, 0.85);
  box-shadow: 0 0 0 1px rgba(117, 255, 138, 0.38);
}

.contact-textarea {
  min-height: 120px;
  resize: vertical;
}

.contact-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.contact-btn {
  border: 1px solid rgba(117, 255, 138, 0.62);
  background: transparent;
  color: #75ff8a;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  cursor: pointer;
}

.contact-btn:hover,
.contact-btn:focus-visible {
  border-color: rgba(117, 255, 138, 0.95);
  box-shadow: 0 0 12px rgba(117, 255, 138, 0.2);
  outline: none;
}

.contact-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.contact-status {
  margin: 10px 0 0;
  min-height: 1.2em;
  color: #75ff8a;
  font-size: inherit;
  line-height: inherit;
}

.contact-stagger-hidden {
  opacity: 0;
  transform: translateY(3px);
}

.contact-stagger-visible {
  animation: contactFadeIn 240ms ease forwards;
}

@keyframes contactFadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .terminal-body {
    height: 100%;
  }

  .panel-terminal {
    padding: 14px;
  }

  .menu-item {
    font-size: clamp(1rem, 5vw, 1.2rem);
    min-height: 44px;
    min-width: 0;
  }

  .terminal-menu {
    gap: 6px;
  }

  .contact-panel {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .screen {
    padding: 10px;
  }

  .panel-terminal {
    padding: 12px;
  }

  .boot-screen {
    font-size: clamp(0.84rem, 3.6vw, 1rem);
    line-height: 1.32;
  }
}
