/* Whiteblock juego section styles — extracted from hub-original.html.
   Some hub-only selectors remain (loginGate/choiceGate/linksHub/wb-header/etc.)
   They are dead code on /juego/ but harmless. */

/* Hub-only DOM is kept in fragment.html so the existing JS doesn't crash on
   null queries — we just hide it here. Removed entirely in a later phase. */
#loginGate, #choiceGate, #linksHub, #wbHeader,
#userModal, #byeGate, #notifFab, #notifDropdown,
#chatWidget, #chatFullModal, .hub-toggle { display: none !important; }

/* Game canvas needs to be visible by default in the section context. */
#c { display: block; }

/* Font assets live in /assets in the SPA shell, not relative ./assets */
@font-face{font-family:'Cossette Titre';font-style:normal;font-weight:400;font-display:swap;src:url('/assets/CossetteTitre-Regular.ttf') format('truetype');}
@font-face{font-family:'Cossette Titre';font-style:normal;font-weight:700;font-display:swap;src:url('/assets/CossetteTitre-Bold.ttf') format('truetype');}

/* TEMP: overlay "experiencia no disponible" mientras reconstruimos el juego */
@keyframes ua-fadeIn{from{opacity:0}to{opacity:1}}
@keyframes ua-slideUp{from{opacity:0;transform:translateY(14px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes ua-pulse{
  0%,100%{box-shadow:0 0 0 0 rgba(255,255,255,.06), inset 0 0 0 1px rgba(255,255,255,.06)}
  50%{box-shadow:0 0 0 12px rgba(255,255,255,0), inset 0 0 0 1px rgba(255,255,255,.10)}
}
#unavailableOverlay#unavailableOverlay{
  position:fixed; inset:0; z-index:99999;
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.04), transparent 60%),
    rgba(6,7,11,.72);
  backdrop-filter:blur(28px) saturate(120%);
  -webkit-backdrop-filter:blur(28px) saturate(120%);
  font-family:'Geist','Inter Tight','Inter',system-ui,sans-serif;
  animation:ua-fadeIn .35s ease-out both;
}
#unavailableOverlay#unavailableOverlay .ua-card{
  position:relative;
  background:linear-gradient(180deg, #15171c 0%, #0e0f13 100%);
  border-radius:22px;
  padding:48px 44px 40px;
  max-width:480px;
  width:100%;
  text-align:center;
  box-shadow:
    0 1px 0 0 rgba(255,255,255,.06) inset,
    0 0 0 1px rgba(255,255,255,.07),
    0 32px 80px -24px rgba(0,0,0,.7),
    0 12px 32px -16px rgba(0,0,0,.5);
  animation:ua-slideUp .45s cubic-bezier(.2,.7,.2,1.05) both;
}
/* subtle top highlight (light reflection on the card edge) */
#unavailableOverlay#unavailableOverlay .ua-card::before{
  content:''; position:absolute; inset:0 1px auto 1px; height:60%;
  border-radius:22px 22px 0 0; pointer-events:none;
  background:linear-gradient(180deg, rgba(255,255,255,.035), transparent 70%);
}
#unavailableOverlay#unavailableOverlay .ua-icon{
  width:64px; height:64px; margin:0 auto 22px;
  display:flex; align-items:center; justify-content:center;
  border-radius:18px;
  color:#fff;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.18), transparent 60%),
    linear-gradient(135deg, #2a2d36 0%, #16181d 100%);
  font-size:1.4rem;
  animation:ua-pulse 3.2s ease-in-out infinite;
}
#unavailableOverlay#unavailableOverlay h2{
  color:#fafafa; font-size:1.18rem;
  font-weight:400; margin-bottom:10px;
  letter-spacing:-.01em; line-height:1.35;
  font-family:'Cossette Titre','Geist','Inter Tight',system-ui,sans-serif;
}
#unavailableOverlay#unavailableOverlay p{
  color:#8a8e98; font-size:.88rem;
  margin:0 0 30px; line-height:1.55;
  max-width:340px; margin-left:auto; margin-right:auto;
}
#unavailableOverlay#unavailableOverlay .ua-btn{
  position:relative;
  background:#fafafa; color:#0a0a0a;
  border:none; padding:13px 26px 13px 30px;
  border-radius:var(--wb-radius-xl); font-size:.88rem;
  font-weight:600; letter-spacing:.01em;
  cursor:pointer; font-family:inherit;
  display:inline-flex; align-items:center; gap:10px;
  transition:transform .15s ease, background .2s, box-shadow .2s;
  box-shadow:0 1px 0 0 rgba(255,255,255,.5) inset, 0 8px 20px -8px rgba(0,0,0,.6);
}
#unavailableOverlay#unavailableOverlay .ua-btn::after{
  content:'→'; font-size:1rem; line-height:1;
  transition:transform .2s;
}
#unavailableOverlay#unavailableOverlay .ua-btn:hover{ background:#fff; transform:translateY(-1px); }
#unavailableOverlay#unavailableOverlay .ua-btn:hover::after{ transform:translateX(3px); }
#unavailableOverlay#unavailableOverlay .ua-btn:active{ transform:translateY(0); }
#unavailableOverlay#unavailableOverlay .ua-tag{
  display:inline-flex; align-items:center; gap:6px;
  font-size:.7rem; color:#8a8e98;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.07);
  padding:6px 12px; border-radius:var(--wb-radius-pill);
  margin-bottom:18px; letter-spacing:.05em;
  text-transform:uppercase; font-weight:500;
}
#unavailableOverlay#unavailableOverlay .ua-tag::before{
  content:''; width:6px; height:6px; border-radius:50%;
  background:var(--yellow); box-shadow:0 0 8px var(--yellow);
  animation:ua-pulse 2s ease-in-out infinite;
}
[data-theme="light"] #unavailableOverlay#unavailableOverlay{
  background:
    radial-gradient(circle at 50% 0%, rgba(0,0,0,.04), transparent 60%),
    rgba(248,248,250,.78);
}
[data-theme="light"] #unavailableOverlay#unavailableOverlay .ua-card{
  background:linear-gradient(180deg,#fff 0%,#f8f8fa 100%);
  box-shadow:
    0 1px 0 0 rgba(0,0,0,.04) inset,
    0 0 0 1px rgba(0,0,0,.06),
    0 32px 80px -24px rgba(0,0,0,.18),
    0 12px 32px -16px rgba(0,0,0,.10);
}
[data-theme="light"] #unavailableOverlay#unavailableOverlay .ua-card::before{
  background:linear-gradient(180deg, rgba(0,0,0,.02), transparent 70%);
}
[data-theme="light"] #unavailableOverlay#unavailableOverlay h2{ color:#0a0a0a; }
[data-theme="light"] #unavailableOverlay#unavailableOverlay p{ color:#666; }
[data-theme="light"] #unavailableOverlay#unavailableOverlay .ua-icon{
  background:
    radial-gradient(circle at 30% 25%, rgba(0,0,0,.05), transparent 60%),
    linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color:#1a1a1a;
}
[data-theme="light"] #unavailableOverlay#unavailableOverlay .ua-tag{
  color:#666; background:rgba(0,0,0,.03); border-color:rgba(0,0,0,.06);
}
[data-theme="light"] #unavailableOverlay#unavailableOverlay .ua-btn{
  background:#0a0a0a; color:#fff;
  box-shadow:0 1px 0 0 rgba(255,255,255,.1) inset, 0 8px 20px -8px rgba(0,0,0,.3);
}
[data-theme="light"] #unavailableOverlay#unavailableOverlay .ua-btn:hover{ background:#222; }

/* SPA scoping: global resets, html/body rules, and theme variables only apply
   while juego is the active section. They must not contaminate the chrome. */
body[data-active-section="juego"] #wb-section-content,
body[data-active-section="juego"] #wb-section-content *{margin:0;padding:0;box-sizing:border-box;}
body[data-active-section="juego"]{
  --hub-bg:var(--bg);--hub-surface:var(--surface);--hub-surface2:var(--surface2);--hub-surface3:var(--surface3);
  --hub-border:var(--border);--hub-border2:var(--border2);
  --hub-text:var(--text);--hub-text2:var(--text2);--hub-muted:var(--muted);--hub-dim:var(--dim);--hub-white:var(--white);
  --hub-accent:var(--accent);--hub-accent-h:var(--accent-h);--hub-accent-bg:var(--accent-bg);--hub-accent-border:var(--accent-border);
  --hub-red:var(--red);--hub-red-bg:var(--red-bg);
  --hub-green:var(--green);--hub-green-bg:var(--green-bg);
  --hub-yellow:var(--yellow);--hub-yellow-bg:var(--yellow-bg);
  --hub-shadow:var(--shadow);
  touch-action:none;font-family:'Geist','Inter Tight',system-ui,sans-serif;
}
/* Fallback de variables hub-* a nivel del documento juego para que los modales
   (#emailModal, #charCreate, #portModal, #userModal, etc.) reciban las vars
   aunque su mounting parent no incluya el atributo data-active-section.
   Replicado dentro del SPA shell sin "leak" porque solo se aplica cuando
   /sections/juego/styles.css está cargado (es decir, cuando juego esta activo).
   Si el shell luego carga otra sección con sus propias vars, ese CSS ganara
   por especificidad (selector más concreto) o por orden de carga. */
:root{
  --hub-bg:var(--bg);--hub-surface:var(--surface);--hub-surface2:var(--surface2);--hub-surface3:var(--surface3);
  --hub-border:var(--border);--hub-border2:var(--border2);
  --hub-text:var(--text);--hub-text2:var(--text2);--hub-muted:var(--muted);--hub-dim:var(--dim);--hub-white:var(--white);
  --hub-accent:var(--accent);--hub-accent-h:var(--accent-h);--hub-accent-bg:var(--accent-bg);--hub-accent-border:var(--accent-border);
  --hub-red:var(--red);--hub-red-bg:var(--red-bg);
  --hub-green:var(--green);--hub-green-bg:var(--green-bg);
  --hub-yellow:var(--yellow);--hub-yellow-bg:var(--yellow-bg);
  --hub-shadow:var(--shadow);
}
[data-theme="light"]:root{
  /* Light theme resuelto vía tokens semánticos: los mismos alias de arriba
     ya flipan con [data-theme="light"] en wb-tokens-semantic.css. */
  --hub-bg:var(--bg);--hub-surface:var(--surface);--hub-surface2:var(--surface2);--hub-surface3:var(--surface3);
  --hub-border:var(--border);--hub-border2:var(--border2);
  --hub-text:var(--text);--hub-text2:var(--text2);--hub-muted:var(--muted);--hub-dim:var(--dim);--hub-white:var(--white);
  --hub-accent:var(--accent);--hub-accent-h:var(--accent-h);--hub-accent-bg:var(--accent-bg);--hub-accent-border:var(--accent-border);
  --hub-red:var(--red);--hub-red-bg:var(--red-bg);
  --hub-green:var(--green);--hub-green-bg:var(--green-bg);
  --hub-yellow:var(--yellow);--hub-yellow-bg:var(--yellow-bg);
  --hub-shadow:var(--shadow);
}
[data-theme="light"] body[data-active-section="juego"]{
  /* Light theme resuelto vía tokens semánticos: los mismos alias de arriba
     ya flipan con [data-theme="light"] en wb-tokens-semantic.css. */
  --hub-bg:var(--bg);--hub-surface:var(--surface);--hub-surface2:var(--surface2);--hub-surface3:var(--surface3);
  --hub-border:var(--border);--hub-border2:var(--border2);
  --hub-text:var(--text);--hub-text2:var(--text2);--hub-muted:var(--muted);--hub-dim:var(--dim);--hub-white:var(--white);
  --hub-accent:var(--accent);--hub-accent-h:var(--accent-h);--hub-accent-bg:var(--accent-bg);--hub-accent-border:var(--accent-border);
  --hub-red:var(--red);--hub-red-bg:var(--red-bg);
  --hub-green:var(--green);--hub-green-bg:var(--green-bg);
  --hub-yellow:var(--yellow);--hub-yellow-bg:var(--yellow-bg);
  --hub-shadow:var(--shadow);
}
body[data-active-section="juego"] #wb-section-content img.logo-light{display:none!important;}
[data-theme="light"] body[data-active-section="juego"] #wb-section-content img.logo-dark{display:none!important;}
[data-theme="light"] body[data-active-section="juego"] #wb-section-content img.logo-light{display:block!important;}
/* Canvas positioned under the 52px chrome. !important on margin overrides the
   legacy `.wb-header.show ~ #c { margin-top:52px }` rule that activates when
   hidden #wbHeader gets the .show class from legacy JS. */
body[data-active-section="juego"] #c{
  position:fixed !important;
  top:52px !important;
  left:0 !important;
  right:0 !important;
  bottom:0 !important;
  width:auto !important;
  height:auto !important;
  margin:0 !important;
  display:block;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
}

