:root {
  color-scheme: dark;
  --matrix-bg: #020503;
  --matrix-green: #61ff8f;
  --matrix-green-soft: rgba(97, 255, 143, 0.18);
  --matrix-green-dim: rgba(97, 255, 143, 0.08);
  --matrix-panel: rgba(2, 8, 4, 0.62);
  --matrix-border: rgba(126, 255, 165, 0.2);
  --matrix-shadow: rgba(16, 255, 104, 0.34);
  --matrix-text: #d8ffe2;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(32, 255, 108, 0.11), transparent 33rem),
    radial-gradient(circle at 82% 18%, rgba(74, 255, 121, 0.07), transparent 24rem),
    linear-gradient(180deg, #030a05 0%, var(--matrix-bg) 58%, #000 100%);
  color: var(--matrix-text);
  cursor: none;
  font-family: "Cascadia Code", "IBM Plex Mono", "SFMono-Regular", "Courier New", monospace;
}

button,
input {
  font: inherit;
}

button {
  cursor: none;
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

input {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid rgba(111, 255, 151, 0.24);
  border-radius: 6px;
  background: rgba(0, 10, 3, 0.72);
  color: var(--matrix-text);
  padding: 0.74rem 0.8rem;
  outline: none;
  box-shadow: inset 0 0 18px rgba(25, 255, 96, 0.04);
}

input:focus {
  border-color: rgba(150, 255, 176, 0.62);
  box-shadow:
    0 0 0 3px rgba(82, 255, 132, 0.12),
    inset 0 0 18px rgba(25, 255, 96, 0.08);
}

label {
  display: grid;
  gap: 0.46rem;
  color: rgba(215, 255, 224, 0.72);
  font-size: 0.78rem;
}

body.matrix-account-page {
  overflow-x: hidden;
  overflow-y: auto;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 1;
  background:
    linear-gradient(rgba(120, 255, 160, 0.03) 50%, rgba(0, 0, 0, 0.08) 50%),
    radial-gradient(circle at center, transparent 0 42%, rgba(0, 0, 0, 0.66) 100%);
  background-size: 100% 4px, 100% 100%;
  mix-blend-mode: screen;
}

body::after {
  z-index: 2;
  background:
    linear-gradient(90deg, transparent, rgba(159, 255, 183, 0.09), transparent),
    repeating-linear-gradient(90deg, transparent 0 56px, rgba(84, 255, 130, 0.035) 57px, transparent 58px);
  opacity: 0.44;
  animation: scanner 8s linear infinite;
}

#matrix-canvas,
#cursor-glow,
#cursor-trail-layer {
  position: fixed;
  inset: 0;
}

#matrix-canvas {
  z-index: 0;
}

#cursor-glow {
  z-index: 4;
  width: 1px;
  height: 1px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50vw, -50vh, 0);
  transition: opacity 160ms ease;
}

#cursor-trail-layer {
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.cursor-trail {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--trail-size, 72px);
  height: var(--trail-size, 72px);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(180, 255, 200, 0.28), rgba(83, 255, 130, 0.12) 36%, transparent 72%);
  filter: blur(8px);
  mix-blend-mode: screen;
  opacity: var(--trail-alpha, 0.34);
  transform: translate(-50%, -50%) scale(0.74);
  animation: cursor-trail-fade 3.2s ease-out forwards;
  will-change: opacity, transform;
}

#cursor-glow::before,
#cursor-glow::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  border-radius: inherit;
  transform: translate(-50%, -50%);
}

#cursor-glow::before {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(118, 255, 157, 0.3), rgba(67, 255, 122, 0.12) 34%, transparent 70%);
  filter: blur(10px);
}

#cursor-glow::after {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(201, 255, 214, 0.95);
  background: rgba(178, 255, 198, 0.76);
  box-shadow:
    0 0 18px rgba(120, 255, 154, 0.95),
    0 0 42px rgba(70, 255, 122, 0.5);
}

body.is-pointer-active #cursor-glow {
  opacity: 1;
}

.matrix-shell {
  position: relative;
  z-index: 3;
  display: grid;
  place-content: center;
  min-height: 100vh;
  width: min(100% - 32px, 980px);
  margin: 0 auto;
  text-align: center;
}

