/* Forja GBA — estilos.
   Concepto: consola de neón. Fondo violeta casi negro, un acento morado neón (el brillo de una pantalla en la oscuridad)
   y un segundo acento cian/magenta solo para detalles. Un solo aspecto oscuro, pensado para trabajar horas sin cansar. */
:root {
  --bg: #0b0716;
  --panel: #130c25;
  --panel-2: #1c1236;
  --line: #34205f;
  --fg: #f1ebff;
  --muted: #a898d4;
  --accent: #b36bff;
  --accent-2: #3ef0ff;
  --accent-3: #ff4fd8;
  --accent-fg: #12062a;
  --accent-soft: rgba(179, 107, 255, .22);
  --glow: 0 0 0 1px rgba(179, 107, 255, .55), 0 0 18px rgba(179, 107, 255, .45);
  --danger: #ff5c7a;
  --ok: #5cffb0;
  --canvas-bg: #07040f;
  --font-display: 'Silkscreen', 'Courier New', monospace;
  --font-ui: 'Sora', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r: 10px;
  --side: 248px;
  --side-r: 300px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-ui);
  display: flex; flex-direction: column; min-height: 0;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--panel); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.small, small { font-size: 12.5px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.warn { color: var(--danger); font-size: 12.5px; }
.ok { color: var(--ok); }
h1, h2, h3, h4 { text-wrap: balance; margin: 0; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 12px; font-family: var(--font-display); font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h4 { font-size: 14px; }
p { margin: 0; }

/* ---------- barra superior ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: 12px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; flex: none; }
.brand-mark { width: 22px; height: 22px; background:
  linear-gradient(var(--accent), var(--accent)) 6px 6px / 10px 10px no-repeat,
  linear-gradient(var(--fg), var(--fg)) 0 0 / 22px 22px; border-radius: 4px; box-shadow: inset 0 0 0 3px var(--fg); }
.brand-name { font-family: var(--font-display); font-size: 17px; letter-spacing: .04em; }
.brand-name span { color: var(--accent); margin-left: 4px; }
.proj { flex: 1; min-width: 0; max-width: 340px; }
.proj input { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 8px; font-weight: 700; }
.proj input:hover, .proj input:focus { border-color: var(--line); background: var(--panel-2); }
.top-actions { display: flex; gap: 6px; margin-left: auto; flex: none; }
.nav { display: flex; gap: 2px; overflow-x: auto; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); scrollbar-width: none; }
.nav a { flex: none; padding: 8px 14px 9px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }

#view { flex: 1; min-height: 0; outline: none; display: flex; flex-direction: column; }

/* ---------- botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 14px; white-space: nowrap; text-decoration: none; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); }
.btn.sm { padding: 4px 9px; font-size: 13px; border-radius: 6px; }
.btn.xs { padding: 1px 7px; font-size: 13px; }
.btn.lg { padding: 11px 18px; font-size: 15px; }
.btn.sel { border-color: var(--accent); background: var(--accent-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn-col { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > .field { flex: 1 1 110px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
input:not([type]), input[type="text"], input[type="number"], select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; width: 100%;
}
textarea { resize: vertical; line-height: 1.4; }
input.num { width: 76px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }

/* ---------- estructura de editores ---------- */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.split.three { grid-template-columns: var(--side) minmax(0, 1fr) var(--side-r); }
.side { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.side.right { border-right: 0; border-left: 1px solid var(--line); }
.side.right.wide { --side-r: 380px; }
.split.three:has(.side.right.wide) { grid-template-columns: var(--side) minmax(0, 1fr) 380px; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; }
.count { font-family: var(--font-mono); color: var(--muted); font-size: 13px; }
.asset-list { display: flex; flex-direction: column; gap: 2px; }
.asset { display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px; border: 1px solid transparent; border-radius: 7px; background: transparent; cursor: pointer; }
.asset:hover { background: var(--panel-2); }
.asset.sel { border-color: var(--accent); background: var(--accent-soft); }
.asset-text { display: flex; flex-direction: column; min-width: 0; }
.asset-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-text small { color: var(--muted); }
canvas.thumb, .thumb { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; flex: none; background: var(--canvas-bg); border-radius: 5px; }
.thumb.ph { display: grid; place-items: center; color: var(--muted); font-family: var(--font-display); }
.panel { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel:last-child { border-bottom: 0; }
.empty { display: flex; flex-direction: column; gap: 10px; justify-content: center; align-items: flex-start; padding: 40px max(16px, 6vw); max-width: 680px; }
.empty.solo { margin: auto; }

.editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.tool { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--fg); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--panel-2); }
.tool.sel { background: var(--accent-soft); border-color: var(--accent); }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.sel { background: var(--accent); color: var(--accent-fg); }
.canvas-wrap { flex: 1; min-height: 240px; overflow: auto; display: grid; place-items: center; padding: 12px; background:
  radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1.5px) 0 0 / 14px 14px, var(--bg); }
.canvas-wrap.dark { background: var(--canvas-bg); place-items: start; }
.canvas-wrap canvas { image-rendering: pixelated; box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(0, 0, 0, .18); touch-action: none; cursor: crosshair; }
.frame-title { padding: 6px 14px; font-size: 13.5px; }
.frames-bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px 12px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.frames { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; padding-bottom: 2px; }
.frame { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); cursor: pointer; width: 76px; flex: none; }
.frame canvas { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; background: var(--canvas-bg); border-radius: 4px; }
.frame span { font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.15; }
.frame.sel { border-color: var(--accent); background: var(--accent-soft); }

