/* Fuentes autoalojadas (SIL Open Font License) */
@font-face { font-family: 'Press Start 2P'; src: url('/fonts/press-start-2p.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('/fonts/pixelify-sans.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
:root {
  --bg: #0b0816;
  --panel: rgba(18, 14, 34, 0.86);
  --panel-2: rgba(32, 24, 58, 0.9);
  --line: rgba(255, 255, 255, 0.12);
  --text: #ece8ff;
  --muted: #a39cc4;
  --gold: #ffc53d;
  --gold-2: #ff7a3d;
  --cyan: #3df2ff;
  --p1: #ff4d5e; --p2: #3da5ff; --p3: #4ade80; --p4: #ffc53d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'Pixelify Sans', system-ui, sans-serif; font-weight: 500; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#dim { position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(11,8,22,0.35), rgba(11,8,22,0.85)); transition: opacity .4s; pointer-events: none; }
body.playing #dim { opacity: 0; visibility: hidden; }

.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; padding: 22px clamp(16px, 3vw, 40px); overflow-y: auto; }
.screen.active { display: flex; animation: fadeIn .35s ease; }
.screen.overlay { background: rgba(5, 3, 12, 0.6); justify-content: center; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Logo */
.logo { text-align: center; margin-top: 12vh; filter: drop-shadow(0 8px 30px rgba(255, 120, 60, .35)); }
.logo h1 { font-family: 'Press Start 2P', monospace; font-size: clamp(64px, 12vw, 170px); line-height: .85; margin: 0; letter-spacing: 4px;
  background: linear-gradient(180deg, #fff6c8 10%, var(--gold) 50%, var(--gold-2) 90%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 3px #1a0f2a; }
.logo h1 span { display: block; font-size: .62em; letter-spacing: 18px; background: linear-gradient(180deg, #e8fbff, var(--cyan) 60%, #3d7bff); -webkit-background-clip: text; background-clip: text; }
.logo-small { font-family: 'Pixelify Sans'; letter-spacing: 10px; color: var(--muted); font-size: 18px; margin-bottom: 6px; }
.logo.mini { margin-top: 4vh; }
.logo.mini h1 { font-size: clamp(48px, 7vw, 96px); }
.press { margin-top: 10vh; font-family: 'Pixelify Sans'; letter-spacing: 3px; animation: pulse 1.4s infinite; text-shadow: 0 0 12px rgba(61, 242, 255, .6); text-align: center; }
@keyframes pulse { 50% { opacity: .35; } }
.version { position: absolute; bottom: 16px; right: 20px; color: var(--muted); font-size: 14px; }

/* Botones */
.btn { font-family: 'Pixelify Sans', sans-serif; font-size: 16px; color: var(--text); background: linear-gradient(180deg, #3a2e66, #241a44); border: 1px solid var(--line);
  padding: 10px 20px; border-radius: 10px; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; letter-spacing: .5px; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(61, 242, 255, .25); border-color: rgba(61, 242, 255, .5); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2a1206; border-color: transparent; }
.btn.primary:hover { box-shadow: 0 6px 26px rgba(255, 150, 60, .5); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.wide { width: 100%; margin: 6px 0; }
.btn.big { display: grid; grid-template-columns: 48px 1fr; text-align: left; font-size: 24px; padding: 16px 22px; width: min(520px, 90vw); align-items: center; }
.btn.big b { grid-row: span 2; font-size: 30px; }
.btn.big small { font-family: 'Pixelify Sans'; font-size: 15px; color: var(--muted); }
.btn.on { background: linear-gradient(180deg, #2fbf71, #1b8a4f); }
.chip { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-family: 'Pixelify Sans'; font-size: 15px; }
.menu { display: flex; flex-direction: column; gap: 14px; margin-top: 5vh; }
.foot { margin-top: auto; }

/* Barras */
.bar { width: 100%; max-width: 1280px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 14px; }
.bar h2 { font-family: 'Press Start 2P'; font-size: clamp(30px, 4vw, 48px); letter-spacing: 2px; margin: 0; text-align: center; color: var(--gold); -webkit-text-stroke: 1px #1a0f2a; }
.bar > :first-child { justify-self: start; }
.bar > :last-child { justify-self: end; }

/* Rejilla de personajes */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; width: 100%; max-width: 1280px; }
.char-grid.compact { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-width: none; max-height: 52vh; overflow-y: auto; }
.char-card { position: relative; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: transform .12s, border-color .12s; aspect-ratio: 3/4; }
.char-card:hover { transform: translateY(-3px) scale(1.02); border-color: rgba(255, 255, 255, .5); }
.char-card canvas { width: 100%; height: 100%; display: block; }
.char-card .nm { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px; font-family: 'Pixelify Sans'; font-size: 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); text-align: center; }
.char-card .marks { position: absolute; top: 6px; left: 6px; display: flex; gap: 3px; }
.char-card .marks i { font-style: normal; font-family: 'Pixelify Sans'; font-size: 11px; padding: 1px 5px; border-radius: 5px; color: #111; }
.char-card.sel { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 197, 61, .5); }

/* Paneles de jugador */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; max-width: 1280px; margin-top: 16px; }
.slot { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px; display: grid; grid-template-columns: 120px 1fr; gap: 8px; cursor: pointer; position: relative; min-height: 210px; }
.slot.active { border-color: currentColor; box-shadow: 0 0 22px -4px currentColor; }
.slot.empty canvas { opacity: .15; }
.slot canvas { width: 120px; height: 150px; }
.slot .info h4 { margin: 0; font-family: 'Pixelify Sans'; font-size: 20px; color: var(--text); }
.slot .info .ttl { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.slot .info .ab { font-size: 13px; color: var(--text); margin-top: 4px; line-height: 1.15; }
.slot .tag { position: absolute; top: -10px; left: 12px; background: currentColor; border-radius: 6px; padding: 0 8px; font-family: 'Pixelify Sans'; font-size: 13px; }
.slot .tag span { color: #111; }
.slot select { width: 100%; grid-column: span 2; }
.slot .arrows { grid-column: span 2; display: flex; gap: 6px; }
.slot .arrows button { flex: 1; }
.stat { display: grid; grid-template-columns: 34px 1fr; align-items: center; font-size: 12px; color: var(--muted); gap: 4px; }
.stat .b { height: 6px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; }
.stat .b i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), #9d7bff); }
.wpns { display: flex; gap: 6px; margin-top: 4px; }
.wpns span { font-size: 12px; background: rgba(255, 255, 255, .08); padding: 1px 7px; border-radius: 6px; }
select, input { font-family: 'Pixelify Sans'; font-size: 16px; font-weight: 700; color: var(--text); background: #1d1636; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none; }
select:focus, input:focus { border-color: var(--cyan); }
.hint { color: var(--muted); font-size: 15px; text-align: center; }
kbd { font-family: 'Pixelify Sans'; font-size: 12px; background: #2a2148; border: 1px solid rgba(255, 255, 255, .2); border-bottom-width: 3px; border-radius: 6px; padding: 1px 7px; margin: 0 2px; color: #fff; white-space: nowrap; }

/* Escenarios */
.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; width: 100%; max-width: 1280px; }
.stage-card { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform .12s; }
.stage-card:hover { transform: translateY(-3px); }
.stage-card.sel { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 197, 61, .45); }
.stage-card canvas { width: 100%; aspect-ratio: 16/9; display: block; }
.stage-card div { padding: 10px 14px; }
.stage-card h4 { margin: 0; font-family: 'Pixelify Sans'; font-size: 19px; }
.stage-card p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.opts { margin-top: 20px; display: flex; gap: 24px; font-family: 'Pixelify Sans'; }
.stepper { display: inline-flex; align-items: center; gap: 10px; margin-left: 10px; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #2a2148; color: #fff; font-size: 18px; cursor: pointer; }
.stepper b { font-size: 24px; min-width: 24px; text-align: center; color: var(--gold); }

/* Paneles genéricos */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.panel h3 { font-family: 'Pixelify Sans'; margin: 4px 0 10px; font-size: 17px; color: var(--gold); letter-spacing: .5px; }
.panel.narrow { width: min(460px, 94vw); }
.panel.center { text-align: center; }
.panel.center h2 { font-family: 'Press Start 2P'; font-size: 48px; margin: 0 0 12px; color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-family: 'Pixelify Sans'; font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.sep { text-align: center; color: var(--muted); margin: 14px 0 6px; font-size: 14px; }
input.code { text-transform: uppercase; font-family: 'Pixelify Sans'; letter-spacing: 8px; width: 150px; text-align: center; font-size: 22px; }
.small { font-size: 14px; }
.muted { color: var(--muted); }
code { background: rgba(255, 255, 255, .08); padding: 1px 6px; border-radius: 5px; }
details summary { cursor: pointer; margin-top: 12px; }

/* Sala */
.lobby { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.3fr); gap: 16px; width: 100%; max-width: 1180px; }
.members { list-style: none; padding: 0; margin: 0 0 10px; }
.members li { display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--panel-2); margin-bottom: 6px; border-left: 4px solid currentColor; }
.members li canvas { width: 40px; height: 40px; }
.members li .who { color: var(--text); }
.members li .who b { font-family: 'Pixelify Sans'; }
.members li .rd { font-family: 'Pixelify Sans'; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #444; color: #ddd; }
.members li .rd.ok { background: #2fbf71; color: #062; }
.members li .x { background: none; border: none; color: #ff6b6b; cursor: pointer; font-size: 18px; }
.code-tag { font-family: 'Pixelify Sans'; background: #241a44; border: 1px solid var(--line); padding: 2px 14px; border-radius: 10px; letter-spacing: 6px; color: var(--cyan); cursor: pointer; }
.ping { color: var(--muted); font-size: 14px; }
.char-info { margin-top: 12px; color: var(--muted); font-size: 15px; }
.char-info b { color: var(--text); font-family: 'Pixelify Sans'; }
body:not(.is-host) .host-only { display: none !important; }
body.is-host .guest-only { display: none !important; }

/* Controles */
.controls-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; max-width: 1180px; }
.controls-grid .span { grid-column: span 3; }
.controls-grid table { width: 100%; border-collapse: collapse; }
.controls-grid td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.controls-grid td:first-child { color: var(--muted); }
.tips li { margin: 6px 0; line-height: 1.35; }

/* Resultados */
.results { display: flex; gap: 40px; align-items: center; margin: auto; flex-wrap: wrap; justify-content: center; }
.results canvas { width: 360px; height: 380px; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .6)); }
.win-sub { font-family: 'Pixelify Sans'; letter-spacing: 8px; color: var(--muted); }
.win-title { font-family: 'Press Start 2P'; font-size: clamp(48px, 7vw, 90px); margin: 0 0 10px; background: linear-gradient(180deg, #fff6c8, var(--gold), var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 2px #1a0f2a; }
.stats { border-collapse: collapse; margin-bottom: 16px; min-width: 380px; }
.stats th, .stats td { padding: 7px 12px; text-align: center; border-bottom: 1px solid var(--line); }
.stats th { font-family: 'Pixelify Sans'; font-size: 13px; color: var(--muted); }
.stats td:first-child { text-align: left; font-family: 'Pixelify Sans'; }

#toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px); background: #2a1d4a; border: 1px solid var(--line); padding: 10px 20px; border-radius: 10px; transition: transform .3s; font-family: 'Pixelify Sans'; z-index: 10; }
#toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 1000px) {
  .slots { grid-template-columns: repeat(2, 1fr); }
  .lobby, .controls-grid { grid-template-columns: 1fr; }
  .controls-grid .span { grid-column: auto; }
}

/* Creador y opciones */
.btn.danger { background: linear-gradient(180deg, #7a2030, #4a1020); }
.check { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-family: 'Pixelify Sans'; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.creator { display: grid; grid-template-columns: 380px 1fr; gap: 16px; width: 100%; max-width: 1380px; }
.cr-left { display: flex; flex-direction: column; }
#cr-preview { width: 100%; height: 420px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 8px; }
.cr-left .row .btn { flex: 1; padding: 8px 6px; font-size: 14px; }
.cr-right { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#creator-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
#creator-tabs button { font-family: 'Pixelify Sans'; background: #241a44; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-size: 15px; }
#creator-tabs button.on { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2a1206; }
#creator-body { overflow-y: auto; padding-right: 6px; max-height: calc(100vh - 210px); }
.cr-row { margin-bottom: 14px; }
.cr-row h4 { font-family: 'Pixelify Sans'; margin: 0 0 8px; color: var(--gold); font-size: 15px; }
.cr-row h4 small { font-family: 'Pixelify Sans'; font-size: 14px; margin-left: 8px; }
.cr-row h4 small.bad { color: #ff6b6b; }
.cr-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.cr-opt { position: relative; width: 92px; background: #1d1636; border: 2px solid var(--line); border-radius: 12px; padding: 4px; cursor: pointer; color: var(--text); font-family: 'Pixelify Sans'; font-weight: 700; font-size: 13px; transition: transform .1s, border-color .1s; }
.cr-opt:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.4); }
.cr-opt.on { border-color: var(--gold); box-shadow: 0 0 14px rgba(255,197,61,.4); background: #2a2050; }
.cr-opt canvas { width: 80px; height: 80px; display: block; margin: 0 auto; }
.cr-opt span { display: block; text-align: center; }
.cr-opt em { position: absolute; top: 4px; right: 6px; font-style: normal; font-family: 'Pixelify Sans'; background: #ffb43d; color: #111; border-radius: 6px; padding: 0 6px; font-size: 12px; }
.cr-opt em.b { background: #4dd8ff; }
.cr-colors { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cr-color { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); cursor: pointer; }
.cr-color input { width: 56px; height: 56px; border: 2px solid var(--line); border-radius: 12px; padding: 2px; background: #1d1636; cursor: pointer; }
.cr-palettes { display: flex; gap: 8px; flex-wrap: wrap; }
.cr-pal { display: flex; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; padding: 0; cursor: pointer; background: #1d1636; color: #fff; font-size: 20px; min-width: 44px; height: 40px; align-items: stretch; justify-content: center; }
.cr-pal i { width: 18px; }
.cr-pal:hover { border-color: var(--gold); }
.cr-abilities { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cr-ab { text-align: left; background: #1d1636; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--text); cursor: pointer; font-family: 'Pixelify Sans'; display: flex; flex-direction: column; gap: 3px; }
.cr-ab b { font-family: 'Pixelify Sans'; color: var(--gold); font-size: 14px; }
.cr-ab span { font-size: 14px; color: var(--muted); }
.cr-ab small { font-size: 12px; color: var(--cyan); }
.cr-ab.on { border-color: var(--gold); background: #2a2050; }
.cr-stat { display: grid; grid-template-columns: 170px 32px 1fr 32px 30px; align-items: center; gap: 8px; margin: 6px 0; }
.cr-stat span { font-family: 'Pixelify Sans'; font-size: 14px; display: flex; flex-direction: column; }
.cr-stat span small { font-family: 'Pixelify Sans'; color: var(--muted); font-size: 12px; }
.cr-stat button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: #2a2148; color: #fff; font-size: 18px; cursor: pointer; }
.cr-stat .pips { display: flex; gap: 4px; }
.cr-stat .pips i { flex: 1; height: 12px; border-radius: 3px; background: rgba(255,255,255,.08); }
.cr-stat .pips i.on { background: linear-gradient(90deg, var(--cyan), #9d7bff); }
.cr-stat b { font-family: 'Pixelify Sans'; color: var(--gold); text-align: center; }
.char-card .edit { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); border: 1px solid var(--line); color: #fff; border-radius: 8px; width: 28px; height: 28px; cursor: pointer; }
.char-card.new { display: flex; align-items: center; justify-content: center; flex-direction: column; font-family: 'Pixelify Sans'; color: var(--gold); border-style: dashed; }
.char-card.new b { font-size: 48px; line-height: 1; }
.char-card .badge { position: absolute; top: 8px; right: 40px; font-size: 10px; color: #111; background: var(--cyan); border-radius: 5px; padding: 0 5px; font-family: 'Pixelify Sans'; }
@media (max-width: 1000px) { .creator { grid-template-columns: 1fr; } #cr-preview { height: 300px; } }

/* ===== Estilo pixel art ===== */
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.logo h1 { font-size: clamp(36px, 7vw, 92px); line-height: 1.15; letter-spacing: 2px; -webkit-text-stroke: 0; text-shadow: 4px 4px 0 #1a0f2a, -2px -2px 0 #1a0f2a, 2px -2px 0 #1a0f2a, -2px 2px 0 #1a0f2a; }
.logo h1 span { letter-spacing: 10px; font-size: .55em; margin-top: 10px; }
.logo.mini h1 { font-size: clamp(28px, 4.5vw, 60px); }
.bar h2 { font-size: clamp(16px, 2.2vw, 28px); -webkit-text-stroke: 0; text-shadow: 3px 3px 0 #1a0f2a; }
.win-title { font-size: clamp(22px, 3.6vw, 46px); -webkit-text-stroke: 0; text-shadow: 4px 4px 0 #1a0f2a; line-height: 1.3; }
.panel.center h2 { font-size: 30px; }
.btn, .panel, .char-card, .slot, .stage-card, .cr-opt, .cr-ab, select, input, .chip, #creator-tabs button, .members li, kbd { border-radius: 0 !important; }
.btn { border: 3px solid #120d1c; box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.18), 4px 4px 0 #120d1c; font-size: 18px; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.25), 6px 6px 0 #120d1c; }
.btn:active { transform: translate(3px, 3px); box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), 1px 1px 0 #120d1c; }
.btn.big { font-size: 22px; }
.panel, .slot, .char-card, .stage-card { border: 3px solid #120d1c; box-shadow: 0 0 0 2px rgba(255,255,255,.08) inset, 5px 5px 0 rgba(0,0,0,.45); }
.char-card.sel, .stage-card.sel, .cr-opt.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 5px 5px 0 rgba(0,0,0,.45); }
.char-card .nm { font-size: 15px; background: #120d1c; padding: 4px; }
.members li canvas, .char-card canvas, .slot canvas, #cr-preview, #winner-canvas, .cr-opt canvas, .stage-card canvas { image-rendering: pixelated; }
.press { font-family: 'Press Start 2P'; font-size: 14px; }
kbd { font-family: 'Press Start 2P'; font-size: 10px; }
body { font-size: 17px; }
#dim { background: rgba(11,8,22,0.72); }

/* Workshop */
.ws-top { display: flex; gap: 10px; width: 100%; max-width: 1280px; margin-bottom: 10px; }
.ws-top input { flex: 1; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; width: 100%; max-width: 1280px; }
.ws-card { display: grid; grid-template-columns: 110px 1fr; gap: 12px; background: var(--panel); border: 3px solid #120d1c; padding: 10px; box-shadow: 5px 5px 0 rgba(0,0,0,.45); }
.ws-card .char-card { aspect-ratio: 3/4; cursor: default; }
.ws-info { display: flex; flex-direction: column; gap: 3px; }
.ws-info b { font-family: 'Press Start 2P'; font-size: 13px; color: var(--gold); }
.ws-info .row .btn { padding: 6px 10px; font-size: 15px; }
.btn.on { background: linear-gradient(180deg, #ff6b8a, #c8234a); }
/* Pintar */
.pt-wrap { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
#pt-canvas { width: 320px; height: 320px; border: 3px solid #120d1c; cursor: crosshair; touch-action: none; background: #241b3e; }
.pt-side { flex: 1; min-width: 260px; }
.pt-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.pt-tools .btn { padding: 6px 10px; font-size: 15px; }
.pt-pal { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pt-col { border: 3px solid #120d1c; padding: 2px; cursor: pointer; }
.pt-col.on { border-color: var(--gold); }
.pt-col input { width: 36px; height: 36px; border: none; padding: 0; background: none; cursor: pointer; }
.pt-add { width: 46px; height: 46px; background: #241b3e; color: #fff; border: 3px dashed var(--line); font-size: 22px; cursor: pointer; }
/* Ataques */
.mv-list { display: flex; flex-direction: column; gap: 6px; }
.mv { display: grid; grid-template-columns: 140px 170px 1fr auto auto auto; gap: 10px; align-items: center; background: #1d1636; padding: 6px 10px; border: 2px solid #120d1c; }
.mv b { font-family: 'Pixelify Sans'; font-size: 15px; }
.mv label { display: flex; align-items: center; gap: 6px; }
.mv input[type=range] { flex: 1; accent-color: var(--gold); }
.mv input[type=range].off { opacity: .35; }
.mv-step { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.mv-step button { width: 26px; height: 26px; background: #2a2148; color: #fff; border: 2px solid #120d1c; cursor: pointer; }
.mv-step i { font-style: normal; min-width: 18px; text-align: center; color: var(--gold); font-family: 'Press Start 2P'; font-size: 11px; }
.mv-reset { padding: 4px 8px !important; font-size: 14px !important; }
@media (max-width: 1100px) { .mv { grid-template-columns: 1fr 1fr; } }

/* ===== Controles táctiles ===== */
#touch { display: none; position: fixed; inset: 0; z-index: 5; pointer-events: none; user-select: none; -webkit-user-select: none; touch-action: none; }
body.touch.playing #touch { display: block; }
.t-stick { position: absolute; left: 0; top: 30%; width: 45%; bottom: 0; pointer-events: auto; touch-action: none; }
.t-base, .t-knob { position: absolute; transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.5); opacity: 0; transition: opacity .1s; }
.t-base { width: 120px; height: 120px; background: rgba(18,13,28,.35); }
.t-knob { width: 54px; height: 54px; background: rgba(255,255,255,.35); }
.t-stick.on .t-base, .t-stick.on .t-knob { opacity: 1; }
.t-btns { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: 14px; width: 250px; height: 210px; pointer-events: auto; touch-action: none; }
.t-btn { position: absolute; width: 74px; height: 74px; font-family: 'Press Start 2P'; font-size: 10px; color: #fff; border: 3px solid #120d1c; background: rgba(60,48,100,.72); box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.2); touch-action: none; }
.t-btn.on { transform: translate(2px, 2px); filter: brightness(1.5); }
.b-light { right: 0; bottom: 0; width: 86px; height: 86px; background: rgba(255,120,60,.8); }
.b-heavy { right: 92px; bottom: 6px; background: rgba(220,50,80,.8); }
.b-jump { right: 4px; bottom: 94px; background: rgba(60,170,255,.8); }
.b-dodge { right: 92px; bottom: 90px; background: rgba(120,220,140,.8); }
.b-throw { right: 178px; bottom: 6px; width: 62px; height: 62px; font-size: 8px; }
.b-special { right: 178px; bottom: 80px; width: 62px; height: 62px; font-size: 18px; background: rgba(255,200,60,.8); color: #2a1206; }
.t-pause { position: absolute; bottom: 14px; left: max(12px, env(safe-area-inset-left)); width: 46px; height: 36px; pointer-events: auto; background: rgba(18,13,28,.6); color: #fff; border: 2px solid rgba(255,255,255,.4); font-size: 14px; }
#rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  body.playing #rotate { display: flex; position: fixed; inset: 0; z-index: 20; background: #0b0816; color: #fff; align-items: center; justify-content: center; text-align: center; font-family: 'Press Start 2P'; font-size: 14px; line-height: 2; padding: 30px; }
}
/* Menús en pantallas pequeñas */
@media (max-width: 760px), (max-height: 520px) {
  .screen { padding: 10px; }
  .btn.big { font-size: 16px; padding: 10px 14px; width: min(460px, 94vw); }
  .btn.big small { font-size: 12px; }
  .menu { gap: 8px; margin-top: 2vh; }
  .logo { margin-top: 4vh; }
  .logo.mini { display: none; }
  .bar { margin-bottom: 8px; }
  .slots { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .slot { grid-template-columns: 70px 1fr; min-height: 0; padding: 6px; }
  .slot canvas { width: 70px; height: 88px; }
  .slot .info .ab, .slot .stat { display: none; }
  .char-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
  .hint { display: none; }
  .stage-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .creator { grid-template-columns: 1fr; }
  #cr-preview { height: 220px; }
  .results canvas { width: 200px; height: 212px; }
  .stats { min-width: 0; font-size: 14px; }
  .lobby { grid-template-columns: 1fr; }
}
body.touch kbd { display: none; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; font-family: 'Pixelify Sans'; font-size: 13px; text-decoration: underline; margin-left: 8px; }
.link:hover { color: #ff8080; }

.pt-targets { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pt-targets .btn { font-size: 15px; padding: 8px 12px; }
.pt-upload { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.pt-upload .btn { font-size: 15px; padding: 8px 14px; cursor: pointer; }
.pt-upload input[type=range] { accent-color: var(--gold); vertical-align: middle; }
#pt-canvas { width: auto; height: auto; max-width: 100%; }

html, body { touch-action: none; overscroll-behavior: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.screen { touch-action: pan-y; }
input, select, textarea { -webkit-user-select: text; user-select: text; touch-action: auto; }

/* Tienda y monedas */
.coin-chip { font-family: 'Press Start 2P'; font-size: 12px; color: var(--gold); background: #120d1c; border: 2px solid var(--gold); padding: 6px 10px; }
.coin-chip.big { font-size: 15px; }
.coin-reward { font-family: 'Press Start 2P'; font-size: 13px; color: var(--gold); margin: 6px 0 10px; }
.shop-ad { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; width: 100%; max-width: 1280px; margin-bottom: 14px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; width: 100%; max-width: 1280px; }
.shop-card { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 3px solid #120d1c; padding: 8px; text-align: center; }
.shop-card .char-card { cursor: default; }
.shop-card b { font-family: 'Press Start 2P'; font-size: 12px; color: var(--gold); margin-top: 4px; }
.shop-card .btn { font-size: 14px; padding: 8px; }
.owned-tag { color: #6fe08a; font-family: 'Press Start 2P'; font-size: 10px; padding: 8px 0; }
.char-card.locked canvas { filter: grayscale(1) brightness(.45); }
.char-card .lock { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-family: 'Press Start 2P'; font-size: 11px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
#adtest { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; }
#adtest .ad-count { font-family: 'Press Start 2P'; font-size: 40px; color: var(--gold); margin: 20px; }
