/* Terminal / CRT — full UI hacker theme */

:root {
  --phosphor: #00ff41;
  --phosphor-dim: rgba(0, 255, 65, 0.5);
  --neon: #39ff14;
  --neon-soft: rgba(57, 255, 20, 0.42);
  --neon-dim: rgba(57, 255, 20, 0.14);
  --bg-void: #010402;
  --bg-deep: #030805;
  --bg-panel: rgba(4, 14, 8, 0.96);
  --panel-edge: rgba(0, 255, 65, 0.28);
  --text: #c4ffc8;
  --muted: #2d5a35;
  --radius: 11px;
  --font-mono: "JetBrains Mono", "Share Tech Mono", "Courier New", monospace;
  --font-head: "Share Tech Mono", "JetBrains Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

.hacker-terminal {
  margin: 0;
  min-height: 100%;
  padding: 32px 76px 44px;
  font-family: var(--font-mono);
  font-size: 15px;
  background-color: #000;
  background-image:
    radial-gradient(ellipse 130% 70% at 50% -15%, rgba(0, 255, 65, 0.09), transparent 52%),
    radial-gradient(ellipse 55% 45% at 105% 110%, rgba(0, 90, 45, 0.18), transparent),
    radial-gradient(ellipse 40% 35% at -5% 90%, rgba(0, 60, 30, 0.15), transparent),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(0, 255, 65, 0.045) 40px,
      rgba(0, 255, 65, 0.045) 41px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      rgba(0, 255, 65, 0.045) 40px,
      rgba(0, 255, 65, 0.045) 41px
    ),
    linear-gradient(185deg, var(--bg-deep) 0%, var(--bg-void) 50%, #000 100%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  animation: crtFlicker 9s infinite;
}

@media (max-width: 700px) {
  .hacker-terminal {
    padding: 32px 18px 44px;
  }
}

@keyframes crtFlicker {
  0%,
  100% {
    opacity: 1;
  }
  91% {
    opacity: 1;
  }
  92.5% {
    opacity: 0.96;
  }
  93% {
    opacity: 1;
  }
  97% {
    opacity: 0.99;
  }
}

/* Mưa mã hex / CSDL — lấp vùng trống (Canvas) */
.hacker-matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.52;
  transition: opacity 0.35s ease;
}

.hacker-matrix-canvas--static {
  display: none;
}

body.hacker-terminal:has(#hackerTickerEnable:not(:checked)) .hacker-matrix-canvas {
  opacity: 0.09;
}

.hacker-terminal::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.25) 1px,
    rgba(0, 0, 0, 0.25) 2px
  );
}

.hacker-terminal::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: radial-gradient(
    ellipse 72% 62% at 50% 48%,
    transparent 25%,
    rgba(0, 0, 0, 0.72) 100%
  );
}

/* Cột nhị phân hai bên — nhiều dãy nhỏ chạy dọc */
.hacker-binary-side {
  position: fixed;
  z-index: 1;
  top: 0;
  bottom: 34px;
  width: 56px;
  pointer-events: none;
}

.hacker-binary-side--left {
  left: 0;
}

.hacker-binary-side--right {
  right: 0;
}

.hacker-binary-side__frame {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: min(42vh, 320px);
  border-left: 1px solid rgba(0, 255, 65, 0.75);
  border-top: 1px solid rgba(0, 255, 65, 0.75);
  border-radius: 14px 0 0 0;
  box-shadow:
    0 0 14px rgba(0, 255, 65, 0.28),
    inset 0 0 20px rgba(0, 255, 65, 0.04);
  pointer-events: none;
}

.hacker-binary-side__frame--right {
  left: auto;
  right: 0;
  border-left: none;
  border-right: 1px solid rgba(0, 255, 65, 0.75);
  border-top: 1px solid rgba(0, 255, 65, 0.75);
  border-radius: 0 14px 0 0;
}

.hacker-binary-side__inner {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  height: 100%;
  padding: 12px 5px 16px;
  gap: 3px;
  mask-image: linear-gradient(
    180deg,
    transparent 0%,
    #000 10%,
    #000 90%,
    transparent 100%
  );
}

.hacker-binary-col {
  flex: 1;
  min-width: 0;
  max-width: 13px;
  overflow: hidden;
}

.hacker-binary-col__track {
  animation: binaryStreamDown linear infinite;
  will-change: transform;
}

.hacker-binary-col__track--up {
  animation-name: binaryStreamUp;
}

.hacker-binary-col__track--a {
  animation-duration: 21s;
}

