:root {
  color-scheme: dark;
  --terminal-size: 720px;
  --terminal-max-size: 600px;
  --hud-status-height: 12px;
  --hud-border-width: 1px;
  --hud-action-size: 18px;
  --frame-margin: 0px;
  --square-top-reserve: 0px;
  --square-bottom-reserve: 0px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; min-height: 100%; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--terminal-font, "IBM Plex Mono","Space Mono","SFMono-Regular","Menlo","Consolas",monospace);
  background: #000;
  color: #fff;
  letter-spacing: 0.04em;
  overflow: hidden; /* rolagem apenas no painel do terminal */
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* ===== HUD ===== */
#hud {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  font-size: clamp(.72rem,1.4vw,.9rem);
  width: 720px;
  height: 48px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  overflow: visible;
}
.hud-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .45rem;
  min-height: var(--hud-status-height);
  width: 100%;
  padding: 0;
}
#status-bar {
  display:block;
  color:#fff;
  width: 720px;
  height: var(--hud-status-height);
  margin: 0 auto;
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  align-self:flex-start;
  flex: 0 0 auto;
  font-size: clamp(.72rem, 1.35vw, .95rem);
  line-height: var(--hud-status-height);
}
.status-route {
  position:absolute;
  left: 108px;
  width: 216px;
  height: var(--hud-status-height);
  display: flex;
  align-items: center;
  line-height: var(--hud-status-height);
  font-weight:600;
  letter-spacing:.06em;
  text-transform:lowercase;
  padding:0;
  margin-right:auto;
  border:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.status-item {
  font-weight: 600;
  letter-spacing:.04em;
  line-height: var(--hud-status-height);
  font-size: clamp(.72rem, 1.25vw, .95rem);
}
.status-item#status-mode { display:none; }
.status-separator {
  opacity:.65;
  font-size: 1.1em;
  line-height: 1;
  transition: color .25s ease, opacity .25s ease;
}
.status-separator[data-state="gui"] { color:#4295ff; opacity:1; }
.status-separator[data-state="terminal"] { color:#ff4242; opacity:1; }
.hud-action-pack {
  position:absolute;
  left:18px;
  top:0;
  display:flex;
  align-items:center;
  gap:.25rem;
  height: var(--hud-status-height);
}
.hud-meta {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  width:72px;
  height: var(--hud-status-height);
  line-height: var(--hud-status-height);
  gap:.25rem;
  padding:0;
}
.hud-action-pack .hud-button {
  border:0;
  margin:0;
}
.hud-button {
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  width: var(--hud-action-size);
  height: var(--hud-action-size);
  border:0;
  background:transparent;
  color:#fff;
  letter-spacing:.04em;
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  line-height:18px;
  cursor: pointer;
  position: relative;
}
.hud-button-icon {
  width:100%;
  height:100%;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.25rem;
  line-height:1;
}
.hud-button-icon::before {
  content:"";
  line-height:1;
}
.hud-button[data-icon="fullscreen"] .hud-button-icon::before { content:"\26F6"; }
.hud-button[data-icon="frontend"] .hud-button-icon::before { content:"\21C6"; }
.hud-button:focus-visible,
.hud-button:hover {
  outline:1px dashed #fff;
}
.hud-chip {
  appearance:none;
  -webkit-appearance:none;
  border:1px solid rgba(255,255,255,.85);
  border-radius:999px;
  background:transparent;
  color:#fff;
  letter-spacing:.15em;
  text-transform:lowercase;
  font-size:clamp(.72rem,1.4vw,.85rem);
  padding:.35rem 1.4rem;
  cursor:pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.hud-chip:hover,
.hud-chip:focus-visible {
  background:#fff;
  color:#000;
  border-color:#fff;
  outline:none;
}

/* ===== Container principal ===== */
#quadro {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--frame-margin);
  background: #000;
  isolation: isolate;
  overflow: hidden;
  z-index: 1;
}

#terminal-stack {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-content: stretch;
  justify-items: center;
  gap: clamp(.45rem, 1.5vh, .75rem);
  width: 100%;
  max-width: var(--terminal-size, 90vmin);
  flex: 1 1 auto;
  height: 100%;
  max-height: calc(100vh - (var(--frame-margin) * 2));
  max-height: calc(100dvh - (var(--frame-margin) * 2));
  min-height: calc(100vh - (var(--frame-margin) * 2));
  min-height: calc(100dvh - (var(--frame-margin) * 2));
}
#terminal-stack > * {
  width: 100%;
  max-width: var(--terminal-size, 90vmin);
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
}
@supports (width: min(100%, 50px)) {
  #terminal-stack > * {
    width: min(100%, var(--terminal-size, 90vmin));
    max-width: none;
  }
}

/* ===== Perfis dinâmicos ===== */
#quadro[data-layout-profile="screen-only"] #hud,
#quadro[data-layout-profile="screen-only"] #virtual-keyboard {
  display:none;
}
#quadro[data-layout-profile="screen-only"] #terminal-stack {
  grid-template-rows: minmax(0, 1fr);
}
#quadro[data-layout-profile="screen-only"] #interaction-panel {
  margin-top:0;
}
#quadro[data-layout-profile="screen-only"] #prompt-panel {
  margin-left:auto;
  margin-right:auto;
}
#quadro[data-layout-profile="screen-hud"] #interaction-panel {
  display:none;
}
#quadro[data-input-mode="hardware"][data-layout-profile="screen-hud"] #interaction-panel {
  display:flex;
}
#quadro[data-input-mode="hardware"][data-layout-profile="screen-hud"] #virtual-keyboard {
  display:none;
}
#quadro[data-layout-profile="screen-keyboard"] #hud {
  display:none;
}
#quadro[data-layout-profile="screen-keyboard"] #interaction-panel {
  align-items:flex-end;
}
#quadro[data-layout-profile="screen-keyboard"] #virtual-keyboard {
  margin:0;
}
#quadro[data-layout-profile="command-keyboard"] #hud {
  display:none;
}
#quadro[data-layout-profile="command-keyboard"] #terminal-stack {
  grid-template-rows: minmax(0, 1fr) auto;
}
#quadro[data-layout-profile="command-keyboard"] #interaction-panel {
  margin-top:0;
}
#quadro[data-layout-profile="command-keyboard"] #prompt-panel {
  display:block;
}
#quadro[data-layout-profile="command-keyboard"] #virtual-keyboard {
  margin:0;
}