/* ── LOADING ── */
#loading{position:fixed;inset:0;background:#f4f4f4;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;z-index:300;}
.bar-wrap{width:220px;height:7px;background:#ddd;border-radius:var(--wb-radius-sm);overflow:hidden;}
.bar{height:100%;width:0;background:var(--accent);border-radius:var(--wb-radius-sm);transition:width .3s;}

/* ── CHAR SELECT ── */
#sel{position:fixed;inset:0;background:var(--hub-bg);display:none;flex-direction:column;align-items:center;justify-content:center;gap:18px;z-index:200;padding:20px;overflow-y:auto;}
#sel.show{display:flex;}
#sel h2{color:var(--hub-white);font-weight:400;font-size:.85rem;letter-spacing:3px;text-transform:uppercase;font-family:'Cossette Titre',sans-serif;}
#sel .sel-sub{color:var(--hub-muted);font-size:.78rem;margin-top:-10px;}
.cards{display:flex;gap:16px;flex-wrap:wrap;justify-content:center;max-width:700px;}
.card{background:var(--hub-surface);border:2px solid var(--hub-border);border-radius:10px;padding:14px 18px;cursor:pointer;transition:all .15s;display:flex;flex-direction:column;align-items:center;gap:8px;color:var(--hub-muted);font-size:.72rem;letter-spacing:1px;text-transform:uppercase;min-width:100px;}
.card:hover,.card.on{border-color:var(--hub-accent);background:var(--hub-accent-bg);color:var(--hub-accent);}
.card canvas{background:var(--hub-surface2);border-radius:var(--wb-radius-sm);}
.card .char-name{color:var(--hub-text);font-size:.8rem;font-weight:600;text-transform:none;letter-spacing:0;}
.card-add{border-style:dashed;border-color:var(--hub-border);color:var(--hub-muted);justify-content:center;min-height:110px;font-size:1.5rem;}
.card-add:hover{border-color:var(--hub-accent);color:var(--hub-accent);}
.card{position:relative;}
.card .char-del{position:absolute;top:4px;right:4px;width:20px;height:20px;border-radius:50%;background:rgba(239,68,68,.15);border:1px solid rgba(239,68,68,.3);color:var(--red);font-size:var(--wb-text-xs);cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s;line-height:1;padding:0;}
.card:hover .char-del{opacity:1;}
.card .char-del:hover{background:rgba(239,68,68,.3);transform:scale(1.1);}
.card .char-edit{position:absolute;top:4px;left:4px;width:20px;height:20px;border-radius:50%;background:var(--hub-accent-bg);border:1px solid var(--hub-accent-border);color:var(--hub-accent);font-size:10px;cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s;line-height:1;padding:0;}
.card:hover .char-edit{opacity:1;}
.card .char-edit:hover{background:rgba(59,130,246,.3);transform:scale(1.1);}
.char-attacks{margin-top:6px;text-align:center;}
.char-attacks summary{font-size:.6rem;font-weight:700;color:var(--hub-muted);cursor:pointer;letter-spacing:.5px;list-style:none;user-select:none;}
.char-attacks summary::before{content:'▸ ';font-size:.55rem;}
.char-attacks[open] summary::before{content:'▾ ';}
.char-attacks summary::-webkit-details-marker{display:none;}
.char-strengths{display:flex;gap:3px;flex-wrap:wrap;justify-content:center;margin-top:4px;}
.char-strengths span{font-size:.58rem;color:var(--orange);background:#f59e0b15;border:1px solid #f59e0b33;padding:1px 5px;border-radius:var(--wb-radius-sm);}

.go{background:#cc2020;color:#fff;border:none;padding:11px 44px;font-size:.88rem;font-weight:bold;border-radius:var(--wb-radius-md);cursor:pointer;letter-spacing:2px;text-transform:uppercase;box-shadow:0 3px 12px rgba(204,32,32,.35);}
.go:hover{background:#ee3030;}

/* ── CHAR CREATE MODAL ── */
#charCreate{position:fixed;inset:0;background:var(--modal-overlay);backdrop-filter:blur(6px);display:none;align-items:center;justify-content:center;z-index:250;padding:20px;}
#charCreate.show{display:flex;}
.cc-panel{background:var(--hub-surface);border:1px solid var(--hub-border);border-radius:var(--radius-lg);padding:24px;width:min(440px,95vw);max-height:90vh;display:flex;flex-direction:column;}
.cc-panel h2{color:var(--hub-white);font-size:1rem;font-weight:400;margin-bottom:12px;text-align:center;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.cc-preview{text-align:center;margin-bottom:12px;}
.cc-preview canvas{background:var(--hub-surface2);border-radius:var(--wb-radius-lg);image-rendering:pixelated;image-rendering:crisp-edges;}
.cc-body{flex:1;overflow-y:auto;padding-right:4px;}
.cc-group{margin-bottom:12px;}
.cc-group label{display:block;color:var(--hub-muted);font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.5px;margin-bottom:5px;}
.cc-group label small{text-transform:none;font-weight:400;color:var(--hub-dim);}
.cc-group input[type=text]{width:100%;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:9px 12px;color:var(--hub-text);font-size:.85rem;font-family:inherit;}
.cc-group input[type=text]:focus{outline:none;border-color:var(--hub-accent);}
.cc-row{display:flex;gap:6px;flex-wrap:wrap;}
.cc-swatch{width:28px;height:28px;border-radius:50%;cursor:pointer;border:2px solid transparent;transition:all .1s;}
.cc-swatch:hover,.cc-swatch.on{border-color:#fff;transform:scale(1.15);}
.cc-chip{background:var(--hub-surface2);border:1.5px solid var(--hub-border);border-radius:var(--wb-radius-md);padding:5px 10px;cursor:pointer;color:var(--hub-text2);font-size:.7rem;font-weight:600;transition:all .12s;white-space:nowrap;font-family:inherit;}
.cc-chip:hover{border-color:var(--hub-border2);color:var(--hub-text);}
.cc-chip.on{border-color:var(--hub-accent);background:var(--hub-accent-bg);color:var(--hub-accent);}
.cc-chip.none{border-style:dashed;color:var(--hub-muted);}
.cc-chip.none.on{border-color:var(--hub-accent);color:var(--hub-accent);border-style:solid;}
.cc-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:14px;padding-top:10px;border-top:1px solid var(--hub-border);}
.cc-btn{padding:9px 20px;border-radius:var(--wb-radius-lg);border:none;cursor:pointer;font-size:.82rem;font-weight:600;font-family:inherit;}
.cc-btn-primary{background:var(--hub-accent);color:#fff;}.cc-btn-primary:hover{background:var(--hub-accent-h);}
.cc-btn-ghost{background:transparent;color:var(--hub-muted);border:1px solid var(--hub-border);}.cc-btn-ghost:hover{color:var(--hub-text);}

/* ── IN-GAME DIALOG ── */
#dlg{position:fixed;bottom:68px;left:50%;transform:translateX(-50%);background:#f8f0d0;border:4px solid #383050;color:#383050;padding:11px 20px 13px;border-radius:var(--wb-radius-sm);font-size:.85rem;text-align:center;max-width:400px;width:90%;z-index:20;opacity:0;pointer-events:none;transition:opacity .2s;font-family:'Courier New',monospace;font-weight:bold;box-shadow:4px 4px 0 rgba(0,0,0,.45),inset 0 0 0 2px rgba(255,255,255,.4);}
#dlg.show{opacity:1;}
#dlgHint{display:block;color:#7870a0;font-size:.68rem;font-weight:normal;margin-top:3px;}
#dlg::after{content:'▾';position:absolute;bottom:3px;right:7px;font-size:.58rem;color:#7870a0;animation:blink .9s infinite;}
@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}

/* ── HUD BUTTON ── */
#btnChar{display:none;}

/* ── BATTLE ── */
#bt{position:fixed;inset:0;background:rgba(0,0,0,.72);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);display:none;align-items:center;justify-content:center;z-index:100;}
#bt.show{display:flex;}
#btModal{background:#1492c0;border:4px solid #383050;border-radius:10px;overflow:hidden;width:min(620px,95vw);max-height:90vh;display:flex;flex-direction:column;box-shadow:0 10px 60px rgba(0,0,0,.85);}
#btSceneCanvas{width:100%;display:block;image-rendering:pixelated;image-rendering:crisp-edges;}
#btBottom{background:#f8f0d0;border-top:4px solid #383050;padding:10px 14px;min-height:148px;display:flex;flex-direction:column;gap:8px;}
#btMsg{background:#f8f0d0;border:3px solid #383050;border-radius:3px;padding:9px 36px 9px 12px;font-family:'Courier New',monospace;font-size:.84rem;font-weight:bold;color:#383050;min-height:56px;cursor:pointer;position:relative;user-select:none;box-shadow:2px 2px 0 rgba(0,0,0,.25);}
#btMsg::after{content:'▾';position:absolute;bottom:4px;right:8px;font-size:.58rem;color:#7870a0;animation:blink .9s infinite;}
#btMoves{display:grid;grid-template-columns:1fr 1fr;gap:5px;}
.mv{background:#f8f0d0;border:3px solid #383050;border-radius:3px;padding:7px 10px;font-family:'Courier New',monospace;font-size:.78rem;font-weight:bold;cursor:pointer;color:#383050;text-align:left;box-shadow:2px 2px 0 rgba(0,0,0,.18);}
.mv:hover{background:#ece4c4;}.mv:active{background:#ddd8b8;}
.mv[disabled]{opacity:.38;cursor:default;pointer-events:none;}

/* ── MOBILE ── */
#mob{position:fixed;bottom:0;left:0;right:0;display:none;pointer-events:none;z-index:30;padding:14px 20px 36px;justify-content:space-between;align-items:flex-end;}
#mob.on{display:flex;}
.dp{position:relative;width:130px;height:130px;pointer-events:all;}
.dp-cross{position:absolute;inset:0;}
.db{position:absolute;display:flex;align-items:center;justify-content:center;user-select:none;-webkit-tap-highlight-color:transparent;cursor:pointer;}
.db svg{width:16px;height:16px;fill:rgba(255,255,255,.7);}
.db:active svg{fill:rgba(255,255,255,1);}
/* Vertical bar of cross */
.du,.dd{left:42px;width:46px;background:rgba(30,30,60,.5);border:1.5px solid rgba(255,255,255,.15);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);}
.du{top:0;height:44px;border-radius:10px 10px 0 0;border-bottom:none;}
.dd{bottom:0;height:44px;border-radius:0 0 10px 10px;border-top:none;}
/* Horizontal bar of cross */
.dl,.dr{top:42px;height:46px;background:rgba(30,30,60,.5);border:1.5px solid rgba(255,255,255,.15);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);}
.dl{left:0;width:44px;border-radius:10px 0 0 10px;border-right:none;}
.dr{right:0;width:44px;border-radius:0 10px 10px 0;border-left:none;}
/* Center of cross */
.dc{position:absolute;top:42px;left:42px;width:46px;height:46px;background:rgba(30,30,60,.5);border:none;}
.db:active{background:rgba(100,100,200,.4)!important;}
.ab{width:56px;height:56px;border-radius:50%;background:rgba(100,100,200,.4);border:2px solid rgba(255,255,255,.2);color:rgba(255,255,255,.7);font-size:0;display:flex;align-items:center;justify-content:center;cursor:pointer;user-select:none;pointer-events:all;-webkit-tap-highlight-color:transparent;box-shadow:0 4px 16px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.1);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);}
.ab:active{transform:scale(.9);background:rgba(130,130,255,.55);}
.ab-stack{display:flex;flex-direction:column-reverse;gap:10px;align-items:center;pointer-events:all;}
.ab-jump{background:rgba(80,180,120,.45)!important;}
.ab-jump:active{background:rgba(100,210,140,.65)!important;}

/* ── LOGIN GATE ── */
#loginGate{position:fixed;inset:0;background:var(--hub-bg);display:flex;align-items:center;justify-content:center;z-index:500;padding:20px;}
#loginGate.hidden{display:none;}
.login-card{background:var(--hub-surface);border:1px solid var(--hub-border);border-radius:var(--radius-lg);padding:40px 36px 36px;width:min(400px,100%);box-shadow:var(--hub-shadow);}
.login-card .lc-logo{text-align:center;margin-bottom:28px;display:flex;justify-content:center;}
.login-card .lc-logo img{max-height:36px;width:auto;display:block;}
.login-card .lc-logo .lc-fallback{font-size:1.2rem;font-weight:700;color:var(--hub-white);letter-spacing:1px;display:none;}
.login-card h1{font-size:1.1rem;font-weight:400;color:var(--hub-white);text-align:center;margin-bottom:6px;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.login-card .lc-sub{font-size:.8rem;color:var(--hub-muted);text-align:center;margin-bottom:28px;}
.login-card .lc-group{margin-bottom:16px;}
.login-card .lc-group label{display:block;font-size:.72rem;color:var(--hub-muted);margin-bottom:5px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;}
.login-card input{width:100%;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:11px 14px;color:var(--hub-text);font-size:.9rem;transition:border .15s;font-family:inherit;}
.login-card input:focus{outline:none;border-color:var(--hub-accent);}
.login-card input::placeholder{color:var(--hub-muted);}
.login-card .lc-btn{width:100%;padding:12px;border-radius:var(--wb-radius-lg);border:none;cursor:pointer;font-size:.85rem;font-weight:700;background:var(--hub-accent);color:#fff;margin-top:8px;transition:background .15s;font-family:inherit;}
.login-card .lc-btn:hover{background:var(--hub-accent-h);}
.login-card .lc-btn:disabled{opacity:.5;cursor:not-allowed;}
.login-card .lc-err{background:var(--hub-red-bg);border:1px solid rgba(238,34,34,.25);border-radius:var(--wb-radius-lg);padding:10px 14px;margin-bottom:16px;font-size:.8rem;color:var(--hub-red);display:none;}
.login-card .lc-err.show{display:block;}
.login-card .lc-footer{text-align:center;margin-top:24px;font-size:.72rem;color:var(--hub-muted);}

/* ── CHOICE SCREEN ── */
#choiceGate{position:fixed;inset:0;background:var(--hub-bg);display:none;align-items:center;justify-content:center;z-index:450;padding:20px;}
#choiceGate.show{display:flex;}
.choice-panel{width:min(600px,95vw);text-align:center;}
.choice-panel .cp-logo{margin-bottom:24px;display:flex;justify-content:center;}
.choice-panel .cp-logo img{max-height:40px;width:auto;display:block;}
.choice-panel .cp-logo .cp-fallback{font-size:1.3rem;font-weight:700;color:var(--hub-white);letter-spacing:1px;display:none;}
.choice-panel h2{font-size:1.1rem;font-weight:400;color:var(--hub-white);margin-bottom:6px;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.choice-panel .cp-sub{font-size:.82rem;color:var(--hub-muted);margin-bottom:32px;}
.choice-cards{display:flex;gap:16px;justify-content:center;flex-wrap:wrap;margin-bottom:0;}
.cp-remember{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:20px;cursor:pointer;font-size:.78rem;color:var(--hub-muted);transition:color .15s;user-select:none;}
.cp-remember:hover{color:var(--hub-text);}
.cp-remember input[type="checkbox"]{width:15px;height:15px;accent-color:var(--hub-accent);cursor:pointer;}
.choice-card{flex:1;min-width:200px;max-width:260px;background:var(--hub-surface);border:2px solid var(--hub-border);border-radius:var(--radius-lg);padding:28px 20px;cursor:pointer;transition:all .2s;text-decoration:none;display:flex;flex-direction:column;align-items:center;gap:12px;}
.choice-card:hover{border-color:var(--hub-accent);background:var(--hub-accent-bg);transform:translateY(-3px);box-shadow:var(--hub-shadow);}
.choice-card.selected{border-color:var(--hub-accent);background:var(--hub-accent-bg);box-shadow:0 0 0 2px var(--hub-accent-border) inset,var(--hub-shadow);}
.choice-card .cc-icon{font-size:2.4rem;line-height:1;color:var(--hub-accent);}
.choice-continue{margin-top:18px;padding:12px 32px;background:var(--hub-accent);color:#fff;border:none;border-radius:10px;font-size:.85rem;font-weight:700;font-family:inherit;cursor:pointer;transition:background .15s,opacity .15s,transform .15s;text-transform:uppercase;letter-spacing:.5px;}
.choice-continue:hover:not(:disabled){background:var(--hub-accent-h);transform:translateY(-2px);box-shadow:0 8px 24px rgba(23,0,255,.3);}
.choice-continue:disabled{opacity:.35;cursor:not-allowed;}
.choice-card .cc-title{font-size:.95rem;font-weight:400;color:var(--hub-white);font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.choice-card .cc-desc{font-size:.75rem;color:var(--hub-muted);line-height:1.4;}
.choice-links{margin-top:20px;}
.choice-links a{color:var(--hub-accent);font-size:.78rem;text-decoration:none;display:inline-flex;align-items:center;gap:4px;}
.choice-links a:hover{text-decoration:underline;}

/* ── LINKS HUB ── */
#linksHub{position:fixed;inset:0;background:var(--hub-bg);display:none;flex-direction:column;z-index:400;overflow-y:auto;}
#linksHub.show{display:flex;}
.lh-header{padding:0 24px;border-bottom:1px solid var(--hub-border);background:var(--hub-surface);display:flex;align-items:center;justify-content:space-between;flex-shrink:0;height:52px;box-sizing:border-box;}
.lh-header img{height:26px;width:auto;object-fit:contain;object-position:left center;display:block;}
.lh-header .lh-fallback{font-weight:700;font-size:var(--wb-text-base);color:var(--hub-white);display:none;}
.lh-header .lh-user{display:flex;align-items:center;gap:10px;color:var(--hub-muted);font-size:var(--wb-text-base);font-weight:600;}
.lh-header .lh-avatar{width:32px;height:32px;border-radius:var(--wb-radius-lg);background:var(--hub-accent);display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:var(--wb-text-sm);overflow:hidden;}
.lh-body{flex:1;padding:32px 24px;max-width:760px;margin:0 auto;width:100%;}
.lh-body h1{font-size:var(--wb-text-lg);font-weight:400;color:var(--hub-white);margin-bottom:2px;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;letter-spacing:.5px;}
.lh-body .lh-sub{font-size:.72rem;color:var(--hub-muted);margin-bottom:20px;}
.lh-section-label{font-size:var(--wb-text-xs);font-weight:400;color:var(--hub-muted);text-transform:uppercase;letter-spacing:1px;padding:18px 0 8px;font-family:'Cossette Titre',sans-serif;}
.lh-section-label:first-of-type{padding-top:0;}
.lh-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;}
@media(max-width:760px){.lh-grid{grid-template-columns:1fr 1fr;}}
@media(max-width:480px){.lh-grid{grid-template-columns:1fr;}}
.lh-link{position:relative;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-xl);padding:16px;cursor:pointer;transition:transform .15s,border-color .15s,background .15s,box-shadow .15s;text-decoration:none;display:flex;align-items:center;gap:14px;color:inherit;font-family:inherit;text-align:left;min-height:74px;}
.lh-link:hover{border-color:var(--hub-accent);background:var(--hub-accent-bg);transform:translateY(-2px);box-shadow:0 8px 22px rgba(0,0,0,.18);}
.lh-link .lh-icon{width:42px;height:42px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:1.05rem;flex-shrink:0;}
.lh-link .lh-info{flex:1;min-width:0;}
.lh-link .lh-name{font-size:var(--wb-text-md);font-weight:400;color:var(--hub-white);text-transform:uppercase;letter-spacing:.4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:'Cossette Titre',sans-serif;}
.lh-link .lh-url{font-size:.7rem;color:var(--hub-muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.lh-secondary{display:grid;grid-template-columns:1fr auto;gap:12px;}
.lh-icon-only{width:74px;min-height:74px;padding:0;display:flex;align-items:center;justify-content:center;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-xl);cursor:pointer;transition:transform .15s,border-color .15s,background .15s,box-shadow .15s;color:var(--orange);font-size:1.45rem;flex-shrink:0;font-family:inherit;}
.lh-icon-only:hover{border-color:var(--orange);background:rgba(245,158,11,.12);transform:translateY(-2px);box-shadow:0 8px 22px rgba(0,0,0,.18);color:var(--orange);}
@media(max-width:480px){.lh-secondary{grid-template-columns:1fr;}.lh-icon-only{width:100%;min-height:60px;}}
.lh-back{margin-top:28px;text-align:center;}
.lh-back button{background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);color:var(--hub-muted);padding:8px 20px;cursor:pointer;font-size:.8rem;font-weight:600;transition:all .15s;font-family:inherit;}
.lh-back button:hover{border-color:var(--hub-accent);color:var(--hub-accent);}

/* ── HUB TOGGLE BUTTON ── */
.hub-toggle{display:none!important;}

/* ── FLOATING NOTIFICATIONS BUTTON ── */
.notif-fab{display:none;position:fixed;bottom:20px;left:20px;width:48px;height:48px;border-radius:50%;background:var(--hub-surface);border:1px solid var(--hub-border);color:var(--hub-text);cursor:pointer;font-size:var(--wb-text-xl);align-items:center;justify-content:center;box-shadow:0 4px 16px rgba(0,0,0,.4);z-index:450;transition:all .15s;font-family:inherit;padding:0;}
.notif-fab:hover{border-color:var(--hub-accent);background:var(--hub-surface2);transform:translateY(-2px);box-shadow:0 8px 24px rgba(0,0,0,.5);}
.notif-fab.show{display:inline-flex;}
.notif-fab .notif-badge{position:absolute;top:-2px;right:-2px;background:var(--red);color:#fff;font-size:10px;font-weight:700;min-width:18px;height:18px;border-radius:9px;display:none;align-items:center;justify-content:center;padding:0 4px;border:2px solid var(--hub-bg);box-sizing:content-box;}
@media(max-width:768px){
  .notif-fab{bottom:16px;left:16px;width:44px;height:44px;font-size:18px;}
}

/* ── BYE SCREEN ── */
#byeGate{position:fixed;inset:0;background:var(--hub-bg);display:none;align-items:center;justify-content:center;z-index:600;padding:20px;}
#byeGate.show{display:flex;}
.bye-panel{text-align:center;max-width:400px;width:100%;}
.bye-panel .bye-icon{font-size:3rem;margin-bottom:16px;animation:byeWave 1.5s ease-in-out infinite;}
@keyframes byeWave{0%,100%{transform:rotate(0deg);}25%{transform:rotate(20deg);}75%{transform:rotate(-10deg);}}
.bye-panel h1{font-size:1.5rem;font-weight:400;color:var(--hub-white);margin-bottom:8px;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.bye-panel p{font-size:.85rem;color:var(--hub-muted);margin-bottom:28px;line-height:1.5;}
.bye-panel .bye-btn{display:inline-flex;align-items:center;gap:8px;background:var(--hub-accent);color:#fff;border:none;border-radius:10px;padding:12px 28px;font-size:.88rem;font-weight:600;cursor:pointer;transition:all .2s;font-family:inherit;}
.bye-panel .bye-btn:hover{background:var(--hub-accent-h);transform:translateY(-2px);box-shadow:0 8px 24px rgba(23,0,255,.3);}
.bye-panel .bye-logo{margin-top:32px;opacity:.4;display:flex;justify-content:center;}
.bye-panel .bye-logo img{max-height:28px;display:block;}

/* ── UNIFIED HEADER ──
   Legacy hub header. Hidden in SPA (display:none on #wbHeader). Sibling rule
   `.wb-header.show ~ #c { margin-top:52px }` removed because it pushed the
   canvas an extra 52px below the chrome whenever legacy JS toggled .show. */
.wb-header{position:fixed;top:0;left:0;right:0;height:52px;background:var(--hub-surface);border-bottom:1px solid var(--hub-border);display:none;align-items:center;justify-content:space-between;padding:0 24px;z-index:100;}
.wb-header.show{display:flex;}
.wb-header-left{display:flex;align-items:center;gap:12px;}
.wb-header-left img{height:26px;width:auto;object-fit:contain;object-position:left center;display:block;}
.wb-header-left .hdr-fallback{font-weight:700;font-size:var(--wb-text-base);color:var(--hub-white);display:none;}
.wb-header-right{display:flex;align-items:center;gap:10px;}
.wb-header-btn{background:var(--hub-surface2);border:1px solid var(--hub-border);color:var(--hub-muted);padding:6px 14px;border-radius:var(--wb-radius-lg);font-size:var(--wb-text-sm);font-weight:600;cursor:pointer;transition:all .15s;font-family:inherit;display:flex;align-items:center;gap:6px;letter-spacing:.3px;}
.wb-header-btn:hover{border-color:var(--hub-accent);color:var(--hub-accent);background:var(--hub-accent-bg);}
.wb-header-user{display:flex;align-items:center;gap:8px;color:var(--hub-muted);font-size:var(--wb-text-base);font-weight:600;cursor:pointer;padding:4px 8px;border-radius:var(--wb-radius-lg);transition:all .15s;}
.wb-header-user:hover{background:var(--hub-surface2);color:var(--hub-text);}
.wb-header-avatar{width:32px;height:32px;border-radius:var(--wb-radius-lg);background:var(--hub-accent);display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:var(--wb-text-sm);overflow:hidden;}
.wb-header-avatar canvas{width:32px;height:32px;image-rendering:pixelated;}

/* ── MOBILE HEADER ── */
@media(max-width:768px){
  .wb-header{padding:0 10px;height:54px;}
  /* sibling rule removed (see desktop counterpart) */

  .wb-header-left img{max-height:26px;max-width:140px;object-fit:contain;object-position:left center;}
  .lh-header{height:54px;padding:0 16px;}
  .lh-header img{height:auto;max-height:26px;max-width:140px;object-fit:contain;object-position:left center;}
  .wb-header-btn{padding:6px 8px;font-size:0;gap:0;border-radius:var(--wb-radius-md);min-width:32px;justify-content:center;}
  .wb-header-btn .btn-icon{font-size:var(--wb-text-lg);}
  .wb-header-btn .btn-label{display:none;}
  .wb-header-user{gap:5px;padding:3px 5px;}
  .wb-header-user span{display:none;}
  .wb-header-avatar{width:26px;height:26px;border-radius:5px;font-size:.65rem;}
  .wb-header-avatar canvas{width:26px;height:26px;}
  #mob{padding:14px 20px 36px;}
  #dlg{bottom:155px;}
}

/* ── USER MODAL ── */
#userModal{position:fixed;inset:0;background:var(--modal-overlay);backdrop-filter:blur(6px);display:none;align-items:center;justify-content:center;z-index:500;padding:20px;}
#userModal.show{display:flex;}
.user-panel{background:var(--hub-surface);border:1px solid var(--hub-border);border-radius:var(--radius-lg);padding:28px;width:min(380px,95vw);box-shadow:var(--shadow-lg);}
.user-panel h2{font-size:1rem;font-weight:400;color:var(--hub-white);margin-bottom:4px;display:flex;align-items:center;gap:10px;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.user-panel .up-sub{font-size:.78rem;color:var(--hub-muted);margin-bottom:20px;}
.user-panel .up-section{margin-bottom:16px;}
.user-panel .up-section h3{font-size:.72rem;color:var(--hub-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px;font-weight:600;}
.user-panel .up-group{margin-bottom:10px;}
.user-panel .up-group label{display:block;font-size:.7rem;color:var(--hub-muted);margin-bottom:4px;font-weight:600;}
.user-panel .up-group input{width:100%;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:9px 12px;color:var(--hub-text);font-size:.85rem;font-family:inherit;}
.user-panel .up-group input:focus{outline:none;border-color:var(--hub-accent);}
.user-panel .up-btn{width:100%;padding:10px;border-radius:var(--wb-radius-lg);border:none;cursor:pointer;font-size:.82rem;font-weight:600;font-family:inherit;transition:all .15s;margin-bottom:8px;}
.user-panel .up-btn.logout{background:rgba(239,68,68,.12);color:var(--red);border:1px solid rgba(239,68,68,.25);}
.user-panel .up-btn.logout:hover{background:rgba(239,68,68,.2);}
.user-panel .up-btn.save{background:var(--hub-accent);color:#fff;}.user-panel .up-btn.save:hover{background:var(--hub-accent-h);}
.user-panel .up-btn.close{background:transparent;color:var(--hub-muted);border:1px solid var(--hub-border);}.user-panel .up-btn.close:hover{color:var(--hub-text);}
.user-panel .up-msg{font-size:.78rem;margin-top:8px;text-align:center;}

/* ── PORT FILE UPLOAD MODAL ── */
#portModal{position:fixed;inset:0;background:var(--modal-overlay);backdrop-filter:blur(6px);display:none;align-items:center;justify-content:center;z-index:500;padding:20px;}
#portModal.show{display:flex;}
.port-panel{background:var(--hub-surface);border:1px solid var(--hub-border);border-radius:var(--radius-lg);padding:28px;width:min(500px,95vw);max-height:80vh;box-shadow:var(--hub-shadow);display:flex;flex-direction:column;}
.port-panel h2{font-size:1rem;font-weight:400;color:var(--hub-white);margin-bottom:4px;display:flex;align-items:center;gap:10px;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.port-panel .pp-sub{font-size:.78rem;color:var(--hub-muted);margin-bottom:16px;}
.port-projects{flex:1;overflow-y:auto;margin-bottom:16px;max-height:50vh;}
.port-proj{background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:10px;padding:14px;margin-bottom:10px;}
.port-proj h3{font-size:.85rem;color:var(--hub-text);margin-bottom:8px;font-weight:600;}
.port-proj .pp-status{font-size:.72rem;padding:3px 8px;border-radius:var(--wb-radius-sm);display:inline-block;margin-bottom:8px;}
.port-proj .pp-status.pending{background:rgba(251,191,36,.15);color:#fbbf24;}
.port-proj .pp-status.done{background:rgba(34,197,94,.15);color:var(--green);}
.port-dropzone{border:2px dashed var(--hub-accent);border-radius:var(--wb-radius-lg);padding:20px;text-align:center;color:var(--hub-muted);font-size:.8rem;cursor:pointer;transition:all .15s;margin-top:8px;}
.port-dropzone:hover,.port-dropzone.dragover{border-color:#60a5fa;background:rgba(59,130,246,.08);color:#93c5fd;}
.port-dropzone input{display:none;}
.port-files{margin-top:8px;}
.port-file{display:flex;align-items:center;gap:8px;padding:6px 0;font-size:.78rem;color:var(--hub-text2);border-bottom:1px solid var(--hub-border);}
.port-file:last-child{border-bottom:none;}
.port-file .pf-icon{font-size:1rem;}
.port-file .pf-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.port-file .pf-size{color:var(--hub-muted);font-size:.7rem;}
.port-file .pf-del{color:var(--red);cursor:pointer;font-size:.7rem;padding:2px 6px;border-radius:var(--wb-radius-sm);border:1px solid rgba(239,68,68,.25);background:rgba(239,68,68,.08);}
.port-file .pf-del:hover{background:rgba(239,68,68,.2);}
.port-panel .pp-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:8px;}
.port-panel .pp-btn{padding:9px 20px;border-radius:var(--wb-radius-lg);border:none;cursor:pointer;font-size:.82rem;font-weight:600;font-family:inherit;transition:all .15s;}
.port-panel .pp-btn.close{background:transparent;color:var(--hub-muted);border:1px solid var(--hub-border);}.port-panel .pp-btn.close:hover{border-color:var(--hub-muted);color:var(--hub-text);}
.port-upload-msg{font-size:.78rem;margin-top:6px;text-align:center;}

/* ── EMAIL MODAL ── */
#emailModal{position:fixed;inset:0;background:var(--modal-overlay);backdrop-filter:blur(6px);display:none;align-items:center;justify-content:center;z-index:500;padding:20px;}
#emailModal.show{display:flex;}
.email-panel{background:var(--hub-surface);border:1px solid var(--hub-border);border-radius:var(--radius-lg);padding:28px;width:min(460px,95vw);box-shadow:var(--hub-shadow);}
.email-panel h2{font-size:1.1rem;font-weight:400;color:var(--hub-white);margin-bottom:4px;display:flex;align-items:center;gap:10px;font-family:'Cossette Titre',sans-serif;text-transform:uppercase;}
.email-panel .ep-sub{font-size:.78rem;color:var(--hub-muted);margin-bottom:20px;}
.email-panel .ep-to{font-size:.8rem;color:var(--hub-text2);margin-bottom:14px;padding:8px 12px;background:var(--hub-surface2);border-radius:var(--wb-radius-lg);display:flex;align-items:center;gap:8px;}
.email-panel .ep-to strong{color:var(--hub-accent);}
.email-panel .ep-group{margin-bottom:14px;}
.email-panel .ep-group label{display:block;font-size:.7rem;color:var(--hub-muted);margin-bottom:4px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;}
.email-panel .ep-group input,.email-panel .ep-group textarea{width:100%;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:10px 14px;color:var(--hub-text);font-size:.85rem;font-family:inherit;transition:border .15s;}
.email-panel .ep-group input:focus,.email-panel .ep-group textarea:focus{outline:none;border-color:var(--hub-accent);}
.email-panel .ep-group textarea{resize:vertical;min-height:100px;}
.email-panel .ep-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:18px;}
.email-panel .ep-btn{padding:9px 20px;border-radius:var(--wb-radius-lg);border:none;cursor:pointer;font-size:.82rem;font-weight:600;font-family:inherit;transition:all .15s;}
.email-panel .ep-btn.cancel{background:transparent;color:var(--hub-muted);border:1px solid var(--hub-border);}.email-panel .ep-btn.cancel:hover{border-color:var(--hub-muted);color:var(--hub-text);}
.email-panel .ep-btn.send{background:var(--hub-accent);color:#fff;}.email-panel .ep-btn.send:hover{background:var(--hub-accent-h);}
.email-panel .ep-btn.send:disabled{opacity:.5;cursor:not-allowed;}
.email-panel .ep-msg{font-size:.78rem;margin-top:10px;text-align:center;}

/* ── CHAT WIDGET ── */
@media(max-width:768px){#chatWidget,.chatMinTab{display:none!important;}}
.chat-hdr-badge{background:var(--red);color:#fff;font-size:9px;font-weight:700;min-width:16px;height:16px;border-radius:var(--wb-radius-lg);display:inline-flex;align-items:center;justify-content:center;padding:0 4px;margin-left:2px;}
#chatWidget{position:fixed;bottom:20px;right:20px;width:380px;height:520px;background:var(--glass-bg);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border:1px solid var(--hub-border);border-radius:var(--radius-lg);z-index:800;display:none;flex-direction:column;box-shadow:var(--shadow-lg);overflow:hidden;font-size:var(--wb-text-base);color:var(--hub-text);}
[data-theme="light"] #chatWidget{background:var(--glass-bg);}
#chatWidget.show{display:flex;}
.chat-header{display:flex;align-items:center;padding:10px 14px;border-bottom:1px solid var(--hub-border);gap:8px;flex-shrink:0;}
.chat-header-title{font-weight:700;font-size:var(--wb-text-base);color:var(--hub-white);flex:1;}
.chat-header-btn{background:none;border:none;color:var(--hub-muted);font-size:15px;cursor:pointer;padding:2px 6px;border-radius:var(--wb-radius-sm);transition:color .15s;}
.chat-header-btn:hover{color:var(--hub-white);}
.chat-tabs{display:flex;border-bottom:1px solid var(--hub-border);overflow-x:auto;flex-shrink:0;scrollbar-width:none;}
.chat-tabs::-webkit-scrollbar{display:none;}
.chat-tab{display:flex;align-items:center;gap:4px;padding:7px 12px;font-size:var(--wb-text-xs);color:var(--hub-muted);cursor:pointer;white-space:nowrap;border-bottom:2px solid transparent;transition:all .15s;flex-shrink:0;}
.chat-tab:hover{color:var(--hub-text);}
.chat-tab.active{color:var(--hub-accent);border-bottom-color:var(--hub-accent);font-weight:600;}
.chat-tab .tab-badge{background:var(--hub-red);color:#fff;font-size:9px;min-width:14px;height:14px;border-radius:7px;display:flex;align-items:center;justify-content:center;padding:0 3px;}
.chat-tab .tab-close{color:var(--hub-muted);font-size:10px;margin-left:2px;cursor:pointer;padding:0 2px;}
.chat-tab .tab-close:hover{color:var(--hub-red);}
.chat-tab .tab-min{color:var(--hub-muted);font-size:10px;margin-left:1px;cursor:pointer;padding:0 2px;}
.chat-tab .tab-min:hover{color:var(--hub-yellow);}
.chat-tab-new{padding:7px 10px;font-size:var(--wb-text-md);color:var(--hub-muted);cursor:pointer;border:none;background:none;font-weight:700;}
.chat-tab-new:hover{color:var(--hub-accent);}
.chat-messages{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:6px;}
.chat-msg{display:flex;gap:8px;align-items:flex-start;max-width:85%;}
.chat-msg.mine{margin-left:auto;flex-direction:row-reverse;}
.chat-msg-avatar{width:24px;height:24px;border-radius:var(--wb-radius-md);background:var(--hub-surface2);border:1px solid var(--hub-border);overflow:hidden;flex-shrink:0;display:flex;align-items:center;justify-content:center;}
.chat-msg-avatar canvas{width:24px;height:24px;image-rendering:pixelated;}
.chat-msg-avatar .initials{font-size:9px;font-weight:700;color:var(--hub-muted);}
.chat-msg-body{background:var(--hub-surface2);border-radius:10px;padding:7px 11px;min-width:0;}
.chat-msg.mine .chat-msg-body{background:var(--hub-accent);color:#fff;}
.chat-msg-name{font-size:10px;font-weight:600;color:var(--hub-muted);margin-bottom:2px;}
.chat-msg.mine .chat-msg-name{color:rgba(255,255,255,.7);}
.chat-msg-text{font-size:var(--wb-text-base);line-height:1.4;white-space:pre-wrap;word-break:break-word;color:var(--hub-text);}
.chat-msg.mine .chat-msg-text{color:#fff;}
.chat-msg-time{font-size:9px;color:var(--hub-dim);margin-top:2px;}
.chat-msg.mine .chat-msg-time{color:rgba(255,255,255,.5);}
.chat-typing{font-size:var(--wb-text-xs);color:var(--hub-muted);padding:0 12px 4px;min-height:18px;flex-shrink:0;}
.chat-input-bar{display:flex;padding:8px 10px;border-top:1px solid var(--hub-border);gap:6px;flex-shrink:0;align-items:flex-end;}
.chat-input-bar textarea{flex:1;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:7px 10px;color:var(--hub-text);font-size:var(--wb-text-base);resize:none;max-height:80px;min-height:34px;font-family:inherit;outline:none;transition:border-color .15s;}
.chat-input-bar textarea:focus{border-color:var(--hub-accent);}
.chat-send-btn{background:var(--hub-accent);color:#fff;border:none;border-radius:var(--wb-radius-lg);padding:7px 12px;cursor:pointer;font-weight:600;font-size:var(--wb-text-sm);transition:opacity .15s;flex-shrink:0;height:34px;}
.chat-send-btn:hover{opacity:.85;}
.chat-send-btn:disabled{opacity:.4;cursor:default;}
.chat-empty{flex:1;display:flex;align-items:center;justify-content:center;color:var(--hub-muted);font-size:var(--wb-text-sm);text-align:center;padding:20px;}
.chat-new-conv{padding:14px;display:flex;flex-direction:column;gap:10px;flex:1;overflow-y:auto;}
.chat-new-conv input{background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:8px 10px;color:var(--hub-text);font-size:var(--wb-text-base);font-family:inherit;outline:none;}
.chat-new-conv input:focus{border-color:var(--hub-accent);}
.chat-user-pick{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:var(--wb-radius-lg);cursor:pointer;transition:background .15s;}
.chat-user-pick:hover{background:var(--hub-surface2);}
.chat-user-pick.selected{background:var(--hub-accent-bg);border:1px solid var(--hub-accent-border);}
.chat-user-pick .pick-avatar{width:24px;height:24px;border-radius:var(--wb-radius-md);background:var(--hub-surface2);overflow:hidden;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.chat-user-pick .pick-avatar canvas{width:24px;height:24px;image-rendering:pixelated;}
.chat-user-pick .pick-name{font-size:var(--wb-text-base);color:var(--hub-text);}
.chat-user-pick .pick-role{font-size:10px;color:var(--hub-muted);}
.chat-create-btn{background:var(--hub-accent);color:#fff;border:none;border-radius:var(--wb-radius-lg);padding:9px;cursor:pointer;font-weight:600;font-size:var(--wb-text-base);font-family:inherit;margin-top:4px;}
.chatMinTab{position:fixed;bottom:20px;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:10px;padding:6px 12px;font-size:var(--wb-text-xs);font-weight:600;color:var(--hub-text);cursor:pointer;z-index:799;box-shadow:0 4px 16px rgba(0,0,0,.3);display:flex;align-items:center;gap:5px;transition:transform .15s;}
.chatMinTab:hover{transform:translateY(-2px);}
.chatMinTab .badge{background:var(--hub-red);color:#fff;font-size:9px;min-width:14px;height:14px;border-radius:7px;display:flex;align-items:center;justify-content:center;padding:0 3px;}

/* ── CHAT FULL MODAL ── */
#chatFullModal{position:fixed;inset:0;z-index:2000;display:none;align-items:center;justify-content:center;background:var(--modal-overlay);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);}
#chatFullModal.show{display:flex;}
.cfm-container{width:min(1100px,94vw);height:min(720px,88vh);background:var(--hub-surface);border:1px solid var(--hub-border);border-radius:var(--wb-radius-2xl);display:flex;overflow:hidden;box-shadow:var(--shadow-lg);font-size:var(--wb-text-base);color:var(--hub-text);}
[data-theme="light"] .cfm-container{background:var(--surface);}
.cfm-sidebar{width:300px;border-right:1px solid var(--hub-border);display:flex;flex-direction:column;flex-shrink:0;}
.cfm-sidebar-header{display:flex;align-items:center;padding:16px;border-bottom:1px solid var(--hub-border);gap:8px;}
.cfm-sidebar-header h3{margin:0;font-size:15px;font-weight:700;color:var(--hub-white);flex:1;}
.cfm-sidebar-search{margin:0 12px 8px;margin-top:8px;}
.cfm-sidebar-search input{width:100%;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:7px 10px;color:var(--hub-text);font-size:var(--wb-text-sm);font-family:inherit;outline:none;}
.cfm-sidebar-search input:focus{border-color:var(--hub-accent);}
.cfm-conv-list{flex:1;overflow-y:auto;padding:4px 8px;}
.cfm-conv-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;cursor:pointer;transition:background .15s;position:relative;}
.cfm-conv-item:hover{background:var(--hub-surface2);}
.cfm-conv-item.active{background:var(--hub-accent-bg);border:1px solid var(--hub-accent-border);}
.cfm-conv-avatar{width:36px;height:36px;border-radius:10px;background:var(--hub-surface2);border:1px solid var(--hub-border);display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:var(--wb-text-md);font-weight:700;color:var(--hub-muted);}
.cfm-conv-info{flex:1;min-width:0;}
.cfm-conv-name{font-size:var(--wb-text-base);font-weight:600;color:var(--hub-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.cfm-conv-preview{font-size:var(--wb-text-xs);color:var(--hub-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;}
.cfm-conv-meta{display:flex;flex-direction:column;align-items:flex-end;gap:4px;flex-shrink:0;}
.cfm-conv-time{font-size:10px;color:var(--hub-dim);}
.cfm-conv-badge{background:var(--hub-red);color:#fff;font-size:9px;min-width:18px;height:18px;border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0 4px;font-weight:700;}
.cfm-conv-del{font-size:var(--wb-text-xs);cursor:pointer;opacity:0;transition:opacity .15s;padding:2px;}
.cfm-conv-item:hover .cfm-conv-del{opacity:.6;}
.cfm-conv-del:hover{opacity:1!important;}
.cfm-main{flex:1;display:flex;flex-direction:column;min-width:0;}
.cfm-main-header{display:flex;align-items:center;padding:16px;border-bottom:1px solid var(--hub-border);gap:10px;}
.cfm-main-header h3{margin:0;font-size:var(--wb-text-md);font-weight:700;color:var(--hub-white);flex:1;}
.cfm-close-btn{background:none;border:1px solid var(--hub-border);color:var(--hub-muted);width:32px;height:32px;border-radius:var(--wb-radius-lg);cursor:pointer;font-size:var(--wb-text-lg);display:flex;align-items:center;justify-content:center;transition:all .15s;}
.cfm-close-btn:hover{background:var(--hub-surface2);color:var(--hub-white);}
.cfm-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:6px;}
.cfm-messages .chat-msg{max-width:70%;}
.cfm-typing{font-size:var(--wb-text-xs);color:var(--hub-muted);padding:0 16px 4px;min-height:18px;flex-shrink:0;}
.cfm-input-bar{display:flex;padding:12px 16px;border-top:1px solid var(--hub-border);gap:8px;align-items:flex-end;}
.cfm-input-bar textarea{flex:1;background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:10px;padding:9px 12px;color:var(--hub-text);font-size:var(--wb-text-base);resize:none;max-height:100px;min-height:38px;font-family:inherit;outline:none;transition:border-color .15s;}
.cfm-input-bar textarea:focus{border-color:var(--hub-accent);}
.cfm-input-bar .chat-send-btn{height:38px;padding:8px 16px;font-size:var(--wb-text-base);border-radius:10px;}
.cfm-empty{flex:1;display:flex;align-items:center;justify-content:center;color:var(--hub-muted);font-size:var(--wb-text-base);text-align:center;padding:20px;}
.cfm-sidebar-new{padding:8px 12px;border-top:1px solid var(--hub-border);flex-shrink:0;}
.cfm-sidebar-new button{width:100%;background:var(--hub-accent);color:#fff;border:none;border-radius:10px;padding:9px;font-size:var(--wb-text-base);font-weight:600;cursor:pointer;font-family:inherit;transition:opacity .15s;}
.cfm-sidebar-new button:hover{opacity:.85;}
.cfm-new-conv{padding:20px;display:flex;flex-direction:column;gap:12px;flex:1;overflow-y:auto;}
.cfm-new-conv input{background:var(--hub-surface2);border:1px solid var(--hub-border);border-radius:var(--wb-radius-lg);padding:9px 12px;color:var(--hub-text);font-size:var(--wb-text-base);font-family:inherit;outline:none;}
.cfm-new-conv input:focus{border-color:var(--hub-accent);}
.cfm-participants{max-height:340px;overflow-y:auto;display:flex;flex-direction:column;gap:4px;}
@media(max-width:640px){.cfm-sidebar{width:100%;}.cfm-main{display:none;}.cfm-container.conv-open .cfm-sidebar{display:none;}.cfm-container.conv-open .cfm-main{display:flex;}.cfm-back-btn{display:inline-flex!important;}}
.cfm-back-btn{display:none;background:none;border:none;color:var(--hub-muted);font-size:18px;cursor:pointer;padding:2px 6px;}
@media(max-width:700px){#copywriterOverlay>div>div:nth-child(3){flex-direction:column!important;}#copywriterOverlay>div>div:nth-child(3)>div:first-child{width:100%!important;max-height:200px!important;border-right:none!important;border-bottom:1px solid var(--hub-border)!important;}}
/* Hub Quill editor styles */
.hub-editor .ql-toolbar.ql-snow{background:var(--hub-surface2);border:none;border-bottom:1px solid var(--hub-border);padding:4px 12px;display:flex;flex-wrap:wrap;align-items:center;gap:1px;}
.hub-editor .ql-toolbar .ql-formats{display:flex;align-items:center;gap:0;margin-right:4px;padding-right:4px;border-right:1px solid var(--hub-border2);}
.hub-editor .ql-toolbar .ql-formats:last-child{border-right:none;}
.hub-editor .ql-toolbar button{width:28px;height:28px;padding:3px;border-radius:var(--wb-radius-sm);}
.hub-editor .ql-toolbar button:hover{background:var(--hub-surface3);}
.hub-editor .ql-toolbar button.ql-active{background:rgba(99,102,241,.2);color:#818cf8;}
.hub-editor .ql-toolbar .ql-picker{height:28px;}
.hub-editor .ql-toolbar .ql-picker-label{color:var(--hub-text2);padding:2px 4px;border:1px solid transparent;border-radius:var(--wb-radius-sm);}
.hub-editor .ql-toolbar .ql-picker-label:hover{background:var(--hub-surface3);}
.hub-editor .ql-toolbar .ql-stroke{stroke:var(--hub-text2);}
.hub-editor .ql-toolbar .ql-fill{fill:var(--hub-text2);}
.hub-editor .ql-toolbar .ql-picker-options{background:var(--hub-surface2);border-color:var(--hub-border);}
.hub-editor .ql-container.ql-snow{border:none;}
.hub-editor .ql-editor{min-height:60vh;font-size:15px;line-height:1.8;padding:40px 72px 120px;color:var(--hub-text);}
.hub-editor .ql-editor img{max-width:100%;height:auto;border-radius:var(--wb-radius-sm);margin:8px 0;}
.hub-editor .ql-editor table{border-collapse:collapse;width:100%;margin:12px 0;}
.hub-editor .ql-editor td,.hub-editor .ql-editor th{border:1px solid var(--hub-border2);padding:8px 12px;min-width:50px;}
/* Highlight comments */
.hl-comment{background:rgba(250,204,21,.25);cursor:pointer;border-bottom:2px solid rgba(250,204,21,.6);transition:background .15s;}
.hl-comment:hover{background:rgba(250,204,21,.45);}
.hl-comment.active{background:rgba(250,204,21,.5);border-bottom-color:var(--orange);}
.comment-highlight-badge{position:absolute;right:-36px;width:24px;height:24px;background:var(--hub-accent);color:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:var(--wb-text-xs);cursor:pointer;box-shadow:0 2px 6px rgba(0,0,0,.3);}

/* ════════════════════════════════════════════════════════════════════════
   GAME UI — banner + modal pixel-on-ecosystem + HUD controles (touch/keyboard)
   Tokens del design system + frame pixel art. Motion curves del wb-motion.css.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Banner inferior ───────────────────────────────────────────────── */
#juego-wrap .game-banner{
  position:absolute;bottom:24px;left:50%;
  transform:translateX(-50%) translateY(20px);
  display:flex;align-items:center;gap:10px;
  padding:10px 16px;border-radius:var(--wb-radius-lg,10px);
  background:rgba(13,17,23,.85);border:1px solid rgba(255,255,255,.10);
  backdrop-filter:blur(12px) saturate(140%);-webkit-backdrop-filter:blur(12px) saturate(140%);
  color:#e6edf3;font-family:'Geist','Inter Tight',system-ui,sans-serif;font-size:var(--wb-text-base);
  opacity:0;pointer-events:none;z-index:1000;
  transition:opacity var(--motion-base,.18s) var(--ease-out,ease), transform var(--motion-base,.18s) var(--ease-out,ease);
}
#juego-wrap .game-banner.is-visible{opacity:1;transform:translateX(-50%) translateY(0);}
#juego-wrap .game-banner-sep{opacity:.55}
#juego-wrap .game-banner #ui-banner-label{font-weight:600}

/* ── Tecla pill ──────────────────────────────────────────────────── */
#juego-wrap .game-kbd{
  display:inline-flex;align-items:center;justify-content:center;
  background:rgba(31,41,55,.95);border:1px solid rgba(55,65,81,.95);
  border-bottom-width:2px;
  border-radius:var(--wb-radius-md);padding:1px 8px 2px;
  font-family:'JetBrains Mono','Inconsolata',monospace;font-size:var(--wb-text-xs);font-weight:600;
  color:#fff;letter-spacing:.4px;
  min-width:18px;height:20px;
  box-shadow:0 1px 0 rgba(0,0,0,.4) inset;
}

/* ── Modal: centrado, ecosistema-coherente, modo texto + modo tabs ────── */
#juego-wrap .game-modal-overlay{
  position:absolute;inset:0;
  display:flex;align-items:center;justify-content:center;
  padding:32px;
  z-index:1100;pointer-events:none;
  background:transparent;
  opacity:0;
  transition:opacity var(--motion-base,.18s) var(--ease-out,ease);
}
#juego-wrap .game-modal-overlay.is-visible{opacity:1;pointer-events:auto;}
#juego-wrap .game-modal-overlay.is-visible::before{
  content:"";position:absolute;inset:0;
  background:var(--modal-overlay);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  animation:wb-fade-in var(--motion-base) var(--ease-out);
}

/* Card: surface + border 1px + radius lg, igual que el resto de modales del
   ecosistema. PADDING aplicado en cada subzona (head/body/foot) en vez de
   en la card, para poder que las pestañas/iframe lleguen a borde sin huecos. */
#juego-wrap .game-modal-card{
  position:relative;
  background:var(--surface,#111);
  color:var(--text,#e0e0e0);
  font-family:'Geist','Inter Tight',system-ui,sans-serif;
  width:min(540px, 92vw);
  max-height:min(80vh, 720px);
  display:flex;flex-direction:column;
  overflow:hidden;
  border:1px solid var(--border,rgba(255,255,255,.08));
  border-radius:var(--radius-lg,14px);
  box-shadow:0 24px 64px rgba(0,0,0,.55);
  opacity:0;transform:scale(.96) translateY(8px);filter:blur(4px);
}
#juego-wrap .game-modal-card[data-mode="archivos"]{
  width:min(720px, 94vw);
  max-height:min(85vh, 760px);
}
#juego-wrap .game-modal-overlay.is-visible .game-modal-card{
  opacity:1;transform:scale(1) translateY(0);filter:blur(0);
  animation:wb-modal-content-in var(--motion-medium,.24s) var(--ease-out,ease);
}

/* Corners pixel descartados — convertido en CSS reset por compat */
#juego-wrap .game-modal-corner{display:none}

/* Cabecera: título + close X. Padding amplio para respirar. */
#juego-wrap .game-modal-head{
  display:flex;align-items:center;gap:16px;
  padding:32px 36px 24px !important;
  border-bottom:1px solid var(--border,rgba(255,255,255,.08));
  flex-shrink:0;
}
#juego-wrap .game-modal-title{
  margin:0;flex:1;min-width:0;
  font-family:'Cossette Titre','Geist',system-ui,sans-serif;
  font-size:var(--wb-text-xl);font-weight:400;color:var(--text,#fff);
  letter-spacing:.04em;text-transform:uppercase;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#juego-wrap .game-modal-close{
  display:inline-flex;align-items:center;justify-content:center;
  background:transparent;border:0;border-radius:var(--wb-radius-lg);
  width:36px;height:36px;flex-shrink:0;
  color:var(--muted,#888);cursor:pointer;
  transition:background var(--motion-fast,.12s) var(--ease-out,ease),
             color var(--motion-fast,.12s) var(--ease-out,ease);
}
#juego-wrap .game-modal-close:hover{background:var(--surface2,rgba(255,255,255,.06));color:var(--text,#fff);}
#juego-wrap .game-modal-close:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent,#1700FF) 30%, transparent);
}

/* Tabs (modo archivos): tabs CLÁSICAS con underline, sentadas sobre el
   border-bottom de la sección. Visualmente dejan claro que son pestañas
   (no botones flotantes). */
#juego-wrap .game-modal-tabs{
  display:flex;gap:0 !important;
  padding:0 32px !important;
  border-bottom:1px solid var(--border,rgba(255,255,255,.08));
  overflow-x:auto;flex-shrink:0;scrollbar-width:none;
}
#juego-wrap .game-modal-tabs::-webkit-scrollbar{display:none;}
#juego-wrap .game-modal-tab{
  background:transparent !important;outline:none;
  padding:14px 18px !important;
  margin-bottom:-1px !important;
  font-family:inherit;font-size:13.5px;font-weight:600;
  color:var(--muted,#888);cursor:pointer;
  border:0 !important;
  border-bottom:2px solid transparent !important;
  border-radius:0 !important;
  transition:color var(--motion-fast,.12s) var(--ease-out,ease),
             border-bottom-color var(--motion-fast,.12s) var(--ease-out,ease);
  white-space:nowrap;flex-shrink:0;
  line-height:1.2;
}
#juego-wrap .game-modal-tab:hover{
  color:var(--text,#fff);
  background:transparent !important;
}
#juego-wrap .game-modal-tab.is-active{
  color:var(--accent,#1700FF) !important;
  background:transparent !important;
  border-bottom-color:var(--accent,#1700FF) !important;
}
#juego-wrap .game-modal-tab:focus-visible{
  outline:none;
  background:color-mix(in srgb, var(--accent,#1700FF) 8%, transparent) !important;
  border-radius:var(--wb-radius-md) 6px 0 0 !important;
}

/* Body: en modo texto lleva padding amplio; en modo archivos el iframe va
   a borde sin padding interno para maximizar el área útil. */
#juego-wrap .game-modal-body{
  flex:1;min-height:0;
  display:flex;flex-direction:column;
  overflow:hidden;
}
#juego-wrap .game-modal-card[data-mode="text"] .game-modal-body{
  padding:28px 32px;
  overflow-y:auto;
}
#juego-wrap .game-modal-text{
  margin:0;font-size:15px;line-height:1.65;color:var(--text2,var(--text,#bbb));
}
#juego-wrap .game-modal-tab-content{
  flex:1;min-height:0;
  overflow-y:auto;
  padding:24px 28px 28px !important;
  background:var(--bg,#0a0a0a);
}
#juego-wrap .game-modal-iframe{
  flex:1;width:100%;height:100%;
  border:0;background:var(--bg,#0a0a0a);
}

/* ── Modal archivos: inline content (list / groups / file-requests) ─── */
#juego-wrap .gm-loading,
#juego-wrap .gm-empty{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:12px;padding:60px 24px;text-align:center;color:var(--muted,#888);
  min-height:200px;
}
#juego-wrap .gm-empty i{font-size:36px;color:var(--muted,#888);opacity:.5;margin-bottom:4px;}
#juego-wrap .gm-empty h4{margin:0;font-size:var(--wb-text-lg);font-weight:600;color:var(--text,#fff);}
#juego-wrap .gm-empty p{margin:0;font-size:13.5px;line-height:1.55;max-width:340px;}

/* List = lista de grupos. Gap amplio entre grupos. */
#juego-wrap .gm-list{display:flex;flex-direction:column;gap:28px !important;}

/* Group = colección de items con su título. */
#juego-wrap .gm-group{display:flex;flex-direction:column;gap:8px !important;}
#juego-wrap .gm-group-title{
  margin:0 0 8px !important;padding:0 4px 14px !important;
  font-size:var(--wb-text-sm);font-weight:700;letter-spacing:.9px;
  text-transform:uppercase;color:var(--text,#fff);
  border-bottom:1px solid var(--border,rgba(255,255,255,.08));
  display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;
}
[data-theme="light"] #juego-wrap .gm-group-title{color:var(--text);}
#juego-wrap .gm-group-sub{
  font-size:var(--wb-text-xs);font-weight:500;letter-spacing:.4px;
  text-transform:uppercase;color:var(--muted,#888);
}

/* Item card (entregables). */
#juego-wrap .gm-item{
  display:flex !important;align-items:center;gap:14px;
  padding:14px 16px !important;
  background:var(--surface,#111);
  border:1px solid var(--border,rgba(255,255,255,.08)) !important;
  border-radius:10px !important;
  text-decoration:none;color:var(--text,#fff);
  transition:border-color var(--motion-fast,.12s) var(--ease-out,ease),
             background var(--motion-fast,.12s) var(--ease-out,ease),
             transform var(--motion-fast,.12s) var(--ease-out,ease);
}
#juego-wrap .gm-item:hover{
  border-color:color-mix(in srgb, var(--accent,#1700FF) 35%, var(--border,rgba(255,255,255,.08)));
  background:color-mix(in srgb, var(--accent,#1700FF) 4%, var(--surface,#111));
}
#juego-wrap .gm-item:active{transform:scale(.99);}
#juego-wrap .gm-item-icon{
  flex-shrink:0;width:32px;height:32px;border-radius:var(--wb-radius-lg);
  background:color-mix(in srgb, var(--accent,#1700FF) 12%, transparent);
  display:flex;align-items:center;justify-content:center;
  color:var(--accent,#1700FF);font-size:var(--wb-text-md);
}
#juego-wrap .gm-item-name{
  flex:1;min-width:0;
  font-size:var(--wb-text-md);font-weight:500;line-height:1.4;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#juego-wrap .gm-item-meta{
  font-size:var(--wb-text-sm);color:var(--muted,#888);
  flex-shrink:0;max-width:220px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#juego-wrap .gm-item-arrow{
  font-size:var(--wb-text-xs);color:var(--muted,#888);opacity:.4;flex-shrink:0;
}
#juego-wrap .gm-item:hover .gm-item-arrow{opacity:1;color:var(--accent,#1700FF);}

/* File request card: title + scope + status/botón. */
#juego-wrap .gm-fr{
  display:flex !important;align-items:center;gap:14px;
  padding:15px 18px !important;
  background:var(--surface,#111);
  border:1px solid var(--border,rgba(255,255,255,.08)) !important;
  border-radius:10px !important;
  position:relative;
  transition:border-color var(--motion-fast,.12s) var(--ease-out,ease);
}
#juego-wrap .gm-fr[data-status="pending"]{
  border-color:color-mix(in srgb, var(--orange) 45%, var(--border,rgba(255,255,255,.08))) !important;
  background:color-mix(in srgb, var(--orange) 4%, var(--surface,#111));
}
#juego-wrap .gm-fr-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px;}
#juego-wrap .gm-fr-label{
  font-size:var(--wb-text-md);font-weight:600;color:var(--text,#fff);line-height:1.35;
  white-space:normal;
  word-break:break-word;
}
#juego-wrap .gm-fr-meta{
  font-size:var(--wb-text-sm);color:var(--muted,#888);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#juego-wrap .gm-fr-up{
  display:inline-flex !important;align-items:center;gap:7px;
  background:var(--accent,#1700FF) !important;color:#fff !important;border:0 !important;
  padding:10px 16px !important;border-radius:var(--wb-radius-lg) !important;
  font-family:inherit;font-size:var(--wb-text-base);font-weight:600;cursor:pointer;
  flex-shrink:0;line-height:1;
  transition:background var(--motion-fast,.12s) var(--ease-out,ease),
             transform var(--motion-fast,.12s) var(--ease-out,ease),
             filter var(--motion-fast,.12s) var(--ease-out,ease);
}
#juego-wrap .gm-fr-up:hover{filter:brightness(1.08);}
#juego-wrap .gm-fr-up:active{transform:scale(.97);}
#juego-wrap .gm-fr-up:disabled{opacity:.7;cursor:default;}
#juego-wrap .gm-fr-done{
  display:inline-flex;align-items:center;gap:7px;
  font-size:var(--wb-text-base);font-weight:600;color:var(--green);
  flex-shrink:0;
}
#juego-wrap .gm-fr-error{
  position:absolute;left:18px;right:18px;bottom:-24px;
  font-size:11.5px;color:var(--red,#ef4444);
}

/* Mi zona Share: landing card con CTA. Más generoso. */
#juego-wrap .gm-share-landing{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:18px;padding:48px 32px;text-align:center;
  background:var(--surface,#111);
  border:1px solid var(--border,rgba(255,255,255,.08));
  border-radius:var(--radius-lg);
  min-height:280px;
}
#juego-wrap .gm-share-icon{
  font-size:42px;color:var(--accent,#1700FF);opacity:.9;
}
#juego-wrap .gm-share-landing h4{
  margin:0;font-family:'Cossette Titre','Geist',system-ui,sans-serif;
  font-size:var(--wb-text-lg);font-weight:400;color:var(--text,#fff);
  letter-spacing:.04em;text-transform:uppercase;
}
#juego-wrap .gm-share-landing p{
  margin:0;font-size:var(--wb-text-md);line-height:1.6;color:var(--muted,#888);
  max-width:400px;
}
#juego-wrap .gm-share-landing .game-modal-cta{
  margin-top:10px;text-decoration:none;
  padding:12px 22px;font-size:var(--wb-text-md);
}

/* Pie: hint + CTA. */
#juego-wrap .game-modal-foot{
  display:flex;justify-content:space-between;align-items:center;gap:16px;
  padding:20px 32px 26px;
  border-top:1px solid var(--border,rgba(255,255,255,.08));
  font-size:12.5px;color:var(--muted,#888);
  flex-shrink:0;
}
#juego-wrap .game-modal-card[data-mode="archivos"] .game-modal-foot{
  padding:14px 24px;
}
#juego-wrap .game-modal-cta{
  display:inline-flex;align-items:center;gap:6px;
  background:var(--accent,#1700FF);color:#fff;border:0;
  border-radius:var(--wb-radius-lg);
  padding:10px 18px;font-size:var(--wb-text-base);font-weight:700;
  font-family:inherit;cursor:pointer;
  letter-spacing:.02em;
  transition:background var(--motion-fast,.12s) var(--ease-out,ease),
             transform var(--motion-fast,.12s) var(--ease-out,ease),
             filter var(--motion-fast,.12s) var(--ease-out,ease);
}
#juego-wrap .game-modal-cta[hidden]{display:none;}
#juego-wrap .game-modal-cta:hover{background:var(--accent-h,var(--accent,#1700FF));filter:brightness(1.08)}
#juego-wrap .game-modal-cta:active{transform:scale(.97)}
#juego-wrap .game-modal-cta:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent,#1700FF) 30%, transparent);
}
#juego-wrap .game-modal-hint{
  display:flex;align-items:center;gap:8px;margin-left:auto;
  color:var(--muted,#888);
}

/* ── HUD: controles touch/keyboard ─────────────────────────────────── */
#juego-wrap .game-hud{
  position:absolute;inset:0;
  pointer-events:none;
  z-index:900;
  font-family:'Geist','Inter Tight',system-ui,sans-serif;
}
#juego-wrap .game-hud > *{pointer-events:auto}

/* PC: auto-hide. Touch: siempre visible. Opacidad bajada respecto al diseño inicial pero legible. */
#juego-wrap .game-hud[data-mode="kbd"]{opacity:0;transition:opacity var(--motion-base,.18s) var(--ease-out,ease);}
#juego-wrap .game-hud[data-mode="kbd"].is-visible{opacity:.78}
#juego-wrap .game-hud[data-mode="kbd"].is-visible:hover{opacity:1}
#juego-wrap .game-hud[data-mode="touch"]{opacity:.92}

/* ─── Cluster: solo wrapper de posición. Botones flotan sin panel ─── */
#juego-wrap .game-hud-cluster{
  position:absolute;
  padding:0;
  background:transparent;
  border:0;
  border-radius:0;
  backdrop-filter:none;-webkit-backdrop-filter:none;
  box-shadow:none;
  user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;
}
#juego-wrap .game-hud-cluster-left{
  left:calc(env(safe-area-inset-left,0px) + 22px);
  bottom:calc(env(safe-area-inset-bottom,0px) + 22px);
}
#juego-wrap .game-hud-cluster-right{
  right:calc(env(safe-area-inset-right,0px) + 22px);
  bottom:calc(env(safe-area-inset-bottom,0px) + 22px);
}
/* Touch (mobile): clusters elevados para que el pulgar alcance + cluster completo
   visible. Bottom suficiente para que el rombo (148px tall) y la cruceta (164px tall)
   queden por encima de la home-indicator. */
#juego-wrap .game-hud[data-mode="touch"] .game-hud-cluster-left{
  left:calc(env(safe-area-inset-left,0px) + 14px);
  bottom:calc(env(safe-area-inset-bottom,0px) + 24px);
}
#juego-wrap .game-hud[data-mode="touch"] .game-hud-cluster-right{
  right:calc(env(safe-area-inset-right,0px) + 14px);
  bottom:calc(env(safe-area-inset-bottom,0px) + 24px);
}

/* Pixel corners — ocultos cuando no hay panel cluster */
#juego-wrap .ghud-corner{display:none}

/* ─── D-Pad (cruceta) ─── */
#juego-wrap .game-hud-dpad{
  position:relative;
  display:grid;
  grid-template-columns:repeat(3, 44px);
  grid-template-rows:repeat(3, 44px);
  gap:3px;
}
#juego-wrap .game-hud[data-mode="touch"] .game-hud-dpad{
  grid-template-columns:repeat(3, 52px);grid-template-rows:repeat(3, 52px);gap:4px;
}
#juego-wrap .ghud-up   {grid-column:2;grid-row:1}
#juego-wrap .ghud-left {grid-column:1;grid-row:2}
#juego-wrap .ghud-right{grid-column:3;grid-row:2}
#juego-wrap .ghud-down {grid-column:2;grid-row:3}
#juego-wrap .ghud-dpad-hub{
  grid-column:2;grid-row:2;
  align-self:center;justify-self:center;
  width:14px;height:14px;border-radius:50%;
  background:radial-gradient(circle at 35% 30%, rgba(255,255,255,.10), rgba(0,0,0,.45));
  border:1px solid rgba(255,255,255,.06);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), inset 0 -1px 0 rgba(0,0,0,.35);
  position:relative;
}
#juego-wrap .ghud-dpad-hub::before{
  content:"";position:absolute;inset:50% 50% 50% 50%;
  width:3px;height:3px;margin:-1.5px 0 0 -1.5px;
  background:var(--accent,#1700FF);border-radius:50%;
  box-shadow:0 0 6px var(--accent,#1700FF);
  opacity:.55;
}

/* ─── Botones D-pad ─── */
#juego-wrap .ghud-arrow{
  position:relative;
  background:linear-gradient(180deg, rgba(40,44,58,.48) 0%, rgba(15,17,24,.58) 100%);
  border:1px solid rgba(255,255,255,.08);
  border-top-color:rgba(255,255,255,.16);
  border-radius:var(--wb-radius-lg);
  color:rgba(232,238,247,.95);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;font-family:inherit;padding:0;
  overflow:hidden;
  box-shadow:
    0 1px 0 rgba(0,0,0,.30) inset,
    0 -1px 0 rgba(255,255,255,.03) inset,
    0 2px 5px rgba(8,4,32,.25);
  transform:scale(1) translateY(0);
  filter:brightness(1);
  transition:
    transform var(--motion-medium,240ms) cubic-bezier(0.16,1,0.3,1),
    filter var(--motion-base,180ms) var(--ease-out),
    background var(--motion-fast,120ms) var(--ease-out),
    border-color var(--motion-fast,120ms) var(--ease-out);
}
#juego-wrap .ghud-arrow:hover{border-top-color:rgba(255,255,255,.20)}
/* Children (SVG) renderizan SIEMPRE por encima del halo (::after) */
#juego-wrap .ghud-arrow > *{position:relative;z-index:2}

/* ─── Botones de acción (PlayStation circles) ─── */
/* PC (kbd): fila horizontal — labels de tecla legibles */
#juego-wrap .game-hud-actions{
  position:relative;
  display:grid;
  grid-template-columns:repeat(3, 56px);
  gap:10px;
}
/* Mobile (touch): rombo PS auténtico — Δ centrada arriba, ○ centrada derecha, ✕ centrada abajo
   Posicionamiento absoluto para mantener simetría real del rombo PlayStation. */
#juego-wrap .game-hud[data-mode="touch"] .game-hud-actions{
  display:block;position:relative;
  width:148px;height:148px;
  grid-template-columns:none;grid-template-rows:none;gap:0;
}
#juego-wrap .game-hud[data-mode="touch"] .ghud-btn{position:absolute}
#juego-wrap .game-hud[data-mode="touch"] .ghud-jump{
  top:0;left:50%;margin-left:-33px;
}
#juego-wrap .game-hud[data-mode="touch"] .ghud-run{
  right:0;top:50%;margin-top:-33px;
}
#juego-wrap .game-hud[data-mode="touch"] .ghud-interact{
  bottom:0;left:50%;margin-left:-33px;
}

#juego-wrap .ghud-btn{
  position:relative;
  width:56px;height:56px;border-radius:50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.10) 0%, transparent 55%),
    linear-gradient(180deg, rgba(38,42,56,.50) 0%, rgba(12,14,20,.62) 100%);
  border:1px solid rgba(255,255,255,.10);
  border-top-color:rgba(255,255,255,.20);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  cursor:pointer;font-family:inherit;padding:0;
  overflow:hidden;
  box-shadow:
    0 1px 0 rgba(0,0,0,.30) inset,
    0 -1px 1px rgba(255,255,255,.03) inset,
    0 3px 8px rgba(8,4,32,.30),
    0 6px 16px rgba(8,4,32,.18);
  transform:scale(1) translateY(0);
  filter:brightness(1);
  transition:
    transform var(--motion-medium,240ms) cubic-bezier(0.16,1,0.3,1),
    filter var(--motion-base,180ms) var(--ease-out),
    border-color var(--motion-fast,120ms) var(--ease-out);
}
#juego-wrap .game-hud[data-mode="touch"] .ghud-btn{width:64px;height:64px}
#juego-wrap .ghud-btn:hover{border-top-color:rgba(255,255,255,.24)}
/* Children por encima de los pseudo-elementos (halo + ring) */
#juego-wrap .ghud-btn > *{position:relative;z-index:2}

/* ─── SVG icons (crisp, currentColor-driven) ─── */
#juego-wrap .ghud-icon{
  width:18px;height:18px;
  filter:drop-shadow(0 1px 0 rgba(0,0,0,.5));
}
#juego-wrap .game-hud[data-mode="touch"] .ghud-arrow .ghud-icon{width:22px;height:22px}
#juego-wrap .ghud-btn .ghud-icon{width:24px;height:24px}
#juego-wrap .game-hud[data-mode="touch"] .ghud-btn .ghud-icon{width:28px;height:28px}

/* PlayStation colors — OKLCH-balanced, brand-coherent (no chillan sobre canvas) */
#juego-wrap .ghud-jump .ghud-icon-tri{color:#65d99a}    /* mint green calmado */
#juego-wrap .ghud-run  .ghud-icon-cir{color:#ff8a8a}    /* coral suave */
#juego-wrap .ghud-interact .ghud-icon-crs{color:#7da6ff}/* azul cielo */

/* Anillo accent sutil dentro del botón (delicado, solo visible al iluminar) */
#juego-wrap .ghud-btn::before{
  content:"";position:absolute;inset:6px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.04);
  pointer-events:none;
  transition:border-color var(--motion-base) var(--ease-out);
}
#juego-wrap .ghud-jump:hover::before    {border-color:rgba(101,217,154,.20)}
#juego-wrap .ghud-run:hover::before     {border-color:rgba(255,138,138,.20)}
#juego-wrap .ghud-interact:hover::before{border-color:rgba(125,166,255,.20)}

/* ─── Halo / ripple ─── */
#juego-wrap .ghud-arrow::after,
#juego-wrap .ghud-btn::after{
  content:"";position:absolute;inset:0;border-radius:inherit;
  background:radial-gradient(circle at center, var(--accent,#1700FF) 0%, rgba(23,0,255,.5) 40%, transparent 70%);
  opacity:0;transform:scale(1.7);
  pointer-events:none;
  /* Release: ripple expands+fades (cubic-bezier ease-out-expo) */
  transition:
    opacity var(--motion-medium,240ms) var(--ease-out),
    transform 320ms cubic-bezier(0.16,1,0.3,1);
}

/* ─── Press state: snap fast (60ms ease-in), depth deeper ─── */
#juego-wrap .ghud-arrow.is-pressed{
  transform:scale(.90) translateY(2px);
  filter:brightness(1.4);
  background:linear-gradient(180deg, rgba(50,55,75,.85) 0%, rgba(20,22,32,.92) 100%);
  border-top-color:rgba(255,255,255,.28);
  box-shadow:
    0 2px 4px rgba(0,0,0,.55) inset,
    0 0 0 1px rgba(23,0,255,.30) inset,
    0 1px 3px rgba(8,4,32,.5);
  transition:
    transform 60ms cubic-bezier(0.55,0.06,0.68,0.19),
    filter 80ms cubic-bezier(0.55,0.06,0.68,0.19),
    background 60ms cubic-bezier(0.55,0.06,0.68,0.19),
    box-shadow 80ms cubic-bezier(0.55,0.06,0.68,0.19);
}
#juego-wrap .ghud-btn.is-pressed{
  transform:scale(.90) translateY(2px);
  filter:brightness(1.45) saturate(1.15);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.18) 0%, transparent 50%),
    linear-gradient(180deg, rgba(48,52,72,.88) 0%, rgba(18,20,30,.92) 100%);
  border-top-color:rgba(255,255,255,.32);
  box-shadow:
    0 2px 5px rgba(0,0,0,.6) inset,
    0 0 0 1px rgba(23,0,255,.35) inset,
    0 1px 3px rgba(8,4,32,.5),
    0 0 16px rgba(23,0,255,.25);
  transition:
    transform 60ms cubic-bezier(0.55,0.06,0.68,0.19),
    filter 80ms cubic-bezier(0.55,0.06,0.68,0.19),
    background 60ms cubic-bezier(0.55,0.06,0.68,0.19),
    box-shadow 80ms cubic-bezier(0.55,0.06,0.68,0.19);
}
#juego-wrap .ghud-arrow.is-pressed::after,
#juego-wrap .ghud-btn.is-pressed::after{
  opacity:.85;transform:scale(1);
  transition:opacity 60ms linear, transform 60ms cubic-bezier(0.55,0.06,0.68,0.19);
}
/* Inner accent ring intensifies on press */
#juego-wrap .ghud-btn.is-pressed::before{
  border-color:rgba(255,255,255,.18);
  inset:5px;
  transition:border-color 60ms var(--ease-in), inset 60ms var(--ease-in);
}

