:root {
  --bg: #09090B;
  --surface: #111115;
  --surface-2: #17171D;
  --border: rgba(255, 255, 255, 0.09);
  --text: #FAFAFA;
  --muted: #A1A1AA;
  --emerald: #10B981;
  --blue: #38BDF8;
  --red: #EF4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; line-height: 1.55; scroll-behavior: smooth; }
body { min-height: 100dvh; overflow-x: clip; background: var(--bg); }
.container { width: min(1140px, 93vw); margin-inline: auto; }

.topbar { position: sticky; top: 0; z-index: 40; background: rgba(9, 9, 11, 0.9); border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; }
.ver-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--emerald); border: 1px solid var(--border); }
.top-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 600; text-decoration: none; border: 1px solid var(--border); cursor: pointer; transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background 0.16s ease; }
.btn:active { transform: scale(0.97); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-primary { background: var(--emerald); color: #032211; border-color: var(--emerald); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: rgba(239, 68, 68, 0.14); color: #FCA5A5; border-color: rgba(239, 68, 68, 0.35); }

.hero { padding: 40px 0 24px; display: grid; gap: 14px; }
.pill { width: fit-content; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--emerald); border: 1px solid var(--border); }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.7rem); line-height: 1.15; max-width: 24ch; }
.lead { color: var(--muted); max-width: 64ch; font-size: 15px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; }

.projects-section, .explorer-section, .how-section, .credits-section { padding-block: 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: 1.38rem; }
.section-head p { color: var(--muted); font-size: 13.5px; }

/* Trilhos de Projetos com movimento lateral na rolagem */
.projects-track { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; will-change: transform; transition: transform 0.15s ease-out; }
.track-right { margin-top: 14px; }
.proj-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.proj-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.proj-logo-box { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; }
.proj-logo-box img { width: 24px; height: 24px; object-fit: contain; }
.proj-card h3 { font-size: 15.5px; }
.proj-card p { font-size: 13px; color: var(--muted); }
.proj-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Explorador de Pastas */
.explorer-layout { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
@media (max-width: 720px) { .explorer-layout { grid-template-columns: 1fr; } }
.explorer-tree { display: grid; gap: 6px; align-content: start; }
.tree-btn { text-align: left; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-family: ui-monospace, monospace; font-size: 12px; cursor: pointer; }
.tree-btn.active { border-color: var(--emerald); color: var(--emerald); }
.explorer-viewer { background: #060608; border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-family: ui-monospace, monospace; font-size: 12px; color: #E4E4E7; white-space: pre-wrap; max-height: 320px; overflow: auto; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.skills-grid h3 { margin-block: 8px 4px; font-size: 15px; }
.skills-grid p { font-size: 13px; color: var(--muted); }
.tag-emerald, .tag-blue { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.tag-emerald { background: rgba(16, 185, 129, 0.14); color: var(--emerald); }
.tag-blue { background: rgba(56, 189, 248, 0.14); color: var(--blue); }

.closing-card { display: grid; gap: 12px; }
.closing-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.footer { padding-block: 24px 96px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--muted); }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; }

/* Modais */
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.82); display: grid; place-items: center; padding: 14px; }
.modal-backdrop[hidden] { display: none; }
.modal-box { width: min(760px, 95vw); max-height: 88dvh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: grid; gap: 14px; }
.modal-wide { width: min(980px, 96vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.profile-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.profile-strip img { width: 32px; height: 32px; border-radius: 50%; }
.all-projects-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

.tester-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.select-sm { height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 0 6px; font-size: 12px; }
.tester-viewport { display: grid; place-items: center; background: #050507; border-radius: 12px; padding: 14px; min-height: 420px; overflow: auto; }
.tester-frame-wrap { width: 375px; height: 540px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; }
.tester-frame-wrap iframe { width: 100%; height: 100%; border: 0; }

.auditor-body { display: grid; gap: 12px; }
.auditor-body textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-family: ui-monospace, monospace; font-size: 12px; }
.audit-results { display: grid; gap: 10px; }
.audit-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-2); padding: 8px 12px; border-radius: 8px; font-size: 12.5px; }

.terms-content { display: grid; gap: 12px; font-size: 13.5px; color: var(--muted); }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.terms-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.consent-toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 55; width: min(640px, 94vw); background: var(--surface-2); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65); touch-action: pan-y; user-select: none; }
.consent-toast[hidden] { display: none; }
.toast-text { display: grid; gap: 2px; font-size: 12.5px; }
.toast-text span { color: var(--muted); font-size: 11.5px; }
.toast-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* MODO ANIMAÇÕES DESLIGADAS (VISUAL DISTINTO ESTÁTICO 2x2) */
body.animations-off .scroll-choreography { height: auto !important; }
body.animations-off .sticky-stage { position: static !important; }
body.animations-off .projects-track { transform: none !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
body.animations-off .card, body.animations-off .proj-card { border-color: rgba(255, 255, 255, 0.2); background: #0E0E12; }
body.animations-off *, body.animations-off *::before, body.animations-off *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Polimento Responsivo Mobile (360px a 412px) */
@media (max-width: 480px) {
  .container { width: 94vw; }
  .topbar-inner { gap: 6px; padding-block: 6px; }
  .top-actions { width: 100%; justify-content: flex-start; gap: 5px; }
  .top-actions .btn-sm { padding: 0 8px; font-size: 11.5px; min-height: 28px; }
  .hero { padding-top: 24px; }
  .hero h1 { font-size: 1.52rem; }
  .hero-cta .btn { width: 100%; }
  .stage-shell { padding: 12px; }
  .stage-title { font-size: 1rem; }
  .laptop-3d-wrap { width: 100%; }
  .phone-3d-wrap { width: min(260px, 86vw); }
  .modal-box { padding: 12px; width: 96vw; }
  .tester-frame-wrap { width: 100%; max-width: 340px; height: 460px; }
  .consent-toast { padding: 10px 12px; bottom: 10px; }
  .toast-btns { width: 100%; }
  .toast-btns .btn-sm { flex: 1; }
  body.animations-off .projects-track { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  body.animations-off .proj-card { padding: 10px; }
  body.animations-off .proj-card h3 { font-size: 13.5px; }
  body.animations-off .proj-card p { font-size: 11.5px; }
}

/* Física de Micro-interações & Troca de Modo sem Glitch (Video Insights) */
.modal-box, .config-popover, .os-dropdown {
  animation: popScaleIn 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes popScaleIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
body.mode-switching *, body.mode-switching *::before, body.mode-switching *::after {
  transition: none !important;
  animation: none !important;
}

/* Grid de Créditos dos Criadores & Repositórios de Skills */
.credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-block: 6px 4px;
}
.credit-item {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}
.credit-item strong { font-size: 12.5px; color: var(--text); }
.credit-item span { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.credit-item code { font-family: ui-monospace, monospace; font-size: 10.5px; color: var(--blue); }
.credit-item a { font-size: 11.5px; color: var(--emerald); text-decoration: none; font-weight: 600; margin-top: 2px; }
.credit-item a:hover { text-decoration: underline; }