#quadro[data-frontend="gui"] #interaction-panel {
  gap:0;
}
#quadro[data-frontend="terminal"] .terminal-line[data-channel="gui"] {
  display:none;
}
#quadro[data-frontend="gui"][data-layout-profile="screen-only"] #terminal-stack {
  grid-template-rows: minmax(0,1fr);
}

/* ===== Estados de inicialização ===== */
#boot-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 6;
  pointer-events: none;
}
.boot-lotus-button {
  appearance:none;
  -webkit-appearance:none;
  width: clamp(120px, 35vmin, 320px);
  aspect-ratio:1/1;
  border: 2px solid transparent;
  border-radius: 50%;
  background: url("./flora-mae-1080.png") center/contain no-repeat;
  cursor: pointer;
  pointer-events: auto;
  transition: border-color .18s ease, transform .18s ease;
}
.boot-lotus-button:hover,
.boot-lotus-button:focus-visible,
.boot-lotus-button:active {
  border-color:#fff;
  outline:none;
  transform: scale(1.02);
}
#quadro[data-stage="intro"] #boot-overlay {
  display: flex;
  pointer-events: auto;
}
#quadro[data-stage="intro"] #terminal-panel > :not(#boot-overlay) {
  opacity: 0;
  pointer-events: none;
}
#quadro[data-stage="intro"] #hud,
#quadro[data-stage="intro"] #interaction-panel {
  display: none !important;
}
#quadro[data-stage="home"] #terminal-panel {
  border: none;
  padding: clamp(.55rem,1.2vw,.85rem);
}
#quadro[data-stage="home"] #hud {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding-left: 0;
  padding-right: 0;
}
#transition-overlay {
  position:absolute;
  inset:0;
  background:#000;
  opacity:0;
  pointer-events:none;
  transition:opacity .35s ease;
  z-index:10;
}
#quadro[data-transition-state="active"] #transition-overlay {
  opacity:1;
  pointer-events:auto;
}

/* ===== Formatos quadrados ===== */
#quadro[data-shell-shape="square"] #terminal-stack {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  max-width: none;
  width: 100%;
  max-height: none;
  min-height: 0;
  justify-items: stretch;
  align-content: stretch;
}
#quadro[data-shell-shape="square"] #terminal-stack > * {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
#quadro[data-shell-shape="square"] #workbench,
#quadro[data-shell-shape="square"] #console {
  width: 100%;
  height: 100%;
  align-self: stretch;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
#quadro[data-shell-shape="square"] #hud,
#quadro[data-shell-shape="square"] #interaction-panel {
  z-index: 3;
  background: rgba(0,0,0,.72);
  border: none;
  box-shadow: 0 0 18px rgba(0,0,0,.55);
  padding: 0;
  backdrop-filter: blur(3px);
  pointer-events: auto;
}
#quadro[data-shell-shape="square"] #hud {
  position: fixed;
  top: 0;
  width: 720px;
  max-width: 720px;
  height: 48px;
  left: 50%;
  right: auto;
  margin: 0;
  transform: translateX(-50%);
}
#quadro[data-shell-shape="square"] #interaction-panel {
  position: fixed;
  top: 48px;
  right: 0;
  left: auto;
  bottom: auto;
  width: 162px;
  height: 666px;
  margin: 0;
  align-items: flex-end;
}
#quadro[data-shell-shape="square"] #interaction-panel > * {
  max-width: none;
}
#quadro[data-shell-shape="square"] #virtual-keyboard {
  width: 126px;
  max-width: 126px;
  left: auto;
  right: 18px;
}
#quadro[data-shell-shape="square"] #terminal-panel {
  max-width: none;
  max-height: none;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: none;
  padding-top: calc(var(--square-top-reserve, 0px) + clamp(.55rem,1.2vw,.85rem));
  padding-bottom: calc(var(--square-bottom-reserve, 0px) + clamp(.55rem,1.2vw,.85rem));
}

/* Layout principal */
#workbench {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, var(--terminal-size, 90vmin));
  height: min(100%, var(--terminal-size, 90vmin));
  align-self: center;
  margin: 0 auto;
}
#console {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  height: 100%;
  align-self: stretch;
}
#interaction-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  width: 162px;
  height: 666px;
  position: fixed;
  top: 48px;
  right: 0;
  left: auto;
  bottom: auto;
  margin: 0;
  box-sizing: border-box;
  z-index: 3;
}
#quadro #interaction-panel.has-home-keyboard {
  width: 720px;
  max-width: 720px;
  left: auto;
  right: 0;
  top: 0;
  bottom: 0;
  height: auto;
  padding: 0;
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
  box-shadow: none;
  border: none;
  backdrop-filter: none;
  pointer-events: none;
}
#quadro #interaction-panel.has-home-keyboard > * {
  max-width: none;
  flex: 0 0 auto;
  pointer-events: auto;
}
#quadro #interaction-panel.has-home-keyboard #virtual-keyboard {
  display: none;
}

/* ===== Terminal quadrado ===== */
#terminal-panel {
  border: 1px solid #fff;
  background: #000;
  padding: clamp(.55rem,1.2vw,.85rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  width: min(100%, var(--terminal-size, 90vmin), var(--terminal-max-size, 600px));
  height: auto;
  max-width: min(100%, var(--terminal-max-size, 600px));
  max-height: min(100%, var(--terminal-size, 90vmin), var(--terminal-max-size, 600px));
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  align-self: center;
}

#quadro[data-app="cartas"] {
  background: transparent;
}

/* Log */
#terminal-output {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  scroll-behavior: smooth;
}

#quadro[data-stage="home"] #terminal-panel {
  position: static;
  width: auto;
  max-width: none;
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
}

