* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --rail-bg: #0f172a;
  --border: #d5dde8;
  --border-soft: #e6ecf2;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-2: #4f46e5;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
}
html, body {
  height: 100vh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
}
body { display: flex; flex-direction: column; }

/* TOPBAR MODERNA */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-badge {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; box-shadow: 0 4px 12px rgba(37,99,235,.25);
}
.brand-row { display: flex; align-items: center; gap: 6px; }
.brand strong { font-size: 15.5px; letter-spacing: -.01em; }
.ver-pill {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #bfdbfe;
}
.brand-sub { font-size: 11px; color: var(--muted); display: block; }

.active-game-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border-soft);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #334155;
}
.chip-sep { opacity: .4; }
.top-actions { display: flex; align-items: center; gap: 7px; }

.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .14s ease;
}
.btn:hover { background: #f1f5f9; border-color: #94a3b8; }
.btn-ghost { background: var(--surface-alt); border-color: var(--border-soft); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 7px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 3px 10px rgba(37,99,235,.24);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }

/* WORKSPACE: RAIL + INSPECTOR + SIMULADOR */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 74px 430px 1fr;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: 64px 1fr; overflow-y: auto; }
  html, body { overflow: auto; height: auto; }
  .active-game-chip { display: none; }
}

/* NAV RAIL */
.nav-rail {
  background: var(--rail-bg);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.rail-btn {
  width: 58px; height: 56px;
  border: none; border-radius: 12px;
  background: transparent; color: #94a3b8;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; cursor: pointer;
  transition: all .15s ease;
}
.rail-ico { font-size: 20px; line-height: 1; }
.rail-btn:hover { background: rgba(255,255,255,.08); color: #e2e8f0; }
.rail-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(37,99,235,.4);
}

/* EDITOR PANEL */
.editor-col {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.tab-pane { display: none; flex: 1; overflow-y: auto; padding: 16px; }
.tab-pane.active { display: block; }

.pane-head { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
.pane-head h2 { font-size: 15.5px; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.pane-head p { font-size: 12px; color: var(--muted); line-height: 1.4; }
.pane-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card {
  border: 1.5px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-alt);
  cursor: pointer;
  text-align: left;
  transition: all .14s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tpl-card:hover { border-color: #93c5fd; background: #f8fbff; transform: translateY(-1px); }
.tpl-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 4px 12px rgba(37,99,235,.14);
}
.tpl-ico { font-size: 25px; }
.tpl-card strong { font-size: 12.5px; color: var(--text); }
.tpl-card span { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* ACORDEÓN DE NIVELES */
.lvl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.lvl-head {
  padding: 9px 11px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.lvl-head strong { font-size: 12.5px; color: var(--accent); }
.lvl-acts { display: flex; gap: 4px; }
.lvl-body { padding: 11px; }

.card {
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 13px;
  margin-bottom: 12px;
}
.card-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 10px; }

.field { display: block; font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 9px; }
.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 7px;
  font-size: 12px; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field textarea { font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.45; resize: vertical; }
.field input[type="color"] {
  display: block; width: 100%; height: 34px; margin-top: 4px;
  border: 1px solid var(--border); border-radius: 7px; padding: 2px; cursor: pointer;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.check-row { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-bottom: 8px; cursor: pointer; }

.media-row { display: flex; align-items: center; gap: 10px; }
.icon-preview {
  width: 58px; height: 58px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  flex-shrink: 0; overflow: hidden; border: 1px solid var(--border);
}
.icon-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-controls { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.media-controls input[type="text"] {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px;
}

.sprite-slot {
  display: flex; align-items: center; gap: 10px;
  padding: 9px; background: #fff; border: 1px solid var(--border-soft);
  border-radius: 9px; margin-bottom: 8px;
}
.sprite-thumb {
  width: 46px; height: 46px; border-radius: 8px; background: #f1f5f9;
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 24px; overflow: hidden; flex-shrink: 0;
}
.sprite-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sprite-info { flex: 1; min-width: 0; }
.sprite-info strong { display: block; font-size: 12px; }
.sprite-info small { color: var(--muted); font-size: 11px; }
.thumb-strip img { max-height: 70px; border-radius: 7px; border: 1px solid var(--border); margin-top: 6px; }

/* SIMULADOR DE SMARTPHONE REALISTA */
.preview-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(circle at 50% 25%, #f8fafc 0%, #dce4f0 100%);
}
.preview-bar {
  height: 44px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}
.sim-info { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: #334155; }
.sim-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.sim-hint { font-weight: 500; color: var(--muted); }
.preview-btns { display: flex; gap: 6px; }

.phone-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}
.phone-chassis {
  position: relative;
  height: min(695px, calc(100vh - 148px));
  aspect-ratio: 9 / 19.5;
  width: auto;
  min-height: 440px;
  max-width: 336px;
  padding: 9px;
  border-radius: 44px;
  background: linear-gradient(145deg, #475569 0%, #1e293b 40%, #0f172a 100%);
  box-shadow:
    0 28px 65px rgba(15, 23, 42, .38),
    0 4px 14px rgba(15, 23, 42, .2),
    inset 0 1px 2px rgba(255,255,255,.42),
    inset 0 -1px 2px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
}
.hw-btn {
  position: absolute;
  width: 3px;
  background: linear-gradient(180deg, #64748b, #334155);
  border-radius: 2px;
}
.hw-vol-up { left: -3px; top: 120px; height: 42px; }
.hw-vol-down { left: -3px; top: 174px; height: 42px; }
.hw-power { right: -3px; top: 145px; height: 64px; }

.phone-screen {
  flex: 1;
  min-height: 0;
  background: #020617;
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 2px solid #020617;
  position: relative;
}
.phone-statusbar {
  height: 34px;
  padding: 0 14px;
  background: #090d16;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}
.phone-island {
  width: 72px; height: 20px;
  background: #000000;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 7px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.island-cam {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #38bdf8 0%, #1e3a8a 45%, #020617 100%);
}
.sb-icons { display: flex; align-items: center; gap: 5px; font-size: 10px; opacity: .92; }
.sb-bat {
  width: 19px; height: 9px; border: 1px solid #f8fafc; border-radius: 2.5px;
  padding: 1px; display: inline-flex; align-items: center;
}
.sb-bat span { width: 82%; height: 100%; background: #4ade80; border-radius: 1px; }

.phone-viewport { flex: 1; min-height: 0; display: flex; }
#gamePreview { flex: 1; width: 100%; height: 100%; border: none; background: #0f172a; }

.phone-homebar {
  height: 18px;
  background: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.phone-homebar span {
  width: 112px; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,.45);
}

/* MODAL EXPORT */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 900; padding: 16px;
}
.modal-card {
  background: #fff; border-radius: 14px; max-width: 800px; width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,.32); overflow: hidden;
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.btn-ico { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px 20px; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.export-card {
  border: 1px solid var(--border); border-radius: 11px; padding: 14px;
  background: var(--surface-alt); display: flex; flex-direction: column; gap: 8px;
}
.export-card.highlight { border-color: #93c5fd; background: #eff6ff; }
.exp-ico { font-size: 26px; }
.export-card h4 { font-size: 13.5px; }
.export-card p { font-size: 11.5px; color: var(--muted); flex: 1; line-height: 1.45; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(30px);
  background: #0f172a; color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* TEMAS VISUALES RÁPIDOS */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.theme-chip {
  border: 1.5px solid var(--border-soft); border-radius: 9px; padding: 7px 6px;
  background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: var(--text); transition: transform .1s, border-color .12s;
}
.theme-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-sw {
  width: 100%; height: 18px; border-radius: 6px;
}

/* FOOTER JUANBE APPS */
.app-footer {
  height: 34px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  flex-shrink: 0;
  z-index: 20;
}
.footer-left, .footer-right { display: flex; align-items: center; gap: 8px; }
.app-footer a { color: var(--accent); text-decoration: none; font-weight: 600; }
.app-footer a:hover { text-decoration: underline; }
.f-sep { opacity: .4; }
.lang-badge { font-size: 11px; color: var(--muted); }
.footer-lang-sel {
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px;
  font-size: 11px; background: var(--surface-alt); color: var(--text); cursor: pointer;
}

.lang-switch {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .14s ease;
}
.lang-btn.active {
  background: var(--accent);
  color: #ffffff;
}


/* FOOTER ELABORADO 0.1 BETA */
.app-footer {
  height: auto;
  min-height: 40px;
  padding: 6px 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-brand, .footer-links {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.footer-dot { font-size: 14px; }
.footer-ver {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #bfdbfe;
}
.footer-link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.footer-link-btn:hover { color: var(--accent); text-decoration: underline; }

/* MODAL LEGAL */
.legal-card { max-width: 640px; }
.legal-body {
  max-height: 62vh;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
}
.legal-body h4 {
  font-size: 13.5px;
  color: var(--text);
  margin: 14px 0 6px;
}
.legal-body h4:first-child { margin-top: 0; }
.legal-body p { margin-bottom: 8px; }
.legal-body ul { padding-left: 18px; margin-bottom: 10px; }
.legal-body li { margin-bottom: 4px; }
.legal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  background: var(--surface-alt);
}

/* POPUP DE COOKIES (30 DÍAS) */
.cookie-popup {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 24px));
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 20px 50px rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 950;
  animation: ckSlideUp .25s ease-out;
}
@keyframes ckSlideUp {
  from { opacity: 0; transform: translate(-50%, 18px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.cookie-ico { font-size: 26px; flex-shrink: 0; }
.cookie-text { flex: 1; min-width: 0; }
.cookie-text strong { display: block; font-size: 13px; margin-bottom: 3px; color: #fff; }
.cookie-text p { font-size: 11.5px; color: #cbd5e1; line-height: 1.45; }
.cookie-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.cookie-popup .btn-ghost {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
  color: #f8fafc;
}
.cookie-popup .btn-ghost:hover { background: rgba(255,255,255,.18); }
@media (max-width: 640px) {
  .cookie-popup { flex-direction: column; align-items: flex-start; bottom: 14px; }
  .cookie-actions { width: 100%; justify-content: flex-end; }
}


/* MODAL DE AYUDA DETALLADA */
.help-card { max-width: 760px; }
.help-tabs {
  display: flex;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 14px;
  gap: 4px;
  overflow-x: auto;
}
.help-tab {
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.help-tab:hover { color: var(--text); }
.help-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.help-body {
  max-height: 60vh;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
}
.help-body h4 {
  font-size: 14px;
  color: var(--text);
  margin: 14px 0 6px;
}
.help-body h4:first-child { margin-top: 0; }
.help-body p { margin-bottom: 8px; }
.help-body ul, .help-body ol { padding-left: 20px; margin-bottom: 10px; }
.help-body li { margin-bottom: 5px; }
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
@media (max-width: 640px) { .help-grid { grid-template-columns: 1fr; } }
.help-box {
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 10px 12px;
}
.help-box strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 3px; }
.help-box span { font-size: 12px; color: var(--muted); display: block; line-height: 1.45; }
.help-tip {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12.5px;
  margin-top: 10px;
}

.sfx-preview-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 4px;
}
.sfx-preview-row .btn-sm { padding: 5px 4px; font-size: 11px; text-align: center; }
.field input[type="range"] { width: 100%; margin-top: 10px; accent-color: var(--accent); cursor: pointer; }


/* SELECTOR MÓVIL / TABLET */
.device-switch {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.dev-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .14s ease;
  font-family: inherit;
}
.dev-btn.active {
  background: var(--accent);
  color: #ffffff;
}

/* MODO TABLET EN EL SIMULADOR */
.phone-chassis.is-tablet {
  height: min(695px, calc(100vh - 148px));
  aspect-ratio: 3 / 4;
  max-width: min(540px, calc(100% - 16px));
  border-radius: 30px;
  padding: 13px;
}
.phone-chassis.is-tablet .phone-screen {
  border-radius: 20px;
}
.phone-chassis.is-tablet .phone-island {
  width: 14px;
  height: 14px;
  padding: 0;
  justify-content: center;
  background: transparent;
  box-shadow: none;
}
.phone-chassis.is-tablet .hw-vol-up { top: 80px; }
.phone-chassis.is-tablet .hw-vol-down { top: 132px; }
.phone-chassis.is-tablet .hw-power { top: 96px; }

/* EDITOR A PANTALLA COMPLETA CUANDO EL SIMULADOR ESTÁ EN POPUP / OCULTO */
.workspace.sim-detached {
  grid-template-columns: 74px 1fr;
}
.workspace.sim-detached .editor-col {
  border-right: none;
}
.workspace.sim-detached .tpl-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.workspace.sim-detached #levelsMount,
.workspace.sim-detached #graphicsMount {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  align-items: start;
}
.workspace.sim-detached #levelsMount .lvl-card,
.workspace.sim-detached #graphicsMount .card {
  margin-bottom: 0;
}

/* HEADER Y FOOTER MEJORADOS (MÁS AMPLIOS + DONACIÓN DESTACADA) */
.topbar {
  height: 68px;
  padding: 0 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .06);
}
.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 22px;
}
.brand strong { font-size: 17px; }
.brand-sub { font-size: 12px; }
.ver-pill { font-size: 10.5px; padding: 2px 8px; }
.active-game-chip {
  padding: 6px 14px;
  font-size: 12.5px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}
.top-actions { gap: 8px; }
.top-actions .btn {
  padding: 8px 13px;
  font-size: 13px;
  border-radius: 9px;
}
.btn-donate {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #ffffff !important;
  border-color: transparent !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(239, 68, 68, .28);
}
.btn-donate:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, .35);
}

/* FOOTER MEJORADO */
.app-footer {
  min-height: 58px;
  padding: 10px 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(15, 23, 42, .04);
  font-size: 13px;
  gap: 14px;
}
.footer-brand { gap: 10px; }
.footer-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.footer-brand-txt { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.footer-brand-row { display: flex; align-items: center; gap: 6px; }
.footer-brand-row strong { font-size: 14px; color: var(--text); }
.footer-by-line { font-size: 12px; color: var(--muted); }
.footer-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-donate-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #ffffff !important;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, .26);
  transition: transform .14s ease, filter .14s ease;
}
.footer-donate-cta:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}
.footer-links { gap: 9px; font-size: 12.5px; }
.footer-link-btn { font-size: 12.5px; }
.lang-switch { padding: 3px; }
.lang-btn { font-size: 11.5px; padding: 4px 11px; }
.cookie-popup { bottom: 68px; }

/* AJUSTE ALTURA CHASIS ACOPLADO PARA QUE NO HAYA SCROLL EN 100VH */
.phone-chassis {
  height: min(668px, calc(100vh - 182px));
}
.phone-chassis.is-tablet {
  height: min(668px, calc(100vh - 182px));
}

/* SIMULADOR POPUP: TELÉFONO O TABLET REAL FLOTANTE SIN MÁRGENES NI CAJA EXTERIOR */
.popup-grip { display: none; font-size: 14px; opacity: .7; cursor: grab; padding: 0 2px; }

.preview-col.is-popup {
  position: fixed;
  top: 76px;
  right: 26px;
  width: auto;
  height: auto;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
  z-index: 820;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.preview-col.is-popup.is-hidden {
  display: none;
}
.preview-col.is-popup .preview-bar {
  pointer-events: auto;
  height: 36px;
  padding: 0 8px;
  gap: 6px;
  width: fit-content;
  border-radius: 999px;
  background: rgba(15, 23, 42, .88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .38);
  cursor: move;
  user-select: none;
}
.preview-col.is-popup .popup-grip { display: inline-block; color: #cbd5e1; }
.preview-col.is-popup .sim-dot,
.preview-col.is-popup .sim-title-txt { display: none; }
.preview-col.is-popup .device-switch {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .16);
}
.preview-col.is-popup .dev-btn {
  color: #cbd5e1;
  padding: 3px 8px;
  font-size: 11px;
}
.preview-col.is-popup .dev-btn.active {
  background: var(--accent);
  color: #ffffff;
}
.preview-col.is-popup .preview-btns { gap: 4px; }
.preview-col.is-popup .preview-btns .btn-sm {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .16);
  color: #f8fafc;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
}
.preview-col.is-popup .preview-btns .btn-sm:hover {
  background: rgba(255, 255, 255, .24);
}
.preview-col.is-popup .preview-btns .btn-danger {
  background: rgba(239, 68, 68, .85);
  border-color: transparent;
  color: #ffffff;
}
.preview-col.is-popup .preview-btns .btn-danger:hover {
  background: #dc2626;
}
.preview-col.is-popup .phone-stage {
  pointer-events: auto;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  overflow: visible !important;
  flex: 0 0 auto;
}
.preview-col.is-popup .phone-chassis {
  height: min(650px, calc(100vh - 185px));
  max-height: calc(100vh - 185px);
  box-shadow:
    0 32px 75px rgba(15, 23, 42, .52),
    0 8px 22px rgba(15, 23, 42, .32),
    inset 0 1px 2px rgba(255, 255, 255, .45),
    inset 0 -1px 2px rgba(0, 0, 0, .65);
}
.preview-col.is-popup .phone-chassis.is-tablet {
  height: min(640px, calc(100vh - 185px));
  max-width: min(500px, calc(100vw - 36px));
}
.preview-col.is-popup .phone-statusbar {
  cursor: move;
}
