* {
  box-sizing: border-box;
}

/* v3.7 · Publicador autenticado de quedadas y batallas del mapa */
.event-publisher{min-height:calc(100vh - 84px);padding:28px;background:radial-gradient(circle at 85% 12%,rgba(226,43,197,.13),transparent 29%),radial-gradient(circle at 8% 80%,rgba(57,223,255,.1),transparent 30%)}
.event-publisher-head{align-items:flex-end;margin-bottom:16px}.event-publisher-head p{margin:6px 0 0;color:#94a1b7}.event-map-link{display:inline-flex;align-items:center;text-decoration:none;white-space:nowrap}
.event-kind-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;max-width:720px;margin-bottom:16px;padding:6px;border:1px solid #2a3a54;border-radius:16px;background:#08111e}
.event-kind-tabs button{padding:13px;border:1px solid transparent;border-radius:11px;background:transparent;color:#aab6ca;font-weight:800;cursor:pointer}.event-kind-tabs button.selected{border-color:#a650ff;background:linear-gradient(135deg,#5020c8,#c12cc4);color:#fff;box-shadow:0 10px 30px rgba(135,55,244,.24)}
.event-publisher-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(280px,.55fr);gap:16px;align-items:start}
.event-form,.event-publications-card{border:1px solid #2a3a54;border-radius:20px;background:linear-gradient(145deg,rgba(14,25,43,.97),rgba(7,13,24,.97));box-shadow:0 18px 50px rgba(0,0,0,.2)}
.event-form{display:grid;grid-template-columns:1fr 1fr;gap:14px;padding:22px}.event-form-title{grid-column:1/-1;padding-bottom:5px}.event-form-title>span,.event-publications-card>div>small{color:#9d75ff;font-size:10px;font-weight:900;letter-spacing:.15em}.event-form-title h3,.event-publications-card h3{margin:5px 0;font-size:24px}.event-form-title p{margin:0;color:#8f9cb0;font-size:13px}
.event-field{display:flex;min-width:0;flex-direction:column;gap:7px;color:#dfe6f2;font-size:13px;font-weight:700}.event-wide{grid-column:1/-1}.event-field input,.event-field select,.event-field textarea{width:100%;min-width:0;padding:12px 13px;border:1px solid #34445d;border-radius:11px;outline:0;background:#080f1c;color:#fff;font:inherit}.event-field input:focus,.event-field select:focus,.event-field textarea:focus{border-color:#a650ff;box-shadow:0 0 0 4px rgba(166,80,255,.1)}.event-field textarea{resize:vertical}.event-field small{color:#7f8da3;font-size:11px;font-weight:500}
.event-address-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}.event-address-row button{padding:10px 13px;white-space:nowrap}
.event-safety{display:flex;align-items:flex-start;gap:9px;color:#b8c3d5;font-size:12px}.event-safety input{width:18px;height:18px;margin:0;accent-color:#9f42ff}.event-safety a{color:#c7a7ff}.event-submit{min-height:48px}
.event-publications-card{position:sticky;top:100px;padding:20px}.event-publications-card h3{font-size:20px}.event-publications-list{display:grid;gap:9px;margin-top:14px}.map-event-item{padding:13px;border:1px solid #2b3b54;border-radius:13px;background:#091321}.map-event-item header{display:flex;align-items:center;justify-content:space-between;gap:8px}.map-event-item header span{padding:4px 7px;border-radius:7px;background:rgba(87,225,255,.1);color:#79eafa;font-size:9px;font-weight:900;letter-spacing:.08em}.map-event-item.battle header span{background:rgba(235,63,207,.11);color:#ff75e6}.map-event-item h4{margin:9px 0 5px;font-size:15px}.map-event-item p{margin:0;color:#94a1b5;font-size:12px}.map-event-item footer{display:flex;justify-content:space-between;align-items:center;margin-top:10px}.map-event-item footer small{color:#738198}.map-event-item footer button{padding:6px 8px;border:1px solid #63384d;border-radius:8px;background:#22101a;color:#ff9bbb;font-size:10px;cursor:pointer}
#event-publisher-status{min-height:18px;margin:8px 0 0}.event-location-ok{color:#6ce8b7!important}
@media(max-width:900px){.event-publisher-grid{grid-template-columns:1fr}.event-publications-card{position:static}.event-publisher{padding:18px 14px 92px}}
@media(max-width:600px){.event-publisher-head{align-items:flex-start;flex-direction:column}.event-map-link{margin-top:10px}.event-kind-tabs{grid-template-columns:1fr}.event-form{grid-template-columns:1fr;padding:16px}.event-wide,.event-form-title{grid-column:auto}.event-address-row{grid-template-columns:1fr}.event-address-row button{width:100%}}
@media(orientation:landscape) and (max-height:700px){.event-publisher{height:calc(100svh - 60px);padding:10px 12px 64px;overflow:auto}.event-publisher-head{margin-bottom:8px}.event-kind-tabs{margin-bottom:8px}.event-form{padding:14px}.event-publications-card{top:64px}}

/* Resultado de batalla: aura inequívoca alrededor del avatar vencedor. */
.fighter.battle-winner .battlecanvas {
  border-color: #ffd96a;
  box-shadow: 0 0 0 2px #ffd96a55, 0 0 28px #ffd64f66, inset 0 0 32px #ffcb4425;
}
.fighter.battle-winner .battlecanvas::before {
  content: "";
  position: absolute;
  z-index: 7;
  inset: 7%;
  pointer-events: none;
  border: 2px solid #ffe98b;
  border-radius: 50%;
  box-shadow: 0 0 18px #ffe45c, 0 0 52px #d837e899, inset 0 0 25px #ffde6744;
  animation: battle-winner-aura 1.7s ease-in-out infinite alternate;
}
.fighter.battle-winner .battlecanvas::after {
  content: "🏆 " attr(data-winner-label);
  position: absolute;
  z-index: 8;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 13px;
  border: 1px solid #ffe17c;
  border-radius: 999px;
  color: #fff7c7;
  background: linear-gradient(110deg, #6d3d00ee, #a54a11ee);
  box-shadow: 0 8px 28px #0009, 0 0 20px #ffd85d88;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .08em;
  white-space: nowrap;
}
.fighter.battle-loser { opacity: .72; filter: saturate(.75); }
.battle-runtime strong.urgent { color: #ff7188; animation: battle-timer-pulse .55s ease-in-out infinite alternate; }
@keyframes battle-winner-aura { from { opacity: .56; transform: scale(.96); } to { opacity: 1; transform: scale(1.03); } }
@keyframes battle-timer-pulse { to { transform: scale(1.12); text-shadow: 0 0 13px #ff426b; } }
html {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: #070912;
  color: #f7f5ff;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
}
.skip-link{position:fixed;z-index:9999;top:8px;left:8px;transform:translateY(-160%);padding:10px 14px;border-radius:10px;background:#fff;color:#080b14;font-weight:800}.skip-link:focus{transform:none}
:focus-visible{outline:3px solid #75efbd;outline-offset:3px}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

/* iPhone/Android en horizontal: interfaz compacta de dos columnas. */
@media (orientation: landscape) and (max-width: 1000px) and (max-height: 600px) {
  body { width: 100%; min-width: 0; overflow: hidden; }
  main { height: 100svh; padding-bottom: calc(54px + env(safe-area-inset-bottom)); overflow: hidden; }
  .side {
    height: calc(54px + env(safe-area-inset-bottom));
    padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .side nav { height: 46px; gap: 5px; }
  .side nav button { min-height: 44px; padding: 3px 2px; border-radius: 10px; }
  .side nav button::first-letter { font-size: 17px; }
  header { min-height: 54px; height: 54px; padding: 5px max(14px, env(safe-area-inset-right)) 5px max(14px, env(safe-area-inset-left)); }
  header small { font-size: 9px; }
  header h1 { font-size: 24px; line-height: 1; }

  #creator.active {
    display: grid;
    grid-template-columns: minmax(0, 58%) minmax(280px, 42%);
    height: calc(100svh - 108px - env(safe-area-inset-bottom));
    min-height: 0;
    overflow: hidden;
  }
  #creator > .stage { height: 100%; min-height: 0; }
  #creator > .panel {
    position: relative; inset: auto; width: 100%; height: 100%;
    overflow-y: auto; padding: 10px; border-top: 0; border-left: 1px solid #273042;
  }
  .tabs { margin-bottom: 10px; gap: 4px; }
  .tabs button { padding: 7px 3px; font-size: 12px; }
  .panel label { margin: 9px 0 5px; }
  .cards { gap: 5px; }
  .cards button { padding: 8px 5px; font-size: 11px; }
  .info { margin-top: 10px; padding: 9px; font-size: 11px; line-height: 1.35; }
  .save { margin-top: 10px; }
  .tools { top: 7px; left: 7px; right: auto; max-width: calc(100% - 14px); }
  .tools button { min-width: 58px; padding: 7px 5px; font-size: 11px; }
  .status { top: 7px; left: auto; right: 7px; max-width: 48%; padding: 7px 9px; }
  .camera-pad { right: 7px; bottom: 7px; padding: 4px; gap: 3px; }
  .camera-pad button, .camera-pad.compact button { width: 30px; height: 30px; font-size: 15px; }

  .studio, .battlewrap, .ranking { height: calc(100svh - 108px - env(safe-area-inset-bottom)); padding: 8px 10px; overflow-y: auto; }
  .studiohead, .battlehead { flex-direction: row; align-items: center; gap: 8px; }
  .studiohead h2, .battlehead h2 { font-size: 18px; }
  .studiohead small, .battlehead small { font-size: 9px; }
  .studiohead > div:last-child { display: flex; }
  .studiohead button, .battlehead button { padding: 8px 10px; font-size: 11px; }
  .movegrid { display: grid; grid-template-columns: minmax(0, 60%) minmax(270px, 40%); height: calc(100% - 43px); margin-top: 7px; overflow: hidden; }
  .movegrid > .stage { width: 100%; height: 100%; min-height: 0; }
  .movegrid > .move-panel { position: relative; width: 100%; height: 100%; overflow-y: auto; padding: 10px; border-top: 0; border-left: 1px solid #273042; }

  .battlewrap { overflow: hidden; }
  .battlehead { height: 38px; }
  .arenas { display: grid; grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr); height: calc(100% - 70px); gap: 6px; }
  .fighter { height: 100%; min-height: 0; grid-template-rows: 22px minmax(0, 1fr) 34px 34px; gap: 4px; }
  .fighter > b { font-size: 14px; }
  .fighter select, .fighter button { min-width: 0; padding: 5px; font-size: 11px; }
  .battlecanvas { width: 100%; min-height: 0; height: 100%; }
  .versus { display: block; font-size: 18px; }
  .versus small { font-size: 8px; overflow-wrap: anywhere; }
  .score { height: 28px; margin: 2px 0 0; font-size: 18px; }
}

/* v3: comunidad y sala de batalla */
.battle-runtime{display:flex;align-items:center;gap:10px;padding:10px 14px;margin:8px 0;border:1px solid #263750;border-radius:14px;background:#091423}.battle-runtime strong{margin-left:auto;color:#69edb7;font-variant-numeric:tabular-nums}.battle-history{max-height:260px;overflow:auto;margin:8px 0;padding:10px;border:1px solid #263750;border-radius:14px;background:#08111d}.battle-history article{display:flex;justify-content:space-between;gap:12px;padding:9px;border-bottom:1px solid #1e2c42}.community-wrap{padding:28px;min-height:calc(100vh - 96px)}.community-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.community-card{min-width:0;padding:18px;border:1px solid #263750;border-radius:18px;background:#08111d}.community-card h3{margin-top:0}.community-card form{display:flex;gap:8px}.community-card input{min-width:0;flex:1}.community-item{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding:10px;border:1px solid #23334a;border-radius:12px}.community-item small{display:block;color:#93a0b8}.community-item button{padding:7px 9px}.hidden{display:none!important}
@media(max-width:760px){.side nav{grid-template-columns:repeat(8,minmax(0,1fr))!important;gap:3px!important}.side nav button .nav-icon{font-size:18px!important}.community-wrap{padding:14px 14px 88px}.community-grid{grid-template-columns:1fr}.community-card{padding:13px}.community-card form{flex-direction:column}.battle-runtime{flex-wrap:wrap}.battle-runtime strong{margin-left:0}.battle-history article{font-size:12px}}
@media(orientation:landscape) and (max-width:1000px) and (max-height:600px){.side nav{grid-template-columns:repeat(8,minmax(0,1fr))!important}.community-wrap{height:calc(100svh - 108px);padding:8px 12px 62px;overflow:auto}.community-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.community-card{padding:10px}.battle-runtime{padding:4px 8px;margin:3px 0;font-size:10px}}

.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions select, .move-library select, .battle-lobby select, .battle-lobby input, .auth-dialog input {
  background: #0d1320; color: #fff; border: 1px solid #35445d; border-radius: 10px; padding: 10px;
}
.header-actions .ghost { padding: 10px 14px; }
.move-library { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto auto; gap: 8px; align-items: center; margin-top: 12px; }
.move-library label { color: #aab6ca; font-weight: 700; }
.battle-lobby { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(180px, .7fr) auto; gap: 10px; align-items: end; margin: 14px 0; padding: 12px; background: #0a101c; border: 1px solid #27354a; border-radius: 14px; }
.battle-lobby .battle-resume { grid-column: 1 / -1; border-color: #55dff277; color: #bff8ff; }
.battle-lobby label { display: grid; gap: 5px; color: #aab6ca; font-size: 12px; }
.battle-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.battle-modes button { padding: 10px; border-radius: 10px; border: 1px solid #344158; background: #0d1422; color: #dbe4f3; cursor: pointer; }
.battle-modes button.selected { border-color: #ae4cff; background: #2a154a; }
.battle-invite { position: fixed; z-index: 150; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 12px; background: #101827; border: 1px solid #9147ff; border-radius: 14px; box-shadow: 0 18px 60px #000b; }
.home-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-top: 30px; }
.home-steps article { display: grid; gap: 8px; padding: 20px; border: 1px solid #2c3950; border-radius: 16px; background: #0b1220; }
.home-steps span { color: #9dacbf; }
.auth-pending .shell { opacity: 0; pointer-events: none; }
.auth-required .shell { filter: blur(5px) saturate(.55); pointer-events: none; user-select: none; }
.auth-required .dialog-close { display: none; }
.auth-dialog {
  width: min(94vw, 860px); max-height: min(92svh, 720px); color: #fff; background: #070b15;
  border: 1px solid #33415a; border-radius: 24px; padding: 0; overflow: auto;
  box-shadow: 0 28px 100px #000d, 0 0 70px #7138ff22;
}
.auth-dialog::backdrop { background: #01030bee; backdrop-filter: blur(12px); }
.auth-card { display: grid; grid-template-columns: minmax(270px, .85fr) minmax(370px, 1.15fr); min-height: 570px; }
.auth-brand-panel {
  position: relative; display: flex; flex-direction: column; justify-content: center; padding: 44px;
  overflow: hidden; background: radial-gradient(circle at 20% 18%, #ac48ff55, transparent 38%), radial-gradient(circle at 85% 80%, #ed2bc444, transparent 42%), linear-gradient(145deg, #13102b, #080c19 72%);
  border-right: 1px solid #303952;
}
.auth-brand-panel::after { content: ""; position: absolute; width: 260px; height: 260px; right: -110px; bottom: -100px; border: 1px solid #af5cff55; border-radius: 50%; box-shadow: 0 0 0 28px #9b46ef12, 0 0 0 58px #d92fc00b; }
.auth-mark { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 24px; border-radius: 20px; background: linear-gradient(135deg,#6546ff,#ec2cc6); box-shadow: 0 14px 34px #b12ee955; font-size: 30px; }
.auth-logo { font-size: 34px; line-height: 1.05; font-weight: 900; font-style: italic; letter-spacing: -1.5px; }
.auth-brand-panel p { max-width: 280px; margin: 22px 0; color: #b8c0d2; font-size: 16px; line-height: 1.6; }
.auth-features { display: flex; flex-wrap: wrap; gap: 7px; }
.auth-features span { padding: 7px 9px; border: 1px solid #5c4a85; border-radius: 999px; color: #cfbaff; font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.auth-form-panel { position: relative; padding: 42px 46px; }
.auth-form-panel > small { color: #9d7cff; font-weight: 800; letter-spacing: 2px; }
.auth-form-panel h2 { margin: 12px 0 8px; font-size: clamp(28px, 4vw, 38px); line-height: 1.08; }
.auth-form-panel > p { color: #99a6bb; line-height: 1.5; }
.auth-dialog label { display: grid; gap: 8px; margin: 16px 0; color: #dfe5f1; font-size: 13px; font-weight: 750; }
.auth-dialog input { width: 100%; min-height: 48px; padding: 13px 14px; font-size: 16px; }
.auth-dialog input:focus { outline: 2px solid #9a4dff; outline-offset: 1px; border-color: transparent; }
.auth-dialog .primary { width: 100%; min-height: 50px; }
.auth-main-action { margin-top: 3px; }
.auth-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 22px 0 8px; padding: 5px; background: #0c1321; border: 1px solid #26344a; border-radius: 13px; }
.auth-mode button { padding: 11px 8px; color: #aab5c8; background: transparent; border: 0; border-radius: 9px; font-weight: 750; cursor: pointer; }
.auth-mode button.selected { color: #fff; background: linear-gradient(110deg,#5932d8,#a92cce); box-shadow: 0 6px 18px #592bc844; }
.auth-code-step { margin-top: 14px; padding-top: 3px; border-top: 1px solid #27334a; }
.auth-code-step input { text-align: center; font-size: 24px; font-weight: 800; letter-spacing: 9px; }
.auth-privacy { margin: 16px 0 0 !important; text-align: center; color: #75839a !important; font-size: 11px; }
.auth-privacy a,.auth-legal a{color:#b98dff}.auth-legal{display:flex!important;grid-template-columns:auto 1fr!important;align-items:flex-start;gap:9px!important;margin-top:13px!important;color:#9ba8bc!important;font-size:11px!important;line-height:1.45}.auth-legal input{margin-top:3px;accent-color:#9d45ff;flex:0 0 auto}
.auth-legal.hidden{display:none!important}
.auth-status { min-height: 20px; margin: 10px 0 0 !important; text-align: center; color: #79efbf !important; font-weight: 700; }
.dialog-close { position: absolute; z-index: 2; top: 16px; right: 18px; border: 0; background: transparent; color: #98a4b8; font-size: 26px; cursor: pointer; }

@media (max-width: 760px) and (orientation: portrait) {
  .auth-dialog { width: calc(100vw - 22px); max-height: calc(100svh - 22px); border-radius: 20px; }
  .auth-card { display: block; min-height: 0; }
  .auth-brand-panel { min-height: 148px; padding: 24px 26px; border-right: 0; border-bottom: 1px solid #303952; }
  .auth-mark { width: 42px; height: 42px; margin-bottom: 11px; border-radius: 13px; font-size: 20px; }
  .auth-logo { font-size: 23px; }
  .auth-brand-panel p { margin: 10px 0 0; font-size: 12px; }
  .auth-features { display: none; }
  .auth-form-panel { padding: 25px 22px calc(25px + env(safe-area-inset-bottom)); }
  .auth-form-panel h2 { font-size: 27px; }
  .auth-mode { margin-top: 16px; }
  .pill { display: none; }
  .header-actions { margin-left: auto; }
  .header-actions .ghost { width: auto; padding: 8px; font-size: 11px; }
  .header-actions select { padding: 8px 5px; }
  .move-library { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .move-library label, .move-library select { grid-column: 1 / -1; }
  .move-library button { min-width: 0; padding-inline: 6px; }
  .battle-lobby { grid-template-columns: 1fr 1fr; }
  .battle-modes, #battle-user-field { grid-column: 1 / -1; }
.battle-lobby .primary { grid-column: 1 / -1; }
.battle-lobby .battle-resume { grid-column: 1 / -1; border-color: #55dff277; color: #bff8ff; }
  .home-steps { grid-template-columns: 1fr; }
  .battle-invite { top: max(10px, env(safe-area-inset-top)); width: calc(100% - 20px); flex-wrap: wrap; }
}

@media (orientation: landscape) and (max-width: 1000px) and (max-height: 600px) {
  .auth-dialog { width: calc(100vw - 18px); max-height: calc(100svh - 12px); border-radius: 16px; }
  .auth-card { grid-template-columns: minmax(180px, .7fr) minmax(360px, 1.3fr); min-height: 0; }
  .auth-brand-panel { justify-content: flex-start; padding: 20px; }
  .auth-mark { width: 38px; height: 38px; margin-bottom: 10px; border-radius: 12px; font-size: 18px; }
  .auth-logo { font-size: 22px; }
  .auth-brand-panel p { margin: 10px 0; font-size: 11px; line-height: 1.35; }
  .auth-features { gap: 4px; }
  .auth-features span { padding: 4px 6px; font-size: 8px; }
  .auth-form-panel { padding: 16px 24px; }
  .auth-form-panel h2 { margin: 5px 0 3px; font-size: 22px; }
  .auth-form-panel > p { margin: 4px 0; font-size: 11px; }
  .auth-mode { margin: 8px 0 4px; padding: 3px; }
  .auth-mode button { padding: 7px 6px; }
  .auth-dialog label { gap: 4px; margin: 7px 0; }
  .auth-dialog input { min-height: 38px; padding: 7px 10px; }
  .auth-dialog .primary { min-height: 40px; }
  .auth-privacy { margin-top: 7px !important; }
  .auth-status { min-height: 14px; margin-top: 4px !important; }
  header .pill { display: none; }
  .header-actions select, .header-actions .ghost { padding: 5px 7px; font-size: 10px; }
  .move-library { margin-top: 4px; grid-template-columns: auto minmax(120px,1fr) repeat(3,auto); gap: 4px; font-size: 10px; }
  .move-library select, .move-library button { padding: 5px; font-size: 9px; }
  .movegrid { height: calc(100% - 72px); }
  .battle-lobby { grid-template-columns: 1fr 60px minmax(110px,.7fr) auto; margin: 4px 0; padding: 4px; gap: 4px; }
  .battle-lobby button, .battle-lobby select, .battle-lobby input { padding: 5px; font-size: 9px; }
  .arenas { height: calc(100% - 108px); }
  .home-steps { margin-top: 12px; gap: 7px; }
  .home-steps article { padding: 10px; }
}
.shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}
.side {
  background: #050711;
  border-right: 1px solid #232b3c;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand {
  font-size: 25px;
  font-weight: 900;
  font-style: italic;
}
.brand b {
  display: block;
}
.side nav {
  display: grid;
  gap: 8px;
}
.side nav button,
.tools button,
.tabs button,
.ghost,
.secondary,
.vote {
  background: #0d1320;
  border: 1px solid #283448;
  color: #cfd7e8;
  border-radius: 12px;
  padding: 13px 15px;
  text-align: left;
  cursor: pointer;
}
.side nav button.active,
.tabs button.active {
  background: linear-gradient(90deg, #7334d4, #221244);
  color: white;
  border-color: #9349ff;
}
.profile {
  margin-top: auto;
  border: 1px solid #27354a;
  background: #09131f;
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 6px;
}
.profile span {
  color: #ef62ff;
}
.profile small,
.ver,
.hint,
.info {
  color: #8e9aae;
}
.ver {
  font-size: 12px;
}
main {
  min-width: 0;
}
header {
  height: 84px;
  border-bottom: 1px solid #273042;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #080b14;
}
header small,
.studiohead small,
.battlehead small {
  color: #9b7eff;
  letter-spacing: 0.12em;
}
h1,
h2 {
  margin: 0.15em 0;
}
.pill,
.badge {
  border: 1px solid #2c8f65;
  color: #82f0bd;
  border-radius: 14px;
  padding: 10px 14px;
  background: #071710;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
#creator.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  width: 100%;
  min-width: 0;
  height: calc(100vh - 84px);
  overflow: hidden;
}
.stage {
  position: relative;
  min-height: 500px;
  background: radial-gradient(circle at 50% 45%, #13253b, #07101c 55%, #060812);
}
.canvas,
.battlecanvas {
  position: absolute;
  inset: 0;
}
.status {
  position: absolute;
  top: 22px;
  right: 22px;
  background: #091a17;
  border: 1px solid #2a8a5e;
  padding: 12px 16px;
  border-radius: 13px;
}
.tools {
  position: absolute;
  left: 20px;
  top: 20px;
  display: flex;
  gap: 7px;
}
.tools button {
  text-align: center;
  padding: 9px 12px;
}
.camera-pad {
  position: absolute;
  z-index: 8;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 6px;
  padding: 7px;
  border: 1px solid #33435d;
  border-radius: 14px;
  background: rgba(5, 9, 17, 0.88);
  backdrop-filter: blur(8px);
}
.camera-pad button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #35455f;
  border-radius: 9px;
  background: #0d1725;
  color: #eef2ff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.camera-pad button:hover {
  border-color: #b34dff;
  background: #251443;
}
.camera-pad button:active {
  transform: translateY(1px);
}
.camera-pad.compact {
  right: 14px;
  bottom: 14px;
}
.camera-pad.compact button {
  width: 34px;
  height: 34px;
}
.panel {
  display: block;
  position: relative;
  min-width: 0;
  background: #070a13;
  border-left: 1px solid #273042;
  padding: 24px;
  overflow: auto;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 25px;
}
.tabs button {
  text-align: center;
  padding: 11px 8px;
}
.tabpane {
  display: none;
}
.tabpane.active {
  display: block;
}
.panel label {
  font-weight: 700;
  display: block;
  margin: 18px 0 7px;
}
.panel input,
.panel select {
  width: 100%;
  accent-color: #9f42ff;
}
.panel select,
.panel input[type="text"],
#move-name {
  background: #0d1320;
  color: white;
  border: 1px solid #2d3a4e;
  border-radius: 10px;
  padding: 11px;
}
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.cards.compact {
  grid-template-columns: repeat(3, 1fr);
}
.cards button {
  background: #0d1422;
  border: 1px solid #2b394e;
  border-radius: 12px;
  color: #dbe4f3;
  padding: 12px;
  cursor: pointer;
}
.cards button.selected {
  border-color: #c54bff;
  box-shadow: 0 0 0 1px #7b38ff inset;
  background: #251443;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.swatches button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid #394458;
  cursor: pointer;
}
.swatches button.selected {
  outline: 2px solid #cf4eff;
}
.info {
  margin-top: 18px;
  padding: 13px;
  background: #0b111d;
  border-radius: 12px;
  line-height: 1.55;
}
.save {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}
.primary,
.secondary,
.ghost {
  border-radius: 12px;
  padding: 13px 16px;
  font-weight: 800;
  cursor: pointer;
}
.primary {
  border: 0;
  color: white;
  background: linear-gradient(90deg, #6a49ff, #d831e5);
}
.secondary {
  text-align: center;
}
.ghost {
  text-align: center;
}
.studio,
.ranking,
.battlewrap {
  padding: 24px;
  height: calc(100vh - 84px);
  overflow: auto;
}
.studiohead,
.battlehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.studiohead > div:last-child {
  display: flex;
  gap: 8px;
}
.movegrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  width: 100%;
  min-width: 0;
  height: calc(100% - 82px);
  margin-top: 18px;
  border: 1px solid #263249;
  border-radius: 18px;
  overflow: hidden;
}
.move-panel {
  display: block;
  position: relative;
  min-width: 0;
  border-left: 1px solid #263249;
}
.badge {
  position: absolute;
  left: 20px;
  bottom: 20px;
}
.timeline {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}
.timeline div {
  background: #101727;
  padding: 8px;
  border-radius: 8px;
  color: #aab5c5;
  font-size: 12px;
}
.arenas {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  gap: 14px;
  align-items: stretch;
  height: 65vh;
  padding: 12px;
  overflow: hidden;
  border: 1px solid #354162;
  border-radius: 24px;
  background: #040612;
  box-shadow: inset 0 0 70px #050718, 0 22px 50px #0008;
}
.battle-environment {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.battle-environment-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.arena-marquee {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid #8c6cff77;
  border-radius: 999px;
  color: #d9e9ff;
  background: #050817c9;
  box-shadow: 0 0 25px #7b47ff66, inset 0 0 18px #16dfff18;
  backdrop-filter: blur(8px);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .16em;
  pointer-events: none;
}
.arena-marquee span:first-child { color: #55e9ff; }
.arena-marquee span:last-child { color: #ff57d8; }
.arena-scanlines {
  position: absolute;
  z-index: 1;
  inset: 0;
  opacity: .11;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #8bcaff 4px);
  mix-blend-mode: screen;
}
.fighter {
  position: relative;
  z-index: 3;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  min-width: 0;
}
.fighter > b {
  justify-self: center;
  z-index: 5;
  padding: 6px 13px;
  border: 1px solid #53617d99;
  border-radius: 999px;
  background: #050817c7;
  box-shadow: 0 8px 22px #0009;
  backdrop-filter: blur(8px);
  text-align: center;
  font-size: 20px;
}
.fighter select {
  position: relative;
  z-index: 6;
  background: #0c1320;
  color: white;
  border: 1px solid #2e3a50;
  border-radius: 10px;
  padding: 10px;
}
.battlecanvas {
  position: relative;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 18px;
  overflow: visible;
  background: transparent;
  filter: drop-shadow(0 16px 13px #0009);
}
.battlecanvas > canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.fighter .vote {
  position: relative;
  z-index: 6;
  border: 1px solid #4b5672;
  background: linear-gradient(100deg, #13192aee, #0b1120ee);
  backdrop-filter: blur(8px);
}
#fighter-a .vote:not(:disabled) {
  border-color: #35dff0;
  box-shadow: 0 0 18px #16dcf733;
}
.versus {
  position: relative;
  z-index: 5;
  display: grid;
  align-content: center;
  justify-items: center;
  align-self: center;
  width: 82px;
  min-height: 82px;
  padding: 13px 6px;
  border: 1px solid #d84cf599;
  border-radius: 50%;
  background: radial-gradient(circle, #36165feb, #090a17e8 70%);
  box-shadow: 0 0 35px #d62ee477, inset 0 0 22px #7c55ff77;
  text-align: center;
  font-size: 34px;
  font-weight: 900;
  color: #f05cff;
}
.versus small {
  display: block;
  font-size: 12px;
  color: #8d9aac;
  margin-top: 12px;
}
.score {
  display: flex;
  justify-content: center;
  gap: 30px;
  align-items: center;
  font-size: 28px;
}
.score span {
  font-size: 12px;
  color: #91a0b5;
}
.ranklist {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}
.rankrow {
  display: grid;
  grid-template-columns: 60px 1fr 130px 120px;
  align-items: center;
  padding: 15px 18px;
  background: #0c1320;
  border: 1px solid #263248;
  border-radius: 12px;
}
.rankrow strong {
  color: #f3c0ff;
}
.hero {
  padding: 70px;
  font-size: 24px;
}
.hero p {
  color: #9dacbf;
}
.vote {
  text-align: center;
}
.vote:disabled {
  opacity: 0.4;
}
.hidden {
  display: none !important;
}
@media (max-width: 1000px) {
  .shell {
    grid-template-columns: 84px 1fr;
  }
  .side {
    padding: 18px 10px;
  }
  .side nav button .nav-label,
  .brand b,
  .profile,
  .ver {
    display: none;
  }
  #creator.active {
    grid-template-columns: 1fr;
  }
  .panel {
    position: absolute;
    right: 0;
    top: 84px;
    width: 390px;
    height: calc(100vh - 84px);
    z-index: 3;
    background: #070a13ed;
  }
  .movegrid {
    grid-template-columns: 1fr;
  }
  .move-panel {
    position: absolute;
    right: 0;
    width: 360px;
    height: calc(100vh - 180px);
    z-index: 2;
  }
  .arenas {
    grid-template-columns: 1fr;
  }
  .versus {
    display: none;
  }
  .fighter {
    min-height: 520px;
  }
}

@media (max-width: 640px) {
  .camera-pad {
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(4, 34px);
  }
  .camera-pad button,
  .camera-pad.compact button {
    width: 34px;
    height: 34px;
  }
}

@media (min-width: 761px) {
  #creator.active {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  }
  #creator > .panel {
    display: block;
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    z-index: 5;
  }
  .movegrid {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  }
  .movegrid > .move-panel {
    display: block;
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    z-index: 5;
  }
}

/* Aplicación móvil: una sola columna, sin paneles flotantes ni ancho de escritorio. */
@media (max-width: 760px) and (orientation: portrait) {
  body {
    overflow-x: hidden;
  }
  .shell {
    display: block;
    width: 100%;
    min-height: 100svh;
  }
  main {
    width: 100%;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .side {
    position: fixed;
    z-index: 100;
    inset: auto 0 0 0;
    width: 100%;
    height: calc(68px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid #263248;
    background: rgba(5, 7, 17, 0.97);
    backdrop-filter: blur(14px);
  }
  .brand, .profile, .ver { display: none; }
  .side nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
    height: 56px;
  }
  .side nav button {
    min-width: 0;
    padding: 7px 2px;
    text-align: center;
    font-size: 0;
    border-radius: 12px;
  }
  .side nav button::first-letter { font-size: 20px; }
  .side nav button .nav-icon { display: inline; font-size: 20px; }
  header {
    width: 100%;
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
  }
  header h1 { font-size: clamp(28px, 8vw, 42px); line-height: 1.05; }
  header small { font-size: 12px; }
  header .pill { display: none; }

  #creator.active {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100svh - 72px);
    overflow: visible;
  }
  #creator > .stage {
    width: 100%;
    min-height: 58svh;
    height: 58svh;
  }
  #creator > .panel,
  .movegrid > .move-panel {
    position: static;
    inset: auto;
    width: 100%;
    height: auto;
    z-index: auto;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid #273042;
    padding: 16px;
    background: #070a13;
  }
  .tools {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 5px;
    overflow-x: auto;
  }
  .tools button { flex: 1; min-width: 66px; padding: 9px 6px; }
  .status {
    top: 62px;
    left: 10px;
    right: 10px;
    padding: 9px 11px;
    text-align: center;
    font-size: 12px;
  }
  .tabs { position: static; margin-bottom: 18px; }
  .tabs button { min-width: 0; padding: 10px 4px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cards.compact { grid-template-columns: repeat(2, 1fr); }
  .save { padding-bottom: 12px; }

  .studio, .battlewrap, .ranking {
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 14px 14px 22px;
  }
  .studiohead, .battlehead {
    align-items: stretch;
    flex-direction: column;
  }
  .studiohead > div:last-child {
    display: grid;
    grid-template-columns: 1fr;
  }
  .movegrid {
    display: flex;
    flex-direction: column;
    height: auto;
    margin-top: 14px;
    overflow: visible;
  }
  .movegrid > .stage { width: 100%; min-height: 56svh; height: 56svh; }
  .badge { left: 10px; bottom: 10px; font-size: 10px; padding: 8px; }

  .arenas {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    gap: 22px;
  }
  .fighter { width: 100%; min-height: 0; height: auto; grid-template-rows: auto 56svh auto auto; }
  .battlecanvas { width: 100%; min-height: 56svh; }
  .versus { display: block; order: 0; font-size: 24px; }
  .score { margin: 20px 0; }
  .rankrow { grid-template-columns: 44px 1fr auto; gap: 8px; padding: 12px; }
  .rankrow > :last-child { display: none; }
  .hero { padding: 28px 18px; font-size: 18px; }
}

@media (orientation: landscape) and (max-width: 1000px) and (max-height: 600px) {
  html, body { width: 100%; height: 100%; overflow: hidden; }
  .shell { display: block; width: 100%; min-height: 100svh; }
  main { width: 100%; height: 100svh; padding-bottom: calc(54px + env(safe-area-inset-bottom)); overflow: hidden; }
  .side {
    position: fixed; z-index: 100; inset: auto 0 0 0; width: 100%;
    height: calc(54px + env(safe-area-inset-bottom));
    padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border: 0; border-top: 1px solid #263248; background: rgba(5, 7, 17, .97);
  }
  .brand, .profile, .ver { display: none; }
  .side nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); height: 46px; gap: 5px; }
  .side nav button { min-width: 0; min-height: 44px; padding: 3px 2px; text-align: center; font-size: 0; border-radius: 10px; }
  .side nav button::first-letter { font-size: 17px; }
  .side nav button .nav-icon { display: inline; font-size: 17px; }
  header { width: 100%; height: 54px; min-height: 54px; padding: 5px max(14px, env(safe-area-inset-right)) 5px max(14px, env(safe-area-inset-left)); }
  header h1 { font-size: 24px; line-height: 1; }
  header small { font-size: 9px; }
  #creator.active { grid-template-columns: minmax(0, 58%) minmax(280px, 42%); height: calc(100svh - 108px - env(safe-area-inset-bottom)); min-height: 0; overflow: hidden; }
  #creator > .stage { height: 100%; min-height: 0; }
  #creator > .panel { position: relative; inset: auto; width: 100%; height: 100%; overflow-y: auto; }
  .studio, .battlewrap, .ranking { height: calc(100svh - 108px - env(safe-area-inset-bottom)); min-height: 0; padding: 7px 10px; overflow-y: auto; }
  .movegrid { grid-template-columns: minmax(0, 60%) minmax(270px, 40%); }
  .movegrid > .move-panel { position: relative; inset: auto; width: 100%; height: 100%; overflow-y: auto; }
  .arenas { grid-template-columns: minmax(0, 1fr) 88px minmax(0, 1fr); }
  .fighter { width: 100%; min-width: 0; min-height: 0; height: 100%; }
  .versus { display: block; min-width: 0; font-size: 18px; }
  .versus { z-index: 10; width: 150px; margin-inline: -31px; padding: 8px; border-radius: 18px; }
  .versus small { display: block; width: 132px; font-size: 11px; line-height: 1.15; overflow: hidden; overflow-wrap: normal; }
  .score { height: 26px; margin: 1px 0 0; font-size: 18px; }
  header .pill { display: none; }
  .header-actions select, .header-actions .ghost { padding: 5px 7px; font-size: 10px; }
  .move-library { margin-top: 4px; grid-template-columns: auto minmax(120px,1fr) repeat(3,auto); gap: 4px; font-size: 10px; }
  .move-library select, .move-library button { padding: 5px; font-size: 9px; }
  .movegrid { height: calc(100% - 72px); }
  .battle-lobby { grid-template-columns: 1fr 60px minmax(110px,.7fr) auto; margin: 4px 0; padding: 4px; gap: 4px; }
  .battle-lobby button, .battle-lobby select, .battle-lobby input { padding: 5px; font-size: 9px; }
  .arenas { height: calc(100% - 108px); }
}

/* La pista es siempre compartida: también en móvil vertical se ven ambos rivales. */
@media (max-width: 760px) and (orientation: portrait) {
  #battle .battlewrap { padding-inline: 9px; }
  #battle .arenas {
    display: grid;
    grid-template-columns: minmax(0,1fr) 54px minmax(0,1fr);
    align-items: stretch;
    width: 100%;
    height: 58svh;
    min-height: 390px;
    gap: 0;
    padding: 7px 3px;
    border-radius: 17px;
  }
  #battle .fighter {
    display: grid;
    grid-template-rows: 27px minmax(0,1fr) 35px 38px;
    width: 100%;
    height: 100%;
    min-height: 0;
    gap: 3px;
  }
  #battle .fighter > b { padding: 4px 7px; font-size: 10px; }
  #battle .battlecanvas { width: 100%; height: 100%; min-height: 0; }
  #battle .fighter select, #battle .fighter button { min-width: 0; padding: 5px 3px; font-size: 9px; }
  #battle .versus {
    display: grid;
    order: initial;
    z-index: 10;
    width: 132px;
    margin-inline: -39px;
    min-width: 0;
    min-height: 84px;
    padding: 10px 8px;
    border-radius: 22px;
    font-size: 22px;
  }
  #battle .versus small { width: 112px; max-height: 70px; margin-top: 5px; color: #e6edfa; font-size: 12px; line-height: 1.18; overflow: hidden; overflow-wrap: normal; }
  #battle .arena-marquee { top: 6px; padding: 4px 7px; font-size: 6px; }
  #battle .score { margin: 8px 0; }
}