#quadro[data-stage="home"] #terminal-output {
  position: absolute;
  top: 48px;
  left: 18px;
  width: 600px;
  height: 600px;
  max-width: 600px;
  max-height: 600px;
  flex: 0 0 auto;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.4);
}
.terminal-line {
  display:flex; align-items:flex-start; gap:.6rem;
  font-size: clamp(.8rem,1.6vw,.95rem);
  line-height:1.45; color:#fff;
  white-space: pre-wrap; word-break: break-word;
  opacity:0; transform: translateY(4px); animation: line-in 220ms ease forwards;
}
.terminal-line .prompt  { color:#fff; flex-shrink:0; }
.terminal-line .content { flex:1; word-break: break-word; }
.terminal-line .loader  { display:inline-block; width:10px; height:10px; border-radius:50%; border:2px solid #fff; border-top-color:#fff; animation: spin .9s linear infinite; margin-right:.4rem; }
.terminal-line .banner  { font-size: clamp(1rem,3vw,1.35rem); letter-spacing:.05em; }
#quadro[data-stage="home"] .terminal-line.options {
  position: fixed;
  top: 48px;
  left: 18px;
  width: 270px;
  height: 270px;
  max-width: 270px;
  max-height: 270px;
  padding: 0;
}
#quadro[data-stage="home"] .terminal-line.options .content {
  width: 234px;
  height: 234px;
  margin-left: 18px;
  margin-top: 18px;
}
#quadro[data-stage="home"] .terminal-line.options .home-option-grid {
  width:234px;
  height:234px;
}
#quadro[data-stage="home"] .terminal-line.home-shortcuts {
  position: fixed;
  top: 318px;
  left: 18px;
  width: 600px;
  height: 270px;
  max-width: 600px;
  max-height: 270px;
  padding: 0;
}

/* Opções */
.option-list { display:flex; flex-direction:column; gap:.4rem; margin-top:.25rem; }
.option-list.home-option-grid { gap:18px; margin-top:0; height:100%; width:100%; }
.option-item {
  appearance:none;
  -webkit-appearance:none;
  display:flex; align-items:flex-start; gap:.6rem;
  padding:.45rem .6rem;
  border:1px solid #fff;
  background:#000;
  color:#fff;
  cursor:pointer;
  transition: background .15s ease, color .15s ease;
  text-align:left;
  font: inherit;
}
.option-item .index { min-width: 1.4rem; opacity:.8; }
.option-item .label { display:flex; flex-direction:column; gap:.15rem; }
.option-item:hover,
.option-item.is-selected {
  background:#fff;
  color:#000;
}
.option-item:focus-visible {
  outline:1px dashed #fff;
  outline-offset:3px;
  background:#fff;
  color:#000;
}
.option-item .label-primary { font-weight:600; letter-spacing:.05em; }
.option-item .label-secondary { font-size:.85em; opacity:.66; letter-spacing:.04em; }
.home-shortcuts-heading .content,
.section-heading .content { font-weight:600; letter-spacing:.05em; }
.home-shortcut-list {
  list-style:none;
  margin:1rem 0 0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:.2rem;
  letter-spacing:.04em;
}
.home-command-list {
  display:flex;
  flex-direction:column;
  gap:.15rem;
  margin-top:.35rem;
  padding:0;
  list-style:none;
  width: min(100%, 320px);
  max-width: 50%;
  align-self:flex-start;
}
.home-command-list li {
  width:100%;
}
.home-command-button {
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  font-size:clamp(.82rem,1.6vw,1rem);
  letter-spacing:.04em;
  border:none;
  background:#000;
  color:#fff;
  padding:.35rem .45rem;
  cursor:pointer;
  font:inherit;
  text-align:left;
  border-radius:.4rem;
  transition:background .2s ease, color .2s ease;
}
.home-command-button:hover,
.home-command-button:focus-visible {
  background:#fff;
  color:#000;
  outline:none;
}
.home-command-button code {
  font-size:1em;
  background:rgba(255,255,255,.1);
  padding:.2rem .55rem;
  border-radius:.35rem;
  flex:0 0 auto;
  min-width:max-content;
  border:1px solid transparent;
  transition:border-color .2s ease, background .2s ease;
}
.home-command-button:hover code,
.home-command-button:focus-visible code {
  background:rgba(0,0,0,.08);
  border-color:#000;
}
.home-command-note {
  font-size:.9em;
  opacity:.65;
  letter-spacing:.04em;
  margin-left:auto;
  text-align:right;
  flex:1 1 auto;
  max-width:65%;
}
.home-option-grid {
  display:flex;
  flex-direction:column;
  gap:18px;
  width:100%;
  height:100%;
  margin:0;
}
.home-option-grid .option-item {
  position:relative;
  align-items:center;
  width:100%;
  margin:0;
  justify-content:flex-start;
  gap:18px;
  height:66px;
  padding:0;
  border:none;
  background:transparent;
  cursor:pointer;
}
.home-option-grid .option-item:hover {
  background:transparent;
  color:inherit;
}
.home-option-grid .option-item .index {
  min-width:66px;
  width:66px;
  height:66px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #fff;
  font-weight:700;
  font-size:clamp(1rem, 2vw, 1.3rem);
  flex:0 0 auto;
  color:#fff;
  position:relative;
  transition:background .2s ease, color .2s ease, border-color .2s ease;
}
.home-option-grid .option-item .label {
  width:150px;
  height:66px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:flex-start;
  border:1px solid #fff;
  padding:0 18px;
  text-transform:uppercase;
  letter-spacing:.05em;
  font-size:clamp(.95rem,1.6vw,1.15rem);
  color:#fff;
  position:relative;
  transition:background .2s ease, color .2s ease, border-color .2s ease;
}
.home-option-grid .option-item .label-secondary { display:none; }
.home-option-grid .option-item .label-primary { margin:0; }
.home-option-grid .option-item .index::after {
  content:"";
  position:absolute;
  top:50%;
  left:100%;
  width:18px;
  height:1px;
  background:#fff;
  transform:translateY(-50%);
  opacity:0;
}
.home-option-grid .option-item .label::after {
  content:"";
  position:absolute;
  top:50%;
  left:100%;
  width:18px;
  height:1px;
  background:#fff;
  transform:translateY(-50%);
  opacity:0;
}
.home-option-grid .option-item.is-selected .index {
  background:#fff;
  color:#000;
}
.home-option-grid .option-item.is-selected .index::after,
.home-option-grid .option-item.is-selected .label::after {
  opacity:1;
}
.home-option-grid .option-item:hover .index,
.home-option-grid .option-item:hover .label {
  background:#fff;
  color:#000;
}
.home-option-grid .option-item:hover .index::after,
.home-option-grid .option-item:hover .label::after {
  opacity:1;
}
#quadro[data-stage="home"] .terminal-line.home-option-detail {
  position: fixed;
  top: 48px;
  left: 270px;
  width: 330px;
  height: 270px;
  max-width: 330px;
  max-height: 270px;
  padding: 0;
}
#quadro[data-stage="home"] .terminal-line.home-option-detail .home-option-detail-card {
  width:312px;
  height:234px;
  margin-left:18px;
  margin-top:18px;
  border:1px solid #fff;
  background:#000;
  color:#fff;
  padding:24px;
  display:flex;
  flex-direction:column;
  gap:18px;
  transition:background .2s ease, color .2s ease, border-color .2s ease;
}
.home-option-detail-title {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  letter-spacing:.06em;
  text-transform:uppercase;
}
.home-option-detail-text {
  font-size: clamp(.9rem, 1.4vw, 1.05rem);
  line-height:1.4;
  opacity:.8;
}
.home-option-detail-card.is-active,
.home-option-detail-card:hover {
  background:#fff;
  color:#000;
}

