*{box-sizing:border-box}:root{--bg:#080d11;--panel:#151f27;--panel2:#1c2932;--line:#364751;--gold:#e7bd65;--text:#f5f7f8;--muted:#9eabb3;--felt:#145d45;--felt2:#083e2f;--tile:#f7f1e5;--pip:#151b20}
body{margin:0;min-height:100vh;background:radial-gradient(circle at top,#293741,#080b0e 65%);color:var(--text);font:14px Arial,sans-serif}.hidden{display:none!important}.page{display:none}.page.active{display:block}.app{width:min(1250px,100%);margin:auto;padding:16px}.screen{min-height:100vh;display:grid;place-items:center;padding:20px}.login-card{width:min(440px,100%);background:linear-gradient(145deg,#1b2730,#10171c);border:1px solid var(--line);border-radius:22px;padding:30px;box-shadow:0 30px 100px #0009}.logo{font-size:25px;font-weight:900;letter-spacing:2px;color:var(--gold)}.logo span{color:#fff}.muted{color:var(--muted)}label{display:grid;gap:6px;color:var(--muted);font-size:12px;margin:16px 0}input,select{width:100%;background:#202d36;color:#fff;border:1px solid #50616b;border-radius:9px;padding:11px;outline:none}button{font:inherit;cursor:pointer;border:1px solid var(--line);background:#202c34;color:#fff;padding:10px 14px;border-radius:9px;font-weight:800}button:disabled{opacity:.4;cursor:not-allowed}.gold{background:linear-gradient(135deg,#d3a649,#f2d080);border:0;color:#171208}.full,.wide{width:100%}.topbar,.roombar,.lobby-head,.league-head{display:flex;align-items:center;justify-content:space-between;gap:15px}.topbar{margin-bottom:14px}nav{display:flex;gap:6px}.nav{background:#202c34}.roombar{padding:12px 15px;margin-bottom:12px}.roombar>div:first-child{display:flex;align-items:center;gap:9px}.label{font-size:10px;color:var(--muted);letter-spacing:1px}.roombar strong{font-size:18px;color:var(--gold);letter-spacing:2px}.pill{font-size:10px;background:#24323a;padding:5px 8px;border-radius:20px}.card{background:linear-gradient(145deg,#19242c,#10171c);border:1px solid var(--line);border-radius:17px;box-shadow:0 18px 55px #0006}.tabs{display:grid;grid-template-columns:1fr 1fr;background:#10181d;padding:4px;border-radius:12px;margin:20px 0}.tab{border:0;background:transparent}.tab.active{background:#293841;color:var(--gold)}.or{text-align:center;color:var(--muted);margin:12px}.status{margin:10px 0;padding:9px 12px;background:#17242a;border:1px solid #2e424b;border-radius:9px;color:#dce5e8}.status.mini{font-size:12px}.waiting{padding:18px;margin-bottom:12px}.waiting h2{margin:0 0 5px}.lobby-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0}.slot{background:#1b2930;border:1px solid #30434d;border-radius:10px;padding:10px}.slot small,.player-box small,.result-row small{display:block;color:var(--muted);margin-top:3px}.game-layout{display:grid;grid-template-columns:210px 1fr;gap:14px}.side{padding:16px}.side h3{font-size:11px;color:var(--muted);letter-spacing:2px;margin:0}.big{font-size:38px;font-weight:900;color:var(--gold);margin:3px 0 16px}.turn-box{background:#0e181d;border:1px solid #31434b;padding:12px;border-radius:11px}.turn-box small{display:block;color:var(--muted);font-size:10px}.turn-box strong{display:block;margin-top:5px}.rules{display:grid;gap:5px;margin-top:14px;padding-top:12px;border-top:1px solid #2d3c43;font-size:11px;color:#c3cdd1}.rules span{color:var(--muted)}.danger{margin-top:18px;background:#49252b;border-color:#71313b}.players{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:10px}.player-box{padding:10px;background:#131d22;border:1px solid #29383f;border-radius:10px}.player-box.active{border-color:var(--gold);box-shadow:0 0 0 1px #e7bd6544 inset}.table-wrap{background:linear-gradient(145deg,var(--felt),var(--felt2));border:9px solid #513c24;border-radius:18px;min-height:310px;overflow:auto;box-shadow:inset 0 0 45px #0008,0 15px 35px #0007}.board{min-width:max-content;min-height:292px;display:flex;align-items:center;justify-content:center;gap:5px;padding:35px}.empty{color:#b8d3c8;opacity:.65}.board-tile,.hand-tile{width:48px;height:92px;border-radius:7px;background:linear-gradient(145deg,#fffaf0,#ded5c3);color:var(--pip);border:1px solid #c9bea9;box-shadow:0 4px 8px #0005;display:grid;grid-template-rows:1fr 1px 1fr;place-items:center;font-weight:900;flex:none;position:relative}.board-tile span,.hand-tile span{font-size:22px}.board-tile i,.hand-tile i{display:block;width:70%;height:1px;background:#766d60}.hand{display:flex;gap:8px;overflow-x:auto;padding:14px}.my-hand{margin-top:12px}.hand-title{padding:13px 14px 0;font-weight:900}.hand-tile{cursor:pointer;transition:.15s}.hand-tile:hover{transform:translateY(-5px)}.hand-tile.disabled{opacity:.35;filter:grayscale(.7);cursor:not-allowed}.controls{display:flex;gap:8px;margin-top:10px}.controls button{flex:1}.end-info{display:flex;justify-content:space-between;color:var(--muted);font-size:12px;padding:7px}.league-head{padding:18px;margin-bottom:12px}.league-head h1{margin:0}.table-card{overflow:auto}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:12px;border-bottom:1px solid #2d3c43}th{color:var(--muted);font-size:11px}.modal{position:fixed;inset:0;background:#000b;display:grid;place-items:center;padding:20px;z-index:20}.modal-box{width:min(480px,100%);background:#17232a;border:1px solid #46565d;border-radius:18px;padding:24px;box-shadow:0 30px 100px #000}.trophy{text-align:center;font-size:45px}.modal-box h2{text-align:center;margin:5px 0}.result-row{display:grid;grid-template-columns:35px 1fr 55px;align-items:center;gap:8px;background:#10191e;border:1px solid #2a3940;border-radius:9px;padding:10px;margin:7px 0}.result-row.winner{border-color:var(--gold)}.result-row> b:first-child{font-size:20px;color:var(--gold)}.result-row> b:last-child{text-align:right;color:var(--gold)}
@media(max-width:800px){.game-layout{grid-template-columns:1fr}.side{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}.side h3,.side .big{display:none}.rules{margin-top:0}.players{grid-template-columns:repeat(2,1fr)}.lobby-grid{grid-template-columns:repeat(2,1fr)}.topbar{align-items:flex-start}.topbar nav{flex-wrap:wrap}.table-wrap{min-height:240px}.board{min-height:220px;padding:25px}.board-tile{width:43px;height:82px}.board-tile span{font-size:19px}}
@media(max-width:480px){.app{padding:10px}.login-card{padding:22px}.logo{font-size:21px}.players{gap:5px}.player-box{padding:8px;font-size:12px}.controls{position:sticky;bottom:5px;z-index:5}.hand{padding:12px 8px}.hand-tile{width:43px;height:82px}.hand-tile span{font-size:19px}.roombar{padding:9px}.roombar button{padding:8px}.side{padding:11px}.rules{font-size:10px}.board{justify-content:flex-start}}

/* D2T DOMINO - realistic pip domino stones */
.tile,
.hand-tile,
.board-tile {
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 9px;
  background:
    radial-gradient(circle at 25% 18%, rgba(255,255,255,.95), rgba(255,255,255,0) 28%),
    linear-gradient(145deg, #fffdf5 0%, #eee8d8 48%, #d8cfbb 100%);
  border: 1px solid rgba(90, 74, 49, .48);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -2px 4px rgba(70,55,35,.16),
    0 4px 10px rgba(0,0,0,.28);
  color: #191919;
}

.hand-tile {
  width: 44px;
  height: 84px;
  flex: 0 0 44px;
}

.board-tile {
  width: 48px;
  height: 92px;
  flex: 0 0 48px;
}

.domino-half {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: calc(50% - 1px);
  padding: 6px;
  box-sizing: border-box;
}

.domino-half .pip {
  width: 7px;
  height: 7px;
  justify-self: center;
  align-self: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #555 0 12%, #161616 42%, #050505 100%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.22),
    0 1px 2px rgba(0,0,0,.45);
}

.domino-half .p0 { grid-area: 1 / 1; }
.domino-half .p1 { grid-area: 1 / 2; }
.domino-half .p2 { grid-area: 1 / 3; }
.domino-half .p3 { grid-area: 2 / 1; }
.domino-half .p4 { grid-area: 2 / 2; }
.domino-half .p5 { grid-area: 2 / 3; }
.domino-half .p6 { grid-area: 3 / 1; }
.domino-half .p7 { grid-area: 3 / 2; }
.domino-half .p8 { grid-area: 3 / 3; }

.domino-divider {
  display: block;
  height: 2px;
  margin: 0 5px;
  background: linear-gradient(90deg, transparent, rgba(70,60,45,.48), transparent);
}

.hand-tile:hover:not(.disabled) {
  transform: translateY(-5px);
  filter: brightness(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 8px 16px rgba(0,0,0,.35);
}

.hand-tile.disabled {
  opacity: .48;
  filter: grayscale(.2);
}

.board-tile {
  margin: 3px;
}

/* If the game board lays stones horizontally, keep each stone readable. */
.board .board-tile .domino-half .pip {
  width: 7px;
  height: 7px;
}

@media (max-width: 600px) {
  .hand-tile {
    width: 40px;
    height: 76px;
    flex-basis: 40px;
  }
  .board-tile {
    width: 43px;
    height: 82px;
    flex-basis: 43px;
  }
  .domino-half .pip {
    width: 6px;
    height: 6px;
  }
}

/* =========================================================
   MBICUKIA DOMINO — PREMIUM TABLE PATH V2
   Visual only: game rules / Firebase / turn logic untouched.
   Board order is shown as a clean serpentine path instead of
   one long straight row. The path turns upward at the right,
   travels back across the top, then turns down on the left.
   ========================================================= */
.table-wrap{
  position:relative;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
  background:
    radial-gradient(circle at 50% 42%, rgba(51,145,106,.18), transparent 48%),
    linear-gradient(145deg,#17684c 0%,#0b4a36 52%,#063728 100%);
  border:10px solid #4a351e;
  box-shadow:
    inset 0 0 0 2px rgba(231,189,101,.18),
    inset 0 0 55px rgba(0,0,0,.52),
    0 18px 40px rgba(0,0,0,.35);
}

.board{
  --cell:72px;
  position:relative;
  display:grid;
  grid-template-columns:repeat(12,var(--cell));
  grid-template-rows:repeat(5,var(--cell));
  align-items:center;
  justify-items:center;
  width:calc(12 * var(--cell));
  min-width:calc(12 * var(--cell));
  height:calc(5 * var(--cell));
  min-height:calc(5 * var(--cell));
  padding:0;
  margin:0 auto;
  gap:0;
  isolation:isolate;
}

.board::before{
  content:"";
  position:absolute;
  left:calc(var(--cell) * 1.45);
  right:calc(var(--cell) * 1.45);
  top:calc(var(--cell) * 1.35);
  height:calc(var(--cell) * 2.35);
  border:1px solid rgba(255,255,255,.055);
  border-radius:28px;
  box-shadow:inset 0 0 28px rgba(0,0,0,.12);
  pointer-events:none;
  z-index:-1;
}

.board .empty{
  grid-column:1 / -1;
  grid-row:1 / -1;
  align-self:center;
  justify-self:center;
  padding:18px 24px;
  border:1px dashed rgba(215,241,229,.22);
  border-radius:14px;
  background:rgba(0,0,0,.10);
  letter-spacing:.4px;
}

.board-tile{
  width:44px;
  height:82px;
  margin:0;
  z-index:2;
  border-radius:10px;
  border:1px solid rgba(79,62,36,.58);
  background:
    radial-gradient(circle at 22% 15%,rgba(255,255,255,.98),rgba(255,255,255,0) 30%),
    linear-gradient(145deg,#fffef8 0%,#f3eddf 45%,#d7ccb8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.98),
    inset 0 -3px 5px rgba(64,47,28,.16),
    0 6px 12px rgba(0,0,0,.34);
  transition:transform .18s ease,filter .18s ease,box-shadow .18s ease;
}

.board-tile:hover{
  z-index:5;
  filter:brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.98),
    0 9px 18px rgba(0,0,0,.4),
    0 0 0 1px rgba(231,189,101,.35);
}

.board-tile .domino-half{
  padding:7px;
}

.board-tile .domino-half .pip{
  width:8px;
  height:8px;
  background:
    radial-gradient(circle at 32% 28%,#707070 0 10%,#202020 40%,#050505 100%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.3),
    0 1px 2px rgba(0,0,0,.55);
}

/* Main run: tiles 1–7 go toward the right. */
.board-tile:nth-child(1){grid-column:3;grid-row:4;transform:rotate(90deg)}
.board-tile:nth-child(2){grid-column:4;grid-row:4;transform:rotate(90deg)}
.board-tile:nth-child(3){grid-column:5;grid-row:4;transform:rotate(90deg)}
.board-tile:nth-child(4){grid-column:6;grid-row:4;transform:rotate(90deg)}
.board-tile:nth-child(5){grid-column:7;grid-row:4;transform:rotate(90deg)}
.board-tile:nth-child(6){grid-column:8;grid-row:4;transform:rotate(90deg)}
.board-tile:nth-child(7){grid-column:9;grid-row:4;transform:rotate(90deg)}

/* Right corner: tiles 8–9 turn upward. */
.board-tile:nth-child(8){grid-column:10;grid-row:3}
.board-tile:nth-child(9){grid-column:10;grid-row:2}

/* Upper run: tiles 10–17 travel back to the left. */
.board-tile:nth-child(10){grid-column:9;grid-row:2;transform:rotate(90deg)}
.board-tile:nth-child(11){grid-column:8;grid-row:2;transform:rotate(90deg)}
.board-tile:nth-child(12){grid-column:7;grid-row:2;transform:rotate(90deg)}
.board-tile:nth-child(13){grid-column:6;grid-row:2;transform:rotate(90deg)}
.board-tile:nth-child(14){grid-column:5;grid-row:2;transform:rotate(90deg)}
.board-tile:nth-child(15){grid-column:4;grid-row:2;transform:rotate(90deg)}
.board-tile:nth-child(16){grid-column:3;grid-row:2;transform:rotate(90deg)}
.board-tile:nth-child(17){grid-column:2;grid-row:2;transform:rotate(90deg)}

/* Left corner: tiles 18–20 turn downward. */
.board-tile:nth-child(18){grid-column:2;grid-row:3}
.board-tile:nth-child(19){grid-column:2;grid-row:4}
.board-tile:nth-child(20){grid-column:2;grid-row:5}

/* Lower return run: tiles 21–28 travel right again. */
.board-tile:nth-child(21){grid-column:3;grid-row:5;transform:rotate(90deg)}
.board-tile:nth-child(22){grid-column:4;grid-row:5;transform:rotate(90deg)}
.board-tile:nth-child(23){grid-column:5;grid-row:5;transform:rotate(90deg)}
.board-tile:nth-child(24){grid-column:6;grid-row:5;transform:rotate(90deg)}
.board-tile:nth-child(25){grid-column:7;grid-row:5;transform:rotate(90deg)}
.board-tile:nth-child(26){grid-column:8;grid-row:5;transform:rotate(90deg)}
.board-tile:nth-child(27){grid-column:9;grid-row:5;transform:rotate(90deg)}
.board-tile:nth-child(28){grid-column:10;grid-row:5;transform:rotate(90deg)}

/* Subtle connector glow so the path reads as one chain. */
.board-tile::after{
  content:"";
  position:absolute;
  inset:3px;
  border-radius:7px;
  pointer-events:none;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.16);
}

@media(max-width:900px){
  .board{--cell:64px}
  .board-tile{width:40px;height:76px}
  .board-tile .domino-half{padding:6px}
  .board-tile .domino-half .pip{width:7px;height:7px}
  .table-wrap{min-height:360px}
}

@media(max-width:600px){
  .board{--cell:57px}
  .board-tile{width:37px;height:70px;border-radius:8px}
  .board-tile .domino-half{padding:5px}
  .board-tile .domino-half .pip{width:6px;height:6px}
  .table-wrap{border-width:7px;border-radius:15px;min-height:320px}
}

@media(max-width:420px){
  .board{--cell:50px}
  .board-tile{width:34px;height:64px}
  .board-tile .domino-half .pip{width:5px;height:5px}
}
