:root {
  color-scheme: dark;
  font: 14px/1.6 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  color: #c4c9d2;
  background: #111315;
  --muted: #99a3b3;
  --green: #a5d7a0;
  --blue: #96bdf5;
  --border: #455469;
}

* { box-sizing: border-box; }
body { margin: 0; }
main { min-height: 100dvh; padding: 20px 24px; }
button, input { font: inherit; }
::selection { background: #445674; color: white; }
[hidden] { display: none !important; }

.user { color: var(--green); }
.path { color: var(--blue); }
.arrow { color: #ba9ad9; margin-right: 5px; }
.command { display: flex; align-items: center; gap: 8px; }
.terminal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.boot-output { white-space: pre-wrap; margin: 0 0 16px; }
.echo { margin: 0; color: var(--green); overflow-wrap: anywhere; }
.response {
  margin: 0 0 14px;
  color: #b3bdcc;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 75ch;
}

form { display: flex; align-items: center; gap: 10px; min-height: 44px; scroll-margin-block: 16px; }
form label { white-space: nowrap; }
.prompt-input {
  --input-scale: .875;
  position: relative;
  flex: 1;
  min-width: 0;
  height: 44px;
  border-bottom: 1px solid var(--border);
}
.prompt-input:focus-within { border-bottom-color: var(--blue); box-shadow: 0 1px 0 var(--blue); }
input {
  /* Prevent mobile Safari from zooming when the prompt receives focus. */
  font-size: 16px;
  position: absolute;
  top: 50%;
  left: 0;
  width: calc(100% / var(--input-scale));
  height: calc(44px / var(--input-scale));
  transform: translateY(-50%) scale(var(--input-scale));
  transform-origin: left center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #e6e9ef;
  caret-color: var(--green);
}
input:focus-visible { outline: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

.fullscreen-control, .submit-command {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.fullscreen-control { margin-left: auto; }
.submit-command { color: var(--green); border-color: var(--border); }
.fullscreen-control:hover, .submit-command:hover { border-color: var(--muted); color: #e6e9ef; }
.fullscreen-control:active, .submit-command:active { background: #20262e; }

.command-reference { white-space: normal; }
.command-list { display: grid; gap: 6px; margin: 8px 0 16px; }
.command-list > div { display: grid; grid-template-columns: 26ch minmax(0, 1fr); column-gap: 2ch; }
.command-reference-help .command-list > div { grid-template-columns: 12ch minmax(0, 1fr); }
.command-list dt { color: #e6e9ef; }
.command-list dd { margin: 0; color: var(--muted); }
.reference-note { margin: 0 0 16px; white-space: pre-wrap; }
.command-reference > :last-child { margin-bottom: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.error-page { padding-top: 60px; }
.error-page h1 { font: inherit; }
.error-page a { color: var(--blue); }

@media (max-width: 600px) {
  main { padding: 16px 14px; }
  .fullscreen-label { display: none; }
  .command-list { gap: 12px; }
  .command-list > div, .command-reference-help .command-list > div { grid-template-columns: minmax(0, 1fr); }
}

.train-track { overflow: hidden; }
.train {
  width: max-content;
  white-space: pre;
  color: var(--green);
  animation: train-pass 5s linear forwards;
}
@keyframes train-pass {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
  .train { animation: none; }
}

.chat-effect { overflow: hidden; padding: 10px 0; color: #ffff00; }
.chat-line { display: inline-block; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.chat-line > span { display: inline-block; white-space: pre; }
.chat-wave .chat-line > span { animation: chat-wave 1.2s ease-in-out infinite; animation-delay: var(--delay); }
.chat-wave2 .chat-line > span { animation: chat-wave2 1.2s ease-in-out infinite; animation-delay: var(--delay); }
.chat-shake .chat-line > span { animation: chat-shake 1s linear infinite; animation-delay: var(--delay); }
.chat-scroll .chat-line { animation: chat-scroll 6s linear infinite; }
.chat-slide .chat-line { animation: chat-slide 3s ease-in-out infinite; }
.flash1 { --from: #ff0000; --to: #ffff00; }
.flash2 { --from: #00ffff; --to: #0000ff; }
.flash3 { --from: #80ff80; --to: #008000; }
.flash1, .flash2, .flash3 { animation: chat-color 2s steps(1) infinite; }
.glow1 { animation: chat-glow1 5s linear infinite; }
.glow2 { animation: chat-glow2 5s linear infinite; }
.glow3 { animation: chat-glow3 5s linear infinite; }
@keyframes chat-glow1 { 0%,100% { color: #ff0000; } 25% { color: #ff8000; } 50% { color: #ffff00; } 75% { color: #00ff00; } 90% { color: #00ffff; } }
@keyframes chat-glow2 { 0%,100% { color: #ff0000; } 33% { color: #ff00ff; } 66% { color: #0000ff; } 90% { color: #800000; } }
@keyframes chat-glow3 { 0%,100% { color: #ffffff; } 25% { color: #00ff00; } 50% { color: #ffffff; } 75% { color: #00ffff; } }
@keyframes chat-wave { 0%,100% { transform: translateY(-4px); } 50% { transform: translateY(4px); } }
@keyframes chat-wave2 { 0%,100% { transform: translate(-2px,-4px); } 50% { transform: translate(2px,4px); } }
@keyframes chat-shake { 0%,40%,100% { transform: none; } 10%,30% { transform: translateY(-3px); } 20% { transform: translateY(3px); } }
@keyframes chat-scroll { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }
@keyframes chat-slide { 0%,100% { transform: translateY(-30px); opacity: 0; } 20%,75% { transform: none; opacity: 1; } 90% { transform: translateY(30px); opacity: 0; } }
@keyframes chat-color { 0%,100% { color: var(--from); } 50% { color: var(--middle, var(--to)); } 75% { color: var(--to); } }
@media (prefers-reduced-motion: reduce) {
  .chat-effect, .chat-effect .chat-line, .chat-effect .chat-line > span { animation: none; }
}
