:root {
  color-scheme: dark;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: #05070a;
}

* {
  box-sizing: border-box;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.12), transparent 28rem),
    radial-gradient(circle at 82% 15%, rgba(16, 185, 129, 0.08), transparent 24rem),
    linear-gradient(135deg, #05070a 0%, #071016 48%, #030507 100%);
  color: var(--fg);
  overflow: hidden;
}

.theme-green {
  --fg: #a7f3d0;
  --muted: #5eead4;
  --accent: #22c55e;
  --dim: rgba(167, 243, 208, 0.62);
  --panel: rgba(2, 10, 10, 0.58);
  --border: rgba(94, 234, 212, 0.26);
  --shadow: rgba(34, 197, 94, 0.22);
}

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

.escher-pixel-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #05070a;
  image-rendering: pixelated;
  pointer-events: none;
}

.terminal-frame {
  position: absolute;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: min(24rem, calc(100vw - 1rem));
  min-height: 16rem;
  max-width: calc(100vw - 1rem);
  max-height: calc(100vh - 1rem);
  max-height: calc(100dvh - 1rem);
  overflow: hidden;
  resize: both;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.08), inset 0 0 24px rgba(255, 255, 255, 0.012);
  backdrop-filter: blur(14px);
}


.terminal-frame::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: screen;
  opacity: 0.35;
}

.terminal-frame.is-maximized {
  resize: none;
  border-radius: 14px;
}

.terminal-frame.is-minimized {
  grid-template-rows: auto;
  width: min(32rem, calc(100vw - 1rem)) !important;
  height: auto !important;
  min-height: 0;
  resize: none;
}

.terminal-frame.is-minimized .terminal-output,
.terminal-frame.is-minimized .terminal-input-row,
.terminal-frame.is-minimized .quick-links {
  display: none;
}

.terminal-header,
.terminal-output,
.terminal-input-row,
.quick-links {
  position: relative;
  z-index: 1;
}

.terminal-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.85rem;
  user-select: none;
  cursor: grab;
}

.terminal-header:active {
  cursor: grabbing;
}

.window-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.dot {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
}

.dot:hover {
  filter: brightness(1.32);
  transform: scale(1.14);
}

.dot.red { background: #ef4444; }
.dot.amber { background: #f59e0b; }
.dot.green { background: #22c55e; }

.title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-output {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1rem, 2vw, 1.5rem);
  scrollbar-color: var(--border) transparent;
  cursor: text;
}

.line {
  min-height: 1.35rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-shadow: 0 0 12px var(--shadow);
}

.system-line {
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt-line,
.prompt {
  color: var(--accent);
}

.output-line {
  color: var(--fg);
}

.output-line a,
.quick-links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}

.output-line a:hover,
.quick-links a:hover {
  color: var(--fg);
  border-bottom-style: solid;
}

.terminal-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem clamp(1rem, 2vw, 1.5rem);
  border-top: 1px solid var(--border);
}

.prompt {
  flex: 0 0 auto;
  white-space: nowrap;
}

#command-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  caret-color: var(--accent);
  font: inherit;
}

#command-input::placeholder {
  color: var(--dim);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0 1.5rem 1rem;
  color: var(--dim);
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .terminal-frame {
    min-width: calc(100vw - 1rem);
    min-height: calc(100dvh - 1rem);
    border-radius: 12px;
    resize: none;
  }

  .terminal-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
  }

  .terminal-output {
    padding: 0.9rem;
  }

  .terminal-input-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0.9rem;
  }

  .prompt {
    font-size: 0.82rem;
  }

  #command-input {
    width: 100%;
    font-size: 16px;
  }

  .quick-links {
    padding-inline: 1rem;
  }

}

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