/* Telas dedicadas */
.app-screen {
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  gap:.6rem;
  border:1px solid #fff;
  background:#000;
  padding:clamp(.8rem,1.8vw,1.1rem);
  overflow:hidden;
}
.app-screen-heading {
  margin:0;
  font-size:clamp(1rem,2.2vw,1.35rem);
  letter-spacing:.06em;
  text-transform:uppercase;
}
.app-screen-subtitle,
.app-screen-footer {
  margin:0;
  font-size:clamp(.78rem,1.35vw,.92rem);
  letter-spacing:.04em;
  opacity:.75;
}
.app-screen-footer { opacity:.6; }
.help-screen-list {
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:.35rem;
  font-size:clamp(.8rem,1.6vw,.95rem);
  letter-spacing:.04em;
}
.help-screen-list li { padding-left:.2rem; }
.config-option-list {
  flex:1 1 auto;
  overflow:hidden;          /* D2: nunca rolar, sem vazamento */
  position: relative;       /* para pager absoluto */
}

/* Pager da lista de config (inserido via JS) */
.config-pager {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .2rem .4rem;
  border-top: 1px solid #fff;
  font-size: clamp(.7rem,1.1vw,.85rem);
  background: #000;
}
.config-pager button {
  background:#000;
  color:#fff;
  border:1px solid #fff;
  padding:.1rem .5rem;
  font: inherit;
  text-transform: lowercase;
  cursor:pointer;
}
.config-pager button:hover,
.config-pager button:focus-visible {
  background:#fff;
  color:#000;
  outline:none;
}
.config-status {
  margin:0;
  font-size:clamp(.75rem,1.3vw,.9rem);
  letter-spacing:.04em;
  opacity:.75;
}
.login-form {
  display:flex;
  flex-direction:column;
  gap:.45rem;
}
.login-line {
  display:flex;
  align-items:center;
  gap:.6rem;
  font-size:clamp(.82rem,1.5vw,.95rem);
  letter-spacing:.04em;
}
.login-label {
  flex:0 0 auto;
  min-width:7ch;
  text-transform:lowercase;
}
.login-value {
  flex:1 1 auto;
  min-height:1.2rem;
  border-bottom:1px solid rgba(255,255,255,.45);
  padding-bottom:.15rem;
  letter-spacing:.05em;
  word-break:break-word;
}
.login-value.is-empty {
  opacity:.45;
}
.login-option {
  align-self:flex-start;
  background:#000;
  color:#fff;
  border:1px solid #fff;
  padding:.35rem .8rem;
  font:inherit;
  letter-spacing:.04em;
  text-transform:lowercase;
  cursor:pointer;
  transition:background .15s ease, color .15s ease;
}
.login-option:hover,
.login-option:focus-visible {
  background:#fff;
  color:#000;
  outline:none;
}
.login-status {
  margin:0;
  font-size:clamp(.78rem,1.35vw,.92rem);
  letter-spacing:.04em;
  opacity:.75;
}

/* Prompt embutido */
#prompt-panel {
  flex: 0 0 auto;
  width:100%;
  margin-top:auto;
  display:flex;
}
#prompt-panel[hidden] { display: none !important; }
#quadro[data-mode="ui"] #prompt-panel { display:none; }
#quadro[data-mode="ui"][data-ui-prompt="visible"] #prompt-panel { display:flex; }
#quadro[data-mode="terminal"] #prompt-panel { display:flex; }
#terminal-prompt {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  column-gap:0;
  row-gap:.45rem;
  padding: clamp(.55rem,1vw,.85rem) clamp(.55rem,1vw,.85rem);
  background:#000;
  min-width: 0;
  overflow: hidden;
  min-height: clamp(3.4rem, 7vw, 5.2rem);
}
.prompt-label {
  color:#fff;
  letter-spacing:.06em;
  flex:0 0 auto;
  font-size:clamp(.75rem,1.3vw,.95rem);
  white-space: nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.terminal-input {
  flex: 1 1 auto;
  min-height: clamp(2.2rem, 4.5vw, 3.2rem);
  padding:.1rem .1rem .35rem;
  background:transparent;
  color:#fff;
  outline:none;
  border:none;
  caret-color: transparent;
  white-space: pre-wrap;
  word-break: break-word;
  min-width:0;
  position: relative;
  font-size:clamp(.72rem,1.25vw,.88rem);
  line-height:1.4;
}
.terminal-input[data-mode="virtual"] { cursor: default; }
.terminal-input:empty::before { content: attr(data-placeholder); color: rgba(255,255,255,.35); }
.terminal-input::after {
  content: "_";
  display: inline-block;
  margin-left: 0;
  animation: prompt-cursor-blink 1s steps(2, start) infinite;
}

#quadro[data-mode="terminal"] .terminal-input,
#quadro[data-mode="ui"][data-ui-prompt="visible"] .terminal-input {
  caret-color: transparent;
}