/* Etiqueta de tecla — visible solo en mode kbd, micro-typography mono */
#juego-wrap .ghud-label{
  font-size:8.5px;font-weight:600;color:rgba(203,213,225,.85);
  letter-spacing:.6px;text-transform:uppercase;
  margin-top:1px;line-height:1;
  font-family:'JetBrains Mono','Inconsolata',monospace;
  text-shadow:0 1px 0 rgba(0,0,0,.5);
}
#juego-wrap .game-hud[data-mode="touch"] .ghud-label{display:none}

/* Focus visible (accesibilidad keyboard tabbing) */
#juego-wrap .ghud-arrow:focus-visible,
#juego-wrap .ghud-btn:focus-visible{
  outline:none;box-shadow:
    0 0 0 3px var(--accent-bg,rgba(23,0,255,.30)),
    0 1px 0 rgba(0,0,0,.5) inset;
}

/* Responsive */
@media (max-width:480px){
  #juego-wrap .game-modal-overlay{padding:16px;}
  #juego-wrap .game-modal-card{
    width:100%;
    border-radius:var(--wb-radius-xl);
  }
  #juego-wrap .game-modal-card[data-mode="archivos"]{
    width:100%;
    max-height:88vh;
  }
  #juego-wrap .game-modal-head{padding:18px 20px 14px;}
  #juego-wrap .game-modal-card[data-mode="text"] .game-modal-body{padding:18px 20px;}
  #juego-wrap .game-modal-foot{padding:14px 20px 18px;}
  #juego-wrap .game-modal-tabs{padding-left:14px;padding-right:14px;}
  #juego-wrap .game-modal-tab{padding:10px 10px;font-size:var(--wb-text-sm);}
  #juego-wrap .game-modal-title{font-size:var(--wb-text-lg);}
  #juego-wrap .game-modal-text{font-size:var(--wb-text-md);}
  #juego-wrap .game-modal-foot{flex-wrap:wrap;}
  #juego-wrap .game-hud-cluster-left{left:12px;bottom:12px;padding:10px}
  #juego-wrap .game-hud-cluster-right{right:12px;bottom:12px;padding:10px}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  #juego-wrap .ghud-arrow,#juego-wrap .ghud-btn,
  #juego-wrap .ghud-arrow::after,#juego-wrap .ghud-btn::after,
  #juego-wrap .ghud-btn::before,
  #juego-wrap .game-modal-card,#juego-wrap .game-banner{
    transition:none !important;animation:none !important;
  }
}

