*{box-sizing:border-box}
html{font-size:18px}
body{margin:0;min-height:100vh;font-family:Arial,sans-serif;color:white;background:#080008;overflow-x:hidden}
.bg{position:fixed;inset:0;background:radial-gradient(circle at 20% 15%,#ffdf61 0,transparent 22%),radial-gradient(circle at 80% 20%,#ff006a 0,transparent 25%),radial-gradient(circle at 50% 100%,#1b7cff 0,transparent 30%),linear-gradient(135deg,#19001f,#650018,#050008);z-index:-1}
.screen{min-height:100vh;padding:22px;display:flex;align-items:center;justify-content:center}
.hidden{display:none!important}
.panel{width:100%;max-width:1180px;padding:26px;border-radius:32px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.35);backdrop-filter:blur(24px);box-shadow:0 30px 100px rgba(0,0,0,.55)}
.auth-panel{max-width:480px;text-align:center}
.brand{font-size:42px;font-weight:900;color:#ffe76a;text-shadow:0 0 20px #ff006a}
input,select{width:100%;padding:17px;margin:8px 0;border:0;border-radius:18px;font-size:18px}
button{border:0;border-radius:18px;padding:15px 20px;margin:7px 0;background:linear-gradient(135deg,#ffd84d,#ff2c78,#7b2cff);color:white;font-size:18px;font-weight:900;cursor:pointer;box-shadow:0 12px 30px rgba(255,0,110,.35)}
.secondary{background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.3)}
.danger{background:linear-gradient(135deg,#ff1e1e,#740000)}
#main{min-height:100vh;padding:20px}
.topbar{position:relative;margin:0 auto 22px;max-width:1180px;display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-radius:28px;background:rgba(0,0,0,.45);backdrop-filter:blur(18px)}
.userbox{display:flex;align-items:center;gap:14px}
.userbox img,.admin-user img{width:62px;height:62px;border-radius:50%;object-fit:cover;background:#222;border:3px solid #ffe76a}
.lobby{width:100%;max-width:1180px;margin:0 auto;display:grid;grid-template-columns:repeat(3,1fr);gap:22px;padding-bottom:80px}
.game-card{min-height:240px;padding:26px;border-radius:34px;background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.3);box-shadow:0 25px 70px rgba(0,0,0,.45)}
.game-icon{text-align:center;font-size:82px}
.game-card h3{font-size:30px;margin:10px 0}
.mode-menu{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.roulette-layout{display:grid;grid-template-columns:420px 1fr;gap:24px;align-items:start}
.wheel-wrap{text-align:center}
.pointer{font-size:44px;margin-bottom:-14px;color:#ffe76a;text-shadow:0 0 15px #000}
.wheel{width:390px;height:390px;margin:auto;border-radius:50%;border:14px solid #ffd95a;background:conic-gradient(#008a3d 0deg 9.7deg,#111 9.7deg 19.4deg,#d7002f 19.4deg 29.1deg,#111 29.1deg 38.8deg,#d7002f 38.8deg 48.5deg,#111 48.5deg 58.2deg,#d7002f 58.2deg 67.9deg,#111 67.9deg 77.6deg,#d7002f 77.6deg 87.3deg,#111 87.3deg 97deg,#d7002f 97deg 106.7deg,#111 106.7deg 116.4deg,#d7002f 116.4deg 126.1deg,#111 126.1deg 135.8deg,#d7002f 135.8deg 145.5deg,#111 145.5deg 155.2deg,#d7002f 155.2deg 164.9deg,#111 164.9deg 174.6deg,#d7002f 174.6deg 184.3deg,#111 184.3deg 194deg,#d7002f 194deg 203.7deg,#111 203.7deg 213.4deg,#d7002f 213.4deg 223.1deg,#111 223.1deg 232.8deg,#d7002f 232.8deg 242.5deg,#111 242.5deg 252.2deg,#d7002f 252.2deg 261.9deg,#111 261.9deg 271.6deg,#d7002f 271.6deg 281.3deg,#111 281.3deg 291deg,#d7002f 291deg 300.7deg,#111 300.7deg 310.4deg,#d7002f 310.4deg 320.1deg,#111 320.1deg 329.8deg,#d7002f 329.8deg 339.5deg,#111 339.5deg 349.2deg,#d7002f 349.2deg 360deg);transition:transform 4s cubic-bezier(.08,.8,.15,1);box-shadow:inset 0 0 35px black,0 0 40px rgba(255,220,80,.7);position:relative}
.wheel:after{content:"WET";position:absolute;inset:50%;transform:translate(-50%,-50%);width:95px;height:95px;border-radius:50%;background:#111;border:7px solid #ffe76a;display:flex;align-items:center;justify-content:center;font-weight:900}
.wheel-num{position:absolute;left:50%;top:50%;font-size:13px;font-weight:900;text-shadow:0 2px 4px #000;transform:rotate(var(--a)) translateY(-165px) rotate(calc(var(--a) * -1))}
.board{display:grid;grid-template-columns:70px repeat(12,1fr);gap:5px}
.cell{min-height:48px;border-radius:10px;border:1px solid rgba(255,255,255,.35);display:flex;align-items:center;justify-content:center;font-weight:900;cursor:pointer;user-select:none}
.zero{grid-row:span 3;background:#008a3d}
.red{background:#c8002c}
.black{background:#111}
.selected{outline:4px solid #ffe76a;box-shadow:0 0 20px #ffe76a}
.bet-panel{margin-top:16px;display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}
.result{font-size:24px;font-weight:900;text-align:center}
.table{min-height:520px;border-radius:34px;background:radial-gradient(circle,#116b39,#063d22);border:10px solid #5b2b10;padding:30px;box-shadow:inset 0 0 50px rgba(0,0,0,.7)}
.table-row{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.hand-title{text-align:center;font-size:24px;font-weight:900}
.cards{display:flex;flex-direction:row;gap:12px;justify-content:center;flex-wrap:nowrap;overflow-x:auto;min-height:180px;padding:14px}
.card3d{min-width:105px;width:105px;height:155px;background:white;color:#111;border-radius:16px;display:flex;align-items:center;justify-content:center;font-size:34px;font-weight:900;box-shadow:0 18px 40px rgba(0,0,0,.45);animation:deal .45s ease both;text-align:center}
.card-red{color:#d7002f}
@keyframes deal{from{transform:translateX(-80px) rotate(-15deg);opacity:0}to{transform:none;opacity:1}}
.slot-machine{position:relative;max-width:560px;margin:20px auto;padding:34px 94px 34px 34px;border-radius:36px;background:linear-gradient(135deg,#ffcf32,#b00035,#3b006e);border:8px solid #ffe76a;box-shadow:0 30px 80px rgba(0,0,0,.55),inset 0 0 25px rgba(255,255,255,.35)}
.slots-title{text-align:center;font-size:30px;font-weight:900;color:#ffe76a;text-shadow:0 0 12px #000}
.reels{display:flex;gap:12px;justify-content:center;background:#120012;padding:18px;border-radius:24px;border:4px solid rgba(255,255,255,.25)}
.reel{width:105px;height:125px;border-radius:20px;background:white;color:#111;display:flex;align-items:center;justify-content:center;font-size:58px;box-shadow:inset 0 0 20px rgba(0,0,0,.3)}
.handle{position:absolute;right:18px;top:105px;width:32px;height:150px;background:linear-gradient(#ffe76a,#8b4d00);border-radius:20px;border:3px solid #2b1600}
.handle:before{content:"";position:absolute;left:50%;top:-42px;transform:translateX(-50%);width:58px;height:58px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff,#ff2c78 45%,#72002c);border:4px solid #ffe76a}
.handle.pull{animation:pull .45s ease}
@keyframes pull{50%{transform:translateY(70px)}}
.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:22px}
.leader-row,.admin-user{display:grid;grid-template-columns:70px 1fr;gap:12px;align-items:center;margin:10px 0;padding:12px;border-radius:18px;background:rgba(0,0,0,.25)}
.admin-user{grid-template-columns:70px 1fr;gap:14px}.admin-user input,.admin-user button{width:100%;margin:4px 0}
@media(max-width:900px){
html{font-size:20px}
.screen{padding:16px;align-items:flex-start}
.lobby{grid-template-columns:1fr}
.panel{padding:20px;border-radius:26px}
.roulette-layout,.table-row,.settings-grid{grid-template-columns:1fr}
.wheel{width:300px;height:300px}
.wheel-num{transform:rotate(var(--a)) translateY(-125px) rotate(calc(var(--a) * -1))}
.board{grid-template-columns:50px repeat(3,1fr)}
.cell{min-height:50px;font-size:16px}
.bet-panel,.mode-menu{grid-template-columns:1fr}
.reel{width:76px;height:100px;font-size:44px}
.slot-machine{padding:26px 70px 26px 18px}
.admin-user{grid-template-columns:60px 1fr}
}


/* FIX ADMIN + MONEY */
#profile {
  white-space: pre-line;
  font-size: 22px;
  font-weight: 800;
}

.admin-user {
  display: grid !important;
  grid-template-columns: 70px 1fr !important;
  gap: 14px !important;
  align-items: start !important;
  padding: 18px !important;
  margin: 16px 0 !important;
  border-radius: 24px !important;
  background: rgba(0,0,0,.35) !important;
}

.admin-user input {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  min-height: 56px !important;
  font-size: 22px !important;
  text-align: center !important;
}

.admin-user button {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  min-height: 62px !important;
  font-size: 22px !important;
  border-radius: 22px !important;
  margin: 6px 0 !important;
}

.admin-user img {
  width: 70px !important;
  height: 70px !important;
}

@media(max-width:900px) {
  .topbar {
    display: block !important;
    overflow: hidden !important;
  }

  .topbar button {
    width: 100% !important;
    margin-top: 14px !important;
  }

  .userbox {
    display: flex !important;
    align-items: center !important;
  }

  #profile {
    font-size: 24px !important;
    line-height: 1.35 !important;
  }
}


/* FULL MONEY FIX */
.money {
  color: #ffe76a !important;
  font-weight: 900 !important;
  text-shadow: 0 0 12px rgba(255, 231, 106, .45) !important;
}

#profile {
  font-size: 23px !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  word-break: break-word !important;
}

#profile b {
  color: white !important;
  font-size: 25px !important;
}

.admin-user {
  display: grid !important;
  grid-template-columns: 72px 1fr !important;
  gap: 14px !important;
  align-items: start !important;
  padding: 18px !important;
  margin: 18px 0 !important;
  border-radius: 26px !important;
  background: rgba(0,0,0,.35) !important;
}

.admin-user img {
  width: 72px !important;
  height: 72px !important;
  border-radius: 50% !important;
}

.admin-info {
  font-size: 20px !important;
  line-height: 1.35 !important;
}

.admin-user input,
.admin-user button {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  min-height: 58px !important;
  font-size: 21px !important;
  border-radius: 20px !important;
}

@media(max-width:900px) {
  .topbar {
    display: block !important;
  }

  .topbar button {
    width: 100% !important;
    margin-top: 16px !important;
  }

  .userbox {
    display: flex !important;
    align-items: center !important;
  }

  #profile {
    font-size: 24px !important;
  }

  #profile b {
    font-size: 27px !important;
  }
}


/* FIX LEADERBOARD AVATAR + POKER CARDS */
.leader-row {
  display: grid !important;
  grid-template-columns: 78px 1fr !important;
  align-items: center !important;
  min-height: 96px !important;
  overflow: hidden !important;
}

.leader-row img {
  width: 70px !important;
  height: 70px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

.cards {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  padding: 12px !important;
}

.card3d {
  min-width: 76px !important;
  width: 76px !important;
  height: 112px !important;
  font-size: 26px !important;
  border-radius: 14px !important;
  flex: 0 0 auto !important;
}

.table {
  overflow: hidden !important;
  padding: 18px !important;
}

@media(max-width:900px) {
  .table {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px !important;
  }

  .cards {
    gap: 8px !important;
  }

  .card3d {
    min-width: 68px !important;
    width: 68px !important;
    height: 102px !important;
    font-size: 23px !important;
  }
}

/* FIX POKER CARDS: второй ряд вместо ухода вбок */
.cards {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: flex-start !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  gap: 10px !important;
  min-height: auto !important;
}

.card3d {
  flex: 0 0 auto !important;
}

@media(max-width:900px) {
  .cards {
    flex-wrap: wrap !important;
    justify-content: center !important;
    overflow-x: hidden !important;
    gap: 8px !important;
  }

  .card3d {
    width: 64px !important;
    min-width: 64px !important;
    height: 96px !important;
    font-size: 22px !important;
  }
}


/* CHAT FIX */
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions button {
  width: auto;
}

.chat-layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
}

.chat-user {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin: 10px 0;
  border-radius: 20px;
  background: rgba(0,0,0,.28);
  cursor: pointer;
}

.chat-user img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffe76a;
}

.chat-messages {
  height: 430px;
  overflow-y: auto;
  padding: 16px;
  border-radius: 24px;
  background: rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.mine {
  align-self: flex-end;
  background: linear-gradient(135deg,#ffd84d,#ff2c78);
}

.other {
  align-self: flex-start;
  background: rgba(255,255,255,.18);
}

.chat-send {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  margin-top: 12px;
}

@media(max-width:900px) {
  .top-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .top-actions button {
    width: 100% !important;
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-send {
    grid-template-columns: 1fr;
  }

  .chat-messages {
    height: 360px;
  }

  .msg {
    max-width: 90%;
    font-size: 20px;
  }
}


/* MONEY TRANSFER CHAT */
.chat-send {
  grid-template-columns: 1fr 140px 170px !important;
}

.chat-send input {
  min-width: 0 !important;
}

.msg b {
  color: #ffe76a !important;
}

@media(max-width:900px) {
  .chat-send {
    grid-template-columns: 1fr !important;
  }
}


/* CHAT REMOVED */
.chat-layout,
.chat-user,
.chat-messages,
.chat-send,
#chats {
  display: none !important;
}

/* UNO */
.uno-table {
  min-height: 520px;
  border-radius: 34px;
  background: radial-gradient(circle, #1b7cff, #07142f);
  border: 8px solid #ffe76a;
  padding: 22px;
}

.uno-center {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.uno-hand,
.uno-enemy {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.uno-card {
  width: 86px;
  height: 126px;
  border-radius: 18px;
  border: 5px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: white;
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
  cursor: pointer;
}

.uno-card b {
  background: rgba(255,255,255,.92);
  color: #111;
  min-width: 54px;
  min-height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-18deg);
}

.uno-card.red { background: #e62828; }
.uno-card.yellow { background: #f5c400; }
.uno-card.green { background: #16a34a; }
.uno-card.blue { background: #2563eb; }
.uno-card.back {
  background: linear-gradient(135deg,#111,#ff2c78,#ffd84d);
}

@media(max-width:900px) {
  .uno-card {
    width: 66px;
    height: 98px;
    font-size: 20px;
    border-radius: 14px;
  }
}

/* SLOT ONLY HANDLE */
.slot-machine button[onclick="playSlots()"] {
  display: none !important;
}

.handle {
  cursor: pointer !important;
}

.uno-card {
  user-select: none !important;
}


/* UNO cards visual order fixed */

.uno-enemy {
  margin-bottom: 24px !important;
}

.uno-hand {
  margin-top: 24px !important;
}

/* room cards */

#roomPlayersList {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}



/* UNO ROOM 10 SEATS */
.room-players-grid {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 12px !important;
  margin: 18px 0 !important;
}

.room-seat {
  min-height: 125px;
  border-radius: 22px;
  background: rgba(0,0,0,.28);
  border: 2px solid rgba(255,255,255,.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 10px;
}

.room-seat img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffe76a;
}

.room-seat.empty {
  opacity: .55;
  border-style: dashed;
}

.room-seat.empty span {
  font-size: 38px;
  font-weight: 900;
  color: #ffe76a;
}

.uno-enemy {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 8px !important;
}

.uno-enemy .uno-card.back {
  width: 58px !important;
  height: 84px !important;
  font-size: 14px !important;
}

@media(max-width:900px) {
  .room-players-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .room-seat {
    min-height: 110px;
  }
}

/* Roulette visible final number */
#rouletteFinalNumber {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 105px !important;
  height: 105px !important;
  border-radius: 50% !important;
  background: #111 !important;
  border: 7px solid #ffe76a !important;
  color: white !important;
  font-size: 34px !important;
  font-weight: 900 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 5 !important;
  box-shadow: 0 0 25px rgba(255,231,106,.65) !important;
}

#rouletteFinalNumber small {
  font-size: 13px !important;
  color: #ffe76a !important;
}


/* FINAL 21 UI FIX */
#stakeBox[style*="display: none"] {
  display: none !important;
}

#after21Buttons button {
  width: 100% !important;
  margin-top: 10px !important;
}


/* STABLE 21 CARDS */
.stable21 .cards,
.stable-cards {
  min-height: 120px !important;
  max-height: none !important;
  overflow: visible !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
}

.stable21 .card3d {
  animation: none !important;
  transform: none !important;
}

.stable21 button:disabled {
  opacity: .45 !important;
  filter: grayscale(1) !important;
}

/* UNIFIED ROOMS */
.room-screen {
  border-radius: 34px;
  padding: 24px;
  border: 8px solid #ffe76a;
}

.room-screen.poker-room {
  background: radial-gradient(circle, #116b39, #063d22);
}

.room-screen.uno-room {
  background: radial-gradient(circle, #1b7cff, #07142f);
}

.room-title {
  text-align: center;
  font-size: 34px;
  font-weight: 900;
}

.room-qr {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.room-qr img {
  border-radius: 20px;
  border: 6px solid #ffe76a;
  background: white;
}

.room-link {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  font-size: 18px;
}

.room-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.room-note {
  text-align: center;
  font-weight: 900;
  color: #ffe76a;
}


/* READY STATUS FIX */
.room-screen .result:last-child {
  color: #ffe76a !important;
  font-weight: 900 !important;
}

/* SMOOTH 21 FIX */
.p21-board {
  min-height: 520px;
}

.p21-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.p21-card {
  animation: deal .28s ease both;
}

.p21-card.old {
  animation: none !important;
}

.p21-actions button:disabled {
  opacity: .45;
  filter: grayscale(1);
}


/* UNO +4 BLACK */
.uno-card.wild {
  background: #050505 !important;
  border-color: #ffe76a !important;
}

.uno-card.wild b {
  color: white !important;
  background: linear-gradient(135deg,#111,#333) !important;
  border: 3px solid #ffe76a !important;
}

/* safer poker buttons */
#p21EndBox button,
#after21Buttons button {
  width: 100% !important;
  min-height: 58px !important;
}


/* MINI GAMES */
.mini-panel {
  border-radius: 34px;
  padding: 24px;
  background: rgba(0,0,0,.35);
  border: 4px solid rgba(255,255,255,.25);
}

.mines-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-width: 520px;
  margin: 20px auto;
}

.mine-cell {
  aspect-ratio: 1/1;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  background: linear-gradient(135deg,#1b7cff,#7b2cff);
  font-size: 22px;
}

.mine-cell.opened {
  background: rgba(255,255,255,.9);
  color: #111;
}

.tetris-board {
  display: grid;
  grid-template-columns: repeat(10, 26px);
  grid-template-rows: repeat(18, 26px);
  gap: 3px;
  justify-content: center;
  margin: 20px auto;
  padding: 14px;
  border-radius: 22px;
  background: #070014;
  width: max-content;
}

.tetris-cell {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}

.tetris-cell.filled {
  background: linear-gradient(135deg,#ffe76a,#ff2c78);
  box-shadow: 0 0 12px rgba(255,231,106,.55);
}

.tetris-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 420px;
  margin: 12px auto;
}

@media(max-width:900px) {
  .tetris-board {
    grid-template-columns: repeat(10, 22px);
    grid-template-rows: repeat(18, 22px);
  }

  .tetris-cell {
    width: 22px;
    height: 22px;
  }

  .mine-cell {
    min-height: 38px;
    font-size: 18px;
  }
}