@keyframes prompt-cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Cartas */
.cartas-host {
  position:fixed;
  inset:0;
  z-index:60;
  background:transparent;
  display:block;
  pointer-events:auto;
}
.cartas-app-shell {
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:auto;
}
.cartas-board-wrapper {
  position:absolute;
  border:none;
  background:transparent;
  overflow:hidden;
  pointer-events:auto;
  z-index:70;
}
.cartas-board-stage {
  position:relative;
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  gap:.45rem;
}
.cartas-board-surface {
  flex:1 1 auto;
  width:100%;
  height:100%;
  border:none;
  background:transparent;
  cursor:crosshair;
}
.cartas-panel-host {
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:auto;
  padding:clamp(.8rem, 1.8vw, 1.5rem);
  z-index:120;
}
.cartas-control-panel {
  width:min(520px, 100%);
  border:1px solid rgba(255,255,255,.45);
  background:rgba(0,0,0,.78);
  box-shadow:0 8px 26px rgba(0,0,0,.45);
  padding:clamp(.8rem, 1.8vw, 1.4rem);
  display:flex;
  flex-direction:column;
  gap:.85rem;
}
.cartas-control-heading {
  display:flex;
  flex-direction:column;
  gap:.25rem;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.cartas-control-heading span {
  font-size:clamp(.75rem,1.2vw,.9rem);
  text-transform:none;
  letter-spacing:.04em;
  opacity:.8;
}
.cartas-control-section {
  display:flex;
  flex-direction:column;
  gap:.45rem;
}
.cartas-control-section h4 {
  margin:0;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:clamp(.72rem,1.1vw,.9rem);
  opacity:.85;
}
.cartas-module-note {
  font-size:clamp(.7rem,1vw,.85rem);
  letter-spacing:.04em;
  text-transform:uppercase;
  opacity:.7;
}
.cartas-dimension-info {
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:.45rem;
  text-transform:uppercase;
  letter-spacing:.06em;
}
.cartas-dimension-info strong {
  font-size:clamp(1rem,1.8vw,1.35rem);
}
.cartas-dimension-form {
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:.45rem;
}
.cartas-dimension-form label {
  display:flex;
  flex-direction:column;
  font-size:clamp(.72rem,1vw,.85rem);
  letter-spacing:.04em;
  text-transform:uppercase;
}
.cartas-dimension-form input {
  margin-top:.2rem;
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.5);
  color:#fff;
  padding:.3rem .4rem;
  font:inherit;
}
.cartas-dimension-actions {
  grid-column: span 2;
  display:flex;
  gap:.4rem;
}
.cartas-dimension-actions button {
  flex:1 1 auto;
  border:1px solid rgba(255,255,255,.45);
  background:transparent;
  color:#fff;
  text-transform:uppercase;
  letter-spacing:.06em;
  padding:.35rem .6rem;
  cursor:pointer;
}
.cartas-control-list {
  display:flex;
  flex-wrap:wrap;
  gap:.35rem;
}
.cartas-control-list.is-compact button {
  flex:1 1 auto;
}
.cartas-control-list button {
  border:1px solid rgba(255,255,255,.35);
  background:transparent;
  color:#fff;
  padding:.35rem .6rem;
  font:inherit;
  letter-spacing:.05em;
  text-transform:uppercase;
  cursor:pointer;
}
.cartas-control-list button:hover,
.cartas-control-list button:focus-visible,
.cartas-dimension-actions button:hover,
.cartas-dimension-actions button:focus-visible {
  background:#fff;
  color:#000;
  outline:none;
}
.cartas-control-list button.is-active {
  background:#fff;
  color:#000;
}
.cartas-card {
  position:absolute;
  left:0;
  top:0;
  width: min(38vw, 140px);
  max-width: 160px;
  min-height: 80px;
  padding:.55rem;
  border-radius:.35rem;
  transform: translate3d(var(--card-x, 0), var(--card-y, 0), 0);
  color:#000;
  background:#f4c095;
  display:flex;
  flex-direction:column;
  gap:.35rem;
  box-shadow:0 4px 14px rgba(0,0,0,.35);
}
.cartas-card-title {
  font-size:clamp(.78rem, 1.3vw, .95rem);
  text-transform:uppercase;
  letter-spacing:.06em;
}
.cartas-card-note {
  font-size:clamp(.7rem, 1.15vw, .85rem);
  letter-spacing:.04em;
}
.cartas-toolbar {
  display:flex;
  gap:.5rem;
  justify-content:space-between;
}
.cartas-toolbar-button {
  flex:1 1 auto;
  border:1px solid #fff;
  background:#000;
  color:#fff;
  font:inherit;
  letter-spacing:.04em;
  text-transform:lowercase;
  padding:.45rem .65rem;
  cursor:pointer;
  transition:background .15s ease, color .15s ease;
}
.cartas-toolbar-button:hover,
.cartas-toolbar-button:focus-visible {
  background:#fff;
  color:#000;
  outline: none;
}
.cartas-presets-panel {
  position:absolute;
  top:.4rem;
  right:.4rem;
  display:flex;
  flex-direction:column;
  gap:.35rem;
  border:1px solid rgba(255,255,255,.4);
  background:rgba(0,0,0,.65);
  padding:.35rem;
  z-index:3;
  max-width: 150px;
}
.cartas-presets-toggle {
  background:transparent;
  border:1px solid #fff;
  color:#fff;
  font:inherit;
  text-transform:uppercase;
  letter-spacing:.08em;
  cursor:pointer;
  padding:.25rem .45rem;
}
.cartas-presets-list {
  display:none;
  flex-direction:column;
  gap:.25rem;
}
.cartas-presets-panel[data-open="true"] .cartas-presets-list {
  display:flex;
}
.cartas-preset-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:.35rem;
  font-size:clamp(.65rem,1vw,.8rem);
}
.cartas-preset-row button {
  border:1px solid #fff;
  background:transparent;
  color:#fff;
  font:inherit;
  letter-spacing:.04em;
  cursor:pointer;
  padding:.2rem .4rem;
}
.cartas-preset-row button:hover,
.cartas-preset-row button:focus-visible {
  background:#fff;
  color:#000;
  outline:none;
}
.cartas-toast {
  position:absolute;
  bottom:.5rem;
  right:.5rem;
  background:rgba(0,0,0,.8);
  color:#fff;
  padding:.4rem .6rem;
  border:1px solid rgba(255,255,255,.35);
  font-size:clamp(.65rem,1vw,.8rem);
  letter-spacing:.04em;
  opacity:0;
  transition:opacity .2s ease;
  pointer-events:none;
}
.cartas-toast[data-visible="true"] {
  opacity:1;
}
.cartas-component-panel {
  position:absolute;
  left:.4rem;
  bottom:.4rem;
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.65);
  padding:.4rem;
  display:flex;
  flex-direction:column;
  gap:.4rem;
  z-index:3;
}
.cartas-component-panel h4 {
  margin:0;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:clamp(.72rem,1vw,.85rem);
}
.cartas-component-list {
  display:flex;
  flex-direction:column;
  gap:.3rem;
}
.cartas-component-list button {
  border:1px solid #fff;
  background:transparent;
  color:#fff;
  font:inherit;
  letter-spacing:.06em;
  padding:.3rem .5rem;
  text-transform:uppercase;
  cursor:pointer;
}
.cartas-component-list button:hover,
.cartas-component-list button:focus-visible {
  background:#fff;
  color:#000;
  outline:none;
}

