.scroll-choreography { position: relative; min-height: 210vh; padding-block: 12px 28px; }
.scroll-choreography.stage-disabled { display: none !important; }
.sticky-stage { position: sticky; top: 58px; z-index: 10; }
.stage-shell { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); overflow: hidden; }
.stage-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.mono-label { font-family: ui-monospace, monospace; font-size: 11px; color: var(--blue); display: block; }
.stage-title { font-size: 1.15rem; }
.stage-expand-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* Barra Flutuante de Tela Cheia (Sempre visível no topo acima do dispositivo expandido) */
.expanded-dock-bar {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 220;
  width: min(760px, calc(100vw - 16px));
  background: rgba(17, 17, 23, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--emerald);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.85);
}
.expanded-dock-bar[hidden] { display: none !important; }
.expanded-dock-info { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); }
.expanded-dock-actions { display: flex; align-items: center; gap: 6px; }

.expanded-outside-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(3, 3, 5, 0.82);
  backdrop-filter: blur(6px);
}
.expanded-outside-backdrop[hidden] { display: none !important; }

body.os-device-expanded { overflow: hidden !important; }

/* Popover de Configurações Globais */
.config-popover { position: absolute; right: 0; top: 42px; z-index: 65; width: min(275px, 88vw); background: #15151B; border: 1px solid rgba(255,255,255,0.16); border-radius: 14px; padding: 10px; display: grid; gap: 8px; box-shadow: 0 18px 40px rgba(0,0,0,0.75); }
.config-popover[hidden] { display: none; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text); padding: 4px 2px; }

/* Banner de Auto-Otimização */
.hw-optimize-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; font-size: 12px; color: #FDE68A;
}
.hw-optimize-bar[hidden] { display: none !important; }

/* Arena 3D Volumétrica */
.devices-arena {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  perspective: 1600px;
  transform-style: preserve-3d;
  padding-block: 16px 10px;
  position: relative;
}
.arena-dashed-guides {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   NOTEBOOK 3D VOLUMÉTRICO — MODO NORMAL E MODO TELA CHEIA (EXPANDED)
   ========================================================================== */
.laptop-3d-wrap {
  width: min(490px, 94vw);
  position: relative;
  z-index: 2;
  transform-style: preserve-3d;
  will-change: transform;
  display: flex;
  flex-direction: column;
}
.laptop-3d-wrap.expanded {
  position: fixed !important;
  inset: 54px 10px 10px 10px !important;
  width: auto !important;
  max-width: none !important;
  height: calc(100dvh - 64px) !important;
  z-index: 200 !important;
  background: #09090B;
  border: 2px solid var(--emerald);
  border-radius: 16px;
  padding: 10px;
  display: flex !important;
  flex-direction: column !important;
  transform: none !important;
  perspective: none !important;
  transform-style: flat !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.92);
}
.laptop-3d-wrap.expanded .laptop-3d-rig,
.laptop-3d-wrap.expanded .laptop-lid-3d,
.laptop-3d-wrap.expanded .laptop-front-face {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
  transform: none !important;
  transform-style: flat !important;
}
.laptop-3d-wrap.expanded .laptop-base-3d,
.laptop-3d-wrap.expanded .laptop-lid-thickness,
.laptop-3d-wrap.expanded .laptop-back-face,
.laptop-3d-wrap.expanded .resize-down-handle {
  display: none !important;
}

.laptop-3d-rig {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  display: flex;
  flex-direction: column;
}

.laptop-lid-3d {
  position: relative;
  transform-style: preserve-3d;
  height: var(--pc-screen-h, 275px);
  border-radius: 14px 14px 4px 4px;
  display: flex;
  flex-direction: column;
}

