/* Terminal surface */
.terminal {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  color: var(--green);
  text-shadow: 0 0 6px rgba(51,255,102,.45), 0 0 1px rgba(51,255,102,.9);
  font-size: clamp(11px, min(1.35vw, 2vh) + 4px, 16px);
  line-height: 1.45;
  outline: none;
  cursor: text;
}

.simulator-badge {
  margin: .65em 1.2em 0;
  padding: .2em .5em;
  align-self: flex-start;
  border: 1px solid var(--green-dim);
  color: var(--green-dim);
  font-size: .78em;
  letter-spacing: .05em;
}

.output {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 1em 1.2em .3em;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dark) transparent;
  overscroll-behavior: contain;
}

.input-line { display: flex; align-items: baseline; padding: .2em 1.2em .9em; white-space: pre-wrap; }
.terminal-input { display: none; }
@media (any-pointer: coarse) {
  .input-line { flex-wrap: wrap; }
  .input-line #typed, .input-line .cursor { display: none; }
  .terminal-input {
    display: block; flex: 1 1 8ch; min-width: 0; width: 8ch;
    min-height: 44px; padding: 0; border: 0; border-radius: 0;
    background: transparent; color: inherit; caret-color: var(--green);
    font: inherit; font-size: 16px; text-shadow: inherit;
  }
  .terminal-input:focus { outline: none; box-shadow: inset 0 -1px var(--green-dim); }
}
.prompt { color: var(--cyan); text-shadow: 0 0 8px rgba(46,230,255,.5); }
body[data-mode="breach"] .prompt { color: var(--magenta); text-shadow: 0 0 8px rgba(255,61,242,.6); }

.cursor { animation: blink 1.06s steps(1) infinite; margin-left: -1ch; opacity: .9; }
@keyframes blink { 50% { opacity: 0; } }
body[data-caret-hidden] .cursor { visibility: hidden; }

.line { white-space: pre-wrap; overflow-wrap: anywhere; }
.line.echo { color: #b6ffd0; }
.line.error { color: var(--magenta); text-shadow: 0 0 8px rgba(255,61,242,.4); }
.line.system { color: var(--cyan); }
.line.warn { color: var(--amber); }

.entry-dir { color: var(--acid); font-weight: 700; text-shadow: 0 0 8px rgba(184,255,46,.35); }
.entry-file { color: #9fffc4; }
.entry-locked { color: var(--magenta); letter-spacing: .06em; }
.hidden-entry { opacity: .75; font-style: italic; }

.clickable { cursor: pointer; text-decoration: underline dotted rgba(153,255,196,.4) 1px; text-underline-offset: 3px; }
.clickable.entry-dir { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; max-width: 100%; overflow-wrap: anywhere; touch-action: manipulation; }
.clickable:hover { background: rgba(51,255,102,.14); color: #d8ffe7; }
.clickable:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }

/* markdown rendering inside terminal */
.md h1, .md h2, .md h3, .md h4 { color: var(--acid); margin: .8em 0 .35em; text-transform: uppercase; letter-spacing: .06em; font-size: 1.05em; }
.md p { margin: .5em 0; }
.md ul, .md ol { margin: .4em 0; padding-left: 1.6em; }
.md blockquote { border-left: 2px solid var(--green-dim); margin: .6em 0; padding: .1em .9em; color: #8fe7ab; font-style: italic; }
.md code, .md pre { background: rgba(51,255,102,.09); border: 1px solid rgba(51,255,102,.16); padding: .05em .35em; font-family: inherit; }
.md pre { padding: .6em .8em; overflow-x: auto; }
.md hr { border: none; border-top: 1px dashed var(--green-dim); margin: 1em 0; }
.md a, .md .ext-link { color: var(--cyan); cursor: pointer; text-decoration: underline; }
.md table { border-collapse: collapse; margin: .6em 0; font-size: .95em; }
.md th, .md td { border: 1px solid rgba(51,255,102,.3); padding: .25em .6em; text-align: left; }
.md-meta { color: var(--green-dim); font-size: .9em; margin-bottom: .4em; letter-spacing: .04em; }

/* pager */
.pager { position: absolute; inset: 0; z-index: 8; background: rgba(3,6,3,.97); display: flex; flex-direction: column; outline: none; }
.pager-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.2em 1.4em; color: var(--green); text-shadow: inherit; font-size: inherit; line-height: 1.5; white-space: pre-wrap; }
.pager-bar { border-top: 1px solid var(--green-dim); padding: .3em calc(1.2em + env(safe-area-inset-right, 0px)) .3em 1.2em; color: var(--cyan); display: flex; font-size: .9em; align-items: center; gap: .5em; }
.pager-bar > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.pager-close { margin-inline-start: auto; flex-shrink: 0; white-space: nowrap; min-width: 44px; min-height: 44px; color: var(--green); background: var(--bg); border: 1px solid currentColor; font: inherit; cursor: pointer; }

/* overlay host (boot, breach) */
.overlay { position: absolute; inset: 0; z-index: 7; background: rgba(4,6,5,.92); padding: 1.4em; overflow-y: auto; outline: none; }
.hidden { display: none !important; }

/* legal fallback strip */
#legal-strip { position: absolute; right: .8em; bottom: .35em; z-index: 6; font-size: .72em; opacity: .45; color: var(--green-dim); }
#legal-strip:hover, #legal-strip:focus-visible { opacity: 1; }

/* mobile */
@media (max-width: 640px) {
  .terminal { font-size: max(13px, 3.4vw); }
  .output { padding: .8em .7em .2em; }
}