/* ─── REFINEMENTS · ronda 1 (audit pass) ─────────────────────────────
   Jerarquía calmada: títulos no gritan, padding con ritmo (head más
   compacto que body, body más compacto que list-gap), icons subordinados
   al texto, footer centrado cuando no hay CTA. */

#juego-wrap .game-modal-title{
  font-size:var(--wb-text-lg) !important; font-weight:400 !important;
  letter-spacing:-.005em !important; text-transform:none !important;
}
#juego-wrap .game-modal-head{
  padding:18px 24px 14px !important;
  gap:12px !important;
}
#juego-wrap .game-modal-close{
  width:30px !important; height:30px !important;
}

/* Tabs: más sutiles, underline fino */
#juego-wrap .game-modal-tabs{padding:0 22px !important;}
#juego-wrap .game-modal-tab{
  padding:11px 14px !important;
  font-size:12.5px !important; font-weight:500 !important;
}

/* Body (text mode): respira pero sin desperdiciar */
#juego-wrap .game-modal-card[data-mode="text"] .game-modal-body{
  padding:20px 26px !important;
}
#juego-wrap .game-modal-text{
  font-size:14.5px !important; line-height:1.6 !important;
  max-width:62ch;
}

/* Footer: padding ritmo + centrar cuando no hay CTA visible */
#juego-wrap .game-modal-foot{
  padding:14px 24px 18px !important;
  font-size:var(--wb-text-sm) !important;
}
#juego-wrap .game-modal-cta{
  padding:9px 16px !important;
  font-size:12.5px !important; font-weight:600 !important;
  letter-spacing:0 !important;
}
#juego-wrap .game-modal-foot:has(.game-modal-cta[hidden]){
  justify-content:center !important;
}
#juego-wrap .game-modal-foot:has(.game-modal-cta[hidden]) .game-modal-hint{
  margin-left:0 !important; margin-right:0 !important;
}