.matrix-shell::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 760px);
  height: min(54vh, 390px);
  border: 1px solid var(--matrix-border);
  border-radius: 999px;
  background:
    radial-gradient(circle at center, rgba(16, 255, 104, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(3, 16, 7, 0.52), rgba(0, 0, 0, 0.2));
  box-shadow:
    0 0 78px rgba(28, 255, 102, 0.12),
    inset 0 0 44px rgba(85, 255, 130, 0.1);
  filter: blur(0.2px);
  transform: translate(-50%, -50%);
}

.matrix-kicker,
.matrix-bottom-bubble,
.matrix-shell h1 {
  position: relative;
  margin: 0;
  text-shadow:
    0 0 12px rgba(84, 255, 132, 0.42),
    0 0 34px rgba(84, 255, 132, 0.18);
}

.matrix-kicker {
  justify-self: center;
  margin-bottom: 1.2rem;
  padding: 0.58rem 0.82rem;
  border: 1px solid var(--matrix-border);
  border-radius: 999px;
  background: var(--matrix-panel);
  color: rgba(204, 255, 217, 0.72);
  font-size: clamp(0.68rem, 1.8vw, 0.78rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  box-shadow: 0 0 28px rgba(30, 255, 94, 0.12);
  backdrop-filter: blur(14px);
}

.matrix-bottom-bubble {
  position: fixed;
  left: 50%;
  bottom: clamp(1.1rem, 4vh, 2.2rem);
  z-index: 3;
  appearance: none;
  padding: 0.46rem 0.74rem;
  border: 1px solid rgba(86, 209, 117, 0.22);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(1, 18, 6, 0.82), rgba(0, 6, 3, 0.72)),
    radial-gradient(circle at 50% 0%, rgba(75, 255, 126, 0.16), transparent 70%);
  color: rgba(174, 255, 196, 0.68);
  font-size: clamp(0.58rem, 1.5vw, 0.7rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow:
    0 0 10px rgba(84, 255, 132, 0.3),
    0 0 22px rgba(84, 255, 132, 0.12);
  box-shadow:
    0 0 22px rgba(13, 167, 62, 0.12),
    inset 0 1px 0 rgba(179, 255, 200, 0.08);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.matrix-bottom-bubble:hover,
.matrix-bottom-bubble:focus-visible,
.matrix-command:hover,
.matrix-command:focus-visible,
.matrix-icon-button:hover,
.matrix-icon-button:focus-visible {
  border-color: rgba(159, 255, 184, 0.66);
  color: #f0fff4;
  outline: none;
  box-shadow:
    0 0 30px rgba(55, 255, 112, 0.2),
    inset 0 1px 0 rgba(179, 255, 200, 0.12);
}

.matrix-shell h1 {
  max-width: 12ch;
  color: #e8ffee;
  font-size: clamp(3.4rem, 11vw, 8.7rem);
  font-weight: 700;
  line-height: 0.84;
  letter-spacing: 0;
  text-wrap: balance;
}

.matrix-modal {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.matrix-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.matrix-modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 3, 1, 0.7);
  backdrop-filter: blur(8px);
}

.matrix-login,
.matrix-panel {
  position: relative;
  border: 1px solid var(--matrix-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(2, 18, 7, 0.86), rgba(0, 7, 2, 0.78)),
    radial-gradient(circle at 50% 0%, rgba(70, 255, 122, 0.12), transparent 70%);
  box-shadow:
    0 0 52px rgba(21, 255, 86, 0.12),
    inset 0 1px 0 rgba(194, 255, 208, 0.08);
  backdrop-filter: blur(16px);
}

.matrix-login {
  width: min(100%, 420px);
  padding: 1.4rem;
}

.matrix-login__close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
}

.matrix-icon-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(111, 255, 151, 0.24);
  border-radius: 6px;
  background: rgba(0, 12, 3, 0.72);
  color: rgba(215, 255, 224, 0.78);
}

.matrix-login__kicker {
  width: fit-content;
  margin-bottom: 0.9rem;
}