/* paleta */
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.swatch { aspect-ratio: 1; max-width: 100%; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .25); background: var(--c); cursor: pointer; position: relative; padding: 0; }
.swatch span { position: absolute; right: 2px; bottom: 0; font: 9px var(--font-mono); color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.swatch.transparent { background: repeating-conic-gradient(#cfcbd9 0 25%, #f2f0f6 0 50%) 0 0 / 10px 10px; }
.swatch.transparent span { left: 0; right: 0; text-align: center; top: 50%; transform: translateY(-50%); font-size: 13px; }
.swatch.sel { outline: 3px solid var(--accent); outline-offset: 1px; z-index: 1; }
.swatch.sel2 { box-shadow: inset 0 0 0 2px var(--panel), inset 0 0 0 4px var(--muted); }
input[type="color"] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); flex: none; }
#px-preview, .battle, .radar { width: 100%; max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 6px; }
#px-preview { border: 1px solid var(--line); }
.dirs .btn { min-width: 34px; }

/* ---------- plantillas ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tpl { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 2px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--panel-2); }
.tpl input { grid-row: span 3; margin-top: 3px; accent-color: var(--accent); }
.tpl small { grid-column: 2; }
.tpl:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- ficha (fakemon / eventos) ---------- */
.sheet { overflow-y: auto; padding: 18px max(16px, 2vw) 40px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mon-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.mon-name { font: 400 26px/1.1 var(--font-display); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -6px; max-width: 100%; width: 14ch; }
.mon-name:hover, .mon-name:focus { border-color: var(--line); background: var(--panel); }
#ev-title.mon-name { width: 100%; font-size: 22px; }
.chips { display: flex; gap: 6px; }
.type-chip { background: var(--t); color: #fff; font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: 99px; text-shadow: 0 1px 1px rgba(0, 0, 0, .35); text-transform: uppercase; letter-spacing: .05em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.stat-rows { display: flex; flex-direction: column; gap: 6px; }
.stat-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 64px; gap: 8px; align-items: center; font-size: 13px; }
.stat-row input.num { width: 64px; }
.stat-label { font-weight: 700; color: var(--muted); }
input[type="range"] { accent-color: var(--c, var(--accent)); width: 100%; min-width: 0; }
.radar-box { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.radar { max-width: 260px; }
.bst { display: flex; gap: 10px; align-items: center; }
.bst-num { font: 400 28px var(--font-display); color: var(--accent); font-variant-numeric: tabular-nums; }
.bst > span:last-child { display: flex; flex-direction: column; font-size: 13px; }
.bst small { color: var(--muted); }
table.learn { width: 100%; border-collapse: collapse; font-size: 14px; }
.learn th { text-align: left; font-size: 12px; color: var(--muted); padding: 4px; border-bottom: 1px solid var(--line); }
.learn td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.learn td:nth-child(2) { width: 45%; }
.slot { display: flex; gap: 10px; align-items: flex-start; }
.slot-img { width: 68px; height: 68px; display: grid; place-items: center; background: var(--canvas-bg); border-radius: 7px; flex: none; font-size: 12px; }
.slot-img canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.slot-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.battle { border: 2px solid var(--line); }

/* ---------- eventos ---------- */
.steps { display: flex; flex-direction: column; gap: 8px; }
.block { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.block-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.op-icon { min-width: 30px; height: 22px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 5px; background: var(--panel-2); font: 600 11px var(--font-mono); color: var(--muted); }
.op-ask .op-icon, .op-if_flag .op-icon { background: var(--accent-soft); color: var(--accent); }
.op-trainer .op-icon, .op-wild .op-icon { background: rgba(192, 48, 60, .14); color: var(--danger); }
.block-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.branch { border-left: 2px dashed var(--line); padding-left: 12px; display: flex; flex-direction: column; gap: 6px; }
.branch-title { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.add-wrap { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.btn.add { border-style: dashed; }
.add-menu { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); }
pre.code { margin: 0; background: var(--canvas-bg); color: var(--fg); border-radius: 7px; padding: 10px; font: 12px/1.5 var(--font-mono); overflow: auto; max-height: 52vh; white-space: pre; }

.row.tight { gap: 6px; align-items: center; }
.text-help { display: flex; flex-wrap: wrap; gap: 6px; }
.add-group { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.add-group > small { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.issues.small { font-size: 12.5px; margin: 0; padding-left: 18px; }
.seg.big { flex-wrap: wrap; flex-shrink: 0; width: fit-content; max-width: 100%; margin-left: max(0px, calc((100% - 1100px) / 2)); margin-right: 0; }
.export > *, .home > * { flex-shrink: 0; }
.seg.big button { padding: 9px 16px; font-size: 14px; }

/* ---------- referencia Pokédex ---------- */
.type-chip.sm { font-size: 10px; padding: 1px 6px; }
.mini-bars { display: inline-flex; align-items: flex-end; gap: 1px; height: 22px; }
.mini-bars i { width: 4px; border-radius: 1px; display: block; }
.ref-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ref-layout .row.tight select { flex: 1 1 140px; width: auto; }
.ref-rows { display: flex; flex-direction: column; max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.ref-row, .ref-mini-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto 34px; gap: 8px; align-items: center; padding: 5px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; font-size: 13.5px; }
.ref-mini-row { grid-template-columns: minmax(0, 1fr) auto auto 34px; cursor: default; padding: 3px 0; }
.ref-row:hover { background: var(--panel-2); }
.ref-row.sel { background: var(--accent-soft); }
.ref-row .num { color: var(--muted); font-size: 12px; }
.ref-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-row b, .ref-mini-row b { text-align: right; font-variant-numeric: tabular-nums; }
.ref-mini { display: flex; flex-direction: column; }
.ref-detail { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; }
.ref-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ref-table th, .ref-table td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.ref-table th:first-child, .ref-table td:first-child { text-align: left; color: var(--muted); }
.ref-table .up { color: var(--ok); } .ref-table .down { color: var(--danger); }
.ref-table .total td { font-weight: 700; }
.ref-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 13px; }
.ref-facts dt { color: var(--muted); } .ref-facts dd { margin: 0; }
.center { text-align: center; }
.move-info { display: block; font-family: var(--font-ui); color: var(--muted); font-size: 11.5px; }
.modal:has(.ref-layout) { width: min(1000px, 100%); }
@media (max-width: 760px) { .ref-layout { grid-template-columns: minmax(0, 1fr); } .ref-row { grid-template-columns: 46px minmax(0, 1fr) 34px; } .ref-row .chips, .ref-row .mini-bars { display: none; } }

/* ---------- estructuras y generadores ---------- */
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.stamp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); cursor: pointer; }
.stamp canvas { max-width: 100%; max-height: 56px; image-rendering: pixelated; }
.stamp span:not(.stamp-x) { font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.15; }
.stamp.sel { border-color: var(--accent); background: var(--accent-soft); }
.stamp-x { position: absolute; top: 1px; right: 4px; font-size: 13px; color: var(--muted); }
.stamp-x:hover { color: var(--danger); }
.swatch.mini { width: 22px; height: 22px; aspect-ratio: auto; flex: none; }
.slice-view { width: 100%; max-width: 620px; height: auto; image-rendering: pixelated; cursor: pointer; border-radius: 6px; align-self: center; }
.gen-layout { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px; align-items: start; }
.gen-left { display: flex; flex-direction: column; gap: 8px; }
.gen-preview { max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 8px; align-self: center; }
.gen-preview.char { width: 100%; max-width: 512px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.modal:has(.gen-layout), .modal:has(.slice-view) { width: min(900px, 100%); }
@media (max-width: 720px) { .gen-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- mapas ---------- */
.terrain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.terrain { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); cursor: pointer; font-weight: 700; font-size: 12.5px; text-align: left; }
.terrain.sel { border-color: var(--accent); background: var(--accent-soft); }
.terrain-swatch { width: 22px; height: 22px; border-radius: 5px; flex: none; background: radial-gradient(circle at 30% 30%, var(--b) 0 22%, transparent 24%), radial-gradient(circle at 72% 70%, var(--b) 0 16%, transparent 18%), var(--a); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.stamp[draggable="true"] { cursor: grab; }
.wild-row select { flex: 1 1 90px; min-width: 0; }
.wild-row input.num { width: 52px; padding-inline: 5px; }
.ts-picker { width: 100%; max-width: 256px; image-rendering: pixelated; cursor: pointer; border-radius: 4px; }
.ev-form { padding-top: 8px; border-top: 1px dashed var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dot); border: 1px solid rgba(0, 0, 0, .3); }
.btn-col .btn { justify-content: flex-start; }

/* ---------- probar ---------- */
.play { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 0; }
.gba { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; background:
  radial-gradient(ellipse at 50% 30%, rgba(120, 100, 200, .25), transparent 60%), var(--canvas-bg); }
.screen { background: #0a0a10; padding: 14px; border-radius: 14px; box-shadow: inset 0 0 0 2px #2a2838, 0 18px 40px rgba(0, 0, 0, .35); max-width: 100%; }
.screen canvas { display: block; width: min(720px, calc(100vw - 420px)); max-width: 100%; aspect-ratio: 3 / 2; height: auto; image-rendering: pixelated; outline: none; }
.play-modal .screen canvas { width: min(600px, 80vw); }
.gamepad { display: flex; justify-content: space-between; width: min(720px, 100%); align-items: center; }
.dpad { display: grid; grid-template: repeat(3, 44px) / repeat(3, 44px); }
.dpad button, .ab button { border: 0; background: #2a2838; color: #c9c4dc; font-size: 15px; cursor: pointer; touch-action: none; user-select: none; }
.dpad .up { grid-area: 1 / 2; border-radius: 8px 8px 0 0; } .dpad .left { grid-area: 2 / 1; border-radius: 8px 0 0 8px; }
.dpad .right { grid-area: 2 / 3; border-radius: 0 8px 8px 0; } .dpad .down { grid-area: 3 / 2; border-radius: 0 0 8px 8px; }
.ab { display: flex; gap: 14px; transform: rotate(-18deg); }
.ab button { width: 56px; height: 56px; border-radius: 50%; font: 400 15px var(--font-display); background: #5b3fb0; color: #fff; }
.ab .b { margin-top: 26px; }
.play-side { background: var(--panel); border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13px; margin: 4px 0 0; }
.keys dt { font-family: var(--font-mono); font-size: 12px; }
.keys dd { margin: 0; color: var(--muted); }

/* ---------- inicio ---------- */
.home { overflow-y: auto; padding-block: 24px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 28px; }
.home > * { width: 100%; max-width: 1180px; margin-inline: auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.hero-text { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font: 400 12px var(--font-display); letter-spacing: .12em; color: var(--accent); text-transform: uppercase; }
.hero h1 { font: 400 clamp(28px, 4.4vw, 50px)/1.08 var(--font-display); letter-spacing: -.01em; }
.lead { font-size: 17px; color: var(--muted); max-width: 58ch; }
.hero-art { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px; border-radius: 14px; background:
  linear-gradient(transparent 62%, rgba(80, 160, 90, .28) 62%), radial-gradient(ellipse at 50% 85%, rgba(80, 160, 90, .35), transparent 55%), var(--canvas-bg); }
.hero-canvas { width: 256px; max-width: 100%; height: auto; image-rendering: pixelated; }
.hero-art figcaption { font-size: 12.5px; color: var(--muted); }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.flow a { display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; row-gap: 4px; align-items: baseline; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--fg); text-decoration: none; height: 100%; }
.flow a:hover { border-color: var(--accent); }
.flow a > span:last-child { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; }
.step-n { font: 400 13px var(--font-display); color: var(--accent); }
.count-tag { font-family: var(--font-mono); color: var(--muted); font-size: 11.5px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.drop { border-style: dashed; border-width: 2px; cursor: pointer; align-items: flex-start; }
.drop:hover { border-color: var(--accent); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.facts dt { font-family: var(--font-display); font-size: 13px; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.facts dd { margin: 0; color: var(--muted); }

/* ---------- exportar ---------- */
.export { overflow-y: auto; padding-block: 22px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 16px; }
.export > * { width: 100%; max-width: 1100px; margin-inline: auto; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head h2 { font: 400 26px var(--font-display); }
.page-head p { color: var(--muted); }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.export-card p { color: var(--muted); font-size: 14px; }
.tree { background: var(--canvas-bg); border-radius: 7px; padding: 10px; max-height: 240px; overflow: auto; line-height: 1.6; }
.tree div { white-space: nowrap; }
.issues { font-size: 13.5px; color: var(--danger); }
.issues ul { margin: 4px 0 0; padding-left: 18px; }
.export-card .btn.primary { align-self: flex-start; }

/* ---------- importación ---------- */
.imp-preview { display: flex; flex-wrap: wrap; gap: 8px; background: var(--canvas-bg); padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; }
.imp-preview figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.imp-preview canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.imp-preview figcaption { font-size: 10.5px; color: var(--muted); max-width: 72px; text-align: center; line-height: 1.15; }
.imp-notes { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }

/* ---------- modales y avisos ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 8, 20, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(680px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, .4); }
.modal h3 { font-size: 13px; color: var(--fg); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.play-modal { width: auto; align-items: center; }
#toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: flex-end; pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-size: 14px; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); transition: opacity .4s, transform .4s; max-width: min(420px, calc(100vw - 32px)); }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }
.drop-hint { display: none; position: fixed; inset: 12px; border: 3px dashed var(--accent); border-radius: 16px; background: var(--accent-soft); z-index: 40; place-items: center; font: 400 20px var(--font-display); color: var(--fg); pointer-events: none; }
body.dragging .drop-hint { display: grid; }

/* ---------- pantallas estrechas ---------- */
@media (max-width: 1100px) {
  .split.three, .split.three:has(.side.right.wide) { grid-template-columns: 210px minmax(0, 1fr); }
  .split.three > .side.right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: start; }
  .split.three > .side.right > .panel { border-bottom: 0; }
  #view { overflow-y: auto; }
  .split { min-height: auto; }
  .play { grid-template-columns: minmax(0, 1fr); }
  .play-side { border-left: 0; border-top: 1px solid var(--line); }
  .screen canvas { width: min(720px, calc(100vw - 64px)); }
}
@media (max-width: 720px) {
  .split, .split.three, .split.three:has(.side.right.wide) { grid-template-columns: minmax(0, 1fr); }
  .side { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .asset-list { flex-direction: row; overflow-x: auto; }
  .asset { flex: none; max-width: 220px; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-art { order: -1; }
  .top-inner { flex-wrap: wrap; }
  .proj { order: 3; max-width: none; flex-basis: 100%; }
  .canvas-wrap { min-height: 320px; }
  .stat-row { grid-template-columns: 64px minmax(0, 1fr) 60px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- capa neón (diseño morado vivo) ---------- */
body { background:
  radial-gradient(900px 420px at 12% -8%, rgba(179, 107, 255, .20), transparent 60%),
  radial-gradient(700px 380px at 100% 0%, rgba(62, 240, 255, .10), transparent 55%),
  var(--bg); background-attachment: fixed; font-size: 14.5px; }
.top { background: rgba(19, 12, 37, .82); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid transparent; border-image: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent-2)) 1; }
body::before { background: rgba(19, 12, 37, .95); }
.brand-mark { background:
  linear-gradient(var(--accent-2), var(--accent-2)) 6px 6px / 10px 10px no-repeat,
  linear-gradient(135deg, var(--accent), var(--accent-3)) 0 0 / 22px 22px; box-shadow: 0 0 14px rgba(179, 107, 255, .8); }
.brand-name { text-shadow: 0 0 12px rgba(179, 107, 255, .8); }
.brand-name span { color: var(--accent-2); text-shadow: 0 0 12px rgba(62, 240, 255, .8); }
.nav a { transition: color .15s, text-shadow .15s; }
.nav a:hover { color: var(--accent-2); }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--accent); text-shadow: 0 0 12px var(--accent); box-shadow: 0 8px 14px -10px var(--accent); }
.btn { transition: box-shadow .15s, border-color .15s, filter .15s, background .15s; }
.btn:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 14px rgba(179, 107, 255, .35); }
.btn.primary { background: linear-gradient(135deg, #c385ff, #8f4dff 55%, #ff4fd8); color: #fff; border-color: transparent; box-shadow: 0 0 18px rgba(179, 107, 255, .5); text-shadow: 0 1px 2px rgba(20, 0, 50, .5); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); box-shadow: 0 0 26px rgba(179, 107, 255, .8); }
.btn.sel, .tool.sel, .asset.sel { box-shadow: var(--glow); }
.seg button.sel { background: linear-gradient(135deg, #b36bff, #7a3dff); color: #fff; box-shadow: 0 0 12px rgba(179, 107, 255, .6); }
.side, .toolbar { background: rgba(19, 12, 37, .72); }
.panel { border-bottom-color: rgba(179, 107, 255, .18); }
h3 { color: var(--accent); text-shadow: 0 0 10px rgba(179, 107, 255, .5); }
input:not([type]):focus, input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(179, 107, 255, .25), 0 0 14px rgba(179, 107, 255, .35); }
.canvas-wrap canvas { box-shadow: 0 0 0 1px var(--accent), 0 0 34px rgba(179, 107, 255, .35), 0 10px 40px rgba(0, 0, 0, .6); }
.canvas-wrap { background: radial-gradient(circle at 1px 1px, rgba(179, 107, 255, .35) 1px, transparent 1.5px) 0 0 / 14px 14px, var(--bg); }
.modal { border-color: var(--accent); box-shadow: 0 0 40px rgba(179, 107, 255, .35), 0 24px 60px rgba(0, 0, 0, .6); }
.modal-back { background: rgba(5, 2, 14, .72); backdrop-filter: blur(4px); }
.toast { background: linear-gradient(135deg, #b36bff, #ff4fd8); color: #fff; box-shadow: 0 0 22px rgba(179, 107, 255, .6); }
.screen { box-shadow: inset 0 0 0 2px #3a2570, 0 0 40px rgba(179, 107, 255, .45), 0 18px 40px rgba(0, 0, 0, .5); }
.ab button { background: linear-gradient(135deg, #b36bff, #7a3dff); box-shadow: 0 0 14px rgba(179, 107, 255, .6); }
.drop-hint { border-color: var(--accent); color: var(--accent-2); text-shadow: 0 0 14px var(--accent-2); }
::selection { background: rgba(179, 107, 255, .5); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: #5b2fb0 transparent; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- inicio: tutoriales y detalles neón ---------- */
.hero h1 { background: linear-gradient(100deg, #fff 10%, #d9b8ff 45%, #3ef0ff 95%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 22px rgba(179, 107, 255, .45)); }
.hero-art { position: relative; border: 1px solid rgba(179, 107, 255, .55); box-shadow: 0 0 40px rgba(179, 107, 255, .35), inset 0 0 40px rgba(179, 107, 255, .12); }
.hero-art::before { content: ""; position: absolute; inset: -2px; border-radius: 15px; padding: 2px; background: conic-gradient(from var(--ang, 0deg), #b36bff, #ff4fd8, #3ef0ff, #b36bff); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: spin 6s linear infinite; opacity: .8; pointer-events: none; }
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --ang: 360deg; } }
.eyebrow { color: var(--accent-2); text-shadow: 0 0 12px rgba(62, 240, 255, .6); }
.flow li a:hover, .card:hover { border-color: var(--accent); box-shadow: 0 0 22px rgba(179, 107, 255, .3); }
.step-n { background: linear-gradient(135deg, #b36bff, #ff4fd8); color: #fff; box-shadow: 0 0 12px rgba(179, 107, 255, .55); }
.tutos { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.tutos-head { display: flex; flex-direction: column; gap: 4px; }
.tutos-head h2 { font: 400 clamp(22px, 3vw, 30px)/1.1 var(--font-display); text-shadow: 0 0 16px rgba(179, 107, 255, .6); }
.tutos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.tuto { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); transition: transform .18s, box-shadow .18s, border-color .18s; }
.tuto:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 0 26px rgba(179, 107, 255, .4); }
.tuto video { width: 100%; aspect-ratio: 16 / 9; background: #000; display: block; }
.tuto-txt { display: flex; gap: 10px; align-items: center; padding: 10px 12px; }
.tuto-txt div { display: flex; flex-direction: column; min-width: 0; }
.tuto-txt b { font-size: 14.5px; }
.tuto-txt small { color: var(--muted); font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { .hero-art::before { animation: none; } .tuto { transition: none; } }