/* Empty state: icono y copy más subordinados */
#juego-wrap .gm-empty{
  padding:48px 24px !important; gap:10px !important; min-height:auto !important;
}
#juego-wrap .gm-empty i{
  font-size:26px !important; opacity:.4 !important; margin-bottom:2px !important;
}
#juego-wrap .gm-empty h4{font-size:14.5px !important;}
#juego-wrap .gm-empty p{font-size:var(--wb-text-base) !important; line-height:1.55 !important;}

/* Lista: items más densos, icon container más sutil */
#juego-wrap .gm-list{gap:22px !important;}
#juego-wrap .gm-group-title{
  font-size:var(--wb-text-xs) !important; font-weight:600 !important;
  letter-spacing:.04em !important; text-transform:uppercase;
  padding:0 4px 10px !important; margin:0 !important;
  color:var(--muted,#9aa3b2) !important;
  border-bottom:1px solid color-mix(in srgb, var(--border,rgba(255,255,255,.08)) 60%, transparent) !important;
}
#juego-wrap .gm-item{padding:11px 14px !important; gap:12px !important;}
#juego-wrap .gm-item-icon{
  width:28px !important; height:28px !important; border-radius:var(--wb-radius-lg) !important;
  background:color-mix(in srgb, var(--accent,#1700FF) 8%, rgba(255,255,255,.02)) !important;
  font-size:var(--wb-text-base) !important;
}
#juego-wrap .gm-item-name{font-size:13.5px !important; font-weight:500 !important;}
#juego-wrap .gm-item-meta{font-size:11.5px !important;}
#juego-wrap .gm-item-arrow{font-size:10px !important;}

/* Tab content: padding ritmo + flex para centrar empty state vertical */
#juego-wrap .game-modal-tab-content{
  padding:20px 22px 24px !important;
  display:flex !important; flex-direction:column !important;
}
#juego-wrap .game-modal-tab-content > .gm-empty{flex:1 !important;}
#juego-wrap .game-modal-tab-content > .gm-list{flex:0 0 auto !important;}

