/* Editor de mascotas: la pantalla negra de Maxi como mesa de trabajo, el cian de sus ojos como acento.
   Tres columnas (animaciones · lienzo · vista previa); en pantallas chicas se apilan. */
:root {
  --bg: #0b0d10; --surface: #14181d; --surface-2: #1c2128; --line: #2a313a;
  --fg: #e9eef2; --muted: #93a0ad; --eye: #5cf2e6; --eye-ink: #062a27; --danger: #ff6b6b;
  --font-display: "Fredoka", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #eef3f6; --surface: #ffffff; --surface-2: #e6edf1; --line: #cfd9df; --fg: #11161b; --muted: #55626e; --eye: #0b8f86; --eye-ink: #fff; color-scheme: light; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; }
button, .btn, select, input, textarea { font: inherit; color: inherit; }
button, .btn {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--eye); }
button.primary, a.btn.primary { text-decoration: none; background: var(--eye); color: var(--eye-ink); border-color: var(--eye); font-weight: 700; }
button.ghost { background: transparent; border-style: dashed; width: 100%; margin-top: 8px; }
button.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--eye); outline-offset: 2px; }
.muted { color: var(--muted); }

.top {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; }
.brand img { width: 34px; height: 30px; object-fit: contain; }
.brand span { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }
.brand small { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.layout {
  flex: 1; display: grid; grid-template-columns: 230px minmax(0, 1fr) 260px; gap: 14px;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; overflow: auto; min-width: 0; }
.anims { max-height: calc(100vh - 140px); }
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin: 6px 0 8px; }
.group { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 12px 0 4px; }
.anim {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; border: 1px solid transparent;
  padding: 5px 8px; border-radius: 8px;
}
.anim.active { background: var(--surface-2); border-color: var(--eye); }
.anim canvas { width: 28px; height: 28px; image-rendering: pixelated; background: #000; border-radius: 4px; flex: none; }
.anim .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.anim .c { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.anim.empty .n { color: var(--muted); }
.anim .req { color: var(--eye); }

.work { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tool { padding: 6px 10px; }
.tool span { margin-left: 4px; }
.tool.active { background: var(--eye); color: var(--eye-ink); border-color: var(--eye); }
.sep { width: 1px; height: 24px; background: var(--line); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.canvas-wrap { display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
#lienzo { width: min(100%, 512px); aspect-ratio: 1; image-rendering: pixelated; cursor: crosshair; touch-action: none; border-radius: 6px; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 6px; border: 2px solid var(--line); padding: 0; }
.swatch.active { border-color: var(--fg); transform: scale(1.12); }
.palette input[type=color] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.frames { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.frames-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.frames-head span:first-child { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.thumb { flex: none; padding: 3px; border-radius: 8px; border: 2px solid var(--line); background: #000; position: relative; }
.thumb.active { border-color: var(--eye); }
.thumb canvas { width: 56px; height: 56px; image-rendering: pixelated; display: block; }
.thumb b { position: absolute; left: 4px; top: 2px; font: 600 .7rem var(--font-mono); color: #fff; text-shadow: 0 0 3px #000; }
.frame-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.side { display: flex; flex-direction: column; gap: 8px; }
.preview-box { border-radius: 12px; display: grid; place-items: center; padding: 10px; background: #0b0d10; }
.preview-box.claro { background: #e9eef2; }
.preview-box.cuadros { background: repeating-conic-gradient(#3a3f47 0 25%, #2a2e35 0 50%) 0 0 / 16px 16px; }
#preview { width: 160px; height: 160px; image-rendering: pixelated; }
.preview-bar { display: flex; align-items: center; gap: 8px; background: rgba(15, 25, 35, .8); border-radius: 999px; padding: 4px 10px; }
#preview-barra { width: 28px; height: 28px; }
.seg { display: flex; }
.seg button { flex: 1; border-radius: 0; padding: 5px 6px; font-size: .85rem; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button.active { background: var(--eye); color: var(--eye-ink); }
.field { display: grid; gap: 4px; font-size: .88rem; color: var(--muted); }
.field input, .field select, .field textarea { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; color: var(--fg); width: 100%; }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
.status { font-size: .85rem; color: var(--eye); min-height: 1.2em; }
.status.error { color: var(--danger); }
.foot { padding: 10px max(16px, env(safe-area-inset-left, 0px)); color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.foot a { color: var(--eye); margin-left: 6px; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .anims { max-height: 260px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
