:root {
  color-scheme: dark;
  font-family: "Manrope", sans-serif;
  --acid: #87ff65;
  --paper: #f2f5ef;
  --ink: #020403;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(135, 255, 101, 0.08), transparent 37%),
    #020403;
  color: var(--paper);
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.console-grid,
.console-noise,
.console-scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.console-grid {
  opacity: 0.8;
  background-image:
    linear-gradient(rgba(135, 255, 101, 0.027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 255, 101, 0.027) 1px, transparent 1px);
  background-size: 48px 48px;
}

.console-noise {
  z-index: 20;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.console-scanline {
  z-index: 18;
  top: -18%;
  height: 18%;
  background: linear-gradient(180deg, transparent, rgba(135, 255, 101, 0.055), transparent);
  animation: terminal-scan 7s linear infinite;
}

.console-nav {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 58px;
  padding: 0 clamp(16px, 3vw, 44px);
  border-bottom: 1px solid rgba(135, 255, 101, 0.18);
  background: rgba(2, 4, 3, 0.8);
  font-family: "DM Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.console-nav a {
  color: rgba(242, 245, 239, 0.52);
  text-decoration: none;
  transition: color 180ms ease;
}

.console-nav a span {
  margin-right: 8px;
  color: var(--acid);
}

.console-nav a:hover,
.console-nav a:focus-visible {
  color: var(--acid);
  outline: none;
}

.console-nav p {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: rgba(135, 255, 101, 0.46);
}

.console-nav p span {
  width: 6px;
  height: 6px;
  background: var(--acid);
  box-shadow: 0 0 10px rgba(135, 255, 101, 0.8);
  animation: console-pulse 1.5s ease-in-out infinite;
}

.console-main {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: calc(100svh - 58px);
  padding: clamp(22px, 5vw, 72px);
  place-items: center;
}

.console-shell {
  width: min(980px, 100%);
  overflow: hidden;
  border: 1px solid rgba(135, 255, 101, 0.43);
  background: rgba(3, 7, 4, 0.92);
  box-shadow:
    0 38px 100px rgba(0, 0, 0, 0.68),
    0 0 56px rgba(135, 255, 101, 0.045);
  transition: filter 360ms ease, opacity 360ms ease, transform 360ms ease;
}

.console-shell.is-suspended {
  filter: blur(1px) brightness(0.36);
  opacity: 0.22;
  transform: scale(0.985);
}

.console-shell__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(135, 255, 101, 0.2);
  background: rgba(135, 255, 101, 0.035);
  color: rgba(242, 245, 239, 0.28);
  font-family: "DM Mono", monospace;
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.console-shell__bar > span:nth-child(2) {
  color: rgba(135, 255, 101, 0.66);
}

.console-shell__bar > span:last-child {
  justify-self: end;
}

.console-lights {
  display: flex;
  gap: 5px;
}

.console-lights i {
  width: 5px;
  height: 5px;
  border: 1px solid rgba(135, 255, 101, 0.48);
  border-radius: 50%;
}

.console-lights i:first-child {
  background: var(--acid);
  box-shadow: 0 0 7px rgba(135, 255, 101, 0.75);
}

.console-terminal {
  min-height: clamp(330px, 48vh, 520px);
  padding: clamp(24px, 4vw, 48px);
  background:
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(135, 255, 101, 0.012) 5px),
    linear-gradient(135deg, rgba(135, 255, 101, 0.025), transparent 48%);
}

.console-terminal__heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(135, 255, 101, 0.11);
  color: rgba(242, 245, 239, 0.23);
  font-family: "DM Mono", monospace;
  font-size: 0.57rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.console-terminal__heading strong {
  color: rgba(135, 255, 101, 0.5);
  font-weight: 400;
}

.console-output {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 190px;
  max-height: 270px;
  padding: 28px 0 20px;
  overflow-y: auto;
  color: rgba(202, 255, 186, 0.66);
  font-family: "DM Mono", monospace;
  font-size: clamp(0.68rem, 1.3vw, 0.84rem);
  line-height: 1.55;
  scrollbar-color: rgba(135, 255, 101, 0.25) transparent;
}

.console-output p {
  margin: 0;
}

.console-output__system::before {
  margin-right: 9px;
  color: var(--acid);
  content: "[OK]";
}

.console-output__muted {
  color: rgba(242, 245, 239, 0.28);
}

.console-output__command {
  color: rgba(242, 245, 239, 0.6);
}

.console-output__error {
  color: #ff7979;
}

.console-output__success {
  color: var(--acid);
}

.console-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 0 0 0 14px;
  border: 1px solid rgba(135, 255, 101, 0.28);
  background: rgba(0, 0, 0, 0.3);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.console-form:focus-within {
  border-color: rgba(135, 255, 101, 0.72);
  box-shadow: 0 0 24px rgba(135, 255, 101, 0.055);
}

.console-form.is-rejected {
  border-color: rgba(255, 121, 121, 0.7);
  animation: command-rejected 320ms steps(1, end);
}

.console-form label {
  color: rgba(135, 255, 101, 0.72);
  font-family: "DM Mono", monospace;
  font-size: clamp(0.62rem, 1.2vw, 0.76rem);
  white-space: nowrap;
}

.console-form input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--paper);
  caret-color: transparent;
  outline: none;
  font-family: "DM Mono", monospace;
  font-size: clamp(0.78rem, 1.4vw, 0.92rem);
}