.hacker-binary-col__track--b {
  animation-duration: 29s;
}

.hacker-binary-col__track--c {
  animation-duration: 17s;
}

.hacker-binary-col__track--d {
  animation-duration: 35s;
}

.hacker-binary-col__chunk {
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 11px;
  letter-spacing: 0.02em;
  font-weight: 600;
  color: rgba(0, 255, 65, 0.62);
  text-shadow:
    0 0 6px rgba(0, 255, 65, 0.35),
    0 0 1px rgba(0, 255, 65, 0.9);
  text-align: center;
  word-break: break-all;
  white-space: pre;
}

.hacker-binary-side--right .hacker-binary-col__chunk {
  color: rgba(57, 255, 20, 0.58);
}

@keyframes binaryStreamDown {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

@keyframes binaryStreamUp {
  0% {
    transform: translateY(-50%);
  }
  100% {
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .hacker-binary-side {
    display: none;
  }
}

body.hacker-terminal:has(#hackerTickerEnable:not(:checked)) .hacker-binary-col__track {
  animation-play-state: paused;
  opacity: 0.35;
}

.shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  filter: drop-shadow(0 0 2px rgba(0, 255, 65, 0.12));
}

.shell::before,
.shell::after {
  position: absolute;
  font-size: 0.58rem;
  letter-spacing: 0.35em;
  color: rgba(0, 255, 65, 0.32);
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}

.shell::before {
  content: "// Uplink :: AES-256 //";
  top: -20px;
  left: 2px;
}

.shell::after {
  content: "// Session_Active //";
  bottom: -20px;
  right: 2px;
}

@media (max-width: 520px) {
  .shell::before,
  .shell::after {
    display: none;
  }
}

.card {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 40px 34px 44px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
      0 0 46px rgba(0, 255, 65, 0.07),
      0 0 100px rgba(0, 0, 0, 0.85),
      inset 0 1px 0 rgba(0, 255, 65, 0.14),
      inset 0 0 70px rgba(0, 25, 12, 0.45);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  left: -50%;
  width: 200%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--phosphor), transparent);
  opacity: 0.55;
  animation: scanBar 5.5s linear infinite;
  box-shadow: 0 0 12px var(--phosphor-dim);
}

@keyframes scanBar {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0.35;
  }
  50% {
    opacity: 0.65;
  }
  100% {
    transform: translateY(460px) translateX(0);
    opacity: 0.2;
  }
}

.card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(0, 255, 65, 0.1);
  border-radius: calc(var(--radius) - 5px);
  pointer-events: none;
}

h1 {
  font-family: var(--font-head);
  font-size: clamp(0.98rem, 3.5vw, 1.32rem);
  font-weight: 400;
  letter-spacing: 0.32em;
  text-align: center;
  margin: 0 0 14px;
  color: var(--phosphor);
  text-transform: uppercase;
  line-height: 1.4;
  text-shadow:
    0 0 14px var(--phosphor-dim),
    0 0 32px rgba(0, 255, 65, 0.22),
    -0.8px 0 rgba(255, 40, 80, 0.18),
    0.8px 0 rgba(0, 220, 255, 0.14);
  position: relative;
  z-index: 1;
}

.hint {
  text-align: center;
  font-size: 0.82rem;
  color: rgba(195, 255, 205, 0.78);
  margin: 0 0 30px;
  line-height: 1.68;
  position: relative;
  z-index: 1;
  letter-spacing: 0.03em;
}

.hint::before {
  content: "> ";
  color: var(--phosphor);
  opacity: 0.5;
  font-weight: 600;
}

.hint code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--neon);
  padding: 3px 9px;
  background: rgba(0, 255, 65, 0.08);
  border: 1px solid rgba(0, 255, 65, 0.22);
  border-radius: 4px;
  text-shadow: 0 0 10px var(--neon-dim);
}

label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--phosphor);
  margin-bottom: 10px;
  text-shadow: 0 0 16px var(--neon-dim);
  position: relative;
  z-index: 1;
  text-transform: uppercase;
}

label::before {
  content: "[";
  opacity: 0.5;
  margin-right: 5px;
}

label::after {
  content: "]";
  opacity: 0.5;
  margin-left: 5px;
}

.result-heading {
  text-align: center;
  font-family: var(--font-head);
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.4em;
  color: var(--phosphor);
  text-transform: uppercase;
  margin: 0 0 14px;
  text-shadow:
    0 0 12px var(--phosphor-dim),
    0 0 26px rgba(0, 255, 65, 0.22);
  position: relative;
  z-index: 1;
}