.matrix-login h2,
.matrix-panel h2,
.matrix-account h1 {
  margin: 0;
  color: #e8ffee;
  letter-spacing: 0;
  text-shadow:
    0 0 12px rgba(84, 255, 132, 0.32),
    0 0 34px rgba(84, 255, 132, 0.14);
}

.matrix-login h2 {
  font-size: clamp(2.2rem, 12vw, 4rem);
  line-height: 0.95;
}

.matrix-login__form {
  display: grid;
  gap: 0.86rem;
  margin-top: 1.1rem;
}

.matrix-command {
  min-height: 2.7rem;
  border: 1px solid rgba(102, 255, 142, 0.34);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(29, 151, 66, 0.34), rgba(0, 18, 5, 0.82)),
    radial-gradient(circle at 50% 0%, rgba(119, 255, 153, 0.18), transparent 70%);
  color: rgba(231, 255, 236, 0.92);
  padding: 0.72rem 0.9rem;
  text-transform: lowercase;
}

.matrix-command--quiet {
  background: rgba(0, 12, 3, 0.72);
}

.matrix-form-status {
  min-height: 1.2rem;
  margin: 0;
  color: rgba(187, 255, 204, 0.68);
  font-size: 0.76rem;
}

.matrix-form-status[data-tone="error"] {
  color: #ffbdbd;
}

.matrix-form-status[data-tone="success"] {
  color: #c7ffd4;
}

.matrix-account {
  position: relative;
  z-index: 3;
  width: min(100% - 32px, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(1.2rem, 5vw, 3rem) 0;
}

.matrix-account__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  min-height: 28vh;
}

.matrix-account h1 {
  max-width: 8ch;
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.88;
}

.matrix-account__identity {
  max-width: min(100%, 24rem);
  border: 1px solid rgba(86, 209, 117, 0.22);
  border-radius: 999px;
  background: var(--matrix-panel);
  color: rgba(204, 255, 217, 0.72);
  padding: 0.58rem 0.82rem;
  text-align: right;
  box-shadow: 0 0 28px rgba(30, 255, 94, 0.12);
  backdrop-filter: blur(14px);
}

.matrix-account__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(1rem, 5vw, 3rem);
  padding-bottom: 2rem;
}

.matrix-panel {
  min-width: 0;
  padding: 1rem;
}

.matrix-panel--wide {
  grid-column: 1 / -1;
}

.matrix-panel h2 {
  font-size: 1rem;
}

.matrix-facts {
  display: grid;
  grid-template-columns: minmax(6rem, 0.34fr) minmax(0, 1fr);
  gap: 0.55rem 0.8rem;
  margin: 1rem 0;
}

.matrix-facts dt,
.matrix-muted,
.matrix-session-item span {
  color: rgba(188, 255, 205, 0.58);
}

.matrix-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: rgba(232, 255, 238, 0.92);
}

.matrix-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.matrix-session-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.matrix-session-item {
  display: grid;
  gap: 0.28rem;
  border: 1px solid rgba(111, 255, 151, 0.16);
  border-radius: 6px;
  background: rgba(0, 10, 3, 0.5);
  padding: 0.74rem;
}

.matrix-session-item strong,
.matrix-session-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@keyframes scanner {
  from {
    transform: translateX(-16%);
  }

  to {
    transform: translateX(16%);
  }
}

@keyframes cursor-trail-fade {
  0% {
    opacity: var(--trail-alpha, 0.34);
    transform: translate(-50%, -50%) scale(0.74);
  }

  28% {
    opacity: var(--trail-alpha-mid, 0.24);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-trail {
    display: none;
  }
}

@media (max-width: 720px) {
  body {
    cursor: default;
  }

  button {
    cursor: pointer;
  }

  .matrix-shell {
    width: min(100% - 24px, 640px);
  }

  .matrix-shell h1 {
    max-width: 11ch;
    font-size: clamp(3rem, 18vw, 5.8rem);
  }

  .matrix-account {
    width: min(100% - 24px, 640px);
  }

  .matrix-account__header {
    display: grid;
    align-items: start;
    min-height: 22vh;
  }

  .matrix-account__identity {
    text-align: left;
  }

  .matrix-account__grid {
    grid-template-columns: 1fr;
  }

  .matrix-button-row {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after {
    animation: none;
  }
}