/* Teclado virtual */
/* Estados compactos */
#quadro[data-density="compact"] {
  --hud-status-height: 10px;
}
#quadro[data-density="compact"] #terminal-stack {
  gap: clamp(.3rem, 1.1vh, .5rem);
}
#quadro[data-density="compact"] #hud {
  gap:.3rem;
  font-size: clamp(.66rem,1.2vw,.85rem);
}
#quadro[data-density="compact"] .hud-meta {
  padding:0 .35rem;
}
#quadro[data-density="compact"] #terminal-panel {
  padding: clamp(.45rem,.95vw,.7rem);
}
#quadro[data-density="compact"] #terminal-output {
  gap:.28rem;
}
#quadro[data-density="compact"] #terminal-prompt {
  padding: clamp(.45rem,.9vw,.7rem) clamp(.45rem,.9vw,.7rem);
  min-height: clamp(3rem, 6vw, 4.4rem);
}
#quadro[data-density="compact"] .prompt-label {
  font-size: clamp(.7rem,1.05vw,.88rem);
}
#quadro[data-density="compact"] .terminal-input {
  min-height: clamp(1.9rem, 4vw, 2.8rem);
  font-size: clamp(.68rem,1.1vw,.82rem);
  line-height:1.3;
}
#quadro[data-density="compact"] #interaction-panel {
  gap: clamp(.3rem, 1vh, .55rem);
}
#quadro[data-density="compact"] .terminal-line {
  font-size: clamp(.72rem,1.2vw,.88rem);
  line-height:1.3;
}
#quadro[data-density="compact"] .option-item {
  padding:.35rem .5rem;
}
#quadro[data-density="compact"] .app-screen {
  padding:clamp(.65rem,1.4vw,.95rem);
  gap:.45rem;
}
#quadro[data-density="compact"] .placeholder-root {
  padding:clamp(.7rem,2.1vw,1.1rem);
  gap:.45rem;
}
#quadro[data-density="compact"] .virtual-keyboard {
  gap:.45rem;
  padding:.35rem;
}
#quadro[data-density="compact"] .virtual-keyboard button {
  padding:.25rem .5rem;
  font-size:.72rem;
}
#quadro[data-density="compact"] .virtual-keyboard .vk-key-backspace,
#quadro[data-density="compact"] .virtual-keyboard .vk-key-enter {
  font-size: clamp(1rem, 1.7vw, 1.4rem);
}
#quadro[data-density="compact"] .vk-nav button,
#quadro[data-density="compact"] .vk-numpad button {
  font-size:.78em;
}
#quadro[data-density="compact"] .vk-alpha {
  gap:.25rem;
  --vk-alpha-key-max-size: clamp(1.6rem, 1vw + 1.1rem, 2rem);
  --vk-alpha-key-min-size: clamp(1rem, 0.5vw + 0.7rem, 1.6rem);
}
#quadro[data-density="ultra"] #terminal-stack { gap: clamp(.25rem, .9vh, .45rem); }
#quadro[data-density="ultra"] #terminal-panel { padding: clamp(.4rem,.85vw,.6rem); }
#quadro[data-density="ultra"] #terminal-prompt {
  min-height: clamp(2.6rem, 5.5vw, 3.6rem);
  padding: clamp(.4rem,.8vw,.65rem);
}
#quadro[data-density="ultra"] .terminal-input {
  min-height: clamp(1.6rem, 3.5vw, 2.4rem);
  font-size: clamp(.64rem,1vw,.78rem);
  line-height: 1.25;
}
#quadro[data-density="ultra"] .terminal-line {
  font-size: clamp(.68rem,1.1vw,.84rem);
  line-height: 1.25;
}
#quadro[data-density="ultra"] .vk-alpha {
  --vk-alpha-key-max-size: clamp(1.35rem, 0.8vw + 0.9rem, 1.8rem);
  --vk-alpha-key-min-size: clamp(.9rem, 0.4vw + .6rem, 1.3rem);
  gap:.2rem;
}
#quadro[data-density="compact"] .login-line {
  gap:.45rem;
}

/* Teclado virtual */
.virtual-keyboard {
  --vk-button-size: 1.85em;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:.65rem;
  padding: 0;
  border:none;
  background:transparent;
  width: 126px;
  max-width: 126px;
  position:absolute;
  top: 0;
  right: 18px;
  bottom: 18px;
  left: auto;
  height: calc(100% - 18px);
  margin: 0;
  box-sizing:border-box;
}
#interaction-panel.has-home-keyboard .vk-home-nav-shell {
  position: absolute;
  top: 48px;
  right: 0;
  width: 102px;
  height: 600px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
