:root {
  --bg: #020402;
  --panel: rgba(0, 20, 8, 0.72);
  --panel-soft: rgba(0, 255, 90, 0.06);
  --green: #40ff75;
  --green-soft: rgba(64, 255, 117, 0.72);
  --green-dim: rgba(180, 255, 195, 0.62);
  --green-faint: rgba(0, 255, 90, 0.25);
  --warn: #d6ff7a;
  --error: #ff5f7a;
  --font-terminal: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at center, rgba(0, 255, 90, 0.08), transparent 34%),
    linear-gradient(180deg, #010201 0%, #020802 100%);
  color: var(--green);
  font-family: var(--font-terminal);
  overflow-x: hidden;
}

/* CRT scanline / screen texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 4px
    );
  opacity: 0.22;
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 51;
  background: radial-gradient(circle at center, transparent 55%, rgba(0, 0, 0, 0.48));
}

/* Shared utility */
.hidden {
  display: none !important;
}

/* Boot selector screen */
.boot-mode {
  width: min(92vw, 920px);
  min-height: 70vh;
  display: grid;
  place-items: center;
  border: 1px solid var(--green-faint);
  background:
    radial-gradient(circle at center, rgba(0, 255, 90, 0.08), transparent 42%),
    rgba(0, 20, 8, 0.38);
  box-shadow:
    0 0 35px rgba(0, 255, 90, 0.08),
    inset 0 0 40px rgba(0, 255, 90, 0.025);
  padding: 2rem;
}

.boot-box {
  width: min(90vw, 520px);
  border: 1px solid rgba(0, 255, 90, 0.45);
  padding: 2rem;
  background: rgba(0, 20, 8, 0.75);
  box-shadow:
    0 0 30px rgba(0, 255, 90, 0.12),
    inset 0 0 24px rgba(0, 255, 90, 0.035);
  text-align: center;
}

.boot-logo {
  font-size: clamp(2.2rem, 8vw, 4.4rem);
  letter-spacing: -0.08em;
  color: var(--green);
  text-shadow:
    0 0 8px rgba(64, 255, 117, 0.9),
    0 0 24px rgba(64, 255, 117, 0.32);
  margin-bottom: 1rem;
}

.boot-text {
  margin: 0 0 1.6rem;
  color: var(--green-dim);
  text-transform: lowercase;
}

.boot-button {
  display: block;
  width: 100%;
  margin: 0.8rem 0;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(0, 255, 90, 0.5);
  background: transparent;
  color: var(--green);
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  text-transform: lowercase;
  transition:
    background 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.boot-button:hover,
.boot-button:focus-visible {
  background: rgba(0, 255, 90, 0.12);
  box-shadow: 0 0 18px rgba(0, 255, 90, 0.12);
  outline: none;
  transform: translateX(3px);
}

.boot-button span {
  color: rgba(180, 255, 195, 0.55);
}

/* Terminal layout */
.terminal-shell {
  width: min(92vw, 920px);
  min-height: 70vh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  border: 1px solid var(--green-faint);
  background:
    linear-gradient(180deg, rgba(0, 30, 12, 0.72), rgba(0, 8, 4, 0.86)),
    var(--panel);
  box-shadow:
    0 0 35px rgba(0, 255, 90, 0.08),
    inset 0 0 40px rgba(0, 255, 90, 0.025);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(0, 255, 90, 0.18);
  background: rgba(0, 255, 90, 0.035);
}

.brand {
  display: flex;
  align-items: baseline;
  min-width: 0;
}

.brand-mark {
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: -0.07em;
  color: var(--green);
  text-shadow:
    0 0 8px rgba(64, 255, 117, 0.75),
    0 0 18px rgba(64, 255, 117, 0.22);
  white-space: nowrap;
}

.cursor {
  display: inline-block;
  margin-left: 0.25rem;
  color: var(--green);
  animation: blink 1s steps(2, start) infinite;
}

.terminal-status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status {
  color: var(--green-dim);
  font-size: 0.85rem;
  text-transform: lowercase;
}

.status.online {
  color: var(--green);
  text-shadow: 0 0 8px rgba(64, 255, 117, 0.7);
}

.audio-toggle {
  border: 1px solid rgba(0, 255, 90, 0.4);
  background: transparent;
  color: rgba(180, 255, 195, 0.75);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  text-transform: lowercase;
}

.audio-toggle:hover,
.audio-toggle:focus-visible {
  background: rgba(0, 255, 90, 0.1);
  outline: none;
}

.audio-toggle.active {
  color: var(--green);
  text-shadow: 0 0 8px rgba(64, 255, 117, 0.7);
}

.terminal-output {
  padding: 1.2rem;
  overflow-y: auto;
  max-height: 58vh;
  scroll-behavior: smooth;
}

.line {
  margin: 0 0 0.42rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--green-soft);
}

.line.dim {
  color: var(--green-dim);
}

.line.warn {
  color: var(--warn);
}

.line.error {
  color: var(--error);
}

.quick-commands {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.85rem 1.2rem;
  border-top: 1px solid rgba(0, 255, 90, 0.14);
  background: rgba(0, 255, 90, 0.025);
}

.quick-commands button {
  border: 1px solid rgba(0, 255, 90, 0.35);
  background: transparent;
  color: var(--green-dim);
  font-family: inherit;
  padding: 0.42rem 0.7rem;
  cursor: pointer;
  text-transform: lowercase;
}

.quick-commands button:hover,
.quick-commands button:focus-visible {
  color: var(--green);
  background: rgba(0, 255, 90, 0.1);
  outline: none;
}

.command-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.2rem 1.2rem;
  border-top: 1px solid rgba(0, 255, 90, 0.14);
}

.prompt {
  flex: 0 0 auto;
  color: var(--warn);
}

#commandInput {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--green);
  font: inherit;
  caret-color: var(--green);
  outline: none;
}

#commandInput:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#commandInput::selection,
.line::selection,
.brand-mark::selection,
.boot-logo::selection {
  background: rgba(64, 255, 117, 0.25);
}

/* Scrollbar */
.terminal-output::-webkit-scrollbar {
  width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
  background: rgba(0, 255, 90, 0.04);
}

.terminal-output::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 90, 0.25);
}

.terminal-output::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 90, 0.4);
}

/* Animations */
@keyframes blink {
  0%,
  45% {
    opacity: 1;
  }

  46%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 640px) {
  body {
    padding: 1rem;
    place-items: stretch;
  }

  .boot-mode,
  .terminal-shell {
    width: 100%;
    min-height: calc(100vh - 2rem);
  }

  .boot-box {
    padding: 1.4rem;
  }

  .terminal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .terminal-status {
    justify-content: flex-start;
  }

  .terminal-output {
    max-height: none;
  }

  .command-form {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }

  #commandInput {
    width: 100%;
  }
}

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

 a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px dotted rgba(64, 255, 117, 0.55);
}

 a:hover,
 a:focus-visible {
  color: var(--warn);
  border-bottom-color: var(--warn);
  outline: none;
}