.laptop-front-face {
  position: relative;
  z-index: 3;
  transform: translateZ(7px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #121217;
  border: 2px solid #2E2E3B;
  border-radius: 14px 14px 4px 4px;
  overflow: hidden;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 38px rgba(0,0,0,0.6);
}

.laptop-back-face {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform: rotateY(180deg) translateZ(7px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: linear-gradient(145deg, #2B2B37, #14141B);
  border: 2px solid #48485A;
  border-radius: 14px 14px 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.laptop-lid-thickness {
  position: absolute;
  inset: 0;
  border-radius: 14px 14px 4px 4px;
  background: linear-gradient(90deg, #3A3A48, #1E1E26, #3A3A48);
  border: 1px solid #525266;
  transform: translateZ(0px);
  pointer-events: none;
}

.back-emblem { display: grid; justify-items: center; gap: 6px; font-weight: 700; letter-spacing: 0.14em; font-size: 12px; color: var(--text); }
.back-emblem small { font-size: 9.5px; color: var(--muted); letter-spacing: 0.2em; }

.laptop-base-3d {
  position: relative;
  transform-style: preserve-3d;
  background: linear-gradient(180deg, #292935, #171720);
  border: 1px solid #434354;
  border-top: 2px solid #525266;
  border-radius: 4px 4px 14px 14px;
  padding: 7px 10px 9px;
  transform-origin: top center;
  transform: rotateX(22deg) translateZ(4px);
  box-shadow: 0 16px 28px rgba(0,0,0,0.72);
  display: grid;
  gap: 5px;
}
.laptop-trackpad-3d { width: 88px; height: 14px; margin-inline: auto; border-radius: 5px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); }

/* Barra Única do Navegador / Servidor */
.os-window-bar, .phone-chrome-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: #181820;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 15;
  flex-shrink: 0;
}
.os-nav-btn { background: #24242F; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; font-size: 11px; cursor: pointer; flex-shrink: 0; }
.os-nav-btn:hover { border-color: var(--emerald); }
.os-close-x { background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.45); color: #FCA5A5; }
.os-url-input { flex: 1; min-width: 44px; height: 24px; background: #09090B; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0 8px; font-size: 11px; }

.os-menu-wrap { position: relative; }
.os-dropdown { position: absolute; right: 0; top: 30px; z-index: 60; min-width: 195px; background: #17171F; border: 1px solid rgba(255,255,255,0.18); border-radius: 10px; padding: 4px; display: grid; gap: 2px; box-shadow: 0 12px 24px rgba(0,0,0,0.85); }
.os-dropdown[hidden] { display: none; }
.os-dropdown button { text-align: left; background: transparent; color: var(--text); border: 0; padding: 6px 8px; border-radius: 6px; font-size: 11.5px; cursor: pointer; }
.os-dropdown button:hover { background: rgba(255,255,255,0.08); }

/* ==========================================================================
   TELA PRINCIPAL UNIFICADA (100% DE ALTURA SEM CRIAR FAIXA EMBAIXO)
   ========================================================================== */
.os-screen-area {
  flex: 1;
  min-height: 0;
  height: 100%;
  background: radial-gradient(circle at 20% 20%, #132A24 0%, #09090B 65%);
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.os-screen-area.wall-blue, .phone-screen-area.wall-blue { background: radial-gradient(circle at 80% 15%, #0C2D48 0%, #09090B 70%); }
.os-screen-area.wall-carbon, .phone-screen-area.wall-carbon { background: linear-gradient(160deg, #18181B 0%, #09090B 100%); }

.os-desktop-home { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 12px; overflow: auto; }
.os-desktop-home[hidden], .phone-home-grid[hidden] { display: none !important; }
.os-app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.phone-home-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; overflow: auto; }

.os-app-icon {
  background: rgba(17, 17, 22, 0.88);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 4px;
  color: var(--text);
  display: grid;
  justify-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.os-app-icon:hover { border-color: var(--emerald); transform: translateY(-1px); }
.os-app-icon.is-add-btn { border-style: dashed; border-color: rgba(16, 185, 129, 0.55); background: rgba(16, 185, 129, 0.08); }
.os-app-icon .ico { font-size: 18px; line-height: 1; display: grid; place-items: center; height: 22px; }
.os-app-icon .ico svg { width: 20px; height: 20px; }
.os-app-icon span:last-child { font-size: 10.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.os-taskbar { display: flex; align-items: center; justify-content: space-between; background: rgba(17,17,22,0.94); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; margin-top: 10px; flex-shrink: 0; }
.win-start-btn { background: var(--emerald); color: #032211; border: 0; border-radius: 5px; padding: 2px 8px; font-weight: 700; cursor: pointer; }
.os-clock { font-size: 11px; color: var(--muted); }

/* Área do Aplicativo / Navegador — Preenche 100% sem sobrar espaço embaixo */
.os-app-view {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0B0B0F;
  padding: 0;
  overflow: hidden;
  font-size: 12px;
}
.os-app-view[hidden] { display: none !important; }

.app-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 10px;
  background: #141418;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  flex-shrink: 0;
}
.app-body-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; }

.os-iframe-stage {
  width: 100%;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: auto;
  background: #0F1117;
  position: relative;
  display: flex;
  flex-direction: column;
}
.os-app-view iframe,
.app-iframe-full {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
  display: block;
}

.os-standby-screen { position: absolute; inset: 0; z-index: 25; background: radial-gradient(circle at center, #0E1015 0%, #050507 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 14px; cursor: pointer; }
.os-standby-screen[hidden] { display: none !important; }
.standby-dot { width: 8px; height: 8px; border-radius: 50%; background: #F59E0B; }

.mini-keys { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.mini-keys button { background: #2B2B36; color: var(--text); border: 1px solid rgba(255,255,255,0.12); border-radius: 5px; padding: 3px 8px; font-family: ui-monospace, monospace; font-size: 10.5px; cursor: pointer; }
.mini-keys button:hover { border-color: var(--emerald); }

/* ==========================================================================
   CELULAR 3D VOLUMÉTRICO — MODO NORMAL E MODO TELA CHEIA (EXPANDED)
   ========================================================================== */
.phone-3d-wrap {
  width: 248px;
  position: relative;
  z-index: 3;
  transform-style: preserve-3d;
  will-change: transform;
  display: flex;
  flex-direction: column;
}
.phone-3d-wrap.expanded {
  position: fixed !important;
  top: 54px !important;
  bottom: 10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: min(375px, calc(100vw - 20px)) !important;
  height: calc(100dvh - 64px) !important;
  z-index: 200 !important;
  display: flex !important;
  flex-direction: column !important;
  perspective: none !important;
  transform-style: flat !important;
}
.phone-3d-wrap.expanded .phone-3d-rig,
.phone-3d-wrap.expanded .phone-front-face {
  flex: 1 !important;
  height: 100% !important;
  min-height: 0 !important;
  transform: none !important;
  transform-style: flat !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.92);
}
.phone-3d-wrap.expanded .phone-side-left,
.phone-3d-wrap.expanded .phone-side-right,
.phone-3d-wrap.expanded .phone-back-face,
.phone-3d-wrap.expanded .resize-down-handle {
  display: none !important;
}

.phone-3d-rig {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  height: var(--mob-screen-h, 395px);
  display: flex;
  flex-direction: column;
}

.phone-side-left, .phone-side-right {
  position: absolute;
  top: 18px;
  bottom: 18px;
  width: 16px;
  background: linear-gradient(180deg, #525266, #272734, #525266);
  border-block: 1px solid #6E6E85;
  pointer-events: none;
}
.phone-side-left { left: -8px; transform: rotateY(-90deg); }
.phone-side-right { right: -8px; transform: rotateY(90deg); }

.phone-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 26px; }
.phone-front-face {
  position: relative;
  z-index: 3;
  transform: translateZ(8px);
  background: #070709;
  border: 4px solid #38BDF8;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  box-shadow: 0 22px 42px rgba(0,0,0,0.68);
}

.phone-screen-area {
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 10px;
  background: radial-gradient(circle at 20% 20%, #132A24 0%, #09090B 65%);
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.phone-screen-area.has-active-app { padding: 0 !important; }

.phone-bottom-nav { display: flex; justify-content: space-around; padding: 6px; background: #121218; border-top: 1px solid var(--border); position: relative; z-index: 15; flex-shrink: 0; }
.phone-bottom-nav button { background: transparent; border: 0; color: var(--text); font-size: 14px; padding: 2px 14px; cursor: pointer; }

.phone-back-face {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform: rotateY(180deg) translateZ(8px);
  background: linear-gradient(155deg, #2B2B38, #121218);
  border: 4px solid #48485A;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.phone-cam-module { width: 64px; height: 92px; background: #09090B; border: 1px solid rgba(255,255,255,0.18); border-radius: 16px; padding: 10px; display: grid; gap: 8px; justify-items: center; }
.cam-lens { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle, #1E293B 30%, #020617 75%); border: 2px solid #3F3F46; }
.cam-flash { width: 10px; height: 10px; border-radius: 50%; background: #FEF08A; }
.phone-back-logo { display: grid; justify-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 40px; }

.resize-down-handle { width: 100%; height: 20px; display: grid; place-items: center; cursor: ns-resize; user-select: none; touch-action: none; margin-top: 6px; flex-shrink: 0; }
.resize-down-handle span { width: 52px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.28); transition: background 0.16s ease, width 0.16s ease; }
.resize-down-handle:hover span, .resize-down-handle:active span { background: var(--emerald); width: 76px; }

/* Studio Modal & Chips */
.studio-modal-box { max-width: 780px; }
.studio-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.studio-pane { display: grid; gap: 10px; }
.studio-pane[hidden] { display: none; }
.studio-form-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
.studio-pane label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.studio-input { width: 100%; background: #09090B; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.studio-ai-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.studio-ai-bar .studio-input { flex: 1; min-width: 200px; }
.studio-files-toolbar, .studio-files-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.file-chip-btn { display: inline-flex; align-items: center; gap: 6px; background: #141418; border: 1px solid var(--border); color: var(--text); border-radius: 99px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.file-chip-btn.is-active { border-color: var(--emerald); background: rgba(16, 185, 129, 0.14); }
.file-chip-btn.is-muted { opacity: 0.5; text-decoration: line-through; }
.studio-editor-drawer { background: #09090B; border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: grid; gap: 8px; }
.studio-editor-drawer.is-collapsed .studio-code-textarea { display: none; }
.studio-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.studio-code-textarea { width: 100%; min-height: 140px; max-height: 360px; resize: vertical; background: #0D0D11; color: #E4E4E7; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: ui-monospace, monospace; font-size: 12px; }

/* Modo Economia / Animações Desligadas */
body.anim-paused .devices-arena { perspective: none; transform-style: flat; }
body.anim-paused .laptop-3d-wrap,
body.anim-paused .phone-3d-wrap,
body.anim-paused .laptop-3d-rig,
body.anim-paused .phone-3d-rig { transform: none !important; opacity: 1 !important; }

/* ==========================================================================
   ADAPTAÇÃO MOBILE (360px a 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .scroll-choreography { min-height: auto; }
  .sticky-stage { position: relative; top: 0; }
  .stage-shell { padding: 10px; border-radius: 14px; }
  .devices-arena { flex-direction: column; align-items: center; gap: 18px; padding-block: 8px 4px; }
  .laptop-3d-wrap { width: 100%; max-width: 100%; }
  .laptop-lid-3d { height: var(--pc-screen-h, 215px); }
  .phone-3d-wrap { width: min(248px, 78vw); }
  .phone-3d-rig { height: var(--mob-screen-h, 385px); }
  .studio-form-row { grid-template-columns: 1fr; }
}