.field {
  width: 100%;
  position: relative;
  z-index: 1;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(0, 255, 65, 0.38);
  border-radius: 7px;
  padding: 15px 18px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--phosphor);
  outline: none;
  caret-color: var(--phosphor);
  box-shadow:
    inset 0 3px 16px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: border-color 0.18s, box-shadow 0.18s;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.25);
}

.field::placeholder {
  color: var(--muted);
  text-shadow: none;
}

.field:focus {
  border-color: var(--phosphor);
  box-shadow:
    inset 0 3px 16px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(0, 255, 65, 0.22),
    0 0 48px rgba(0, 255, 65, 0.09);
}

.btn-wrap {
  display: flex;
  justify-content: center;
  margin: 28px 0 32px;
  position: relative;
  z-index: 1;
}

.btn {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--phosphor);
  background: linear-gradient(180deg, #08120a 0%, #020604 100%);
  border: 2px solid var(--phosphor);
  border-radius: 7px;
  padding: 16px 42px;
  cursor: pointer;
  text-shadow:
    0 0 14px var(--phosphor-dim),
    0 0 28px rgba(0, 255, 65, 0.32);
  box-shadow:
    0 0 22px rgba(0, 255, 65, 0.28),
    0 0 48px rgba(0, 255, 65, 0.09),
    inset 0 0 28px rgba(0, 255, 65, 0.08);
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, color 0.2s;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.btn:hover {
  background: linear-gradient(180deg, #0c1e12 0%, #06100a 100%);
  color: #fff;
  box-shadow:
    0 0 32px rgba(0, 255, 65, 0.48),
    0 0 64px rgba(0, 255, 65, 0.14),
    inset 0 0 34px rgba(0, 255, 65, 0.14);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.15) brightness(0.85);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.login-error {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: #ff7a8c;
  text-shadow: 0 0 10px rgba(255, 100, 120, 0.38);
}

.shell--login .field {
  margin-bottom: 6px;
}

.shell--login label + .field {
  margin-bottom: 14px;
}

.session-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed rgba(0, 255, 65, 0.15);
}

.session-bar__user {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 255, 65, 0.55);
}

.session-bar__user::before {
  content: "User: ";
  opacity: 0.65;
}

.btn-logout {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  color: rgba(0, 255, 65, 0.65);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(0, 255, 65, 0.28);
  border-radius: 6px;
  transition:
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.btn-logout:hover {
  color: var(--phosphor);
  border-color: rgba(0, 255, 65, 0.5);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.12);
}

.output-box {
  position: relative;
  z-index: 1;
  min-height: 200px;
  width: 100%;
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(0, 255, 65, 0.32);
  border-radius: 7px;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.55);
}

.output-box.has-content:not(.report) {
  color: #72e888;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.22);
}

.output-box.error {
  color: #ff7a8c;
  border-color: rgba(255, 85, 105, 0.48);
  box-shadow:
    inset 0 0 28px rgba(40, 0, 12, 0.28),
    0 0 22px rgba(255, 80, 100, 0.14);
  font-family: var(--font-mono);
  text-shadow: 0 0 10px rgba(255, 100, 120, 0.35);
}

.output-box.report {
  --matrix-green: #00ff41;
  background: #000;
  border: 1px solid var(--matrix-green);
  border-radius: 7px;
  box-shadow:
    0 0 18px rgba(0, 255, 65, 0.38),
    inset 0 0 38px rgba(0, 255, 65, 0.05);
  color: var(--matrix-green);
  font-family: "Courier New", Courier, var(--font-mono);
  font-size: 0.93rem;
  line-height: 1.55;
  min-height: 132px;
  padding: 22px 24px;
  text-shadow:
    0 0 8px rgba(0, 255, 65, 0.5),
    0 0 1px rgba(0, 255, 65, 0.9);
}

.output-box.report .report-lines {
  margin: 0;
}

.output-box.report .report-line {
  margin: 0 0 12px;
  word-break: break-word;
}

.output-box.report .report-line:last-child {
  margin-bottom: 0;
}

.output-box.report .report-key {
  font-weight: 700;
}

.output-box.report .report-val {
  font-weight: 400;
}

.output-box.report .report-urgent {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 255, 65, 0.45);
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 1.04rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  color: #00ff41;
  text-shadow:
    0 0 12px rgba(0, 255, 65, 0.75),
    0 0 26px rgba(0, 255, 65, 0.38);
  animation: urgentPulse 1.35s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.output-box.loading {
  overflow: hidden;
  position: relative;
  border-color: rgba(0, 255, 65, 0.5);
  box-shadow:
    inset 0 0 30px rgba(0, 255, 65, 0.1),
    0 0 20px rgba(0, 255, 65, 0.06);
}