.console-form__caret {
  width: 7px;
  height: 17px;
  background: var(--acid);
  box-shadow: 0 0 8px rgba(135, 255, 101, 0.55);
  animation: caret-blink 900ms steps(1, end) infinite;
}

.console-form button {
  align-self: stretch;
  padding: 0 17px;
  border: 0;
  border-left: 1px solid rgba(135, 255, 101, 0.22);
  background: rgba(135, 255, 101, 0.075);
  color: rgba(135, 255, 101, 0.74);
  cursor: pointer;
  font-family: "DM Mono", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 180ms ease, color 180ms ease;
}

.console-form button:hover,
.console-form button:focus-visible {
  background: var(--acid);
  color: var(--ink);
  outline: none;
}

.console-form button:disabled {
  cursor: wait;
  opacity: 0.35;
}

.console-shell__footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  min-height: 38px;
  padding: 0 13px;
  border-top: 1px solid rgba(135, 255, 101, 0.12);
  color: rgba(242, 245, 239, 0.2);
  font-family: "DM Mono", monospace;
  font-size: 0.48rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.console-shell__footer span {
  align-self: center;
}

.console-flash {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: #9dff81;
  opacity: 0;
  pointer-events: none;
}

.console-flash.is-active {
  animation: console-flash 920ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.console-answer {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 24px;
  overflow: hidden;
  text-align: center;
  pointer-events: none;
}

.console-answer::before {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(135, 255, 101, 0.13), transparent 45%);
  content: "";
  opacity: 0;
}

.console-answer.is-visible::before {
  animation: answer-glow 5s ease-in-out both;
}

.console-answer__text {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0;
  color: var(--paper);
  font-size: clamp(2.4rem, 7.6vw, 7.6rem);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 0.96;
  text-wrap: balance;
  text-shadow: 0 0 48px rgba(135, 255, 101, 0.2);
}

