:root {
  --bg: #030605;
  --fg: #3dfc8c;
  --dim: #1e8a50;
  --faint: #0f3d26;
  --alert: #ff4b4b;
  --warn: #ffc24b;
  --sys: #9fe8ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--fg);
  font: 15px/1.6 "IBM Plex Mono", ui-monospace, Consolas, monospace;
  text-shadow: 0 0 6px rgba(61, 252, 140, .35);
  overflow-x: hidden;
}
a { color: var(--sys); }
#term { max-width: 920px; margin: 0 auto; padding: 24px 16px 140px; min-height: 100%; cursor: text; }
#out div { white-space: pre-wrap; word-break: break-word; min-height: 1.6em; }
#out .dim { color: var(--dim); }
#out .sys { color: var(--sys); text-shadow: 0 0 6px rgba(159, 232, 255, .35); }
#out .alert { color: var(--alert); text-shadow: 0 0 8px rgba(255, 75, 75, .5); font-weight: 600; }
#out .warn { color: var(--warn); text-shadow: 0 0 6px rgba(255, 194, 75, .35); }
#out .echo { color: var(--dim); }
#out .file { border-left: 2px solid var(--faint); padding-left: 12px; }
#out .head { color: var(--sys); margin-top: .6em; }

#line { display: flex; gap: .6em; align-items: baseline; margin-top: .2em; }
#prompt { white-space: nowrap; color: var(--dim); }
#cmd {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: var(--fg); font: inherit; font-size: 16px; caret-color: var(--fg);
  text-shadow: inherit; padding: 0;
}
#line.secret #cmd { -webkit-text-security: disc; }
#line.busy { opacity: .45; }

#chips {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%);
}
#chips button {
  font: inherit; font-size: 13px; color: var(--fg); background: rgba(61, 252, 140, .06);
  border: 1px solid var(--faint); border-radius: 3px; padding: 6px 10px; cursor: pointer;
  text-shadow: inherit;
}
#chips button:hover, #chips button:focus-visible { border-color: var(--dim); background: rgba(61, 252, 140, .12); outline: 0; }

.crt {
  pointer-events: none; position: fixed; inset: 0; z-index: 10;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, .22) 3px);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, .85);
}
.noscript { padding: 24px 16px; }

/* audit trace effect */
body.audit { animation: shake .18s infinite; }
body.audit #out, body.audit #line { animation: flick .9s infinite steps(2); }
body.audit .crt { background-color: rgba(255, 40, 40, .07); }
@keyframes shake {
  0% { transform: translate(0, 0); } 25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, 0); } 100% { transform: translate(0, 0); }
}
@keyframes flick { 0% { opacity: 1; filter: none; } 50% { opacity: .85; filter: hue-rotate(-90deg); } }

@media (prefers-reduced-motion: reduce) {
  body.audit, body.audit #out, body.audit #line { animation: none; }
}
@media (max-width: 520px) {
  body { font-size: 14px; }
  #term { padding-top: 44px; }
}

/* clickable names in ls and mail */
#out .lnk {
  font: inherit; color: var(--fg); background: none; border: 0; padding: 0; cursor: pointer;
  text-shadow: inherit; text-decoration: underline dotted var(--dim); text-underline-offset: 3px;
}
#out .lnk:hover, #out .lnk:focus-visible { color: #fff; outline: 0; text-decoration-color: var(--fg); }
#out .tag { color: var(--dim); white-space: pre; }

/* sound toggle */
#snd {
  position: fixed; top: 10px; right: 12px; z-index: 20;
  font: 12px "IBM Plex Mono", ui-monospace, Consolas, monospace; letter-spacing: .05em;
  color: var(--dim); background: rgba(3, 6, 5, .85); border: 1px solid var(--faint); border-radius: 3px;
  padding: 4px 8px; cursor: pointer;
}
#snd:hover, #snd:focus-visible { color: var(--fg); border-color: var(--dim); outline: 0; }

/* connect screen */
#splash {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: var(--bg); cursor: pointer; text-align: center; padding: 24px;
}
#splash.gone { display: none; }
.splash-title { font-size: 20px; font-weight: 600; letter-spacing: .12em; margin-bottom: 1.4em; }
.splash-go { animation: blink 1.2s steps(2) infinite; }
.splash-note { color: var(--dim); font-size: 13px; margin-top: 1.4em; }
@keyframes blink { 50% { opacity: .25; } }

/* power on and off */
body.on #term { animation: poweron .5s ease-out; }
@keyframes poweron { 0% { opacity: 0; transform: scaleY(.02); filter: brightness(3); } 60% { opacity: 1; transform: scaleY(1); } 100% { filter: none; } }
body.off #term { animation: poweroff .6s ease-in forwards; }
@keyframes poweroff { 0% { transform: scaleY(1); } 60% { transform: scaleY(.02); filter: brightness(3); } 100% { transform: scale(0, .02); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .splash-go, body.on #term, body.off #term { animation: none; }
}