#interaction-panel.has-home-keyboard .vk-home-nav-inner {
  position: absolute;
  top: 0;
  right: 48px;
  width: 36px;
  height: 144px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.vk-nav.vk-nav-home {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 36px;
}
.vk-nav.vk-nav-home button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
}
#interaction-panel.has-home-keyboard .vk-nav-home button,
#interaction-panel.has-home-keyboard .vk-numpad-home button {
  border: 1px solid #fff;
  background:#000;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
  border-radius:0;
}
#interaction-panel.has-home-keyboard .vk-nav-home button:hover,
#interaction-panel.has-home-keyboard .vk-nav-home button:focus-visible,
#interaction-panel.has-home-keyboard .vk-nav-home button:active,
#interaction-panel.has-home-keyboard .vk-nav-home button.is-pointer-hover,
#interaction-panel.has-home-keyboard .vk-nav-home button.is-active,
#interaction-panel.has-home-keyboard .vk-numpad-home button:hover,
#interaction-panel.has-home-keyboard .vk-numpad-home button:focus-visible,
#interaction-panel.has-home-keyboard .vk-numpad-home button:active,
#interaction-panel.has-home-keyboard .vk-numpad-home button.is-pointer-hover,
#interaction-panel.has-home-keyboard .vk-numpad-home button.is-active {
  background:#fff;
  color:#000;
  border-color:#000;
  outline:none;
}
#interaction-panel.has-home-keyboard .vk-home-number-shell {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 720px;
  height: 72px;
}
#interaction-panel.has-home-keyboard .vk-home-number-inner {
  position: absolute;
  left: 84px;
  bottom: 18px;
  width: 468px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
#interaction-panel.has-home-keyboard .vk-numpad-home {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: center;
  justify-content: flex-start;
}
#interaction-panel.has-home-keyboard .vk-numpad-home button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: clamp(.9rem, 1vw, 1rem);
}
.virtual-keyboard[data-mode="compact"] {
  gap:.45rem;
}
.vk-compact-row {
  display:flex;
  gap:.45rem;
  width:100%;
}
.vk-compact-row button {
  flex:1 1 0;
  white-space:nowrap;
}
.vk-compact-row .vk-toggle-key {
  flex:0 0 auto;
  min-width: clamp(6ch, 10vw, 9ch);
}
.vk-compact-row.is-expanded {
  margin-bottom:.25rem;
}
.vk-expanded-layout {
  position: relative;
  display:block;
  width:100%;
  height:100%;
  padding: 0;
  box-sizing:border-box;
}
.vk-side-controls {
  display:flex;
  flex-direction:column;
  gap:.45rem;
  align-items:flex-end;
  justify-content:flex-end;
  flex:0 0 auto;
  justify-self:flex-start;
  position:absolute;
  top: 156px;
  right: 0;
  width: 126px;
}
.vk-side-controls .vk-command-button {
  min-width: clamp(3.2rem, 5vw, 4.2rem);
}
.vk-nav-wrapper {
  display:flex;
  justify-content:center;
  align-items:center;
  width: 126px;
  height: 126px;
  justify-self:center;
  flex:0 0 auto;
  position:absolute;
  top: 6px;
  right: 0;
}
.vk-nav-wrapper .vk-nav {
  width:100%;
  height:100%;
  margin:0;
}
.vk-numpad-wrapper {
  display:flex;
  justify-content:center;
  align-items:center;
  width: 126px;
  height: 126px;
  flex:0 0 auto;
  justify-self:flex-end;
  position:absolute;
  top: 396px;
  right: 0;
  bottom: auto;
}
.vk-numpad-wrapper .vk-numpad {
  width:100%;
  height:100%;
  margin:0;
}
.virtual-keyboard[data-mode="login"] {
  gap:.85rem;
}
.virtual-keyboard button {
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.3);
  color:#fff;
  padding:.3rem .6rem;
  border-radius:0;
  font-size:.8rem;
  text-transform:lowercase;
  letter-spacing:.04em;
}
.virtual-keyboard button:hover:not(.vk-command-button),
.virtual-keyboard button.is-pointer-hover:not(.vk-command-button) {
  background:#fff;
  color:#000;
}
.virtual-keyboard button:focus-visible,
.virtual-keyboard button:active {
  background:#fff;
  color:#000;
  outline: none;
}
.virtual-keyboard .vk-key-backspace,
.virtual-keyboard .vk-key-enter {
  border: none;
  background: transparent;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1;
  padding: 0;
  text-transform: none;
  min-width: 0;
}
.virtual-keyboard .vk-key-backspace:focus-visible,
.virtual-keyboard .vk-key-enter:focus-visible {
  outline:1px dashed #fff;
  outline-offset:2px;
}
.virtual-keyboard .vk-key-backspace:active,
.virtual-keyboard .vk-key-enter:active {
  background: transparent;
  color:#fff;
  transform: scale(1.05);
}
.virtual-keyboard .vk-toggle-key[aria-pressed="true"] {
  background:#fff;
  color:#000;
}
.vk-command-button {
  border:1px solid rgba(255,255,255,.3);
  background:rgba(255,255,255,.1);
  color:#fff;
  border-radius:.45rem;
  font-size:clamp(.78rem,1.2vw,.92rem);
  font-weight:600;
  letter-spacing:.05em;
  text-transform:lowercase;
  padding:.45rem 1rem;
  justify-content:center;
  min-height:clamp(2.4rem, 3vw, 2.8rem);
}
.vk-command-button:hover,
.vk-command-button:focus-visible,
.vk-command-button.is-pointer-hover {
  background:rgba(255,255,255,.2);
  color:#fff;
  outline:none;
}
.vk-command-primary {
  background:#fff;
  color:#000;
}
.vk-command-primary:hover,
.vk-command-primary:focus-visible,
.vk-command-primary.is-pointer-hover {
  background:rgba(255,255,255,.85);
  color:#000;
}
.vk-keyboard-button {
  padding:.35rem .65rem;
  min-width: clamp(3.8rem, 5vw, 4.5rem);
}
.vk-keyboard-icon {
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:2px;
  width:100%;
  height:100%;
}
.vk-keyboard-icon .vk-keyboard-key,
.vk-keyboard-icon .vk-keyboard-space {
  border:1px solid currentColor;
  border-radius:2px;
  display:block;
  height:6px;
}
.vk-keyboard-icon .vk-keyboard-space {
  grid-column: span 4;
  height:8px;
  margin-top:2px;
}
.vk-default-layout {
  display:grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items:center;
  gap:.6rem;
  width:100%;
}
.virtual-keyboard .vk-mode-toggle {
  align-self:center;
  border-radius:999px;
  letter-spacing:.2em;
  text-transform:lowercase;
  margin-top:.35rem;
}
.virtual-keyboard .vk-mode-toggle:hover,
.virtual-keyboard .vk-mode-toggle:focus-visible {
  background:#fff;
  color:#000;
  outline:none;
}
.vk-commands {
  display:flex;
  flex-direction:column;
  gap:.35rem;
  align-items:stretch;
}
.vk-commands button {
  justify-content:flex-start;
  min-width:8ch;
}
.vk-shortcuts {
  display:flex;
  gap:.4rem;
  flex-wrap:wrap;
  justify-content:flex-start;
}
.vk-nav {
  display:grid;
  grid-template-columns: repeat(3, 36px);
  grid-template-rows: repeat(3, 36px);
  gap:9px;
  justify-items:center;
  align-items:center;
}
.vk-default-layout .vk-nav {
  justify-self:center;
}
.vk-nav button {
  width: 36px;
  height: 36px;
  padding:0;
  font-size:.9em;
  text-transform:none;
}
.vk-nav-spacer {
  visibility:hidden;
  pointer-events:none;
  width: 36px;
  height: 36px;
}
.vk-numpad {
  display:grid;
  grid-template-columns: repeat(3, 36px);
  gap:9px;
  justify-items:center;
}
.vk-default-layout .vk-numpad {
  justify-self:end;
}
.vk-numpad button {
  width: 36px;
  height: 36px;
  padding:0;
  font-size:.85em;
  text-transform:none;
}
.vk-numpad button.is-active {
  background:#fff;
  color:#000;
}
.vk-numpad button:disabled {
  opacity:.35;
  cursor:not-allowed;
}
.vk-alpha {
  --vk-alpha-key-max-size: clamp(1.9rem, 1.2vw + 1.4rem, 2.4rem);
  --vk-alpha-key-min-size: clamp(1.2rem, 0.6vw + 0.9rem, 1.8rem);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:.35rem;
  width:100%;
}
.vk-alpha-row {
  display:flex;
  flex-wrap: wrap;          /* caber sem rolagem */
  justify-content:center;
  gap:.35rem;
  width:100%;
  max-width:100%;
  margin:0 auto;
  overflow:hidden;          /* D2: sem barra horizontal */
}
#quadro[data-density="compact"] .vk-alpha-row {
  gap:.3rem;
}
#quadro[data-density="ultra"] .vk-alpha-row {
  gap:.22rem;
}
.virtual-keyboard[data-mode="login"] .vk-alpha-row button {
  flex:0 0 var(--vk-alpha-key-max-size);
  width:var(--vk-alpha-key-max-size);
  max-width: var(--vk-alpha-key-max-size);
  min-width: var(--vk-alpha-key-min-size);
}
.virtual-keyboard[data-mode="login"] .vk-key-backspace {
  text-transform:none;
}

