/* =====================================================================
   Ataúlfo City · estilos
   Paleta: vino del logo suavizado, crema cálida, coral y verdes de parque
   ===================================================================== */
@font-face { font-family: 'Pixelify Sans'; src: url('../fonts/pixelify-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('../fonts/pixelify-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('../fonts/pixelify-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-900-normal.woff2') format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --vino: #8e1b2b; --vino-2: #6b1421; --vino-3: #4a0e17; --rojo: #c0101e;
  --coral: #e8505b; --coral-2: #f27e7a; --rosa: #fbe3df; --rosa-2: #f6cfc8;
  --crema: #fff7ee; --crema-2: #fbecd9; --arena: #f1dfc6;
  --tinta: #2b1d22; --tinta-2: #5b4650; --tinta-3: #8a7880;
  --verde: #3f9b5a; --verde-2: #e3f3e2; --oro: #f2c14e; --cielo: #bfe6f7; --azul: #2e6fbf;
  --code-bg: #221520; --code-bg-2: #2d1d2a;
  --r: 14px;
  --sombra: 0 4px 0 rgba(43, 29, 34, .18);
  --borde: 3px solid var(--tinta);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pixel: 'Pixelify Sans', 'Nunito', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
.code-editor, .codeline, .help pre, .help td, code, .chip .name, .colorname, .qr-card .url { font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--tinta); background: var(--crema); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--pixel); font-weight: 700; letter-spacing: .3px; margin: 0; }
a { color: var(--vino); }
.hidden { display: none !important; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; border: var(--borde); border-radius: 12px; background: #fff; padding: .65em 1.05em; font-weight: 800; cursor: pointer; box-shadow: 0 4px 0 var(--tinta); transition: transform .06s, box-shadow .06s; text-decoration: none; color: var(--tinta); user-select: none; line-height: 1.1; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--tinta); }
.btn.primary { background: var(--coral); color: #fff; }
.btn.vino { background: var(--vino); color: #fff; }
.btn.verde { background: var(--verde); color: #fff; }
.btn.oro { background: var(--oro); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.small { padding: .4em .7em; font-size: .9em; border-width: 2px; box-shadow: 0 3px 0 var(--tinta); border-radius: 10px; }
.btn.big { font-size: 1.15em; padding: .85em 1.3em; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; padding: 0; font-size: 20px; }

/* ---------- tarjetas y chips ---------- */
.card { background: #fff; border: var(--borde); border-radius: var(--r); box-shadow: 0 5px 0 rgba(43, 29, 34, .9); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--tinta); background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; font-weight: 700; font-size: 14px; box-shadow: 0 3px 0 rgba(43, 29, 34, .8); }
.chip.on { outline: 3px solid var(--coral); outline-offset: 2px; background: var(--rosa); }
.chip.swatch { width: 40px; padding: 0; position: relative; }
.chip.swatch.on::after { content: '✓'; position: absolute; color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000; font-weight: 900; }
.chip.wide { height: auto; min-height: 44px; padding: 6px 10px; flex-direction: column; gap: 2px; font-size: 12px; min-width: 70px; }
.chip.wide .em { font-size: 22px; line-height: 1; }
.chip .name { font-family: var(--mono); font-size: 11px; }
.chip input[type=color] { width: 0; height: 0; opacity: 0; position: absolute; }
.colorname { font-family: var(--mono); font-size: 12px; color: var(--tinta-2); margin-top: 6px; min-height: 16px; }
.colorname code { background: var(--crema-2); padding: 1px 6px; border-radius: 6px; color: var(--vino); }

/* ---------- avisos ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--tinta); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; z-index: 1000; transition: transform .3s cubic-bezier(.2, 1.4, .5, 1); max-width: min(92vw, 520px); text-align: center; box-shadow: 0 6px 0 rgba(0, 0, 0, .25); border: 3px solid #fff; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); }
.toast.ok { background: var(--verde); }
.toast.warn { background: var(--coral); }

/* ---------- editor de código ---------- */
.code-editor { position: relative; display: flex; background: var(--code-bg); border-radius: 12px; border: 3px solid var(--tinta); overflow: hidden; font-family: var(--mono); font-size: 14px; line-height: 21px; min-height: 160px; }
.ce-gutter { flex: 0 0 auto; padding: 10px 6px 10px 8px; color: #7d6a76; text-align: right; user-select: none; background: var(--code-bg-2); overflow: hidden; min-width: 34px; }
.ce-gutter div { height: 21px; }
.ce-gutter .mk-error { color: #fff; background: #d6404d; border-radius: 4px; }
.ce-gutter .mk-aviso { color: #2b1d22; background: var(--oro); border-radius: 4px; }
.ce-gutter .flash { color: #fff; background: #3f9b5a; border-radius: 4px; }
.ce-body { position: relative; flex: 1; min-width: 0; }
.ce-hl, .ce-ta { position: absolute; inset: 0; margin: 0; padding: 10px 12px; font: inherit; line-height: inherit; white-space: pre; overflow: auto; tab-size: 2; }
.ce-hl { color: #f3e8ee; pointer-events: none; overflow: hidden; }
.ce-ta { background: transparent; color: transparent; caret-color: #ffd23f; border: 0; outline: none; resize: none; -webkit-text-fill-color: transparent; }
.ce-ta::selection { background: rgba(255, 210, 63, .3); -webkit-text-fill-color: transparent; }
.readonly .ce-ta { caret-color: transparent; }
.tk-br { color: #c9a9b8; } .tk-tag { color: #ff7a90; font-weight: 600; } .tk-attr { color: #ffb86b; } .tk-str { color: #a6e3a1; }
.tk-prop { color: #7fd3ff; } .tk-val { color: #f9e2af; } .tk-com { color: #8f7d88; font-style: italic; } .tk-txt { color: #ffffff; font-weight: 600; }
.ln-flash { background: rgba(63, 155, 90, .45); border-radius: 3px; animation: flashfade 1.6s forwards; }
@keyframes flashfade { 0%, 60% { background: rgba(63, 155, 90, .55); } 100% { background: transparent; } }
.errors { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.errors li { background: #fff4d6; border: 2px solid var(--oro); padding: 7px 10px; border-radius: 10px; font-size: 14px; cursor: pointer; }
.errors li.error { background: #ffe3e5; border-color: #d6404d; }
.errors li b { font-family: var(--mono); font-size: 12px; margin-right: 6px; }
.errors .ok { background: var(--verde-2); border-color: var(--verde); cursor: default; }

/* =====================================================================
   PORTADA (monitor)
   ===================================================================== */
body.portada { height: 100vh; overflow: hidden; display: flex; background: #f6ecdf; }
.side { width: clamp(330px, 23vw, 430px); flex: 0 0 auto; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 14px; background:
  linear-gradient(180deg, #fff7ee 0%, #fbeadb 100%); border-right: 4px solid var(--tinta); position: relative; z-index: 2; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 74px; height: 74px; flex: 0 0 auto; filter: drop-shadow(0 3px 0 rgba(43, 29, 34, .15)); }
.brand h1 { font-size: clamp(30px, 2.4vw, 42px); color: var(--vino); line-height: .95; }
.brand p { margin: 4px 0 0; font-weight: 700; color: var(--tinta-2); font-size: 14px; line-height: 1.25; }
.qr-card { padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; background: #fff; }
.qr-card .qr { width: 100%; max-width: 270px; aspect-ratio: 1; background: #fff; border-radius: 8px; }
.qr-card .qr svg, .qr-card .qr img { width: 100%; height: 100%; display: block; }
.qr-card strong { font-family: var(--pixel); font-size: 24px; color: var(--vino); text-align: center; line-height: 1.05; }
.qr-card .url { font-family: var(--mono); font-size: 13px; color: var(--tinta-2); background: var(--crema-2); padding: 4px 10px; border-radius: 8px; word-break: break-all; text-align: center; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: s; }
.steps li { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; background: #fff; border: 2px solid var(--tinta); border-radius: 12px; padding: 8px 10px; }
.steps li::before { counter-increment: s; content: counter(s); width: 28px; height: 28px; flex: 0 0 auto; border-radius: 8px; background: var(--coral); color: #fff; display: grid; place-items: center; font-family: var(--pixel); font-size: 18px; border: 2px solid var(--tinta); }
.steps li .em { font-size: 20px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats div { background: var(--vino); color: #fff; border-radius: 12px; padding: 8px 12px; border: 3px solid var(--tinta); }
.stats b { font-family: var(--pixel); font-size: 32px; display: block; line-height: 1; }
.stats span { font-size: 13px; font-weight: 700; opacity: .9; }
.feed { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.feed h3 { font-size: 18px; color: var(--tinta-2); margin-bottom: 6px; }
.feed ul { list-style: none; margin: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
.feed li { background: #fff; border-radius: 10px; padding: 7px 10px; font-size: 14px; font-weight: 700; border-left: 5px solid var(--coral); animation: slidein .5s; cursor: pointer; }
.feed li small { display: block; color: var(--tinta-3); font-weight: 700; font-size: 11px; }
.feed li.avatar { border-left-color: var(--verde); }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.side footer { font-size: 12px; color: var(--tinta-2); font-weight: 700; line-height: 1.35; border-top: 2px dashed var(--rosa-2); padding-top: 10px; }
.stage { position: relative; flex: 1; height: 100vh; min-width: 0; }
.stage canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.live { position: absolute; top: 16px; right: 16px; background: #fff; border: 3px solid var(--tinta); border-radius: 999px; padding: 6px 14px; font-weight: 900; font-size: 14px; display: flex; align-items: center; gap: 8px; box-shadow: var(--sombra); }
.live::before { content: ''; width: 11px; height: 11px; border-radius: 50%; background: #e8505b; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.title-float { position: absolute; top: 16px; left: 16px; display: none; }
.controls { position: absolute; right: 16px; bottom: 16px; display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); gap: 6px; }
.controls .btn { width: 46px; height: 46px; padding: 0; font-size: 18px; border-radius: 12px; }
.tools { position: absolute; right: 16px; bottom: 182px; display: flex; flex-direction: column; gap: 6px; }
.tools .btn { width: 46px; height: 46px; padding: 0; font-size: 20px; }
.hint { position: absolute; left: 16px; bottom: 16px; background: rgba(255, 247, 238, .92); border: 2px solid var(--tinta); border-radius: 12px; padding: 6px 12px; font-weight: 700; font-size: 13px; color: var(--tinta-2); }
.ticker { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); background: var(--vino); color: #fff; border: 3px solid var(--tinta); border-radius: 14px; padding: 8px 18px; font-weight: 800; font-size: 18px; max-width: 60%; text-align: center; box-shadow: var(--sombra); }
.tip { position: absolute; pointer-events: none; background: var(--tinta); color: #fff; padding: 6px 10px; border-radius: 10px; font-weight: 800; font-size: 13px; white-space: nowrap; transform: translate(-50%, -130%); z-index: 5; }
.tip small { color: #f6cfc8; font-weight: 700; }
.caption { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); background: #fff; border: 3px solid var(--tinta); border-radius: 16px; padding: 10px 18px 10px 12px; display: flex; gap: 12px; align-items: center; box-shadow: 0 6px 0 rgba(43, 29, 34, .9); transition: opacity .4s, transform .4s; max-width: 70%; }
.caption.off { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.caption canvas { width: 42px; height: 78px; flex: 0 0 auto; }
.caption b { font-family: var(--pixel); font-size: 22px; color: var(--vino); display: block; line-height: 1.05; }
.caption span { font-weight: 700; color: var(--tinta-2); font-size: 14px; }
.drawer { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(470px, 46%); background: var(--crema); border: 4px solid var(--tinta); border-radius: 18px; box-shadow: 0 8px 0 rgba(43, 29, 34, .9); display: flex; flex-direction: column; overflow: hidden; transform: translateX(120%); transition: transform .35s cubic-bezier(.2, 1.1, .4, 1); z-index: 10; }
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 10px; background: var(--vino); color: #fff; }
.drawer header h2 { font-size: 26px; line-height: 1.05; flex: 1; word-break: break-word; }
.drawer header .who { font-size: 14px; font-weight: 700; color: #fbe3df; margin-top: 4px; font-family: var(--font); letter-spacing: 0; }
.drawer header .btn { flex: 0 0 auto; }
.drawer .body { flex: 1; overflow: auto; padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.drawer .preview-wrap { display: flex; gap: 12px; align-items: flex-end; background: linear-gradient(180deg, #d9f0fb, #fff7ee); border: 3px solid var(--tinta); border-radius: 14px; padding: 8px; }
.drawer .preview-wrap canvas.prev { width: 60%; aspect-ratio: 1 / 1.05; }
.drawer .preview-wrap .av { width: 34%; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 13px; text-align: center; }
.drawer .preview-wrap .av canvas { width: 56px; height: 104px; }
.drawer .desc { background: #fff; border: 2px solid var(--tinta); border-radius: 12px; padding: 10px 12px; font-weight: 700; line-height: 1.35; }
.drawer .code-editor { min-height: 260px; flex: 0 0 auto; height: 330px; font-size: 13px; line-height: 20px; }
.drawer .code-editor .ce-gutter div { height: 20px; }
.drawer .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.drawer .note { font-size: 13px; color: var(--tinta-2); font-weight: 700; }
.badge { display: inline-block; background: var(--oro); color: var(--tinta); border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 900; border: 2px solid var(--tinta); }

@media (max-width: 900px) {
  body.portada { flex-direction: column-reverse; height: auto; min-height: 100vh; overflow: auto; }
  .side { width: 100%; height: auto; border-right: 0; border-top: 4px solid var(--tinta); }
  .stage { height: 75vh; flex: none; }
  .drawer { width: auto; left: 12px; }
  .ticker { max-width: 90%; font-size: 14px; top: 64px; }
}

/* =====================================================================
   PANEL DEL ALUMNO (móvil)
   ===================================================================== */
body.alumno { min-height: 100vh; min-height: 100dvh; background: #fbf1e4; overscroll-behavior: none; }
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--vino); color: #fff; border-bottom: 3px solid var(--tinta); }
.topbar img { width: 34px; height: 34px; background: #fff7ee; border-radius: 9px; padding: 2px; }
.topbar h2 { font-size: 20px; flex: 1; line-height: 1; }
.topbar .stepper-dots { display: flex; gap: 5px; }
.topbar .stepper-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.topbar .stepper-dots i.on { background: #fff; }
.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 14px; flex: 1; }

/* inicio */
.hero { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 20px 30px; text-align: center; background:
  radial-gradient(ellipse at 50% 120%, #b9e3a5 0 36%, transparent 37%), linear-gradient(180deg, #cfeefb 0%, #fff4e6 70%); }
.hero img.logo { width: 120px; height: 120px; filter: drop-shadow(0 4px 0 rgba(43, 29, 34, .15)); }
.hero h1 { font-size: 46px; color: var(--vino); line-height: .95; }
.hero p { font-size: 18px; font-weight: 700; margin: 0; max-width: 420px; line-height: 1.35; }
.hero .mini-city { width: min(92vw, 420px); height: 190px; border-radius: 18px; border: 3px solid var(--tinta); background: #cfeefb; box-shadow: 0 5px 0 rgba(43, 29, 34, .9); }
.hero .actions { display: flex; flex-direction: column; gap: 12px; width: min(92vw, 360px); }
.hero .actions .btn { width: 100%; }
.hero small { color: var(--tinta-2); font-weight: 700; }

/* secciones de opciones */
.sec { margin: 0 0 12px; padding: 14px; }
.sec h3 { font-size: 20px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; color: var(--vino); }
.sec h3 .em { font-size: 22px; }
.sec p.help { margin: -4px 0 10px; color: var(--tinta-2); font-weight: 700; font-size: 14px; }
.field { width: 100%; border: 3px solid var(--tinta); border-radius: 12px; padding: 12px 14px; font-size: 18px; font-weight: 800; background: #fff; outline: none; }
.field:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--rosa-2); }
textarea.field { font-size: 16px; font-weight: 700; resize: vertical; min-height: 84px; }
.counter { text-align: right; font-size: 12px; color: var(--tinta-3); font-weight: 800; margin-top: 4px; }

.avatar-stage { display: flex; align-items: flex-end; justify-content: center; gap: 18px; padding: 12px; margin-bottom: 12px; background: linear-gradient(180deg, #cdeefc, #fff3e0); }
.avatar-stage canvas { width: 112px; height: 208px; }
.avatar-stage .info { flex: 1; min-width: 0; }
.avatar-stage .info .prof { font-weight: 900; font-size: 16px; color: var(--vino); }
.avatar-stage .info .fam { font-size: 13px; font-weight: 700; color: var(--tinta-2); }
.prof-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prof-grid .chip { height: auto; min-height: 70px; flex-direction: column; padding: 8px 4px; gap: 3px; font-size: 12px; text-align: center; line-height: 1.1; }
.prof-grid .chip .em { font-size: 26px; }
.hair-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hair-grid .chip { height: auto; flex-direction: column; padding: 4px; font-size: 11px; }
.hair-grid canvas { width: 42px; height: 42px; }

.bottombar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(251, 241, 228, .96); border-top: 3px solid var(--tinta); }
.bottombar .btn { flex: 1; white-space: nowrap; }
.bottombar .btn.big { font-size: 1.05em; padding: .8em .9em; }
.bottombar .btn.back { flex: 0 0 auto; }

/* editor de edificio */
.builder-top { position: sticky; top: 54px; z-index: 15; background: #fbf1e4; padding: 10px 12px 8px; border-bottom: 3px solid var(--tinta); }
.preview-box { position: relative; height: clamp(170px, 30vh, 290px); border-radius: 16px; border: 3px solid var(--tinta); background: linear-gradient(180deg, #c8ecfb 0%, #eaf7fb 55%, #fff4e2 100%); overflow: hidden; }
.preview-box canvas { width: 100%; height: 100%; display: block; }
.preview-box .pname { position: absolute; left: 10px; top: 8px; right: 10px; font-family: var(--pixel); font-size: 20px; color: var(--vino); text-shadow: 0 2px 0 #fff; pointer-events: none; }
.preview-box .zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.preview-box .zoom .btn { width: 36px; height: 36px; padding: 0; border-width: 2px; box-shadow: 0 3px 0 var(--tinta); }
.codeline { margin-top: 6px; background: var(--code-bg); border: 3px solid var(--tinta); border-radius: 12px; padding: 7px 10px; font-family: var(--mono); font-size: 12.5px; line-height: 17px; color: #f3e8ee; white-space: pre-wrap; word-break: break-word; overflow: hidden; max-height: 74px; min-height: 36px; position: relative; }
.codeline .lbl { font-family: var(--font); font-weight: 900; color: #ffd23f; font-size: 11px; display: block; letter-spacing: .3px; text-transform: uppercase; margin-bottom: 1px; }
.codeline.pop { animation: pop .35s; }
@keyframes pop { 0% { transform: scale(.97); background: #3f9b5a; } 100% { transform: none; } }
.tabs { display: flex; gap: 6px; margin-top: 6px; }
.tabs button { flex: 1; border: 3px solid var(--tinta); border-radius: 12px; background: #fff; padding: 7px 6px; font-weight: 900; font-size: 15px; cursor: pointer; box-shadow: 0 3px 0 var(--tinta); }
.tabs button.on { background: var(--tinta); color: #fff; box-shadow: none; transform: translateY(3px); }
.acc { border: 3px solid var(--tinta); border-radius: 14px; background: #fff; margin-bottom: 10px; box-shadow: 0 4px 0 rgba(43, 29, 34, .85); overflow: hidden; }
.acc > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 13px 14px; font-weight: 900; font-size: 17px; cursor: pointer; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary .em { font-size: 22px; width: 28px; text-align: center; }
.acc > summary .val { margin-left: auto; font-size: 13px; color: var(--tinta-2); font-weight: 800; max-width: 45%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc > summary::after { content: '▸'; font-size: 16px; transition: transform .2s; }
.acc[open] > summary::after { transform: rotate(90deg); }
.acc[open] > summary { background: var(--rosa); border-bottom: 2px dashed var(--rosa-2); }
.acc .in { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.acc .lbl { font-weight: 900; font-size: 14px; color: var(--tinta-2); margin-bottom: 6px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper .btn { width: 48px; height: 48px; padding: 0; font-size: 24px; }
.stepper output { font-family: var(--pixel); font-size: 34px; min-width: 44px; text-align: center; color: var(--vino); }
.stepper .unit { font-weight: 800; color: var(--tinta-2); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--tinta); border-radius: 12px; padding: 8px 12px; font-weight: 800; cursor: pointer; background: #fff; box-shadow: 0 3px 0 rgba(43, 29, 34, .8); }
.toggle.on { background: var(--verde-2); outline: 3px solid var(--verde); outline-offset: 1px; }
.decor-sel { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; align-items: center; }
.decor-sel .chip { background: var(--verde-2); }
.decor-sel .empty { color: var(--tinta-3); font-weight: 700; font-size: 14px; }
.kbd-bar { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.kbd-bar::-webkit-scrollbar { display: none; }
.kbd-bar button { flex: 0 0 auto; min-width: 40px; height: 40px; border: 2px solid var(--tinta); border-radius: 10px; background: #fff; font-family: var(--mono); font-weight: 600; font-size: 16px; box-shadow: 0 3px 0 rgba(43, 29, 34, .8); padding: 0 10px; }
.kbd-bar button.snip { font-family: var(--font); font-size: 13px; font-weight: 800; background: var(--rosa); }
.builder .code-editor { height: 46vh; min-height: 260px; }
.help h4 { font-family: var(--pixel); font-size: 19px; color: var(--vino); margin: 16px 0 6px; }
.help p, .help li { font-weight: 700; line-height: 1.4; }
.help pre { background: var(--code-bg); color: #f3e8ee; border-radius: 12px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; overflow: auto; border: 3px solid var(--tinta); white-space: pre-wrap; }
.help table { width: 100%; border-collapse: collapse; font-size: 14px; }
.help td { border-bottom: 2px dashed var(--rosa-2); padding: 7px 4px; vertical-align: top; font-weight: 700; }
.help td:first-child { font-family: var(--mono); color: var(--vino); white-space: nowrap; }
.help .reto { background: var(--verde-2); border: 2px solid var(--verde); border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-weight: 800; }
.help .reto.done { opacity: .7; }
.help .reto.done::before { content: '✅ '; }

/* ciudad a pantalla completa en el móvil */
.city-screen { position: fixed; inset: 0; z-index: 50; background: #cfeefb; }
.city-screen canvas { width: 100%; height: 100%; display: block; }
.city-screen .topbar { position: absolute; left: 0; right: 0; top: 0; }
.city-screen .float-actions { position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.city-screen .zoombtns { position: absolute; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.city-screen .zoombtns .btn { width: 46px; height: 46px; padding: 0; font-size: 20px; }
.sheet { position: absolute; left: 8px; right: 8px; bottom: 8px; max-height: 72%; background: var(--crema); border: 3px solid var(--tinta); border-radius: 18px; box-shadow: 0 -4px 0 rgba(43, 29, 34, .2); display: flex; flex-direction: column; transform: translateY(110%); transition: transform .3s; z-index: 5; }
.sheet.open { transform: none; }
.sheet header { padding: 12px 14px 8px; display: flex; gap: 10px; align-items: flex-start; }
.sheet header h3 { font-size: 22px; color: var(--vino); flex: 1; line-height: 1.05; }
.sheet header .who { font-size: 13px; font-weight: 800; color: var(--tinta-2); margin-top: 4px; font-family: var(--font); }
.sheet .body { overflow: auto; padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.sheet .code-editor { height: 240px; font-size: 12.5px; line-height: 19px; }
.sheet .code-editor .ce-gutter div { height: 19px; }
.celebrate { position: absolute; left: 50%; top: 76px; transform: translateX(-50%); background: #fff; border: 3px solid var(--tinta); border-radius: 16px; padding: 12px 16px; text-align: center; font-weight: 900; box-shadow: 0 5px 0 rgba(43, 29, 34, .9); width: min(92vw, 420px); animation: drop .6s cubic-bezier(.2, 1.4, .4, 1); }
.celebrate b { font-family: var(--pixel); font-size: 24px; color: var(--vino); display: block; }
@keyframes drop { from { transform: translate(-50%, -40px); opacity: 0; } }
.closed-msg { margin: 30px auto; max-width: 420px; text-align: center; padding: 24px; }

/* =====================================================================
   ADMINISTRACIÓN
   ===================================================================== */
body.admin { background: #f6ecdf; min-height: 100vh; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login img { width: 90px; margin: 0 auto; }
.adm-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--vino); color: #fff; border-bottom: 4px solid var(--tinta); flex-wrap: wrap; }
.adm-head img { width: 42px; height: 42px; background: #fff7ee; border-radius: 10px; padding: 3px; }
.adm-head h1 { font-size: 26px; }
.adm-head .sp { flex: 1; }
.adm-head .st { background: rgba(255, 255, 255, .15); border-radius: 10px; padding: 4px 10px; font-weight: 800; font-size: 14px; }
.adm-main { display: grid; grid-template-columns: minmax(360px, 520px) 1fr; height: calc(100vh - 66px); }
.adm-left { display: flex; flex-direction: column; min-height: 0; border-right: 4px solid var(--tinta); background: var(--crema); }
.adm-tabs { display: flex; gap: 6px; padding: 10px; flex-wrap: wrap; }
.adm-tabs button { border: 2px solid var(--tinta); border-radius: 10px; background: #fff; padding: 8px 12px; font-weight: 900; cursor: pointer; }
.adm-tabs button.on { background: var(--tinta); color: #fff; }
.adm-pane { flex: 1; overflow: auto; padding: 0 12px 16px; }
.adm-list { display: flex; flex-direction: column; gap: 8px; }
.adm-item { display: flex; gap: 10px; align-items: center; background: #fff; border: 2px solid var(--tinta); border-radius: 12px; padding: 8px; cursor: pointer; }
.adm-item.sel { outline: 3px solid var(--coral); background: var(--rosa); }
.adm-item canvas { width: 56px; height: 64px; flex: 0 0 auto; background: linear-gradient(180deg, #d9f0fb, #fff7ee); border-radius: 8px; }
.adm-item .t { flex: 1; min-width: 0; }
.adm-item .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-item .t small { color: var(--tinta-2); font-weight: 700; display: block; }
.adm-item .acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 150px; }
.adm-item .acts .btn { padding: 4px 7px; font-size: 14px; box-shadow: 0 2px 0 var(--tinta); border-width: 2px; }
.adm-right { position: relative; min-width: 0; }
.adm-right canvas { width: 100%; height: 100%; display: block; }
.adm-right .banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--oro); border: 3px solid var(--tinta); border-radius: 12px; padding: 8px 14px; font-weight: 900; }
.adm-form { display: flex; flex-direction: column; gap: 12px; }
.adm-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 14px; }
.adm-form label.inline { flex-direction: row; align-items: center; gap: 10px; }
.adm-form input[type=text], .adm-form input[type=password], .adm-form input[type=url], .adm-form select, .adm-form textarea { border: 2px solid var(--tinta); border-radius: 10px; padding: 8px 10px; background: #fff; font-weight: 700; }
.adm-form input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--vino); }
.adm-form fieldset { border: 2px solid var(--tinta); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.adm-form legend { font-family: var(--pixel); font-weight: 700; font-size: 18px; color: var(--vino); padding: 0 6px; }
.adm-search { width: 100%; border: 2px solid var(--tinta); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; font-weight: 700; }
.modal { position: fixed; inset: 0; background: rgba(43, 29, 34, .55); display: grid; place-items: center; z-index: 100; padding: 14px; }
.modal .card { width: min(980px, 100%); max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.modal header { display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: var(--vino); color: #fff; }
.modal header h2 { flex: 1; font-size: 22px; }
.modal .mbody { display: grid; grid-template-columns: 1fr 1.25fr; gap: 12px; padding: 12px; overflow: auto; }
.modal .mbody .code-editor { height: 56vh; }
.modal .mbody canvas.prev { width: 100%; aspect-ratio: 1; border-radius: 12px; border: 3px solid var(--tinta); background: linear-gradient(180deg, #c8ecfb, #fff4e2); }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 2px solid var(--rosa-2); }
@media (max-width: 860px) {
  .adm-main { grid-template-columns: 1fr; height: auto; }
  .adm-right { height: 60vh; order: -1; }
  .modal .mbody { grid-template-columns: 1fr; }
}

/* cartel imprimible */
body.cartel { background: #fff; }
.poster { width: 210mm; min-height: 297mm; margin: 0 auto; padding: 16mm; display: flex; flex-direction: column; align-items: center; gap: 8mm; text-align: center; background: linear-gradient(180deg, #fff7ee, #fbe3df); }
.poster img.logo { width: 46mm; }
.poster h1 { font-size: 64px; color: var(--vino); }
.poster .qr { width: 120mm; height: 120mm; border: 4px solid var(--tinta); border-radius: 16px; padding: 6mm; background: #fff; }
.poster .qr svg { width: 100%; height: 100%; }
.poster p { font-size: 24px; font-weight: 800; margin: 0; }
.poster .url { font-family: var(--mono); font-size: 20px; background: #fff; padding: 6px 14px; border-radius: 10px; border: 2px solid var(--tinta); }
@media print { .noprint { display: none; } .poster { margin: 0; } }
@media (max-height: 980px) and (min-width: 901px) {
  .side { gap: 10px; padding: 14px 14px 10px; }
  .brand img { width: 58px; height: 58px; }
  .qr-card { padding: 10px; gap: 6px; }
  .qr-card .qr { max-width: min(240px, 27vh); }
  .qr-card strong { font-size: 20px; }
  .steps li { padding: 6px 8px; font-size: 14px; }
  .stats b { font-size: 26px; }
  .feed li { padding: 5px 8px; font-size: 13px; }
}
@media (max-height: 760px) and (min-width: 901px) {
  .steps { display: none; }
}