.console-answer.is-visible .console-answer__text {
  animation: answer-arrive 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.console-answer.is-dissolving .console-answer__text {
  animation: answer-dissolve 1.45s steps(12, end) both;
}

.console-answer__code {
  position: relative;
  z-index: 2;
  margin-top: 28px;
  color: rgba(135, 255, 101, 0.48);
  font-family: "DM Mono", monospace;
  font-size: 0.57rem;
  letter-spacing: 0.14em;
  opacity: 0;
}

.console-answer.is-visible .console-answer__code {
  animation: answer-code 520ms 420ms ease-out both;
}

.console-answer.is-dissolving .console-answer__code {
  opacity: 0;
  transition: opacity 180ms ease;
}

.console-answer__pixels {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.answer-pixel {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--size);
  height: var(--size);
  background: var(--pixel-color);
  opacity: 0;
  box-shadow: 0 0 7px rgba(135, 255, 101, 0.5);
}

.console-answer.is-dissolving .answer-pixel {
  animation: pixel-scatter 1.35s var(--delay) cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes terminal-scan {
  from { transform: translateY(-120%); }
  to { transform: translateY(680%); }
}

@keyframes console-pulse {
  50% { opacity: 0.24; }
}

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

@keyframes command-rejected {
  0%, 100% { transform: none; }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@keyframes console-flash {
  0% { opacity: 0; }
  7% { opacity: 0.98; }
  18% { opacity: 0.76; }
  36% { opacity: 0.3; }
  100% { opacity: 0; }
}

@keyframes answer-arrive {
  0% { opacity: 0; filter: blur(12px); transform: scaleX(0.2) translateY(18px); clip-path: inset(40% 0); }
  34% { opacity: 1; filter: blur(1px); transform: scaleX(1.04) translateY(-3px); clip-path: inset(0); }
  56% { transform: scaleX(0.98) translateY(1px); }
  100% { opacity: 1; filter: none; transform: none; clip-path: inset(0); }
}

@keyframes answer-code {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes answer-glow {
  0% { opacity: 0; }
  15%, 82% { opacity: 1; }
  100% { opacity: 0.4; }
}

@keyframes answer-dissolve {
  0% { opacity: 1; filter: none; transform: none; clip-path: inset(0); }
  18% { transform: translateX(-4px); clip-path: polygon(0 0, 100% 0, 100% 18%, 0 22%, 0 43%, 100% 39%, 100% 62%, 0 67%, 0 84%, 100% 80%, 100% 100%, 0 100%); }
  42% { opacity: 0.78; filter: blur(0.8px); transform: translateX(6px) scaleX(1.02); clip-path: polygon(0 5%, 82% 0, 74% 22%, 100% 28%, 91% 46%, 66% 54%, 100% 68%, 72% 78%, 86% 100%, 0 94%); }
  72% { opacity: 0.34; filter: blur(2px); transform: translateY(8px) scaleX(0.96); clip-path: polygon(12% 8%, 82% 0, 69% 19%, 96% 34%, 73% 48%, 88% 63%, 58% 74%, 76% 100%, 24% 88%, 35% 66%, 8% 52%, 28% 31%); }
  100% { opacity: 0; filter: blur(9px); transform: translateY(22px) scale(0.86); clip-path: inset(48%); }
}

@keyframes pixel-scatter {
  0% { opacity: 0.86; transform: translate(0, 0) scale(0.4); }
  16% { opacity: 0.9; }
  76% { opacity: 0.58; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rotation)) scale(0.15); }
}

@media (max-width: 620px) {
  .console-nav {
    min-height: 52px;
  }

  .console-nav p {
    font-size: 0;
  }

  .console-main {
    min-height: calc(100svh - 52px);
    padding: 14px;
  }

  .console-shell__bar {
    min-height: 36px;
  }

  .console-terminal {
    min-height: 410px;
    padding: 22px 17px;
  }

  .console-terminal__heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .console-output {
    min-height: 180px;
  }

  .console-form {
    grid-template-columns: 1fr auto;
    gap: 0;
    padding: 0;
  }

  .console-form label {
    grid-column: 1 / -1;
    padding: 10px 11px 0;
  }

  .console-form input {
    min-height: 42px;
    padding: 0 11px;
  }

  .console-form__caret {
    display: none;
  }

  .console-form button {
    min-height: 42px;
    padding: 0 12px;
  }

  .console-shell__footer {
    display: none;
  }

  .console-answer__text {
    font-size: clamp(2.25rem, 12.5vw, 4.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
