/* Base da página (vale para os dois modos) + modo Backend: o terminal estilo DOS. */
:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  --bg: #020a04;
  --bg2: #04140a;
  --fg: #3dff7a;
  --fg-dim: #27bd59;
  --fg-faint: #14723a;
  --hi: #c8ffd8;
  --err: #ff7b7b;
  --logo-head: #3dff7a;
  --logo-facet: #1f9c4b;
  --logo-eye: #020a04;
  --glow: 0 0 8px rgba(61, 255, 122, 0.42);
  --font: 'VT323', ui-monospace, Menlo, Consolas, monospace;
  --fs: 22px;
  --lh: 1.28;
}
@media (max-width: 560px) {
  :root { --fs: 20px; }
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); height: 100%; background: var(--bg); }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  text-shadow: var(--glow);
}
button { font: inherit; color: inherit; text-shadow: inherit; }
body, button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--hi); outline-offset: 2px; }

.crt { position: relative; height: 100%; width: 100%; display: flex; flex-direction: column; background: var(--bg); }
:root[data-term="dos"] .crt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.24) 0, rgba(0, 0, 0, 0.24) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.5) 100%);
}

/* Barra superior: a marca sempre visível */
.bar { flex: none; display: flex; flex-wrap: wrap; row-gap: 8px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: var(--bg2); border-bottom: 1px solid var(--fg-faint); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand span { font-size: 0.95em; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-controls { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.themes { display: flex; flex: none; }
.modebtn { min-height: 44px; padding: 0 14px; background: transparent; color: var(--fg-dim); border: 1px solid var(--fg-faint); cursor: pointer; font-size: 0.8em; touch-action: manipulation; }
.modebtn:hover { color: var(--fg); border-color: var(--fg-dim); }
.tbtn { min-height: 44px; padding: 0 14px; background: transparent; color: var(--fg-dim); border: 1px solid var(--fg-faint); cursor: pointer; font-size: 0.8em; touch-action: manipulation; }
.tbtn + .tbtn { border-left: 0; }
.tbtn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); text-shadow: none; }

/* Tela */
.screen { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 18px 16px 24px; scrollbar-width: thin; scrollbar-color: var(--fg-faint) transparent; }
.ln { white-space: pre-wrap; word-break: break-word; min-height: 1lh; animation: lnin 0.22s ease-out both; }
@keyframes lnin { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.hi { color: var(--hi); }
.dim { color: var(--fg-dim); }
.err { color: var(--err); }
.big { font-size: 1.7em; line-height: 1.1; }
.prompt { color: var(--fg); }
.echo .prompt { color: var(--fg-dim); }
.row { display: flex; flex-wrap: wrap; column-gap: 2ch; align-items: baseline; }
.col { display: inline-block; min-width: 12ch; }
.cmd, .lnk { background: none; border: 0; padding: 5px 0; color: var(--hi); cursor: pointer; text-decoration: underline; text-decoration-color: var(--fg-faint); text-underline-offset: 4px; touch-action: manipulation; }
.lnk { display: inline-block; }
.cmd:hover, .lnk:hover { text-decoration-color: var(--hi); }

/* Tabelas de prompt: moldura dupla no DOS, colunas sem borda no PowerShell */
.tablewrap { margin: 6px 0 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ptable { border-collapse: collapse; width: max-content; max-width: 100%; font: inherit; text-shadow: inherit; }
.ptable th, .ptable td { padding: 3px 14px; text-align: left; vertical-align: top; font-weight: normal; }
.ptable th { color: var(--hi); }
.ptable td:first-child { color: var(--hi); white-space: nowrap; }
.ptable a.lnk { overflow-wrap: anywhere; }
.answers { display: flex; flex-wrap: wrap; gap: 24px; }
:root[data-term="dos"] .ptable { border: 3px double var(--fg-dim); }
:root[data-term="dos"] .ptable thead th { border-bottom: 3px double var(--fg-dim); padding-top: 6px; padding-bottom: 6px; }
:root[data-term="dos"] .ptable th + th, :root[data-term="dos"] .ptable td + td { border-left: 1px solid var(--fg-faint); }
:root[data-term="dos"] .ptable tbody tr + tr td { border-top: 1px solid var(--fg-faint); }

/* Banner fixo: abertura e marca ficam sempre visíveis; só a saída abaixo rola e é limpa */
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.banner { flex: none; max-height: 60%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 10px; border-bottom: 1px dashed var(--fg-faint); scrollbar-width: thin; scrollbar-color: var(--fg-faint) transparent; }
.banner .splash { margin: 12px 0 10px; }
.banner .splash svg { width: 104px; height: 104px; }
.banner .wm-a { font-size: clamp(42px, 8vw, 68px); }
.banner .wm-d { font-size: clamp(15px, 3vw, 24px); }
.banner + .screen { padding-top: 12px; }
@media (max-height: 680px) { #bootlines { display: none; } }

/* Prompt com segmentos clicáveis (sobem na pasta) */
.inputline .prompt { position: relative; z-index: 2; overflow-wrap: anywhere; }
.pseg { display: inline-block; padding: 10px 3px; margin: -10px -3px; background: none; border: 0; color: inherit; font: inherit; text-shadow: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--fg-faint); text-underline-offset: 4px; touch-action: manipulation; }
.pseg:hover { color: var(--hi); text-decoration-color: var(--hi); }

/* Indicador de sistema online */
.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--fg); box-shadow: 0 0 0 3px rgba(61, 255, 122, 0.18), 0 0 6px rgba(61, 255, 122, 0.7); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

/* Marca: o lobo herda as cores do tema */
.w-head { fill: var(--logo-head); }
.w-facet { fill: var(--logo-facet); }
.w-eye { fill: none; stroke: var(--logo-eye); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.w-eyefill { fill: var(--logo-eye); }
:root[data-term="dos"] .wolf { filter: drop-shadow(0 0 7px rgba(61, 255, 122, 0.55)); }
.splash { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin: 10px 0 12px; }
.splash svg { width: 120px; height: 120px; flex: none; }
.wm { display: flex; flex-direction: column; gap: 6px; }
.wm-a { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: clamp(46px, 10vw, 80px); letter-spacing: -0.04em; line-height: 1; color: var(--fg); }
.wm-d { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-weight: 500; font-size: clamp(17px, 3.6vw, 28px); letter-spacing: 0.32em; line-height: 1; color: var(--fg-dim); padding-left: 3px; }

/* Linha de entrada com cursor de bloco */
.inputline { position: relative; display: flex; flex-wrap: wrap; column-gap: 1ch; }
.inputline[hidden] { display: none; }
.typed { white-space: pre-wrap; word-break: break-all; }
.cur { display: inline-block; min-width: 1ch; background: var(--fg); color: var(--bg); text-shadow: none; animation: blink 1.06s steps(1) infinite; }
.inputline:not(:focus-within) .cur { background: transparent; color: transparent; outline: 1px solid var(--fg); animation: none; }
@keyframes blink { 50% { opacity: 0; } }
#field { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; padding: 0; background: transparent; color: transparent; caret-color: transparent; }

/* Atalhos para toque */
.bottombar { flex: none; display: flex; align-items: center; background: var(--bg2); border-top: 1px solid var(--fg-faint); }
.chips { flex: 1 1 auto; min-width: 0; display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chip { flex: none; min-height: 44px; padding: 0 16px; background: transparent; color: var(--fg); border: 1px solid var(--fg-faint); cursor: pointer; font-size: 0.85em; touch-action: manipulation; }
.chip:hover { background: var(--fg); color: var(--bg); text-shadow: none; }

.foot { flex: none; align-self: stretch; display: flex; align-items: center; padding: 0 16px; border-left: 1px solid var(--fg-faint); font-size: 0.72em; letter-spacing: 0.08em; color: var(--fg-dim); white-space: nowrap; }

.crt.howl .screen { animation: howl 0.7s ease-out; }
@keyframes howl { 0% { filter: brightness(1); } 18% { filter: brightness(1.9) saturate(1.3); } 100% { filter: none; } }

@media (max-width: 480px) {
  .bar { gap: 8px; padding: 8px 12px; }
  .brand { gap: 8px; }
  .brand span { font-size: 0.82em; }
  .brand .proto { display: none; }
  .tbtn { padding: 0 9px; font-size: 0.75em; }
  .modebtn { padding: 0 9px; font-size: 0.75em; }
  .bar-controls { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .ln { animation: none; }
  .cur { animation: none; }
  .crt.howl .screen { animation: none; }
}
