:root {
  color-scheme: dark;
  --green: #8cff9f;
  --green-soft: #42d86b;
  --amber: #f1c86c;
  --red: #ff6b5d;
  --cyan: #77e7ff;
  --muted: #7fa984;
  --blue: #55a9ff;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--green);
  background: #050805;
}

button,
input {
  font: inherit;
}

.desk-scene {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #050805;
}

.desk-scene::after {
  content: none;
}

.screen-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
}

.screen-content {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #050805;
  box-shadow: none;
  pointer-events: auto;
}

.terminal-surface {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  border-radius: 0;
  clip-path: none;
  background: #050805;
  box-shadow: none;
  filter: none;
}

.terminal-surface::before {
  content: none;
}

.terminal-surface::after {
  content: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 0, 0, 0.045), transparent 18%, transparent 82%, rgba(70, 120, 255, 0.04)),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.43) 0,
      rgba(0, 0, 0, 0.43) 1px,
      rgba(140, 255, 159, 0.055) 2px,
      rgba(140, 255, 159, 0.03) 3px,
      transparent 5px
    );
  opacity: 0.72;
  transition: opacity 180ms ease;
}

.glow {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
  animation: roll 7s linear infinite;
  transition: opacity 180ms ease;
}

.glass-mask {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: transparent;
  mix-blend-mode: screen;
  opacity: 0;
}

.power-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  background: #020202;
  transition: opacity 260ms ease, background 260ms ease;
}

.terminal-viewport {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  filter: none;
  scrollbar-color: rgba(140, 255, 159, 0.35) rgba(0, 0, 0, 0.06);
  scrollbar-width: thin;
  text-shadow:
    0 0 5px rgba(140, 255, 159, 0.5);
}

.terminal {
  flex: 0 0 auto;
  padding: clamp(18px, 2.4vw, 34px) clamp(18px, 2.8vw, 42px) 8px;
  font-size: clamp(0.92rem, 1.25vw, 1.05rem);
}

.terminal p,
.terminal pre {
  margin: 0 0 8px;
}

.terminal pre {
  white-space: pre-wrap;
  line-height: 1.35;
}

.line {
  line-height: 1.48;
  word-break: break-word;
}

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

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

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

.line.info {
  color: var(--cyan);
}

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

.prompt-line {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 clamp(18px, 2.8vw, 42px) clamp(18px, 2.2vw, 32px);
  text-shadow: 0 0 8px rgba(140, 255, 159, 0.84);
}

.prompt {
  color: var(--amber);
  white-space: nowrap;
}

#commandInput {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--green);
  caret-color: var(--green);
  text-shadow: inherit;
}

.desk-scene.is-off .screen-content {
  background: #020202;
  box-shadow: none;
  mix-blend-mode: normal;
}

.desk-scene.is-off .scanlines,
.desk-scene.is-off .glow,
.desk-scene.is-off .glass-mask,
.desk-scene.is-off .terminal-surface,
.desk-scene.is-off .terminal-viewport {
  opacity: 0;
}

.desk-scene.is-off .power-overlay {
  opacity: 0.96;
}

.desk-scene.is-waking .power-overlay {
  animation: screenWake 920ms ease-out both;
}

.desk-scene.is-waking .screen-content {
  animation: screenBloom 920ms ease-out both;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.crt-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.desk-scene.is-calibrating {
  cursor: crosshair;
}

.desk-scene.is-calibrating .screen-layer {
  pointer-events: auto;
}

.calibration-handle {
  position: absolute;
  z-index: 30;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(9, 15, 12, 0.84);
  box-shadow: 0 0 0 2px rgba(119, 231, 255, 0.7), 0 0 18px rgba(119, 231, 255, 0.8);
  color: #fff;
  cursor: grab;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  transform: translate(-50%, -50%);
  user-select: none;
}

.calibration-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.calibration-layer .calibration-handle {
  pointer-events: auto;
}

.calibration-handle:active {
  cursor: grabbing;
}

.calibration-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 40;
  width: min(560px, calc(100vw - 32px));
  max-height: 44dvh;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(119, 231, 255, 0.42);
  border-radius: 8px;
  background: rgba(5, 10, 12, 0.92);
  color: #d7fff0;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.calibration-panel pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

@keyframes roll {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(100%);
  }
}

@keyframes screenWake {
  0% {
    opacity: 0.96;
    background: #020202;
  }
  12% {
    opacity: 0.94;
    background: radial-gradient(ellipse at 50% 50%, rgba(201, 255, 218, 0.95) 0 1px, #020202 2px);
  }
  34% {
    opacity: 0.7;
    background: radial-gradient(ellipse at 50% 50%, rgba(201, 255, 218, 0.65) 0 3%, #020202 31%);
  }
  100% {
    opacity: 0;
    background: transparent;
  }
}

@keyframes screenBloom {
  0% {
    filter: brightness(0.35) contrast(1.3);
  }
  35% {
    filter: brightness(1.52) contrast(1.12);
  }
  100% {
    filter: brightness(1) contrast(1);
  }
}

@media (max-width: 760px) {
  .terminal {
    padding: 12px clamp(16px, 5vw, 30px) 8px;
    font-size: 0.78rem;
  }

  .prompt-line {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0 clamp(16px, 5vw, 30px) 12px;
    font-size: 0.78rem;
  }
}

@media (max-width: 520px) {
  .terminal {
    font-size: 0.72rem;
  }

  .prompt-line {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .glow,
  .desk-scene.is-waking .power-overlay,
  .desk-scene.is-waking .screen-content {
    animation: none;
  }
}