/* Petshop: preview column centrada verticalmente */
#juego-wrap .petshop-preview{justify-content:center !important;}

/* Group title ligeramente más legible */
#juego-wrap .gm-group-title{font-size:11.5px !important; letter-spacing:.06em !important;}

/* ─── Petshop dialog (kind:'petshop') ─── */
#juego-wrap .game-modal-card[data-mode="petshop"]{max-width:600px;}
#juego-wrap .game-modal-card[data-mode="petshop"] .game-modal-body{
  padding:0;
}

/* Two-column layout: preview + controls */
#juego-wrap .petshop-layout{
  display:grid;
  grid-template-columns:188px 1fr;
  gap:0;
  align-items:stretch;
}

/* LEFT: preview + meta */
#juego-wrap .petshop-preview{
  display:flex;flex-direction:column;align-items:center;gap:16px;
  padding:24px 20px;
  background:linear-gradient(180deg, rgba(23,0,255,.04) 0%, transparent 100%);
  border-right:1px solid var(--border,rgba(255,255,255,.06));
}
#juego-wrap .petshop-preview-frame{
  position:relative;
  width:148px;height:148px;
  border-radius:var(--radius-lg);
  background:
    radial-gradient(circle at 50% 65%, rgba(23,0,255,.08) 0%, transparent 60%),
    var(--surface2,#15161c);
  border:1px solid var(--border,rgba(255,255,255,.08));
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
#juego-wrap .petshop-preview-frame::before{
  /* Subtle grid floor — gives the pet a "stage" feel */
  content:'';position:absolute;inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size:12px 12px;
  background-position:center bottom;
  mask-image:linear-gradient(180deg, transparent 50%, #000 100%);
  -webkit-mask-image:linear-gradient(180deg, transparent 50%, #000 100%);
  pointer-events:none;
}
#juego-wrap .petshop-preview-frame canvas{
  width:128px;height:128px;
  image-rendering:pixelated;
  -ms-interpolation-mode:nearest-neighbor;
  position:relative;z-index:1;
}
#juego-wrap .petshop-preview-frame[data-empty="true"] canvas{display:none;}
#juego-wrap .petshop-preview-empty{
  position:absolute;inset:0;
  display:flex;align-items:center;justify-content:center;
  color:var(--muted,#666);opacity:.5;
}
#juego-wrap .petshop-preview-frame[data-empty="false"] .petshop-preview-empty{display:none;}
#juego-wrap .petshop-preview-meta{
  display:flex;flex-direction:column;align-items:center;gap:2px;text-align:center;
}
#juego-wrap .petshop-preview-eyebrow{
  font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted,#888);
}
#juego-wrap .petshop-preview-title{
  font-size:15px;font-weight:600;color:var(--text,#fff);margin:0;
  text-transform:capitalize;
}
#juego-wrap .petshop-preview-subtitle{
  font-size:var(--wb-text-sm);color:var(--muted,#888);margin:0;line-height:1.4;
  max-width:148px;
}

