:root{
  --bg:#0f1221;--panel:#181c31;--panel2:#202641;--text:#f8f9ff;--muted:#aab1c8;
  --brand:#7b6cf6;--brand2:#9b8cff;--line:#2c3355;--danger:#ff6b81;--ok:#57d6a1;
}
*{box-sizing:border-box}html{background:var(--bg)}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:radial-gradient(circle at top,#202853 0,#101322 42%,#0b0e19 100%);color:var(--text);min-height:100vh}
button,input{font:inherit}.hidden{display:none!important}.app-shell{width:min(1100px,100%);margin:0 auto;padding:22px 18px 42px}.auth-view{max-width:460px;margin:6vh auto 0}.brand-block{display:flex;gap:14px;align-items:center;margin-bottom:22px}.brand-mark{width:58px;height:58px;border-radius:18px;background:linear-gradient(135deg,var(--brand),#4dd8ff);display:grid;place-items:center;font-size:30px;font-weight:900;box-shadow:0 14px 40px rgba(123,108,246,.28)}h1,h2,h3,h4,p{margin-top:0}.brand-block h1{font-size:30px;margin-bottom:3px}.brand-block p{color:var(--muted);margin:0}.auth-card,.hero-card,.room,.inline-panel{background:rgba(24,28,49,.93);border:1px solid var(--line);border-radius:24px;box-shadow:0 24px 70px rgba(0,0,0,.28)}.auth-card{padding:22px}.tabs{display:grid;grid-template-columns:1fr 1fr;background:#111527;border-radius:14px;padding:4px;margin-bottom:22px}.tab{border:0;background:transparent;color:var(--muted);padding:11px;border-radius:10px;cursor:pointer}.tab.active{background:var(--panel2);color:white;font-weight:800}.stack{display:grid;gap:16px}.stack label{display:grid;gap:7px;color:#dfe3f7;font-size:14px}.stack input,.row-form input,.chat-form input{border:1px solid var(--line);background:#111528;color:white;border-radius:14px;padding:14px 15px;outline:none;min-width:0}.stack input:focus,.row-form input:focus,.chat-form input:focus{border-color:var(--brand);box-shadow:0 0 0 3px rgba(123,108,246,.18)}button{cursor:pointer}.primary,.secondary,.ghost,.photo-button,.send-button{border:0;border-radius:14px;min-height:46px;padding:0 16px;font-weight:800}.primary{background:linear-gradient(135deg,var(--brand),var(--brand2));color:white}.secondary{background:#222946;color:#f4f6ff;border:1px solid #37406b}.ghost{background:#171c30;color:#dbe0f5;border:1px solid var(--line)}.small{min-height:38px;padding:0 12px}.photo-picker{display:flex;align-items:center;gap:14px}.photo-picker img,.profile-mini img{object-fit:cover;background:#2a3150;border:2px solid #393f67}.photo-picker img{width:76px;height:76px;border-radius:24px}.photo-button{display:inline-grid;place-items:center;background:#222946;color:white;border:1px solid #39416b}.message{min-height:18px;margin:14px 2px 0;color:var(--muted);font-size:14px}.message.error{color:var(--danger)}.message.ok{color:var(--ok)}
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}.profile-mini{display:flex;align-items:center;gap:10px}.profile-mini img{width:48px;height:48px;border-radius:16px}.profile-mini small{display:block;color:var(--muted);font-size:11px}.profile-mini strong{font-size:17px}.hero-card{display:flex;justify-content:space-between;gap:22px;padding:24px;margin-bottom:18px}.hero-card h2{font-size:clamp(23px,4vw,36px);max-width:650px;margin-bottom:8px}.hero-card p{color:var(--muted);margin-bottom:0}.eyebrow{display:inline-block;color:#b9afff;font-weight:900;font-size:11px;letter-spacing:.16em;margin-bottom:8px}.stats-placeholder{display:flex;gap:10px;align-items:stretch}.stats-placeholder span{min-width:120px;background:#111528;border:1px solid var(--line);border-radius:18px;padding:14px;display:grid;align-content:center}.stats-placeholder b{font-size:22px}.stats-placeholder small{display:block;color:var(--muted);margin-top:2px}.group-tools{display:flex;gap:10px;flex-wrap:wrap}.inline-panel{padding:14px;margin-top:12px}.row-form{display:flex;gap:10px}.row-form input{flex:1}.groups-section{margin-top:26px}.section-title{display:flex;align-items:center;gap:10px}.section-title h3{margin:0;font-size:20px}.section-title span{background:#252c4a;border:1px solid var(--line);color:#cdd2e8;border-radius:999px;padding:3px 9px;font-size:12px}.groups-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px;margin-top:13px}.group-card{background:#171c30;border:1px solid var(--line);border-radius:18px;padding:16px;text-align:left;color:white}.group-card:hover{border-color:#514d86}.group-card strong{display:block;font-size:17px;margin-bottom:5px}.group-card span,.group-card small{display:block;color:var(--muted)}.group-card .code{color:#c8c0ff;font-weight:800;letter-spacing:.08em;margin-top:10px}.empty{color:var(--muted);padding:18px;border:1px dashed var(--line);border-radius:16px;text-align:center}.room{margin-top:24px;overflow:hidden}.room-head{display:flex;justify-content:space-between;align-items:start;padding:18px 20px;border-bottom:1px solid var(--line)}.room-head small{color:#aaa2ef;font-weight:900;letter-spacing:.14em}.room-head h3{font-size:23px;margin:3px 0}.room-head p{margin:0;color:var(--muted);font-size:13px}.room-grid{display:grid;grid-template-columns:240px 1fr;min-height:480px}.members-panel{padding:16px;border-right:1px solid var(--line);background:#141829}.members-panel h4{display:flex;justify-content:space-between;margin-bottom:12px}.members-list{display:grid;gap:9px}.member{display:flex;gap:9px;align-items:center}.member img{width:36px;height:36px;border-radius:12px;object-fit:cover;background:#293050}.member strong{font-size:13px}.member small{display:block;color:var(--muted);font-size:10px}.chat-panel{display:grid;grid-template-rows:1fr auto;min-width:0}.chat-messages{padding:18px;display:flex;flex-direction:column;gap:12px;overflow:auto;max-height:560px}.chat-row{display:flex;gap:9px;align-items:flex-end}.chat-row.mine{flex-direction:row-reverse}.chat-row img{width:34px;height:34px;border-radius:11px;object-fit:cover;background:#293050}.bubble{max-width:min(520px,76%);background:#242b49;border:1px solid #343d66;border-radius:18px 18px 18px 5px;padding:9px 12px}.mine .bubble{background:#6d5fe6;border-color:#6d5fe6;border-radius:18px 18px 5px 18px}.bubble strong{font-size:11px;color:#cfcaff}.mine .bubble strong{color:#fff}.bubble p{margin:3px 0 2px;white-space:pre-wrap;overflow-wrap:anywhere}.bubble time{display:block;color:#adb4cc;font-size:9px;text-align:right}.mine .bubble time{color:#e4e0ff}.chat-form{display:flex;gap:10px;padding:14px;border-top:1px solid var(--line);background:#141829}.chat-form input{flex:1}.send-button{width:48px;padding:0;background:var(--brand);color:white;font-size:19px}
@media(max-width:720px){.app-shell{padding:14px 12px 28px}.auth-view{margin-top:3vh}.hero-card{display:grid}.stats-placeholder{width:100%}.stats-placeholder span{flex:1;min-width:0}.room-grid{grid-template-columns:1fr}.members-panel{border-right:0;border-bottom:1px solid var(--line)}.members-list{display:flex;overflow-x:auto;padding-bottom:4px}.member{min-width:130px}.chat-messages{max-height:470px}.row-form{display:grid}.group-tools>*{flex:1 1 150px}.bubble{max-width:84%}}

/* Jugamos v6 - avatares PNG visibles + foto obligatoria */
.photo-actions{display:grid;gap:7px}.photo-actions small{color:var(--muted);font-size:12px}.avatar-choice-block{display:grid;gap:9px}.avatar-choice-block>p{margin:0;color:var(--muted);font-size:13px}.avatar-grid{display:grid;grid-template-columns:repeat(5,minmax(48px,1fr));gap:9px}.avatar-option{border:2px solid transparent;background:#111528;border-radius:15px;padding:4px;min-height:0;aspect-ratio:1;display:grid;place-items:center;transition:.15s ease}.avatar-option img{width:100%;height:100%;object-fit:cover;border-radius:10px}.avatar-option:hover{border-color:#4c557f}.avatar-option.selected{border-color:var(--brand2);box-shadow:0 0 0 3px rgba(123,108,246,.16);background:#252b4b}.profile-trigger{border:0;background:transparent;color:inherit;padding:0;text-align:left;cursor:pointer;border-radius:16px}.profile-trigger:focus-visible{outline:3px solid rgba(123,108,246,.45);outline-offset:4px}.profile-trigger:hover img{border-color:var(--brand2)}
.modal-backdrop{position:fixed;inset:0;z-index:1000;background:rgba(5,8,18,.78);display:grid;place-items:center;padding:18px;overflow:auto}.profile-modal{width:min(560px,100%);background:#181c31;border:1px solid var(--line);border-radius:24px;box-shadow:0 30px 90px rgba(0,0,0,.55);overflow:hidden}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--line)}.modal-head small{color:#b9afff;font-weight:900;letter-spacing:.13em}.modal-head h3{margin:3px 0 0;font-size:22px}.profile-photo-form{display:grid;gap:16px;padding:20px}.profile-preview-row{display:flex;align-items:center;gap:14px}.profile-preview-row>img{width:82px;height:82px;border-radius:24px;object-fit:cover;background:#293050;border:2px solid #3b456f}.profile-preview-row strong{font-size:20px}.profile-preview-row p{color:var(--muted);font-size:13px;margin:4px 0 0}.profile-upload-button{width:max-content}.avatar-grid.large{grid-template-columns:repeat(5,1fr)}.save-profile{width:100%}
@media(max-width:520px){.avatar-grid,.avatar-grid.large{grid-template-columns:repeat(5,1fr);gap:6px}.avatar-option{border-radius:12px;padding:3px}.profile-modal{border-radius:20px}.profile-photo-form{padding:16px}.profile-preview-row>img{width:70px;height:70px;border-radius:20px}}

/* Jugamos v7 - avatares fotorealistas */
.avatar-choice-block>p{font-size:17px;font-weight:900;color:var(--text);margin-bottom:4px}
.avatar-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.avatar-option{aspect-ratio:auto;min-height:0;border:1px solid var(--line);background:#12172a;border-radius:16px;padding:8px 6px 7px;display:grid;gap:6px;place-items:center;color:#eef1ff}
.avatar-photo-wrap{width:100%;aspect-ratio:1;display:grid;place-items:center;border-radius:999px;overflow:hidden;background:#0d1120}
.avatar-option img{width:100%;height:100%;object-fit:cover;border-radius:999px;display:block}
.avatar-label{font-size:11px;font-weight:800;line-height:1.1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.avatar-option:hover{border-color:#59628d;background:#171d33}
.avatar-option.selected{border-color:var(--brand2);background:#232948;box-shadow:0 0 0 3px rgba(123,108,246,.2)}
.avatar-option.selected .avatar-photo-wrap{box-shadow:0 0 0 3px var(--brand2)}
.avatar-grid.large .avatar-label{font-size:12px}
@media(max-width:560px){
  .avatar-grid,.avatar-grid.large{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .avatar-option{padding:10px 9px 8px;border-radius:18px}
  .avatar-label{font-size:12px}
}

/* Jugamos v8 - centro de campeonato y arquitectura modular de juegos */
.championship-section{margin-top:28px}.championship-title{justify-content:space-between}.tournament-card{margin-top:13px;background:linear-gradient(135deg,rgba(32,38,65,.96),rgba(18,22,40,.96));border:1px solid var(--line);border-radius:22px;padding:20px;display:flex;align-items:center;justify-content:space-between;gap:18px}.tournament-card small{color:#b9afff;font-weight:900;letter-spacing:.1em}.tournament-card h3{font-size:24px;margin:5px 0}.tournament-card p{color:var(--muted);margin:0;max-width:700px}.today-game{margin-top:12px;border:1px solid #4e4a85;background:#201f3d;border-radius:18px;padding:15px 16px;display:flex;align-items:center;justify-content:space-between;gap:14px}.today-game small{display:block;color:#b9afff;font-weight:900;font-size:10px;letter-spacing:.12em}.today-game strong{display:block;font-size:20px;margin-top:3px}.today-game p{color:var(--muted);margin:3px 0 0;font-size:13px}.games-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px;margin-top:13px}.game-card{position:relative;background:#151a2d;border:1px solid var(--line);border-radius:17px;padding:14px;min-height:118px;display:grid;align-content:start;gap:6px}.game-card.played{opacity:.72}.game-card.selected{border-color:var(--brand2);box-shadow:0 0 0 2px rgba(123,108,246,.12)}.game-number{font-size:10px;font-weight:900;color:#7f88aa;letter-spacing:.12em}.game-card>strong{font-size:16px}.game-card>small{color:var(--muted);font-size:11px;line-height:1.35}.game-select{margin-top:auto;min-height:36px;padding:0 10px}.game-card:not(.played):has(.game-select){background:#181e34}@media(max-width:620px){.tournament-card,.today-game{display:grid}.tournament-card .primary,.today-game .primary{width:100%}.games-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.game-card{min-height:112px;padding:12px}.game-card>strong{font-size:14px}}
\n\n/* v11 · Ranking del grupo */\n.group-ranking-panel{margin:16px 18px 0;border:1px solid var(--line);background:linear-gradient(135deg,#171c30,#121628);border-radius:19px;overflow:hidden}.group-ranking-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:15px 16px 12px;border-bottom:1px solid var(--line)}.group-ranking-head small{color:#aaa2ef;font-weight:900;font-size:10px;letter-spacing:.13em}.group-ranking-head h4{margin:4px 0 2px;font-size:18px}.group-ranking-head p{margin:0;color:var(--muted);font-size:12px}.ranking-list{display:grid}.ranking-row{display:grid;grid-template-columns:46px 44px minmax(0,1fr) auto;align-items:center;gap:10px;padding:11px 15px;border-bottom:1px solid rgba(54,61,96,.62)}.ranking-row:last-child{border-bottom:0}.ranking-row.me{background:rgba(123,108,246,.10)}.ranking-pos{width:36px;height:36px;border-radius:12px;display:grid;place-items:center;background:#202744;border:1px solid #343d66;font-weight:900}.ranking-row:nth-child(-n+3) .ranking-pos{font-size:20px;background:#25294a}.ranking-avatar{width:40px;height:40px;border-radius:13px;object-fit:cover;background:#293050;border:1px solid #3a426a}.ranking-player{min-width:0}.ranking-player strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ranking-player small{display:block;color:var(--muted);font-size:11px;margin-top:2px}.ranking-points{text-align:right;min-width:76px}.ranking-points strong{display:block;font-size:18px}.ranking-points small{display:block;color:#b9afff;font-size:10px;text-transform:uppercase;letter-spacing:.06em}.ranking-empty{padding:16px;color:var(--muted);text-align:center}.ranking-empty.error{color:var(--danger)}\n@media(max-width:620px){.group-ranking-panel{margin:12px 12px 0}.group-ranking-head{align-items:flex-start}.ranking-row{grid-template-columns:38px 38px minmax(0,1fr) auto;padding:10px 11px;gap:8px}.ranking-pos{width:32px;height:32px;border-radius:10px}.ranking-avatar{width:36px;height:36px;border-radius:11px}.ranking-points{min-width:64px}.ranking-points strong{font-size:16px}.ranking-player small{font-size:10px}}\n
/* v12 · interfaz compacta + modo de pruebas */
.compact-topbar{gap:10px;margin-bottom:8px;padding:2px 0}.account-strip{display:flex;align-items:center;gap:10px;min-width:0;flex:1}.profile-mini{min-width:0}.profile-mini img{width:44px;height:44px;border-radius:14px}.profile-mini div{min-width:0}.profile-mini strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:190px}.profile-mini small{font-size:10px}.topbar-stats{display:flex;align-items:center;gap:7px;margin-left:auto}.top-stat{height:44px;min-width:92px;border:1px solid var(--line);background:#151a2e;border-radius:14px;padding:6px 9px;display:grid;grid-template-columns:auto auto;grid-template-rows:1fr 1fr;column-gap:5px;align-items:center}.top-stat i{grid-row:1/3;font-style:normal;font-size:15px}.top-stat b{font-size:15px;line-height:1}.top-stat small{color:var(--muted);font-size:9px;line-height:1}.logout-compact{min-width:58px}.compact-message{margin:0;min-height:0}.compact-message:empty{display:none}
.championship-section{margin-top:12px}.championship-title{margin-bottom:0}.tournament-card{margin-top:8px;border-radius:17px;padding:13px 15px}.tournament-card h3{font-size:19px;margin:3px 0}.tournament-card p{font-size:12px;line-height:1.35}.games-grid{margin-top:9px;gap:8px;grid-template-columns:repeat(auto-fill,minmax(165px,1fr))}.game-card{min-height:112px;border-radius:15px;padding:12px}.game-card.test-card.played{opacity:1}.game-card.test-card.ready{border-color:#454d80;background:#191f36}.game-test{margin-top:auto;min-height:38px;padding:0 12px;width:100%}.game-dev-badge{margin-top:auto;display:inline-flex;align-items:center;width:max-content;max-width:100%;min-height:30px;padding:0 9px;border-radius:999px;background:#202641;border:1px solid var(--line);color:#858da9;font-size:10px;font-weight:800}.groups-section{margin-top:18px}.groups-list{margin-top:9px;gap:9px}.group-card{padding:13px;border-radius:15px}.room{margin-top:16px}
.profile-quick-actions{padding:14px 20px 0}.profile-summary-stats{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px}.profile-summary-stats span{background:#111528;border:1px solid var(--line);border-radius:14px;padding:10px 12px;display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;column-gap:7px}.profile-summary-stats b{font-size:18px}.profile-summary-stats small{grid-column:2;color:var(--muted);font-size:10px}.profile-group-tools{display:grid;grid-template-columns:1fr 1fr;gap:8px}.profile-group-tools button{width:100%;min-height:42px}.profile-inline-panel{margin-top:9px;padding:10px;border-radius:14px}.profile-quick-actions>.message{margin:7px 2px 0;min-height:0}.profile-photo-form{padding-top:14px;gap:13px}.profile-preview-row{padding-top:2px}
@media(max-width:720px){.app-shell{padding:10px 10px 24px}.compact-topbar{align-items:center}.account-strip{gap:6px}.profile-mini{gap:7px}.profile-mini img{width:40px;height:40px;border-radius:13px}.profile-mini strong{font-size:14px;max-width:105px}.profile-mini small{display:none}.topbar-stats{gap:4px}.top-stat{min-width:68px;height:40px;padding:5px 6px;border-radius:12px;column-gap:3px}.top-stat i{font-size:12px}.top-stat b{font-size:13px}.top-stat small{font-size:8px}.logout-compact{min-width:48px;padding:0 8px;min-height:36px;font-size:12px}.championship-section{margin-top:8px}.tournament-card{padding:11px 12px}.tournament-card h3{font-size:17px}.games-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.game-card{min-height:106px;padding:10px}.game-card>strong{font-size:13px}.game-card>small{font-size:10px}.groups-section{margin-top:14px}.profile-quick-actions{padding:12px 14px 0}.profile-photo-form{padding:12px 14px 15px}.profile-group-tools{grid-template-columns:1fr 1fr}.profile-inline-panel .row-form{display:grid}.profile-summary-stats span{padding:8px 10px}.profile-summary-stats b{font-size:16px}}
@media(max-width:420px){.top-stat small{display:none}.top-stat{grid-template-rows:1fr;grid-template-columns:auto auto;min-width:58px}.top-stat i{grid-row:auto}.profile-mini strong{max-width:86px}.logout-compact{min-width:44px}.games-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v39 · torneo automático */
.today-game{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px;border:1px solid rgba(125,224,255,.22);background:linear-gradient(135deg,rgba(76,62,180,.22),rgba(0,213,255,.08));border-radius:18px;margin:12px 0 8px}.today-game-copy{display:flex;flex-direction:column;gap:4px;min-width:0}.today-game-copy small{font-size:11px;letter-spacing:.08em;color:#93a4d8;font-weight:800}.today-game-copy strong{font-size:22px}.today-game-copy span{font-size:13px;color:#aeb9df}.today-game>.primary{min-width:150px}.admin-link{text-decoration:none;display:grid;place-items:center}.admin-link.hidden{display:none!important}@media(max-width:620px){.today-game{align-items:stretch;flex-direction:column}.today-game>.primary{width:100%}}

/* v41 · perfil más cómodo + cámara */
.profile-modal{
  width:min(700px,100%);
  max-height:calc(100vh - 28px);
  overflow-y:auto;
  scrollbar-width:thin;
}
.modal-head{
  position:sticky;
  top:0;
  z-index:3;
  background:rgba(24,28,49,.98);
  padding:20px 24px;
}
.profile-quick-actions{
  padding:22px 24px 0;
}
.profile-summary-stats{
  gap:12px;
  margin-bottom:16px;
}
.profile-summary-stats span{
  padding:14px 16px;
  border-radius:17px;
}
.profile-summary-stats b{font-size:21px}
.profile-summary-stats small{font-size:11px}
.profile-group-tools{gap:12px}
.profile-group-tools button{min-height:48px}
.profile-inline-panel{
  margin-top:12px;
  padding:14px;
}
.profile-photo-form{
  padding:24px;
  gap:20px;
  border-top:1px solid var(--line);
  margin-top:20px;
}
.profile-section-title{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
}
.profile-section-title small{
  display:block;
  color:#aaa2ef;
  font-weight:900;
  font-size:10px;
  letter-spacing:.13em;
  margin-bottom:4px;
}
.profile-section-title h4{margin:0;font-size:20px}
.profile-section-title>span{color:var(--muted);font-size:12px;text-align:right}
.profile-preview-row{
  gap:18px;
  padding:16px;
  border:1px solid var(--line);
  background:#12172a;
  border-radius:18px;
}
.profile-preview-row>img{
  width:96px;
  height:96px;
  border-radius:26px;
  flex:0 0 auto;
}
.profile-preview-row strong{font-size:22px}
.profile-preview-row p{font-size:14px;line-height:1.45;margin-top:6px}
.profile-photo-actions,
.photo-action-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.profile-photo-actions .photo-button,
.photo-action-row .photo-button{
  width:100%;
  min-height:50px;
  text-align:center;
}
.camera-button{
  background:linear-gradient(135deg,#202946,#16233d);
  border-color:#405078;
}
.profile-avatar-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.profile-avatar-title strong{font-size:15px}
.profile-avatar-title small{color:var(--muted);font-size:11px}
.profile-modal .avatar-grid.large{
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:12px;
}
.profile-modal .avatar-option{padding:9px 7px 8px}
.save-profile{min-height:52px;font-size:16px}

@media(max-width:560px){
  .modal-backdrop{padding:8px;align-items:start}
  .profile-modal{
    width:100%;
    max-height:calc(100vh - 16px);
    border-radius:18px;
    margin-top:0;
  }
  .modal-head{padding:16px 16px}
  .profile-quick-actions{padding:18px 16px 0}
  .profile-summary-stats{gap:8px;margin-bottom:12px}
  .profile-summary-stats span{padding:11px 12px}
  .profile-group-tools{grid-template-columns:1fr;gap:8px}
  .profile-group-tools button{min-height:46px}
  .profile-photo-form{padding:20px 16px 22px;gap:16px;margin-top:16px}
  .profile-section-title{align-items:flex-start;display:grid;gap:5px}
  .profile-section-title>span{text-align:left}
  .profile-preview-row{padding:13px;gap:13px;align-items:center}
  .profile-preview-row>img{width:82px;height:82px;border-radius:22px}
  .profile-preview-row strong{font-size:18px}
  .profile-preview-row p{font-size:12px}
  .profile-photo-actions,.photo-action-row{grid-template-columns:1fr;gap:8px}
  .profile-modal .avatar-grid.large{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .profile-avatar-title{align-items:flex-start;display:grid;gap:3px}
}

/* v42 · grupo elegido para competir */
.play-group-bar{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  margin:10px 0 4px;padding:12px 14px;border:1px solid rgba(117,132,255,.24);
  border-radius:16px;background:linear-gradient(135deg,rgba(31,38,77,.72),rgba(15,21,45,.72));
}
.play-group-bar>div{min-width:0;display:flex;flex-direction:column;gap:3px}
.play-group-bar small{font-size:10px;letter-spacing:.12em;color:#8f9ac8;font-weight:800}
.play-group-bar strong{font-size:14px;color:#f5f7ff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.play-group-bar select{
  min-width:150px;max-width:48%;height:44px;padding:0 36px 0 12px;border-radius:12px;
  border:1px solid rgba(114,203,255,.35);background:#10162f;color:#fff;font-weight:800;font-size:14px;
}
.active-group-help{margin:0 4px 10px;color:#8f9ac8;font-size:12px;line-height:1.35}
.group-card.active-play-group{outline:2px solid rgba(94,225,255,.65);box-shadow:0 0 0 4px rgba(94,225,255,.08)}
.group-card.active-play-group::after{content:'JUGANDO';font-size:9px;letter-spacing:.08em;font-weight:900;color:#72ebff;margin-left:auto}
@media(max-width:560px){
  .play-group-bar{align-items:stretch;flex-direction:column;gap:8px}
  .play-group-bar select{width:100%;max-width:none;min-width:0}
}


/* v44 · selección de grupo directamente en Mis grupos */
.play-group-bar,.active-group-help{display:none!important}
.groups-list{align-items:stretch}
.group-card{padding:0!important;overflow:hidden;display:flex;flex-direction:column;background:#171c30;border:1px solid var(--line);border-radius:18px;color:white}
.group-card:hover{border-color:#514d86}
.group-card-open{appearance:none;border:0;background:transparent;color:inherit;text-align:left;width:100%;padding:16px;cursor:pointer}
.group-card-open strong{display:block;font-size:17px;margin-bottom:5px}
.group-card-open span,.group-card-open small{display:block;color:var(--muted)}
.group-card-open .code{color:#c8c0ff;font-weight:800;letter-spacing:.08em;margin-top:10px}
.group-play-select{appearance:none;width:100%;min-height:48px;border:0;border-top:1px solid var(--line);background:#12172a;color:#aeb7d5;display:flex;align-items:center;gap:10px;padding:10px 14px;text-align:left;font-weight:800;cursor:pointer}
.group-play-select:hover{background:#171e35}
.group-play-check{width:25px;height:25px;flex:0 0 25px;border-radius:8px;border:2px solid #5c678c;display:grid;place-items:center;color:#07101b;font-size:17px;font-weight:1000;background:transparent}
.group-play-label{font-size:12px}
.group-play-select.selected{background:linear-gradient(135deg,rgba(47,226,199,.16),rgba(77,121,255,.14));color:#dffefa}
.group-play-select.selected .group-play-check{border-color:#62ebd4;background:#62ebd4;box-shadow:0 0 16px rgba(98,235,212,.22)}
.group-card.active-play-group{outline:2px solid rgba(98,235,212,.72);box-shadow:0 0 0 4px rgba(98,235,212,.07)}
.group-card.active-play-group::after{content:none!important}
@media(max-width:560px){.group-card-open{padding:16px 18px}.group-play-select{min-height:54px;padding:12px 18px}.group-play-check{width:28px;height:28px;flex-basis:28px}.group-play-label{font-size:13px}}


/* v45 · invitaciones por WhatsApp */
.group-whatsapp-invite{appearance:none;width:100%;min-height:46px;border:0;border-top:1px solid var(--line);background:#151b2d;color:#dff9e8;display:flex;align-items:center;justify-content:center;gap:8px;padding:10px 14px;font-weight:900;cursor:pointer}
.group-whatsapp-invite:hover{background:#192437}
.new-group-share{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:8px;padding:10px;border:1px solid var(--line);border-radius:14px;background:#11172a}
.new-group-share small{color:var(--muted);font-weight:800;letter-spacing:.04em}
.whatsapp-invite{appearance:none;border:1px solid rgba(94,225,126,.35);background:rgba(39,181,92,.14);color:#ddffe8;border-radius:12px;min-height:44px;padding:0 14px;font-weight:900;cursor:pointer}
.whatsapp-invite:hover{background:rgba(39,181,92,.22)}
@media(max-width:560px){.group-whatsapp-invite{min-height:52px;font-size:13px}.new-group-share{display:grid}.whatsapp-invite{width:100%}}

/* v46 · acceso desde invitación de WhatsApp */
.invite-auth-notice{margin-bottom:16px;padding:14px 15px;border:1px solid rgba(88,224,163,.34);background:linear-gradient(135deg,rgba(40,170,111,.14),rgba(123,108,246,.12));border-radius:16px}
.invite-auth-notice strong{display:block;font-size:16px;margin-bottom:5px;color:#f3fff8}
.invite-auth-notice p{margin:0 0 6px;color:#dce8e2;line-height:1.4}
.invite-auth-notice small{color:var(--muted)}
@media(max-width:520px){.invite-auth-notice{padding:12px}.auth-card{padding:16px}.auth-card .tabs{margin-bottom:16px}}

/* v48: accesos visibles para crear/unirse a grupos */
.groups-quick-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px;margin-bottom:4px}
.groups-quick-actions .primary,.groups-quick-actions .secondary{min-height:46px}
@media(max-width:520px){
  .groups-quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .groups-quick-actions button{padding:0 10px;font-size:14px}
}
@media(max-width:360px){.groups-quick-actions{grid-template-columns:1fr}}

/* v52 · cámara interna optimizada para celulares */
.camera-modal{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;padding:18px;background:rgba(4,8,20,.78);backdrop-filter:blur(10px)}
.camera-modal.hidden{display:none!important}
.camera-panel{width:min(430px,100%);background:#11172a;border:1px solid rgba(124,135,255,.32);border-radius:22px;padding:16px;box-shadow:0 24px 80px rgba(0,0,0,.48)}
.camera-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.camera-head small{display:block;color:#9c96ff;font-weight:900;letter-spacing:.14em;font-size:10px}
.camera-head h2{margin:3px 0 0;font-size:22px}
.camera-close{width:42px;height:42px;border-radius:12px;border:1px solid var(--line);background:#171d33;color:#fff;font-size:28px;line-height:1;cursor:pointer}
.camera-preview-wrap{position:relative;width:100%;aspect-ratio:1/1;overflow:hidden;border-radius:20px;background:#050916;border:1px solid rgba(103,117,230,.28)}
.camera-preview-wrap video{width:100%;height:100%;object-fit:cover;transform:scaleX(-1);display:block}
.camera-guide{position:absolute;inset:10%;border:2px solid rgba(255,255,255,.72);border-radius:50%;box-shadow:0 0 0 999px rgba(0,0,0,.08);pointer-events:none}
.camera-help{min-height:22px;margin:11px 2px;color:#aeb7d5;font-size:13px;line-height:1.35}
.camera-help.error{color:#ff7d93}
.camera-actions{display:grid;grid-template-columns:1fr 1.4fr;gap:10px}
.camera-secondary,.camera-primary{min-height:50px;border-radius:14px;font-weight:900;font-size:15px;cursor:pointer}
.camera-secondary{border:1px solid var(--line);background:#171d33;color:#fff}
.camera-primary{border:0;background:linear-gradient(135deg,#6d5dfc,#9b7cff);color:#fff}
@media(max-width:420px){.camera-modal{padding:10px}.camera-panel{padding:12px;border-radius:18px}.camera-actions{grid-template-columns:1fr}.camera-preview-wrap{border-radius:16px}}
#cameraMsg.message{min-height:22px;margin:11px 2px;color:#aeb7d5;font-size:13px;line-height:1.35}
#cameraMsg.message.error{color:#ff7d93}

/* v53: fallback de cámara nativa */
.camera-actions:has(#cameraNativeFallbackBtn:not(.hidden)){grid-template-columns:1fr}
#cameraNativeFallbackBtn{min-height:50px}

/* v54 cámara liviana */
#cameraVideo{width:100%;aspect-ratio:1/1;object-fit:cover;background:#060a16}
.camera-preview{max-height:520px;overflow:hidden}

/* v55: mensaje de permisos de cámara */
#cameraMsg{
  white-space:pre-line;
  line-height:1.45;
}
#cameraCaptureBtn[data-mode="retry"]{
  background:linear-gradient(135deg,#6d5dfc,#8f76ff);
}


/* v57 · torneo independiente por grupo */
.group-tournament-status{
  margin-top:10px;border:1px solid #2b3d66;background:#0b1530;border-radius:13px;
  padding:10px 11px;display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap
}
.group-tournament-status span{font-size:12px;color:#aebce0;font-weight:800}
.group-tournament-status strong{font-size:12px;color:#86f7df}
.group-tournament-status small{font-size:11px;color:#8fa0c8}
.group-tournament-status.active{border-color:#245d59;background:#0b2728}
.group-tournament-start{
  width:100%;border:0;border-radius:11px;min-height:42px;padding:8px 11px;
  background:linear-gradient(135deg,#8dff78,#35e7ff);color:#071421;font-weight:1000;cursor:pointer
}
.group-tournament-start:active{transform:translateY(1px)}


/* v61 · descripción / premio del grupo */
.create-group-form{
  display:grid;
  gap:10px;
}
.create-group-form input,
.create-group-form textarea{
  width:100%;
  border:1px solid var(--line);
  background:#111528;
  color:#fff;
  border-radius:14px;
  padding:13px 14px;
  outline:none;
  font:inherit;
}
.create-group-form textarea{
  min-height:92px;
  resize:vertical;
  line-height:1.4;
}
.create-group-form input:focus,
.create-group-form textarea:focus{
  border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(123,108,246,.18);
}
.group-description-help{
  color:var(--muted);
  font-size:11px;
  line-height:1.4;
  margin:-2px 2px 0;
}
.create-group-form .primary{
  width:100%;
}
.group-challenge-preview{
  margin:9px 0 0!important;
  padding:9px 10px;
  border:1px solid rgba(255,211,92,.20);
  border-radius:11px;
  background:rgba(255,211,92,.07);
  color:#f4e8b6!important;
  font-size:12px;
  line-height:1.35;
  display:-webkit-box!important;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
#roomMeta{
  max-width:760px;
  line-height:1.45;
}
@media(max-width:560px){
  .create-group-form textarea{min-height:105px}
  .group-challenge-preview{font-size:12px}
}


/* v68 · sala de grupo optimizada para celular */
.room,
.room-grid,
.members-panel,
.members-list,
.chat-panel,
.chat-messages,
.chat-row,
.bubble{
  min-width:0;
  max-width:100%;
}

.room{
  width:100%;
  overflow:hidden;
}

.room-grid{
  width:100%;
  overflow:hidden;
}

/* El carrusel de integrantes se desplaza adentro, nunca ensancha la página */
.members-panel{
  overflow:hidden;
}
.members-list{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-x:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
}
.member{
  flex:0 0 auto;
}

/* El chat nunca puede salirse a la derecha */
.chat-panel{
  width:100%;
  max-width:100%;
  overflow:hidden;
}
.chat-messages{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}
.chat-row{
  width:100%;
  max-width:100%;
  min-width:0;
}
.chat-row.mine{
  justify-content:flex-start;
}
.chat-row.mine .bubble{
  margin-left:auto;
}
.chat-row:not(.mine) .bubble{
  margin-right:auto;
}
.bubble{
  box-sizing:border-box;
  width:max-content;
  max-width:calc(100% - 50px)!important;
  min-width:0;
}
.bubble p{
  max-width:100%;
  overflow-wrap:anywhere;
  word-break:break-word;
  white-space:pre-wrap;
}

/* Celular: integrantes en una sola tira y chat mucho más compacto */
@media(max-width:720px){
  .room-grid{
    grid-template-columns:minmax(0,1fr);
    min-height:0;
  }

  .members-panel{
    padding:14px 14px 11px;
  }
  .members-panel h4{
    margin-bottom:9px;
  }
  .members-list{
    display:flex;
    gap:14px;
    padding:2px 2px 8px;
  }
  .member{
    min-width:108px;
    max-width:124px;
  }
  .member img{
    width:42px;
    height:42px;
    flex:0 0 42px;
  }
  .member strong{
    font-size:12px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width:72px;
  }

  .chat-panel{
    grid-template-rows:minmax(230px,360px) auto;
  }
  .chat-messages{
    min-height:230px;
    max-height:360px;
    padding:14px 12px;
    gap:10px;
  }
  .chat-row{
    gap:7px;
  }
  .chat-row img{
    width:30px;
    height:30px;
    flex:0 0 30px;
  }
  .bubble{
    max-width:calc(100% - 42px)!important;
    padding:9px 11px;
  }
  .chat-form{
    padding:10px;
    gap:8px;
  }
  .chat-form input{
    width:100%;
    min-width:0;
  }
  .send-button{
    flex:0 0 44px;
    width:44px;
  }
}

@media(max-width:390px){
  .member{
    min-width:98px;
    max-width:110px;
  }
  .member strong{
    max-width:64px;
  }
  .bubble{
    max-width:calc(100% - 38px)!important;
  }
}


/* v69 · contador de chat sin leer */
.chat-unread-total{
  min-width:24px;
  height:24px;
  padding:0 7px!important;
  border-radius:999px!important;
  display:inline-grid!important;
  place-items:center;
  background:#ff496d!important;
  border:2px solid #ff8ca2!important;
  color:#fff!important;
  font-size:11px!important;
  font-weight:1000!important;
  line-height:1;
  box-shadow:0 0 16px rgba(255,73,109,.34);
}
.chat-unread-total.hidden{display:none!important}

.group-card-open{
  position:relative;
}
.group-chat-unread{
  position:absolute;
  top:10px;
  right:10px;
  z-index:3;
  display:flex!important;
  align-items:center;
  gap:4px;
  min-width:31px;
  height:29px;
  padding:0 8px;
  border-radius:999px;
  background:#ff496d;
  border:2px solid rgba(255,255,255,.88);
  color:#fff!important;
  box-shadow:0 5px 16px rgba(255,73,109,.35);
  pointer-events:none;
}
.group-chat-unread-icon{
  display:inline!important;
  color:#fff!important;
  font-size:12px;
  line-height:1;
}
.group-chat-unread b{
  font-size:12px;
  font-weight:1000;
  line-height:1;
}
.group-card-open:has(.group-chat-unread) > strong{
  padding-right:62px;
}

@media(max-width:560px){
  .group-chat-unread{
    top:9px;
    right:9px;
    min-width:29px;
    height:27px;
    padding:0 7px;
  }
}
