:root{
  --bg1:#07111f;
  --bg2:#171b44;
  --gold:#ffd166;
  --gold2:#f7b801;
  --txt:#f8fbff;
  --muted:#b9c5d8;
  --glass:rgba(255,255,255,.09);
  --stroke:rgba(255,255,255,.18);
  --danger:#ff5d73;
  --ok:#7ef2b0;
}

*{
  box-sizing:border-box;
}

html,
body{
  margin:0;
  min-height:100%;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--txt);
  background:#050814;
  overflow-x:hidden;
}

body:before{
  content:"";
  position:fixed;
  inset:0;
  background:
    radial-gradient(circle at 20% 10%,#315bff66,transparent 32%),
    radial-gradient(circle at 80% 20%,#ffbf0060,transparent 25%),
    linear-gradient(135deg,var(--bg1),var(--bg2) 55%,#080913);
  z-index:-2;
}

body:after{
  content:"";
  position:fixed;
  inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.025) 1px,transparent 1px);
  background-size:44px 44px;
  mask-image:linear-gradient(to bottom,#000,transparent);
  z-index:-1;
}

.glass{
  background:var(--glass);
  border:1px solid var(--stroke);
  box-shadow:0 20px 80px rgba(0,0,0,.35);
  backdrop-filter:blur(18px);
  border-radius:28px;
}

/* =========================
   HOME
   ========================= */

.home-body{
  display:grid;
  place-items:center;
  padding:22px;
  min-height:100vh;
}

.home-shell{
  width:min(940px,100%);
}

.hero-card{
  padding:42px;
  text-align:center;
  position:relative;
  overflow:hidden;
}

.hero-card:before{
  content:"";
  position:absolute;
  inset:-120px;
  background:conic-gradient(from 120deg,transparent,#ffffff1a,transparent,#ffd16622,transparent);
  animation:spin 8s linear infinite;
  z-index:-1;
}

@keyframes spin{
  to{
    transform:rotate(1turn);
  }
}

.brand-pill{
  display:inline-flex;
  padding:8px 14px;
  border:1px solid #ffffff25;
  border-radius:999px;
  color:var(--gold);
  font-weight:800;
  letter-spacing:.12em;
  font-size:12px;
}

h1{
  font-size:clamp(42px,8vw,88px);
  line-height:.92;
  margin:24px 0 14px;
}

.hero-subtitle{
  color:var(--muted);
  font-size:clamp(17px,2.5vw,22px);
  margin:0 auto 26px;
  max-width:620px;
}

.dice-preview{
  display:flex;
  justify-content:center;
  gap:12px;
  font-size:54px;
  filter:drop-shadow(0 18px 22px #0008);
  margin-bottom:28px;
}

.dice-preview span{
  animation:bob 2s ease-in-out infinite;
}

.dice-preview span:nth-child(2){
  animation-delay:.1s;
}

.dice-preview span:nth-child(3){
  animation-delay:.2s;
}

.dice-preview span:nth-child(4){
  animation-delay:.3s;
}

.dice-preview span:nth-child(5){
  animation-delay:.4s;
}

@keyframes bob{
  50%{
    transform:translateY(-10px) rotate(8deg);
  }
}

.home-actions,
.dice-controls{
  display:flex;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
}

.primary-btn,
.secondary-btn,
.mini-btn{
  border:0;
  border-radius:18px;
  padding:14px 20px;
  font-weight:900;
  color:#07111f;
  cursor:pointer;
  transition:.18s transform,.18s opacity,.18s box-shadow;
  font-size:16px;
}

.primary-btn{
  background:linear-gradient(135deg,#9ee7ff,#fff);
  box-shadow:0 12px 26px #9ee7ff2c;
}

.primary-btn.gold{
  background:linear-gradient(135deg,var(--gold),var(--gold2));
  box-shadow:0 14px 34px #ffd16635;
}

.secondary-btn{
  background:#ffffff17;
  color:var(--txt);
  border:1px solid #ffffff24;
}

.mini-btn{
  background:#ffffff16;
  color:var(--txt);
  border:1px solid #ffffff22;
  padding:10px 14px;
}

.primary-btn:hover,
.secondary-btn:hover,
.mini-btn:hover{
  transform:translateY(-2px);
}

button:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.home-status{
  margin-top:18px;
  color:var(--muted);
  min-height:24px;
}

.select-line{
  display:inline-flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  margin:0 0 18px;
  color:var(--muted);
  font-weight:800;
}

.select-line select{
  background:#ffffff16;
  color:#fff;
  border:1px solid #ffffff28;
  border-radius:14px;
  padding:10px 14px;
  font-weight:900;
}

.select-line option{
  color:#07111f;
}

/* =========================
   GAME DESKTOP
   ========================= */

.game-body{
  min-height:100vh;
  padding:14px;
}

.game-shell{
  width:100%;
  max-width:1460px;
  margin:auto;
}

.topbar{
  height:70px;
  padding:12px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:14px;
}

.topbar div{
  display:grid;
  text-align:center;
}

.topbar strong{
  line-height:1.1;
}

.topbar span{
  color:var(--muted);
  font-size:13px;
}

.back-link{
  color:var(--txt);
  text-decoration:none;
  font-weight:800;
}

.board-layout{
  display:grid;
  grid-template-columns:minmax(420px,460px) minmax(0,1fr);
  gap:14px;
}

.score-panel{
  padding:16px;
  min-height:calc(100vh - 98px);
  overflow:hidden;
}

.player-cards{
  display:grid;
  gap:8px;
  margin-bottom:10px;
}

.player-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  border-radius:20px;
  background:#ffffff0d;
  margin-bottom:10px;
  border:1px solid transparent;
  min-width:0;
}

.player-card.active{
  border-color:var(--gold);
  box-shadow:0 0 0 3px #ffd16622;
}

.player-card div{
  min-width:0;
  display:flex;
  align-items:center;
  gap:8px;
}

.player-card b{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.player-card strong{
  flex:0 0 auto;
}

.avatar{
  flex:0 0 auto;
}

.lobby-actions{
  display:flex;
  justify-content:center;
  margin:8px 0 12px;
}

.primary-btn.small{
  padding:10px 14px;
  font-size:14px;
}

.score-table-wrap{
  overflow-y:auto;
  overflow-x:hidden;
  max-height:calc(100vh - 245px);
  border-radius:18px;
  padding-right:2px;
}

.score-table{
  width:100%;
  min-width:0;
  table-layout:fixed;
  border-collapse:collapse;
  font-size:13px;
}

.score-table th,
.score-table td{
  padding:9px 6px;
  border-bottom:1px solid #ffffff12;
  text-align:center;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.score-table th:first-child,
.score-table td:first-child{
  width:42%;
  text-align:left;
  color:var(--muted);
}

.score-table th:not(:first-child),
.score-table td:not(:first-child){
  width:auto;
}

.score-table th{
  color:#dce7f7;
  font-weight:900;
}

.score-cell.open{
  color:var(--gold);
  font-weight:900;
  cursor:pointer;
}

.score-cell.used{
  color:#fff;
}

.score-cell strong{
  color:var(--gold);
}

.table-stage{
  position:relative;
  min-height:calc(100vh - 98px);
  overflow:hidden;
}

.three-stage{
  position:absolute;
  inset:0;
}

.three-stage canvas{
  width:100%!important;
  height:100%!important;
  display:block;
}

.hud{
  position:absolute;
  left:18px;
  right:18px;
  bottom:18px;
  display:grid;
  gap:12px;
  pointer-events:none;
}

.hud>*{
  pointer-events:auto;
}

.message-box{
  padding:14px 16px;
  border-radius:20px;
  background:rgba(0,0,0,.42);
  border:1px solid #ffffff1c;
  font-weight:800;
  text-align:center;
}

.last-roll-box{
  padding:10px 14px;
  border-radius:16px;
  background:rgba(0,0,0,.32);
  border:1px solid #ffffff18;
  color:var(--muted);
  font-weight:800;
  text-align:center;
  min-height:39px;
}

.roll-info{
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}

.roll-info span{
  padding:8px 12px;
  border-radius:999px;
  background:#00000055;
  border:1px solid #ffffff19;
  color:var(--muted);
}

.category-panel{
  display:flex;
  gap:8px;
  justify-content:center;
  flex-wrap:wrap;
}

.cat-btn{
  padding:9px 11px;
  border-radius:13px;
  border:1px solid #ffffff20;
  background:#ffffff13;
  color:#fff;
  font-weight:800;
  cursor:pointer;
}

.cat-btn strong{
  color:var(--gold);
}

.toast{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translateX(-50%) translateY(120px);
  background:#07111fee;
  border:1px solid #ffffff30;
  color:#fff;
  border-radius:18px;
  padding:13px 18px;
  font-weight:800;
  transition:.25s;
  z-index:99;
}

.toast.show{
  transform:translateX(-50%) translateY(0);
}

/* =========================
   DESKTOP ANCHO MEDIO
   ========================= */

@media (min-width:881px) and (max-width:1200px){
  .game-shell{
    max-width:100%;
  }

  .board-layout{
    grid-template-columns:minmax(390px,420px) minmax(0,1fr);
  }

  .score-table{
    font-size:12.5px;
  }

  .score-table th,
  .score-table td{
    padding:8px 5px;
  }

  .score-table th:first-child,
  .score-table td:first-child{
    width:40%;
  }
}

/* =========================
   MOBILE
   ========================= */

@media (max-width:880px){

  html,
  body{
    width:100%;
    min-height:100%;
    overflow-x:hidden;
  }

  body.game-body{
    padding:0;
    min-height:100dvh;
    height:auto;
    overflow-x:hidden;
  }

  .game-shell{
    width:100%;
    max-width:none;
    min-height:100dvh;
    display:flex;
    flex-direction:column;
    padding:8px;
    gap:8px;
  }

  .topbar{
    flex:0 0 auto;
    height:54px;
    min-height:54px;
    margin:0;
    padding:8px 10px;
    border-radius:18px;
    display:grid;
    grid-template-columns:auto 1fr auto;
    gap:8px;
  }

  .topbar strong{
    font-size:14px;
    line-height:1.1;
  }

  .topbar span{
    font-size:10px;
    line-height:1.1;
  }

  .back-link{
    font-size:13px;
    white-space:nowrap;
  }

  .mini-btn{
    padding:8px 10px;
    border-radius:13px;
    font-size:12px;
    white-space:nowrap;
  }

  .board-layout{
    flex:1 1 auto;
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:8px;
  }

  .table-stage{
    order:1;
    flex:0 0 auto;
    min-height:430px;
    height:calc(100dvh - 62px - 268px - 24px);
    max-height:560px;
    border-radius:20px;
    overflow:hidden;
  }

  .score-panel{
    order:2;
    flex:0 0 auto;
    min-height:0;
    padding:10px;
    border-radius:20px;
    overflow:hidden;
  }

  .three-stage{
    inset:0;
  }

  .hud{
    top:8px;
    bottom:8px;
    left:8px;
    right:8px;
    display:flex;
    flex-direction:column;
    justify-content:flex-end;
    gap:7px;
    pointer-events:none;
  }

  .hud > *{
    pointer-events:auto;
  }

  .message-box{
    order:0;
    margin-bottom:auto;
    padding:8px 10px;
    border-radius:14px;
    font-size:12.5px;
    line-height:1.25;
    font-weight:800;
    background:rgba(0,0,0,.42);
    border:1px solid rgba(255,255,255,.18);
    max-width:100%;
    text-align:center;
  }

  .last-roll-box{
    order:1;
    padding:7px 9px;
    min-height:30px;
    border-radius:13px;
    font-size:11.5px;
    line-height:1.2;
  }

  .roll-info{
    order:2;
    gap:6px;
  }

  .roll-info span{
    padding:6px 9px;
    font-size:12px;
  }

  .dice-controls{
    order:3;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
  }

  .primary-btn,
  .secondary-btn{
    width:100%;
    padding:11px 10px;
    border-radius:15px;
    font-size:14px;
  }

  .category-panel{
    order:4;
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px;
    max-height:96px;
    overflow:auto;
    overscroll-behavior:contain;
    padding-right:2px;
  }

  .cat-btn{
    width:100%;
    padding:8px 7px;
    border-radius:12px;
    font-size:12px;
    line-height:1.1;
  }

  .player-cards{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px;
    margin-bottom:8px;
  }

  .player-card{
    margin:0;
    padding:8px 9px;
    border-radius:14px;
    font-size:12px;
    min-width:0;
  }

  .player-card b{
    display:inline-block;
    max-width:95px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    vertical-align:bottom;
  }

  .player-card strong{
    font-size:13px;
  }

  .lobby-actions{
    margin:6px 0 8px;
  }

  .score-table-wrap{
    max-height:210px;
    overflow-y:auto;
    overflow-x:hidden;
    border-radius:14px;
    -webkit-overflow-scrolling:touch;
    padding-right:0;
  }

  .score-table{
    width:100%;
    min-width:0 !important;
    table-layout:fixed;
    border-collapse:collapse;
    font-size:11.5px;
  }

  .score-table th,
  .score-table td{
    padding:7px 4px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    text-align:center;
  }

  .score-table th:first-child,
  .score-table td:first-child{
    width:34%;
    text-align:left;
  }

  .score-table th:not(:first-child),
  .score-table td:not(:first-child){
    width:auto;
  }

  .toast{
    width:calc(100% - 24px);
    max-width:420px;
    bottom:12px;
    text-align:center;
    font-size:13px;
  }

  .hero-card{
    padding:28px 18px;
  }

  .dice-preview{
    font-size:42px;
  }
}

/* =========================
   MOBILE CHICO
   ========================= */

@media (max-width:520px){

  .game-shell{
    padding:6px;
    gap:6px;
  }

  .topbar{
    height:50px;
    min-height:50px;
    padding:7px 8px;
    border-radius:16px;
  }

  .topbar strong{
    font-size:13px;
  }

  .topbar span{
    font-size:9.5px;
  }

  .back-link{
    font-size:12px;
  }

  .mini-btn{
    padding:7px 8px;
    font-size:11px;
  }

  .table-stage{
    height:calc(100dvh - 50px - 246px - 18px);
    min-height:390px;
    border-radius:18px;
  }

  .hud{
    top:6px;
    left:6px;
    right:6px;
    bottom:6px;
    gap:6px;
  }

  .message-box{
    font-size:11.5px;
    padding:7px 8px;
    line-height:1.22;
  }

  .last-roll-box{
    font-size:11px;
    padding:6px 8px;
    min-height:30px;
  }

  .roll-info span{
    font-size:11.5px;
    padding:6px 8px;
  }

  .primary-btn,
  .secondary-btn{
    padding:10px 8px;
    font-size:13px;
    border-radius:14px;
  }

  .category-panel{
    grid-template-columns:repeat(2,minmax(0,1fr));
    max-height:84px;
  }

  .cat-btn{
    font-size:11.5px;
    padding:7px 6px;
  }

  .score-panel{
    padding:8px;
    border-radius:18px;
  }

  .player-cards{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:5px;
  }

  .player-card{
    padding:7px 8px;
    font-size:11.5px;
    border-radius:13px;
  }

  .player-card b{
    max-width:78px;
  }

  .score-table-wrap{
    max-height:190px;
    overflow-y:auto;
    overflow-x:hidden;
  }

  .score-table{
    width:100%;
    min-width:0 !important;
    table-layout:fixed;
    font-size:11px;
  }

  .score-table th,
  .score-table td{
    padding:6px 3px;
  }

  .score-table th:first-child,
  .score-table td:first-child{
    width:36%;
  }

  .home-actions button{
    width:100%;
  }

  .select-line{
    display:grid;
  }
}

/* =========================
   MOBILE BAJO / LANDSCAPE
   ========================= */

@media (max-height:720px) and (max-width:880px){

  .table-stage{
    min-height:340px;
    height:calc(100dvh - 50px - 210px - 18px);
  }

  .score-table-wrap{
    max-height:150px;
  }

  .category-panel{
    max-height:70px;
  }

  .message-box{
    font-size:11.5px;
    padding:7px 8px;
  }

  .last-roll-box{
    min-height:28px;
    padding:7px 8px;
  }

  .roll-info span{
    padding:5px 7px;
    font-size:11px;
  }

  .primary-btn,
  .secondary-btn{
    padding:9px 8px;
  }
}
/* =========================================================
   GENERALA 2.2: nombres, tabla fija, modal de puntajes, ganador
   ========================================================= */

.score-table-wrap{
  position:relative;
}

.score-table thead th{
  position:sticky;
  top:0;
  z-index:5;
  background:rgba(22,26,42,.96);
  backdrop-filter:blur(12px);
  box-shadow:0 1px 0 rgba(255,255,255,.12);
}

.score-table th:first-child,
.score-table td:first-child{
  padding-left:6px;
  width:34%;
}

.player-card b{
  max-width:260px;
}

.score-main-btn{
  min-width:220px;
  background:linear-gradient(135deg,var(--gold),var(--gold2));
  color:#07111f;
  border:0;
  box-shadow:0 12px 26px rgba(255,209,102,.24);
}

.modal-backdrop{
  position:fixed;
  inset:0;
  z-index:200;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(2,6,18,.72);
  backdrop-filter:blur(10px);
}

.modal-card{
  width:min(560px,100%);
  padding:22px;
  border-radius:28px;
  position:relative;
}

.modal-card h2{
  margin:0 0 8px;
  font-size:clamp(24px,4vw,36px);
  line-height:1.05;
}

.modal-card p{
  margin:0 0 18px;
  color:var(--muted);
  line-height:1.35;
  font-weight:700;
}

.name-input{
  width:100%;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(0,0,0,.28);
  color:#fff;
  border-radius:18px;
  padding:15px 16px;
  font-size:18px;
  font-weight:800;
  outline:none;
}

.name-input:focus{
  border-color:var(--gold);
  box-shadow:0 0 0 4px rgba(255,209,102,.16);
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:16px;
}

.modal-title-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
}

.modal-close{
  width:42px;
  height:42px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.12);
  color:#fff;
  border-radius:14px;
  cursor:pointer;
  font-size:28px;
  line-height:1;
  font-weight:900;
}

.score-modal-card{
  width:min(720px,100%);
  max-height:92dvh;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.score-modal-dice{
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.22);
  border-radius:20px;
  padding:12px;
  margin:6px 0 14px;
  text-align:center;
}

.modal-dice-label{
  color:var(--muted);
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.12em;
  margin-bottom:8px;
}

.modal-dice-values{
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}

.modal-dice-values span{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:#fff;
  color:#111827;
  font-size:22px;
  font-weight:1000;
  box-shadow:0 10px 24px rgba(0,0,0,.22);
}

.modal-dice-text{
  margin-top:9px;
  color:#dce7f7;
  font-weight:900;
}

.score-modal-options{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  overflow:auto;
  padding:2px 2px 4px;
  -webkit-overflow-scrolling:touch;
}

.score-option-btn{
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.12);
  color:#fff;
  border-radius:18px;
  padding:15px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  cursor:pointer;
  font-size:16px;
  font-weight:900;
  text-align:left;
  min-height:62px;
}

.score-option-btn strong{
  color:var(--gold);
  font-size:24px;
  flex:0 0 auto;
}

.score-option-btn.zero{
  background:rgba(255,93,115,.12);
  border-color:rgba(255,93,115,.28);
}

.score-option-btn.zero strong{
  color:#ff9aaa;
}

.winner-backdrop{
  background:rgba(2,6,18,.78);
}

.winner-card{
  width:min(620px,100%);
  min-height:300px;
  padding:34px 24px 28px;
  border-radius:32px;
  text-align:center;
  position:relative;
  overflow:hidden;
}

.winner-kicker{
  color:var(--gold);
  text-transform:uppercase;
  letter-spacing:.14em;
  font-size:12px;
  font-weight:1000;
  margin-bottom:10px;
}

.winner-card h2{
  margin:0;
  font-size:clamp(34px,7vw,62px);
  line-height:.95;
  text-shadow:0 12px 36px rgba(255,209,102,.22);
}

.winner-card p{
  color:#dce7f7;
  font-weight:800;
  margin:16px auto 22px;
  max-width:460px;
  line-height:1.4;
}

.winner-confetti{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
}

.winner-confetti span{
  position:absolute;
  top:-20px;
  left:var(--x);
  width:10px;
  height:18px;
  border-radius:4px;
  background:linear-gradient(135deg,var(--gold),#9ee7ff);
  transform:rotate(var(--r));
  animation:confettiFall 2.2s ease-in infinite;
  animation-delay:var(--d);
}

@keyframes confettiFall{
  0%{ transform:translateY(-20px) rotate(var(--r)); opacity:0; }
  10%{ opacity:1; }
  100%{ transform:translateY(380px) rotate(calc(var(--r) + 420deg)); opacity:0; }
}

@media (max-width:880px){
  .score-table th:first-child,
  .score-table td:first-child{
    width:30%;
    padding-left:4px;
  }

  .player-card b{
    max-width:120px;
  }

  .score-main-btn{
    min-width:0;
    width:100%;
    grid-column:1 / -1;
    font-size:14px;
    padding:12px 10px;
  }

  .score-modal-card{
    width:100%;
    max-height:92dvh;
    padding:16px;
    border-radius:24px;
  }

  .score-modal-options{
    grid-template-columns:1fr;
    gap:8px;
  }

  .score-option-btn{
    min-height:58px;
    padding:13px 14px;
    font-size:15px;
  }

  .score-option-btn strong{
    font-size:22px;
  }

  .modal-dice-values span{
    width:40px;
    height:40px;
    font-size:20px;
  }
}

@media (max-width:520px){
  .modal-backdrop{
    padding:10px;
  }

  .modal-card{
    padding:16px;
    border-radius:22px;
  }

  .modal-card h2{
    font-size:25px;
  }

  .name-input{
    font-size:16px;
    padding:13px 14px;
  }

  .score-table{
    font-size:10.5px;
  }

  .score-table th,
  .score-table td{
    padding:6px 2px;
  }

  .score-table th:first-child,
  .score-table td:first-child{
    width:28%;
    padding-left:3px;
  }

  .winner-card{
    min-height:280px;
    padding:30px 18px 24px;
  }
}

/* =========================================================
   GENERALA 2.3: modal compacto sin scroll + dados 2D + tachado con cruz
   ========================================================= */

.score-cell.crossed{
  color:#ff5d73;
  font-weight:1000;
}

.score-cross{
  display:inline-grid;
  place-items:center;
  width:24px;
  height:24px;
  margin:auto;
  border-radius:999px;
  background:rgba(255,93,115,.14);
  border:1px solid rgba(255,93,115,.42);
  color:#ff5d73;
  font-size:18px;
  line-height:1;
  font-weight:1000;
  text-shadow:0 0 14px rgba(255,93,115,.45);
}

.score-modal-card{
  width:min(760px,100%);
  max-height:calc(100dvh - 24px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  padding:18px;
}

.score-modal-card .modal-title-row{
  align-items:center;
  margin-bottom:8px;
}

.score-modal-card h2{
  font-size:clamp(20px,3vw,30px);
  margin:0;
}

.score-modal-dice{
  flex:0 0 auto;
  padding:9px 10px;
  margin:4px 0 10px;
  border-radius:18px;
}

.modal-dice-label{
  font-size:11px;
  margin-bottom:6px;
}

.modal-dice-text{
  display:none;
}

.dice-2d-row{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:9px;
  flex-wrap:nowrap;
}

.die-2d{
  width:48px;
  height:48px;
  flex:0 0 48px;
  position:relative;
  display:block;
  border-radius:12px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,.95), rgba(255,255,255,.25) 28%, transparent 48%),
    linear-gradient(135deg,#ffffff 0%,#f6f9ff 42%,#d9e4f2 100%);
  border:1px solid rgba(255,255,255,.85);
  box-shadow:
    inset -5px -7px 10px rgba(15,23,42,.16),
    inset 4px 4px 8px rgba(255,255,255,.88),
    0 10px 22px rgba(0,0,0,.28);
}

.die-2d .pip{
  width:7px;
  height:7px;
  position:absolute;
  border-radius:999px;
  background:radial-gradient(circle at 35% 28%,#617083,#111827 75%);
  box-shadow:inset 1px 1px 2px rgba(255,255,255,.18), 0 1px 1px rgba(0,0,0,.25);
}

.die-2d .tl{ left:11px; top:11px; }
.die-2d .tr{ right:11px; top:11px; }
.die-2d .ml{ left:11px; top:50%; transform:translateY(-50%); }
.die-2d .mr{ right:11px; top:50%; transform:translateY(-50%); }
.die-2d .mc{ left:50%; top:50%; transform:translate(-50%,-50%); }
.die-2d .bl{ left:11px; bottom:11px; }
.die-2d .br{ right:11px; bottom:11px; }

.score-modal-options{
  flex:1 1 auto;
  min-height:0;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  overflow:visible;
  padding:0;
}

.score-option-btn{
  min-height:50px;
  padding:10px 11px;
  border-radius:15px;
  font-size:14px;
  line-height:1.08;
}

.score-option-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.score-option-btn strong{
  font-size:22px;
}

.score-option-btn.zero strong,
.score-option-x{
  color:#ff5d73;
}

.score-option-x{
  display:inline-grid;
  place-items:center;
  width:28px;
  height:28px;
  border-radius:999px;
  background:rgba(255,93,115,.14);
  border:1px solid rgba(255,93,115,.42);
  font-size:20px;
  line-height:1;
}

@media (max-width:880px){
  .score-modal-card{
    width:100%;
    max-height:calc(100dvh - 16px);
    padding:12px;
    border-radius:22px;
  }

  .score-modal-card .modal-title-row{
    margin-bottom:5px;
  }

  .score-modal-card h2{
    font-size:21px;
  }

  .score-modal-card .modal-close{
    width:36px;
    height:36px;
    border-radius:12px;
    font-size:24px;
  }

  .score-modal-dice{
    padding:8px;
    margin:2px 0 8px;
    border-radius:16px;
  }

  .dice-2d-row{
    gap:7px;
  }

  .die-2d{
    width:42px;
    height:42px;
    flex-basis:42px;
    border-radius:11px;
  }

  .die-2d .pip{
    width:6px;
    height:6px;
  }

  .die-2d .tl{ left:10px; top:10px; }
  .die-2d .tr{ right:10px; top:10px; }
  .die-2d .ml{ left:10px; }
  .die-2d .mr{ right:10px; }
  .die-2d .bl{ left:10px; bottom:10px; }
  .die-2d .br{ right:10px; bottom:10px; }

  .score-modal-options{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px;
    overflow:visible;
  }

  .score-option-btn{
    min-height:43px;
    padding:8px 9px;
    border-radius:13px;
    font-size:12.5px;
  }

  .score-option-btn strong{
    font-size:18px;
  }

  .score-option-x{
    width:23px;
    height:23px;
    font-size:16px;
  }

  .score-cross{
    width:20px;
    height:20px;
    font-size:15px;
  }
}

@media (max-width:520px){
  .score-modal-card{
    padding:10px;
    max-height:calc(100dvh - 10px);
  }

  .score-modal-card h2{
    font-size:19px;
  }

  .score-modal-dice{
    padding:7px;
    margin-bottom:7px;
  }

  .modal-dice-label{
    font-size:10px;
    margin-bottom:5px;
  }

  .dice-2d-row{
    gap:5px;
  }

  .die-2d{
    width:36px;
    height:36px;
    flex-basis:36px;
    border-radius:9px;
  }

  .die-2d .pip{
    width:5px;
    height:5px;
  }

  .die-2d .tl{ left:8px; top:8px; }
  .die-2d .tr{ right:8px; top:8px; }
  .die-2d .ml{ left:8px; }
  .die-2d .mr{ right:8px; }
  .die-2d .bl{ left:8px; bottom:8px; }
  .die-2d .br{ right:8px; bottom:8px; }

  .score-modal-options{
    gap:5px;
  }

  .score-option-btn{
    min-height:38px;
    padding:7px 8px;
    border-radius:12px;
    font-size:11.5px;
  }

  .score-option-btn strong{
    font-size:16px;
  }

  .score-option-x{
    width:20px;
    height:20px;
    font-size:14px;
  }
}

@media (max-height:720px) and (max-width:880px){
  .score-modal-card{
    padding:9px;
  }

  .score-modal-card h2{
    font-size:18px;
  }

  .score-modal-card .modal-close{
    width:32px;
    height:32px;
    font-size:22px;
  }

  .score-modal-dice{
    padding:6px;
    margin-bottom:6px;
  }

  .die-2d{
    width:32px;
    height:32px;
    flex-basis:32px;
    border-radius:8px;
  }

  .die-2d .pip{
    width:4.5px;
    height:4.5px;
  }

  .die-2d .tl{ left:7px; top:7px; }
  .die-2d .tr{ right:7px; top:7px; }
  .die-2d .ml{ left:7px; }
  .die-2d .mr{ right:7px; }
  .die-2d .bl{ left:7px; bottom:7px; }
  .die-2d .br{ right:7px; bottom:7px; }

  .score-option-btn{
    min-height:34px;
    padding:6px 7px;
    font-size:10.8px;
  }
}

/* =========================================================
   MODO ACEPTAR DESAFÍO
   ========================================================= */

.challenge-join-mode .table-stage{
  display:flex;
  align-items:center;
  justify-content:center;
}

.challenge-join-mode .three-stage{
  opacity:.28;
  filter:blur(1px);
}

.challenge-join-mode .hud{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:24px;
  pointer-events:none;
  gap:18px;
}

.challenge-join-mode .hud > *{
  pointer-events:auto;
}

.challenge-join-mode .message-box{
  width:min(520px, calc(100% - 32px));
  padding:28px 24px;
  border-radius:28px;
  background:rgba(4,8,18,.78);
  border:1px solid rgba(255,255,255,.24);
  box-shadow:0 24px 90px rgba(0,0,0,.55);
  backdrop-filter:blur(18px);
  text-align:center;
  order:0;
  margin:0;
}

.challenge-join-title{
  font-size:clamp(28px, 5vw, 46px);
  line-height:1;
  font-weight:1000;
  color:#fff;
  margin-bottom:10px;
}

.challenge-join-subtitle{
  font-size:clamp(14px, 2.4vw, 18px);
  color:var(--muted);
  font-weight:800;
}

.challenge-join-mode .last-roll-box,
.challenge-join-mode .roll-info,
.challenge-join-mode .category-panel{
  display:none!important;
}

.challenge-join-mode .dice-controls{
  width:min(420px, calc(100% - 32px));
  display:flex;
  justify-content:center;
  margin:0;
  order:1;
}

.challenge-join-mode #rollBtn{
  width:100%;
  min-height:64px;
  font-size:22px;
  border-radius:24px;
  background:linear-gradient(135deg,#ffd166,#f7b801);
  box-shadow:
    0 18px 50px rgba(255,209,102,.32),
    0 0 0 6px rgba(255,209,102,.12);
  animation:acceptPulse 1.35s ease-in-out infinite;
}

.challenge-join-mode #releaseBtn{
  display:none!important;
}

@keyframes acceptPulse{
  0%,100%{
    transform:scale(1);
    box-shadow:
      0 18px 50px rgba(255,209,102,.32),
      0 0 0 6px rgba(255,209,102,.12);
  }

  50%{
    transform:scale(1.035);
    box-shadow:
      0 22px 70px rgba(255,209,102,.48),
      0 0 0 10px rgba(255,209,102,.18);
  }
}

@media (max-width: 880px){
  .challenge-join-mode .table-stage{
    min-height:calc(100dvh - 76px);
    height:calc(100dvh - 76px);
  }

  .challenge-join-mode .hud{
    inset:0;
    padding:18px;
    justify-content:center;
    gap:16px;
  }

  .challenge-join-mode .message-box{
    width:100%;
    padding:24px 18px;
  }

  .challenge-join-mode .dice-controls{
    width:100%;
  }

  .challenge-join-mode #rollBtn{
    min-height:62px;
    font-size:20px;
  }

  .challenge-join-mode .score-panel{
    display:none;
  }
}

/* =========================================================
   GENERALA 2.4: invitación clara + rematch + modal mejorado
   ========================================================= */

.challenge-join-title{
  max-width:820px;
  margin-left:auto;
  margin-right:auto;
}

.winner-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  width:min(480px,100%);
  margin:20px auto 10px;
}

.winner-actions .primary-btn,
.winner-actions .secondary-btn{
  width:100%;
  min-height:54px;
  border-radius:18px;
}

.winner-close-link{
  border:0;
  background:transparent;
  color:var(--muted);
  font-weight:900;
  cursor:pointer;
  margin-top:4px;
  padding:8px 12px;
}

.winner-close-link:hover{
  color:#fff;
}

.score-modal-dice .modal-dice-values{
  display:none;
}

.score-modal-dice .dice-2d-row{
  margin-top:2px;
}

@media (max-width:520px){
  .winner-actions{
    grid-template-columns:1fr;
    gap:8px;
  }

  .winner-actions .primary-btn,
  .winner-actions .secondary-btn{
    min-height:48px;
    font-size:14px;
  }
}