/* RIGHT: controls */
#juego-wrap .petshop-controls{
  padding:22px 22px 18px;
  display:flex;flex-direction:column;gap:18px;
}
#juego-wrap .petshop-fieldset{
  border:0;padding:0;margin:0;
  display:flex;flex-direction:column;gap:10px;
}
#juego-wrap .petshop-legend{
  font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted,#888);padding:0;margin:0;
}

/* Species chips */
#juego-wrap .petshop-chips{display:flex;gap:6px;flex-wrap:wrap;}
#juego-wrap .petshop-chip{
  appearance:none;cursor:pointer;font-family:inherit;
  padding:7px 14px;border-radius:var(--wb-radius-pill);
  background:transparent;
  border:1px solid var(--border,rgba(255,255,255,.12));
  color:var(--text,#e7e7ec);font-size:12.5px;font-weight:500;
  transition:background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
#juego-wrap .petshop-chip:hover{
  border-color:rgba(255,255,255,.22);background:rgba(255,255,255,.03);
}
#juego-wrap .petshop-chip:active{transform:scale(.97);}
#juego-wrap .petshop-chip:focus-visible{
  outline:2px solid var(--accent,#1700FF);outline-offset:2px;
}
#juego-wrap .petshop-chip.is-active{
  background:var(--accent,#1700FF);border-color:var(--accent,#1700FF);color:#fff;
  box-shadow:0 0 0 1px var(--accent,#1700FF) inset, 0 4px 12px -4px rgba(23,0,255,.5);
}

/* Breed grid */
#juego-wrap .petshop-grid{
  display:grid;grid-template-columns:repeat(5,1fr);gap:6px;
}
#juego-wrap .petshop-breed{
  appearance:none;cursor:pointer;font-family:inherit;
  display:flex;flex-direction:column;align-items:center;gap:4px;
  padding:6px 4px 7px;border-radius:var(--wb-radius-lg);
  background:rgba(255,255,255,.02);
  border:1px solid var(--border,rgba(255,255,255,.06));
  color:var(--text,#e7e7ec);
  transition:background .18s ease, border-color .18s ease, transform .12s ease;
}
#juego-wrap .petshop-breed:hover{
  border-color:rgba(255,255,255,.18);background:rgba(255,255,255,.05);
}
#juego-wrap .petshop-breed:active{transform:scale(.97);}
#juego-wrap .petshop-breed:focus-visible{
  outline:2px solid var(--accent,#1700FF);outline-offset:2px;
}
#juego-wrap .petshop-breed.is-active{
  border-color:var(--accent,#1700FF);
  background:linear-gradient(180deg, rgba(23,0,255,.12), rgba(23,0,255,.05));
  box-shadow:inset 0 0 0 1px var(--accent,#1700FF);
}
#juego-wrap .petshop-breed-img{
  display:block;width:48px;height:48px;
  background-repeat:no-repeat;background-position:0 0;
  background-size:192px 192px;          /* 128×128 source → 192×192, recorta 48×48 top-left = down-frame0 ×1.5 */
  image-rendering:pixelated;-ms-interpolation-mode:nearest-neighbor;
}
#juego-wrap .petshop-breed-label{
  font-size:10px;color:var(--muted,#9aa);text-transform:capitalize;
  max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#juego-wrap .petshop-breed.is-active .petshop-breed-label{color:var(--text,#fff);}

/* Footer */
#juego-wrap .petshop-footer{
  display:flex;justify-content:flex-end;align-items:center;
  padding:14px 22px 18px;
  border-top:1px solid var(--border,rgba(255,255,255,.06));
  background:rgba(0,0,0,.18);
}
#juego-wrap .petshop-save{min-width:160px;}
#juego-wrap .petshop-save[disabled]{opacity:.45;cursor:not-allowed;}
/* "Quitar mascota" estilo secundario para diferenciar de "Guardar".
   data-action="save" + textContent "Quitar mascota" lo cogemos vía :has() del label.
   Como :has() text-content matching no existe, usamos data-action y un
   atributo data-mode que el JS marca en cada render. */