.output-box.loading::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 40%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 255, 65, 0.09), transparent);
  animation: sweepLoad 1.5s ease-in-out infinite;
}

@keyframes sweepLoad {
  0%,
  100% {
    opacity: 0.45;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(42px);
  }
}

.matrix-feed {
  margin: 0;
  min-height: 168px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: rgba(0, 255, 65, 0.52);
  position: relative;
  z-index: 1;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.28);
  animation: matrixJitter 0.85s ease-in-out infinite alternate;
}

@keyframes matrixJitter {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-5px);
  }
}

.matrix-feed.flip {
  animation-name: matrixJitterRev;
}

@keyframes matrixJitterRev {
  from {
    transform: translateY(-3px);
  }
  to {
    transform: translateY(4px);
  }
}

/* Ẩn checkbox gốc — chỉ dùng label tùy biến */
.hacker-ticker-check {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hacker-ticker-control {
  position: fixed;
  z-index: 120;
  left: 64px;
  bottom: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 255, 65, 0.85);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(0, 255, 65, 0.35);
  border-radius: 4px;
  box-shadow:
    0 0 14px rgba(0, 255, 65, 0.08),
    inset 0 0 12px rgba(0, 255, 65, 0.04);
  cursor: pointer;
  user-select: none;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.35);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    color 0.2s;
}

.hacker-ticker-control:hover {
  border-color: rgba(0, 255, 65, 0.55);
  color: var(--phosphor);
}

.hacker-ticker-control__box {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--phosphor);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.8);
  box-shadow:
    inset 0 0 8px rgba(0, 255, 65, 0.15),
    0 0 10px rgba(0, 255, 65, 0.25);
  transition:
    background 0.15s,
    box-shadow 0.15s;
}

.hacker-ticker-control__box::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 5px;
  height: 9px;
  border: solid var(--phosphor);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.15s;
  filter: drop-shadow(0 0 4px rgba(0, 255, 65, 0.8));
}

.hacker-ticker-check:checked + .hacker-ticker-control .hacker-ticker-control__box {
  background: rgba(0, 255, 65, 0.12);
  box-shadow:
    inset 0 0 12px rgba(0, 255, 65, 0.25),
    0 0 14px rgba(0, 255, 65, 0.35);
}

.hacker-ticker-check:checked + .hacker-ticker-control .hacker-ticker-control__box::after {
  opacity: 1;
}

.hacker-ticker-check:focus-visible + .hacker-ticker-control {
  outline: 2px solid var(--phosphor);
  outline-offset: 3px;
}

/* Dải chữ chạy — ngoài khối giao diện chính */
.hacker-ticker {
  position: fixed;
  z-index: 110;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 8, 4, 0.92) 0%, #000 100%);
  border-top: 1px solid rgba(0, 255, 65, 0.35);
  box-shadow:
    0 -4px 24px rgba(0, 255, 65, 0.08),
    inset 0 1px 0 rgba(0, 255, 65, 0.12);
}

.hacker-ticker__track {
  display: flex;
  width: max-content;
  height: 100%;
  align-items: center;
  animation: hackerTickerScroll 55s linear infinite;
  will-change: transform;
}

.hacker-ticker__segment {
  flex-shrink: 0;
  padding-right: 4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(0, 255, 65, 0.88);
  white-space: nowrap;
  text-shadow:
    0 0 6px rgba(0, 255, 65, 0.45),
    0 0 14px rgba(0, 255, 65, 0.2);
}

/* Tắt chữ chạy khi bỏ tick */
body.hacker-terminal:has(#hackerTickerEnable:not(:checked)) .hacker-ticker__track {
  animation-play-state: paused;
  opacity: 0.38;
}

body.hacker-terminal:has(#hackerTickerEnable:not(:checked)) .hacker-ticker {
  border-top-color: rgba(0, 255, 65, 0.12);
}

@keyframes hackerTickerScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hacker-ticker__track {
    animation: none;
  }

  .hacker-ticker__segment {
    white-space: normal;
    text-align: center;
    padding: 6px 12px;
    font-size: 0.65rem;
  }

  .hacker-ticker {
    height: auto;
    min-height: 34px;
  }

  .hacker-binary-col__track {
    animation: none !important;
    transform: none !important;
  }
}

@media (max-width: 700px) {
  .hacker-ticker-control {
    left: 14px;
  }
}