/* App host genérico */
.app-pane {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  gap: .6rem;
}

/* Galeria */
.gallery-root {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.gallery-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: .35rem;
  overflow: hidden;
}
.gallery-grid[hidden] { display: none !important; }
.gallery-tile {
  position: relative;
  border: 1px solid #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.gallery-tile.is-selected {
  box-shadow: inset 0 0 0 2px #fff;
}
.gallery-tile img,
.gallery-tile canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-tile.is-empty {
  opacity: .18;
  cursor: default;
  border-style: dashed;
}

/* Tela cheia (dentro do terminal) */
.gallery-fullview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  border: none;
}
.gallery-fullview[hidden] { display: none !important; }
.gallery-fullview img,
.gallery-fullview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Placeholders (Studio/Biblioteca) */
.placeholder-root {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .6rem;
  text-align: center;
  border: 1px dashed #fff;
  padding: clamp(.9rem,2.6vw,1.4rem);
}
.placeholder-root h2 {
  margin: 0;
  font-size: clamp(1rem,2.2vw,1.35rem);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.placeholder-root p {
  margin: 0;
  font-size: clamp(.8rem,1.6vw,.95rem);
  letter-spacing: .05em;
}
.placeholder-root .placeholder-hint {
  opacity: .7;
}

/* Animações e responsivo */
@keyframes line-in { to { opacity:1; transform: translateY(0); } }
@keyframes spin    { 0% { transform: rotate(0deg);} 100% { transform: rotate(360deg);} }

@media (max-width: 740px) {
  .prompt-label { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-line { animation: none; opacity: 1; transform: none; }
}

/* ===== Tokens adicionais ===== */
:root {
  --console-size: 90vmin;               /* lado do quadrado em uso */
  --console-size-sticky: 0px;           /* última medida “grudada” */
  --vk-vertical-min: 240px;             /* min-width do VK vertical */
  --stack-gap: clamp(.45rem, 1.5vh, .75rem);
}

/* ===== Estados de layout ===== */
/* terminal-only: só o console, centrado */
#quadro[data-layout="terminal-only"] #hud,
#quadro[data-layout="terminal-only"] #interaction-panel { display: none !important; }
#quadro[data-layout="terminal-only"] #workbench { display:flex; align-items:center; justify-content:center; }
#quadro[data-layout="terminal-only"] #terminal-panel { margin: 0 auto; }

/* portrait-narrow: hud + console; sem VK; sem acesso ao terminal via UI */
#quadro[data-layout="portrait-narrow"] #interaction-panel { display: none !important; }
#quadro[data-layout="portrait-narrow"][data-mode="ui"] #prompt-panel { display: none !important; }

/* portrait-compact: hud + console + VK; input do terminal oculto em modo UI */
#quadro[data-layout="portrait-compact"][data-mode="ui"]:not([data-ui-prompt="visible"]) #prompt-panel { display: none !important; }

/* landscape-split: hud no topo, linha com console à esquerda e VK vertical à direita */
#quadro[data-layout="landscape-split"] #workbench {
  display:grid;
  grid-template-columns: 1fr auto; /* console cresce, VK colado à direita */
  align-items:stretch;
  gap: var(--stack-gap);
}
#quadro[data-layout="landscape-split"] #virtual-keyboard {
  width: 126px;
  min-width: 126px;
}

/* Console sempre quadrado */
#terminal-panel {
  aspect-ratio: 1 / 1;
  width: min(100%, var(--console-size));
  max-height: min(100%, var(--console-size));
}
.home-option-grid .option-item:hover,
.home-option-grid .option-item.is-selected {
  background:transparent;
  color:inherit;
}