#juego-wrap .petshop-save[data-mode="remove"]{
  background:transparent !important;
  color:var(--text,#e7e7ec) !important;
  border:1px solid var(--border,rgba(255,255,255,.18)) !important;
  font-weight:500 !important;
}
#juego-wrap .petshop-save[data-mode="remove"]:hover:not([disabled]){
  background:rgba(255,255,255,.04) !important;
  border-color:rgba(255,255,255,.28) !important;
  filter:none !important;
}

/* Locked / empty state */
#juego-wrap .petshop-locked{
  display:flex;flex-direction:column;align-items:center;gap:10px;
  padding:36px 28px 32px;text-align:center;
}
#juego-wrap .petshop-locked-icon{
  width:64px;height:64px;
  display:flex;align-items:center;justify-content:center;
  background:radial-gradient(circle at 50% 50%, rgba(23,0,255,.18) 0%, transparent 70%);
  color:var(--text,#fff);opacity:.9;
}
#juego-wrap .petshop-locked-title{
  margin:0;font-size:var(--wb-text-lg);font-weight:600;color:var(--text,#fff);
}
#juego-wrap .petshop-locked-desc{
  margin:0;font-size:var(--wb-text-base);line-height:1.5;color:var(--muted,#9aa);
  max-width:380px;
}
#juego-wrap .petshop-locked-meter{
  margin-top:14px;display:flex;flex-direction:column;align-items:center;gap:6px;
  width:100%;max-width:280px;
}
#juego-wrap .petshop-locked-meter-track{
  width:100%;height:6px;border-radius:var(--wb-radius-pill);
  background:rgba(255,255,255,.06);overflow:hidden;
}
#juego-wrap .petshop-locked-meter-fill{
  height:100%;background:var(--accent,#1700FF);
  transition:width .3s ease;
}
#juego-wrap .petshop-locked-meter-label{
  font-size:var(--wb-text-xs);color:var(--muted,#9aa);letter-spacing:.04em;
}

/* Reduced motion: no transforms */
@media (prefers-reduced-motion: reduce){
  #juego-wrap .petshop-chip,
  #juego-wrap .petshop-breed,
  #juego-wrap .petshop-locked-meter-fill{transition:none !important;}
}

/* Mobile: single column */
@media (max-width:520px){
  #juego-wrap .game-modal-card[data-mode="petshop"]{max-width:96vw;}
  #juego-wrap .petshop-layout{grid-template-columns:1fr;}
  #juego-wrap .petshop-preview{
    flex-direction:row;justify-content:center;gap:18px;
    border-right:0;border-bottom:1px solid var(--border,rgba(255,255,255,.06));
    padding:18px;
  }
  #juego-wrap .petshop-preview-meta{align-items:flex-start;text-align:left;}
  #juego-wrap .petshop-grid{grid-template-columns:repeat(4,1fr);}
}
