:root {
  --bg: #0d111b;
  --ink: #111827;
  --muted: #6b7280;
  --panel: #ffffff;
  --line: #e5e7eb;
  --red: #ef4444;
  --green: #16a34a;
  --yellow: #f5b82e;
  --blue: #2563eb;
  --track: #fff8df;
  --shadow: 0 24px 70px rgba(3, 7, 18, 0.22);
}

@media (max-width: 620px) {
  .setup-screen {
    gap: 8px;
  }

  .setup-screen .section-title {
    margin-top: 0;
  }

  .setup-screen .section-title h2 {
    font-size: 16px;
  }

  .setup-header {
    grid-template-columns: 42px 1fr;
    min-height: 52px;
    gap: 8px;
    padding: 8px;
    border-radius: 15px;
  }

  .setup-header .dock-icon {
    width: 42px;
    min-height: 42px;
  }

  .setup-header span {
    font-size: 11px;
  }

  .setup-header h2 {
    font-size: 18px;
  }

  .player-select {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
  }

  .player-select button,
  .duration-chips button {
    min-height: 40px;
    font-size: 14px;
  }

  .player-select button b {
    font-size: 17px;
  }

  .player-select button span {
    font-size: 10px;
  }

  .duration-chips {
    gap: 6px;
  }

  .setup-screen .stake-grid {
    gap: 7px;
  }

  .setup-screen .stake-grid button {
    min-height: 44px;
    gap: 4px;
    padding: 0 4px;
    font-size: 15px;
  }

  .setup-screen .stake-grid button span {
    width: 20px;
    height: 20px;
  }

  .match-preview {
    gap: 8px;
    padding: 11px;
  }

  .match-preview > h2 {
    font-size: 18px;
  }

  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
  }

  .preview-details p {
    gap: 6px;
    min-height: 26px;
    font-size: 12px;
  }

  .preview-details strong {
    font-size: 13px;
  }

  .rules-summary {
    gap: 3px;
    font-size: 12px;
  }

  .rules-summary strong {
    font-size: 14px;
  }

  .setup-screen .gold-action {
    min-height: 52px;
    border-radius: 14px;
    font-size: 18px;
  }

  .wallet-actions {
    grid-template-columns: 1fr;
  }
}

/* Wallet payment help, referrals, and support center */
.common-player-header .avatar,
.profile-page-card .avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  line-height: 1;
  text-align: center;
}

#referralLabel small {
  color: #8fa5cc;
  font-size: 10px;
  font-weight: 600;
}

.payment-guide {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(111, 151, 219, 0.36);
  border-radius: 10px;
  background: rgba(7, 25, 53, 0.78);
}

.payment-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.payment-guide-head span {
  display: block;
  color: #8fa5cc;
  font-size: 8px;
  text-transform: uppercase;
}

.payment-guide-head h3 {
  margin: 2px 0 0;
  color: #fff;
  font-size: 13px;
}

.payment-guide-head > b {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid rgba(255, 199, 49, 0.5);
  border-radius: 7px;
  color: #ffda58;
  font-size: 9px;
  background: rgba(120, 75, 0, 0.24);
}

.payment-guide > p {
  margin: 0;
  color: #b8c7e2;
  font-size: 10px;
  line-height: 1.55;
}

.whatsapp-action {
  display: grid;
  min-height: 36px;
  place-items: center;
  border: 1px solid rgba(72, 215, 118, 0.52);
  border-radius: 8px;
  color: #9df0b7;
  background: rgba(20, 115, 58, 0.2);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.referral-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 199, 49, 0.42);
  border-radius: 10px;
  background: rgba(80, 52, 0, 0.2);
}

.referral-card span,
.referral-card strong {
  display: block;
}

.referral-card span {
  color: #91a6ca;
  font-size: 9px;
}

.referral-card strong {
  margin-top: 2px;
  color: #ffda58;
  font-size: 14px;
  letter-spacing: 1px;
}

.referral-card small {
  display: block;
  margin-top: 3px;
  color: #9caed0;
  font-size: 8px;
}

.referral-card button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(111, 151, 219, 0.46);
  border-radius: 7px;
  color: #fff;
  background: rgba(31, 83, 171, 0.3);
  font-size: 10px;
}

.support-center {
  display: grid;
  gap: 11px;
}

.support-center > p {
  margin: 0;
}

.support-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8299c1;
  font-size: 9px;
  text-transform: uppercase;
}

.support-divider::before,
.support-divider::after {
  height: 1px;
  flex: 1;
  content: "";
  background: rgba(111, 151, 219, 0.28);
}

.ticket-list {
  display: grid;
  gap: 8px;
}

.ticket-card {
  padding: 10px;
  border: 1px solid rgba(111, 151, 219, 0.3);
  border-radius: 9px;
  background: rgba(4, 18, 42, 0.64);
}

.ticket-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket-card strong {
  color: #fff;
  font-size: 11px;
}

.ticket-card em {
  color: #ffda58;
  font-size: 8px;
  font-style: normal;
  text-transform: uppercase;
}

.ticket-card small {
  display: block;
  margin-top: 3px;
  color: #8299c1;
  font-size: 8px;
}

.ticket-card p {
  margin: 7px 0 0;
  color: #b8c7e2;
  font-size: 10px;
  line-height: 1.45;
}

.ticket-reply {
  margin-top: 8px;
  padding: 8px;
  border-left: 2px solid #58d37a;
  background: rgba(28, 109, 51, 0.14);
}

.ticket-reply b {
  color: #8beaa7;
  font-size: 9px;
}

.status-in_progress { color: #68a8ff !important; }
.status-resolved { color: #80ed70 !important; }
.status-closed { color: #9caac2 !important; }

/* Full player pages: wallet, profile and notifications */
.common-player-header .home-profile-actions {
  display: flex;
}

.header-icon-button {
  position: relative;
  display: grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(137, 170, 229, 0.44);
  border-radius: 50%;
  color: #ffda58;
  background: rgba(7, 24, 55, 0.9);
  font-size: 19px;
}

.header-icon-button b {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border: 1px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #e53535;
  font-size: 9px;
}

.app-page {
  display: grid;
  width: min(375px, calc(100vw - 43px));
  margin-inline: auto;
  gap: 10px;
}

.app-page[hidden] {
  display: none;
}

.app-page-title {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-page-title span,
.app-page-title h2 {
  display: block;
  margin: 0;
}

.app-page-title span {
  color: #8fa5cc;
  font-size: 10px;
  text-transform: uppercase;
}

.app-page-title h2 {
  color: #ffda58;
  font-size: 20px;
}

.page-refresh-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 204, 64, 0.58);
  border-radius: 9px;
  color: #ffda58;
  background: rgba(8, 27, 56, 0.88);
  font-size: 17px;
}

.wallet-balance-card,
.profile-page-card,
.policy-content {
  border: 1px solid rgba(255, 204, 64, 0.48);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(15, 51, 101, 0.9), rgba(6, 22, 47, 0.96));
}

.wallet-balance-card {
  display: grid;
  gap: 3px;
  padding: 14px;
}

.wallet-balance-card span,
.wallet-balance-card small {
  color: #9eb1d4;
  font-size: 11px;
}

.wallet-balance-card strong {
  color: #ffdb59;
  font-size: 28px;
}

.page-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(106, 146, 214, 0.4);
  border-radius: 11px;
  background: rgba(5, 19, 42, 0.86);
}

.page-tabs button {
  min-height: 34px;
  padding: 0 6px;
  border-radius: 8px;
  color: #aebedf;
  background: transparent;
  font-size: 11px;
}

.page-tabs button.active {
  color: #241600;
  background: linear-gradient(#ffe16f, #e9a518);
}

.wallet-pane {
  display: grid;
  gap: 10px;
}

.wallet-pane[hidden] {
  display: none;
}

.wallet-method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.wallet-method-grid button {
  display: grid;
  min-height: 58px;
  place-items: center;
  gap: 3px;
  border: 1px solid rgba(104, 146, 219, 0.4);
  border-radius: 10px;
  color: #dce8ff;
  background: rgba(9, 31, 66, 0.8);
  font-size: 10px;
}

.wallet-method-grid button b {
  font-size: 17px;
}

.wallet-method-grid button.active {
  border-color: #ffc83d;
  color: #ffda58;
  box-shadow: 0 0 14px rgba(255, 194, 43, 0.18);
}

.deposit-qr-box {
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(116, 159, 233, 0.38);
  border-radius: 12px;
  background: rgba(7, 25, 53, 0.82);
}

.deposit-qr-box[hidden] {
  display: none;
}

.deposit-qr-box img,
#depositQrPlaceholder {
  width: 132px;
  height: 132px;
  border: 6px solid #fff;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

#depositQrPlaceholder {
  display: grid;
  place-items: center;
  color: #112244;
  font-size: 24px;
  font-weight: 900;
}

.deposit-qr-box strong {
  color: #fff;
  font-size: 12px;
}

.page-note {
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid #ffc83d;
  color: #aebedf;
  background: rgba(7, 25, 53, 0.62);
  font-size: 10px;
  line-height: 1.4;
}

.compact-form {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(116, 159, 233, 0.38);
  border-radius: 12px;
  background: rgba(7, 25, 53, 0.82);
}

.compact-form label {
  display: grid;
  gap: 5px;
  color: #9eb1d4;
  font-size: 10px;
}

.compact-form input,
.compact-form textarea {
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.compact-form textarea {
  min-height: 64px;
}

.compact-form button {
  min-height: 40px;
  font-size: 12px;
}

.transaction-list,
.notification-list,
.profile-menu {
  display: grid;
  gap: 7px;
}

.transaction-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(111, 151, 219, 0.34);
  border-radius: 10px;
  background: rgba(7, 25, 53, 0.78);
}

.transaction-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  font-weight: 900;
}

.transaction-icon.credit { color: #80ed70; background: rgba(44, 171, 67, 0.18); }
.transaction-icon.debit { color: #ff9d91; background: rgba(202, 58, 45, 0.18); }
.transaction-row strong,
.transaction-row small,
.transaction-amount b,
.transaction-amount em {
  display: block;
}
.transaction-row strong { color: #fff; font-size: 11px; text-transform: capitalize; }
.transaction-row small { margin-top: 2px; color: #8fa5cc; font-size: 9px; line-height: 1.3; }
.transaction-amount { text-align: right; }
.transaction-amount b { font-size: 11px; }
.transaction-amount b.credit { color: #80ed70; }
.transaction-amount b.debit { color: #ff9d91; }
.transaction-amount em { margin-top: 3px; font-size: 8px; font-style: normal; text-transform: uppercase; }
.status-approved, .status-completed { color: #80ed70; }
.status-pending { color: #ffda58; }
.status-rejected { color: #ff9d91; }

.profile-page-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.profile-page-card .avatar {
  width: 46px;
  height: 46px;
  font-size: 23px;
}

.profile-page-card strong,
.profile-page-card span {
  display: block;
}

.profile-page-card strong { color: #fff; font-size: 14px; }
.profile-page-card span:not(.avatar) { color: #8fa5cc; font-size: 10px; }
.profile-page-card b { color: #ffda58; font-size: 14px; }

.profile-menu button {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border: 1px solid rgba(111, 151, 219, 0.34);
  border-radius: 10px;
  color: #e3edff;
  background: rgba(7, 25, 53, 0.78);
  font-size: 12px;
}

.profile-menu button b {
  color: #ffda58;
  font-size: 20px;
}

.policy-content {
  padding: 12px;
}

.policy-content h3 {
  margin-bottom: 7px;
  font-size: 14px;
}

.policy-content p {
  margin: 0;
  color: #afbedb;
  font-size: 10px;
  line-height: 1.5;
}

.profile-logout-button {
  min-height: 40px;
  border: 1px solid rgba(255, 106, 94, 0.45);
  color: #ffc1ba;
  background: rgba(149, 36, 31, 0.25);
  font-size: 12px;
}

.notification-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  padding: 10px;
  border: 1px solid rgba(111, 151, 219, 0.34);
  border-radius: 10px;
  color: inherit;
  text-align: left;
  background: rgba(7, 25, 53, 0.78);
}

.notification-card.unread {
  border-color: rgba(255, 204, 64, 0.72);
  box-shadow: inset 3px 0 0 #ffc83d;
}

.notification-card img {
  width: 100%;
  max-height: 150px;
  border-radius: 7px;
  object-fit: cover;
}

.notification-card strong,
.notification-card small {
  display: block;
}

.notification-card strong { color: #fff; font-size: 12px; }
.notification-card small { margin-top: 2px; color: #8fa5cc; font-size: 9px; }
.notification-card p { margin: 6px 0 0; color: #bdc9df; font-size: 10px; line-height: 1.4; }
.page-empty { padding: 24px 10px; color: #8295b8; font-size: 11px; text-align: center; }

/* Compact 50px bottom navigation */
.bottom-nav {
  min-height: 50px;
  height: 50px;
  padding: 4px 8px;
  border-radius: 16px;
}

.bottom-nav button {
  min-height: 42px;
  font-size: 18px;
  line-height: 1;
}

.bottom-nav button span {
  font-size: 10px;
  line-height: 1;
}

.bottom-nav .nav-dashboard {
  top: -15px;
  width: 54px;
  height: 54px;
  min-height: 54px;
  font-size: 20px;
}

.bottom-nav .nav-dashboard span {
  top: 54px;
  width: 78px;
  font-size: 10px;
}

.lobby {
  padding-bottom: 70px;
}

@media (max-width: 620px) {
  .bottom-nav {
    min-height: 50px;
    height: 50px;
    width: min(360px, calc(100vw - 20px));
  }
}

/* Final dashboard priority overrides */
.lobby {
  max-width: 430px;
  gap: 18px;
  padding: 44px 16px 100px;
}

.home-screen {
  gap: 22px;
}

.home-profile.compact-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 128px;
  padding: 22px 24px;
  border: 2px solid rgba(255, 205, 75, 0.76);
  border-radius: 34px;
}

.home-profile .avatar {
  width: 88px;
  height: 88px;
  font-size: 52px;
}

.online-dot {
  left: 72px;
  width: 28px;
  height: 28px;
}

.home-profile .profile-chip strong {
  font-size: 32px;
}

.home-profile .profile-chip span:not(.avatar):not(.online-dot) {
  font-size: 20px;
}

.mode-grid {
  gap: 16px;
}

.mode-card {
  min-height: 166px;
  padding: 16px 12px 14px;
}

.mode-card strong {
  font-size: 26px;
}

.mode-visual {
  width: 108px;
  height: 72px;
}

.bottom-nav {
  width: min(392px, calc(100vw - 28px));
}

.legal-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0 10px;
}

.legal-links a {
  color: rgba(225, 235, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 620px) {
  .lobby {
    max-width: 390px;
    gap: 16px;
    padding: 28px 14px 96px;
  }

  .home-screen {
    gap: 16px;
  }

  .home-profile.compact-profile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 140px;
    padding: 18px;
  }

  .home-profile-actions {
    justify-content: end;
  }

  .home-profile .avatar {
    width: 76px;
    height: 76px;
    font-size: 44px;
  }

  .online-dot {
    left: 61px;
    width: 25px;
    height: 25px;
  }

  .home-profile .profile-chip strong {
    font-size: 28px;
  }

  .home-profile .profile-chip span:not(.avatar):not(.online-dot) {
    font-size: 18px;
  }

  .mode-grid {
    gap: 12px;
  }

  .mode-card {
    min-height: 152px;
    padding: 13px 8px;
  }

  .mode-card strong {
    font-size: 22px;
  }

  .mode-visual {
    width: 92px;
    height: 64px;
  }

  .bottom-nav {
    width: min(360px, calc(100vw - 28px));
  }
}

/* Mode card icon/text balance */
.mode-card {
  align-content: start;
  grid-template-rows: 58px auto auto;
  min-height: 150px;
  gap: 7px;
  padding-top: 12px;
}

.mode-visual {
  width: 82px;
  height: 58px;
  align-self: start;
}

.mode-visual img {
  max-height: 62px;
}

.mode-dice-img {
  width: 58px;
}

.mode-pawn-img.single {
  height: 62px;
}

.mode-pawn-pair {
  width: 82px;
  height: 60px;
}

.mode-pawn-pair img {
  width: 43px;
}

.mode-pawn-pair img + img {
  margin-left: -12px;
}

.mini-board-icon {
  grid-template-columns: repeat(2, 22px);
  grid-template-rows: repeat(2, 22px);
  gap: 3px;
  padding: 6px;
  border-radius: 12px;
}

.mode-card strong {
  position: relative;
  z-index: 2;
  font-size: 22px;
  line-height: 1.05;
}

.mode-card small,
.time-chips {
  position: relative;
  z-index: 2;
}

.mode-card small {
  font-size: 14px;
}

.time-chips {
  max-width: 138px;
  gap: 4px;
}

.time-chips em {
  min-height: 28px;
  font-size: 13px;
}

@media (max-width: 620px) {
  .mode-card {
    grid-template-rows: 52px auto auto;
    min-height: 136px;
    gap: 6px;
    padding-top: 10px;
  }

  .mode-visual {
    width: 72px;
    height: 52px;
  }

  .mode-visual img {
    max-height: 56px;
  }

  .mode-dice-img {
    width: 52px;
  }

  .mode-pawn-img.single {
    height: 56px;
  }

  .mode-pawn-pair {
    width: 72px;
    height: 54px;
  }

  .mode-pawn-pair img {
    width: 38px;
  }

  .mini-board-icon {
    grid-template-columns: repeat(2, 19px);
    grid-template-rows: repeat(2, 19px);
  }

  .mode-card strong {
    font-size: 19px;
  }

  .mode-card small {
    font-size: 12px;
  }

  .time-chips {
    max-width: 124px;
  }

  .time-chips em {
    min-height: 26px;
    font-size: 12px;
  }
}

/* Keep mode artwork clear of labels */
.mode-card {
  grid-template-rows: 48px auto auto;
  gap: 10px;
}

.mode-visual {
  width: 70px;
  height: 48px;
}

.mode-visual img {
  max-height: 48px;
}

.mode-dice-img {
  width: 46px;
}

.mode-pawn-img.single {
  height: 48px;
}

.mode-pawn-pair {
  width: 68px;
  height: 48px;
}

.mode-pawn-pair img {
  width: 32px;
}

.mini-board-icon {
  grid-template-columns: repeat(2, 16px);
  grid-template-rows: repeat(2, 16px);
  gap: 3px;
  padding: 5px;
  border-width: 2px;
}

@media (max-width: 620px) {
  .mode-card {
    grid-template-rows: 44px auto auto;
    gap: 9px;
  }

  .mode-visual {
    width: 64px;
    height: 44px;
  }

  .mode-visual img {
    max-height: 44px;
  }

  .mode-dice-img {
    width: 42px;
  }

  .mode-pawn-img.single {
    height: 44px;
  }

  .mode-pawn-pair {
    width: 64px;
    height: 44px;
  }

  .mode-pawn-pair img {
    width: 30px;
  }

  .mini-board-icon {
    grid-template-columns: repeat(2, 15px);
    grid-template-rows: repeat(2, 15px);
  }
}

/* Premium lobby refresh */
.lobby {
  max-width: 430px;
  gap: 18px;
  padding: 44px 16px 100px;
}

.home-screen {
  gap: 22px;
}

.home-profile.compact-profile {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 128px;
  padding: 22px 24px;
  overflow: hidden;
  border: 2px solid rgba(255, 205, 75, 0.76);
  border-radius: 34px;
  background:
    radial-gradient(circle at 70% 0, rgba(25, 106, 230, 0.34), transparent 34%),
    linear-gradient(145deg, rgba(14, 53, 115, 0.98), rgba(3, 14, 34, 0.99));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07) inset, 0 24px 44px rgba(0, 0, 0, 0.42), 0 0 30px rgba(255, 194, 52, 0.18);
}

.home-profile.compact-profile::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.11) 1px, transparent 1px);
  background-size: 12px 12px;
  opacity: 0.14;
  pointer-events: none;
}

.home-profile .profile-chip {
  gap: 16px;
  z-index: 1;
}

.home-profile .avatar {
  width: 88px;
  height: 88px;
  border: 4px solid #ffd95c;
  font-size: 52px;
  box-shadow: 0 9px 0 rgba(61, 34, 5, 0.78), 0 0 20px rgba(255, 208, 75, 0.28);
}

.online-dot {
  left: 72px;
  bottom: 2px;
  width: 28px;
  height: 28px;
  border-color: #07172f;
  box-shadow: 0 0 0 4px rgba(24, 204, 75, 0.12);
}

.home-profile .profile-chip strong {
  max-width: 142px;
  font-size: 32px;
  line-height: 1.05;
}

.home-profile .profile-chip span:not(.avatar):not(.online-dot) {
  margin-top: 5px;
  font-size: 20px;
}

.home-profile-actions {
  position: relative;
  z-index: 1;
}

.socket-pill {
  display: none;
}

.coin-pill {
  min-height: 52px;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid rgba(166, 185, 221, 0.38);
  background: linear-gradient(180deg, rgba(24, 37, 65, 0.98), rgba(5, 13, 27, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 20px rgba(0, 0, 0, 0.35);
}

.coin-pill span {
  width: 34px;
  height: 34px;
  background:
    radial-gradient(circle at 35% 30%, #fff7a9 0 17%, #ffd13b 18% 62%, #a15f00 63%),
    #ffc83d;
  box-shadow: inset 0 0 0 3px #ffb923;
}

.coin-pill b {
  font-size: 22px;
}

.section-title {
  gap: 10px;
}

.section-title h2 {
  color: #ffe2a3;
  font-size: 27px;
  text-shadow: 0 2px 0 #5d3300, 0 0 16px rgba(255, 203, 67, 0.22);
}

.section-title span {
  background: linear-gradient(90deg, transparent, rgba(255, 207, 77, 0.82));
}

.section-title span:last-child {
  background: linear-gradient(90deg, rgba(255, 207, 77, 0.82), transparent);
}

.mode-grid {
  gap: 16px;
}

.mode-card {
  min-height: 166px;
  gap: 9px;
  padding: 16px 12px 14px;
  align-content: center;
  border-color: rgba(92, 135, 211, 0.92);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 24%, rgba(23, 124, 255, 0.42), transparent 38%),
    linear-gradient(180deg, rgba(8, 56, 124, 0.98), rgba(4, 19, 45, 0.99));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06), 0 16px 28px rgba(0, 0, 0, 0.28);
}

.mode-card.active {
  border-color: #ffd95c;
  box-shadow: 0 0 24px rgba(255, 204, 54, 0.46), inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.mode-card.active::after {
  content: "♛";
  position: absolute;
  right: 0;
  top: 0;
  display: grid;
  width: 52px;
  height: 50px;
  place-items: center;
  border-left: 1px solid rgba(255, 217, 92, 0.32);
  border-bottom: 1px solid rgba(255, 217, 92, 0.32);
  border-radius: 0 20px 0 18px;
  color: #ffd95c;
  background: rgba(12, 29, 58, 0.74);
  font-size: 28px;
}

.mode-card strong {
  font-size: 26px;
  line-height: 1.05;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.36);
}

.mode-card small {
  font-size: 16px;
  color: rgba(206, 221, 255, 0.78);
}

.mode-visual {
  width: 108px;
  height: 72px;
  overflow: visible;
  border-radius: 0;
  background: radial-gradient(ellipse at center, rgba(23, 124, 255, 0.28), transparent 62%);
  box-shadow: none;
}

.mode-visual img {
  display: block;
  max-width: 100%;
  max-height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 14px 11px rgba(0, 0, 0, 0.42));
}

.mode-dice-img {
  width: 84px;
  transform: rotate(-8deg);
}

.mode-pawn-img.single {
  height: 92px;
}

.mode-pawn-pair {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 118px;
  height: 96px;
}

.mode-pawn-pair img {
  width: 64px;
  height: auto;
}

.mode-pawn-pair img + img {
  margin-left: -18px;
  transform: translateY(2px);
}

.mini-board-icon {
  display: grid;
  grid-template-columns: repeat(2, 34px);
  grid-template-rows: repeat(2, 34px);
  gap: 4px;
  padding: 8px;
  border: 3px solid #d8a846;
  border-radius: 16px;
  background: #efe5ca;
  transform: rotate(4deg);
  box-shadow: 0 12px 13px rgba(0, 0, 0, 0.34);
}

.mini-board-icon i {
  border-radius: 5px;
}

.mini-board-icon i:nth-child(1) { background: #ed321f; }
.mini-board-icon i:nth-child(2) { background: #11a346; }
.mini-board-icon i:nth-child(3) { background: #0872ce; }
.mini-board-icon i:nth-child(4) { background: #ffc526; }

.time-chips {
  max-width: 178px;
  margin-top: 2px;
}

.time-chips em {
  min-height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-radius: 12px;
  font-size: 16px;
}

.time-chips em.active {
  color: #2d1b00;
  border-color: #fff6c8;
  background: linear-gradient(#fff3a5, #ffc331 62%, #ce7d08);
  box-shadow: 0 0 18px rgba(255, 198, 37, 0.72);
}

.room-list-panel {
  min-height: 196px;
  padding: 20px;
  border-color: rgba(100, 141, 215, 0.78);
  border-radius: 26px;
  background:
    radial-gradient(circle at 84% 12%, rgba(30, 103, 219, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(8, 41, 92, 0.98), rgba(3, 17, 42, 0.99));
}

.room-list-panel .panel-head h2 {
  font-size: 24px;
}

.room-list-panel .icon-button {
  width: 54px;
  min-height: 54px;
  border: 1px solid rgba(255, 212, 92, 0.48);
  border-radius: 18px;
  color: #ffd95c;
  background: linear-gradient(180deg, rgba(57, 49, 35, 0.96), rgba(15, 21, 34, 0.98));
  font-size: 28px;
}

.room-list .hint {
  display: grid;
  min-height: 84px;
  place-items: center;
  color: rgba(183, 200, 239, 0.52);
  font-size: 16px;
}

.bottom-nav {
  bottom: 14px;
  width: min(392px, calc(100vw - 28px));
  border-color: rgba(75, 113, 185, 0.78);
  border-radius: 24px;
  background: rgba(5, 18, 42, 0.96);
}

.bottom-nav button {
  min-height: 72px;
  color: rgba(184, 202, 240, 0.62);
}

.bottom-nav button.active {
  color: #ffd95c;
}

.bottom-nav button.active::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-bottom: -2px;
  border-radius: 50%;
  background: #ffc536;
  box-shadow: 0 0 18px #ffc536;
}

@media (max-width: 620px) {
  .lobby {
    max-width: 390px;
    gap: 16px;
    padding: 28px 14px 96px;
  }

  .home-screen {
    gap: 16px;
  }

  .home-profile.compact-profile {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 140px;
    padding: 18px 18px;
  }

  .home-profile-actions {
    justify-content: end;
  }

  .home-profile .avatar {
    width: 76px;
    height: 76px;
    font-size: 44px;
  }

  .online-dot {
    left: 61px;
    width: 25px;
    height: 25px;
  }

  .home-profile .profile-chip strong {
    font-size: 28px;
  }

  .home-profile .profile-chip span:not(.avatar):not(.online-dot) {
    font-size: 18px;
  }

  .coin-pill {
    min-height: 46px;
    padding: 0 14px;
  }

  .coin-pill span {
    width: 30px;
    height: 30px;
  }

  .coin-pill b {
    font-size: 19px;
  }

  .section-title h2 {
    font-size: 23px;
  }

  .mode-grid {
    gap: 12px;
  }

  .mode-card {
    min-height: 152px;
    padding: 13px 8px;
  }

  .mode-card strong {
    font-size: 22px;
  }

  .mode-card small {
    font-size: 14px;
  }

  .mode-visual {
    width: 92px;
    height: 64px;
  }

  .mode-pawn-img.single {
    height: 80px;
  }

  .mode-pawn-pair img {
    width: 55px;
  }

  .mini-board-icon {
    grid-template-columns: repeat(2, 27px);
    grid-template-rows: repeat(2, 27px);
  }

  .room-list-panel {
    min-height: 176px;
  }

  .bottom-nav {
    width: min(360px, calc(100vw - 28px));
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 15%, rgba(239, 68, 68, 0.22), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(37, 99, 235, 0.22), transparent 28%),
    radial-gradient(circle at 52% 88%, rgba(22, 163, 74, 0.2), transparent 30%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: #111827;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  padding: 0 15px;
  color: var(--ink);
  background: #f8fafc;
  outline: none;
  font-weight: 750;
}

input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 8vw, 42px);
  line-height: 0.95;
  color: #fff;
  max-width: 260px;
}

h2 {
  font-size: 18px;
  line-height: 1.15;
}

.shell {
  width: min(1220px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.auth-view {
  display: grid;
  min-height: calc(100vh - 36px);
  place-items: center;
}

.phone-card {
  width: min(430px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  background: #f8fafc;
  box-shadow: var(--shadow);
}

.auth-hero {
  position: relative;
  min-height: 240px;
  padding: 24px;
  overflow: hidden;
  background: linear-gradient(145deg, #111827 0%, #1f2937 55%, #0f172a 100%);
}

.brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: end;
  gap: 14px;
  height: 100%;
}

.brand p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 650;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: conic-gradient(from 45deg, var(--red), var(--yellow), var(--green), var(--blue), var(--red));
  font-size: 34px;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.hero-board {
  position: absolute;
  inset: 28px 18px auto auto;
  display: grid;
  width: 132px;
  aspect-ratio: 1;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  transform: rotate(10deg);
  opacity: 0.82;
}

.hero-cell {
  border-radius: 20px;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.72);
}

.hero-cell.red {
  background: var(--red);
}

.hero-cell.green {
  background: var(--green);
}

.hero-cell.blue {
  background: var(--blue);
}

.hero-cell.yellow {
  background: var(--yellow);
}

.hero-dice {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  color: #111827;
  background: #fff;
  font-size: 28px;
  font-weight: 950;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.3);
}

.auth-panel {
  display: grid;
  gap: 15px;
  padding: 18px;
}

.auth-tabs,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 5px;
  border-radius: 17px;
  background: #e8edf5;
}

.segmented {
  grid-template-columns: repeat(3, 1fr);
}

.auth-tabs button,
.segmented button {
  min-height: 44px;
  color: #475569;
  background: transparent;
  border-radius: 13px;
}

.auth-tabs button.active,
.segmented button.active {
  color: #fff;
  background: #111827;
  box-shadow: 0 10px 18px rgba(17, 24, 39, 0.18);
}

.form-title {
  display: grid;
  gap: 5px;
}

label {
  display: grid;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 850;
}

.hint,
.status,
.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.primary-action {
  background: linear-gradient(135deg, #111827, #334155);
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.2);
}

.app-view {
  display: grid;
  gap: 16px;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  color: #fff;
  background: rgba(17, 24, 39, 0.86);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.profile-chip,
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-chip strong {
  display: block;
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip span:not(.avatar) {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--yellow), var(--red));
  color: #fff;
  font-size: 18px;
  font-weight: 950;
}

.coin-pill,
.socket-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  white-space: nowrap;
}

.coin-pill span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6bd, var(--yellow) 55%, #ba7800);
}

.socket-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
}

.socket-pill.online span {
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
}

.socket-pill b,
.coin-pill b {
  font-size: 13px;
}

.lobby {
  display: grid;
  max-width: 760px;
  margin: 0 auto;
  gap: 14px;
  padding: 8px 0 96px;
  color: #fff;
}

.home-screen,
.setup-screen {
  display: grid;
  gap: 14px;
}

.home-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 3px;
  border: 1px solid rgba(93, 150, 255, 0.62);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(8, 24, 48, 0.98), rgba(4, 13, 28, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 14px 30px rgba(0, 0, 0, 0.3);
}

.home-tabs button {
  min-height: 56px;
  border-radius: 24px;
  color: rgba(255, 255, 255, 0.45);
  background: transparent;
  font-size: 24px;
}

.home-tabs button.active {
  color: #fff;
  border: 2px solid #f6c343;
  background: linear-gradient(180deg, #1f67f2, #0f3995);
  box-shadow: 0 0 18px rgba(255, 201, 57, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.home-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 104px;
  padding: 18px 22px;
  border: 1px solid rgba(139, 169, 224, 0.42);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(17, 43, 82, 0.94), rgba(7, 18, 37, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 16px 32px rgba(0, 0, 0, 0.28);
}

.compact-profile {
  min-height: 82px;
  padding: 12px 16px;
}

.home-profile .profile-chip {
  position: relative;
}

.home-profile .avatar {
  width: 58px;
  height: 58px;
  border: 3px solid #ffd44f;
  border-radius: 50%;
  font-size: 28px;
  background: linear-gradient(145deg, #ff8c32, #c93a1d);
}

.online-dot {
  position: absolute;
  left: 43px;
  bottom: 2px;
  width: 20px;
  height: 20px;
  border: 3px solid #0a1830;
  border-radius: 50%;
  background: #23c145;
}

.home-profile .profile-chip strong {
  max-width: 260px;
  color: #fff;
  font-size: 23px;
}

.home-profile .profile-chip span:not(.avatar):not(.online-dot) {
  color: rgba(211, 224, 255, 0.72);
  font-size: 17px;
}

.home-profile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-button {
  display: grid;
  width: 64px;
  min-height: 64px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: #e8f1ff;
  background: rgba(11, 29, 57, 0.9);
  font-size: 30px;
}

.refer-banner {
  display: grid;
  grid-template-columns: 86px 1fr 34px;
  align-items: center;
  gap: 18px;
  min-height: 104px;
  padding: 14px 22px;
  border: 2px solid #d99f2b;
  border-radius: 20px;
  color: #fff;
  text-align: left;
  background: linear-gradient(135deg, rgba(0, 75, 171, 0.98), rgba(7, 28, 61, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.refer-icon {
  display: grid;
  width: 78px;
  height: 72px;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(33, 118, 224, 0.7), rgba(2, 20, 42, 0.75));
  font-size: 38px;
}

.refer-banner strong {
  display: block;
  font-size: 25px;
}

.refer-banner span:not(.refer-icon) {
  display: block;
  margin-top: 4px;
  color: rgba(224, 233, 255, 0.82);
  font-size: 18px;
  font-weight: 650;
}

.refer-banner b {
  color: rgba(255, 255, 255, 0.85);
  font-size: 50px;
}

.section-title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-align: center;
}

.section-title span {
  height: 1px;
  background: linear-gradient(90deg, transparent, #b98223 50%, transparent);
}

.section-title span::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: -4px auto 0;
  transform: rotate(45deg);
  background: #ffc13c;
}

.section-title h2 {
  font-size: 23px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.section-title.small h2 {
  font-size: 20px;
}

.home-mode-wrap {
  display: grid;
  gap: 12px;
}

.eyebrow,
.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.eyebrow {
  color: #111827;
  background: rgba(255, 255, 255, 0.84);
}

.mini-badge {
  color: #475569;
  background: #eef2f7;
}

.stake-box {
  display: grid;
  place-items: center;
  min-width: 96px;
  min-height: 96px;
  border-radius: 26px;
  color: #111827;
  background: #fff;
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.2);
}

.stake-box span {
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
}

.stake-box strong {
  font-size: 34px;
  line-height: 1;
}

.action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  border: 1px solid rgba(105, 138, 198, 0.48);
  border-radius: 22px;
  padding: 16px;
  color: #fff;
  background: linear-gradient(180deg, rgba(14, 38, 76, 0.96), rgba(5, 17, 36, 0.96));
  box-shadow: 0 18px 42px rgba(3, 7, 18, 0.22);
}

.create-room,
.join-room {
  display: grid;
  align-content: start;
  gap: 14px;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.icon-button {
  display: grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: #eef2f7;
  font-size: 21px;
}

.room-list-panel {
  min-height: 190px;
}

.mode-panel,
.redeem-panel {
  display: grid;
  gap: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-card {
  position: relative;
  display: grid;
  min-height: 138px;
  align-content: end;
  justify-items: center;
  gap: 8px;
  padding: 12px 10px;
  overflow: hidden;
  color: #fff;
  text-align: center;
  border: 2px solid rgba(131, 166, 232, 0.64);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(19, 62, 126, 0.92), rgba(7, 24, 49, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.mode-card strong {
  font-size: 19px;
}

.mode-card small {
  color: rgba(229, 238, 255, 0.74);
  font-size: 13px;
  font-weight: 750;
}

.mode-visual {
  display: grid;
  width: 68px;
  height: 54px;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(145deg, #2c8bff, #051a34);
  font-size: 32px;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.28);
}

.time-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.time-chips em {
  display: grid;
  min-height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 10px;
  color: #fff;
  background: rgba(4, 15, 31, 0.42);
  font-style: normal;
  font-weight: 900;
}

.setup-header {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(105, 138, 198, 0.48);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(14, 38, 76, 0.96), rgba(5, 17, 36, 0.96));
}

.setup-header span {
  color: rgba(224, 234, 255, 0.64);
  font-size: 13px;
  font-weight: 800;
}

.setup-header h2 {
  margin-top: 2px;
  color: #fff;
  font-size: 25px;
}

.mode-card.active {
  border-color: #ffd554;
  box-shadow: 0 0 24px rgba(255, 205, 55, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.time-chips em.active {
  color: #3b2600;
  background: linear-gradient(#ffe36e, #f2b11e);
  box-shadow: 0 0 16px rgba(255, 205, 55, 0.44);
}

.mode-card.active span {
  color: #fff;
}

.duration-wrap {
  display: grid;
  gap: 8px;
}

.duration-wrap > span {
  color: #475569;
  font-size: 13px;
  font-weight: 850;
}

.mini-action {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #111827;
  background: #ffd66c;
}

.rejoin-action {
  justify-self: center;
  min-height: 44px;
  padding: 0 22px;
}

.player-select,
.stake-grid,
.duration-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 5px;
  border: 1px solid rgba(132, 164, 224, 0.45);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(12, 32, 64, 0.95), rgba(5, 17, 35, 0.95));
}

.player-select button,
.stake-grid button,
.duration-chips button {
  min-height: 58px;
  border: 1px solid rgba(133, 169, 231, 0.42);
  border-radius: 14px;
  color: rgba(225, 235, 255, 0.72);
  background: rgba(15, 43, 83, 0.72);
  font-size: 20px;
}

.player-select button.active,
.stake-grid button.active,
.duration-chips button.active {
  color: #ffd95c;
  border-color: #ffc23b;
  background: linear-gradient(180deg, rgba(20, 58, 110, 0.96), rgba(6, 22, 45, 0.96));
  box-shadow: 0 0 18px rgba(255, 200, 48, 0.26), inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.stake-grid {
  grid-template-columns: repeat(4, 1fr);
  padding: 0;
  border: 0;
  background: transparent;
}

.point-duration-setup {
  display: grid;
  gap: 12px;
}

.stake-grid button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 66px;
  font-size: 24px;
}

.stake-grid button span,
.preview-details p span:first-child::before {
  display: inline-block;
}

.stake-grid button span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7b8 0 18%, #ffd33d 19% 60%, #c17900 61%);
  box-shadow: inset 0 0 0 3px #ffb41f;
}

.match-preview {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(108, 145, 211, 0.5);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(12, 39, 80, 0.96), rgba(5, 17, 36, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 38px rgba(0, 0, 0, 0.3);
}

.match-preview > h2 {
  font-size: 24px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 170px;
  gap: 18px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid rgba(142, 172, 225, 0.36);
  border-radius: 18px;
  background: rgba(9, 27, 55, 0.66);
}

.preview-details {
  display: grid;
  align-content: center;
  gap: 10px;
}

.preview-details p,
.modal-details p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 14px;
  min-height: 38px;
  margin: 0;
  color: rgba(227, 237, 255, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-details strong,
.modal-details b {
  color: #fff;
  font-size: 18px;
}

.modal-details p span,
.modal-details b {
  min-width: 0;
}

.modal-details b {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-art {
  position: relative;
  min-height: 150px;
  overflow: hidden;
}

.mini-piece,
.mini-dice {
  position: absolute;
  display: grid;
  place-items: center;
}

.mini-piece {
  bottom: 20px;
  width: 56px;
  height: 90px;
  border: 4px solid #f8c943;
  border-radius: 50% 50% 42% 42%;
  box-shadow: 0 12px 0 rgba(73, 43, 6, 0.9), inset 0 12px 18px rgba(255, 255, 255, 0.34);
}

.mini-piece.blue {
  left: 28px;
  background: radial-gradient(circle at 35% 20%, #fff 0 10%, #55bfff 11% 32%, #0868c5 72%);
}

.mini-piece.red {
  right: 18px;
  background: radial-gradient(circle at 35% 20%, #fff 0 10%, #ff7464 11% 32%, #c51b14 72%);
}

.mini-dice {
  left: 62px;
  bottom: 0;
  width: 70px;
  height: 70px;
  border: 4px solid #e6c06b;
  border-radius: 16px;
  color: #15100a;
  background: linear-gradient(145deg, #fff9e6, #cda969);
  font-size: 38px;
  font-weight: 950;
  transform: rotate(-10deg);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.36);
}

.rules-summary {
  display: grid;
  gap: 7px;
  padding-top: 4px;
  color: rgba(227, 237, 255, 0.78);
}

.rules-summary strong {
  color: #ffd454;
  font-size: 18px;
}

.rules-summary span::before,
.modal-rules span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #ffc23b;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}

.single-action {
  grid-template-columns: 1fr;
}

.blue-action {
  min-height: 72px;
  border: 2px solid #79aaff;
  border-radius: 14px;
  background: linear-gradient(#2f7cff, #0d43b2);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), 0 8px 18px rgba(0, 0, 0, 0.3);
  font-size: 22px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 8px;
  z-index: 45;
  display: grid;
  width: min(760px, calc(100vw - 20px));
  grid-template-columns: repeat(5, 1fr);
  transform: translateX(-50%);
  border: 1px solid rgba(120, 151, 207, 0.42);
  border-radius: 22px;
  background: rgba(6, 20, 42, 0.95);
  box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  display: grid;
  min-height: 70px;
  place-items: center;
  gap: 3px;
  color: rgba(222, 233, 255, 0.56);
  background: transparent;
  font-size: 25px;
}

.bottom-nav button span {
  font-size: 13px;
}

.bottom-nav button.active {
  color: #ffd54f;
  text-shadow: 0 0 14px rgba(255, 208, 50, 0.52);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background: rgba(0, 8, 20, 0.78);
  backdrop-filter: blur(8px);
}

.history-sheet {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  align-items: end;
  padding: 16px 16px 96px;
  background: rgba(0, 8, 20, 0.66);
  backdrop-filter: blur(7px);
  pointer-events: none;
}

.history-panel {
  width: min(560px, 100%);
  max-height: min(78vh, 680px);
  margin: 0 auto;
  overflow: auto;
  border: 1px solid rgba(120, 151, 207, 0.46);
  border-radius: 24px;
  padding: 18px;
  color: #fff;
  background: linear-gradient(180deg, rgba(14, 38, 76, 0.98), rgba(5, 17, 36, 0.99));
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.42);
  pointer-events: auto;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(137, 170, 229, 0.38);
  border-radius: 16px;
  background: rgba(8, 27, 56, 0.72);
}

.history-item strong,
.history-item span {
  display: block;
  min-width: 0;
}

.history-item span {
  margin-top: 4px;
  color: rgba(224, 234, 255, 0.66);
  font-size: 13px;
}

.history-item b {
  color: #75e66a;
  font-size: 20px;
}

.history-item.loss b {
  color: #ff746e;
}

.nav-summary {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(255, 204, 64, 0.46);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(16, 51, 101, 0.86), rgba(7, 24, 50, 0.94));
}

.nav-summary span {
  color: rgba(230, 239, 255, 0.72);
  font-weight: 800;
}

.nav-summary strong {
  color: #ffd65b;
  font-size: 34px;
  line-height: 1;
}

.sheet-action,
.sheet-note {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(137, 170, 229, 0.34);
  border-radius: 16px;
  background: rgba(8, 27, 56, 0.64);
}

.sheet-note strong,
.sheet-note span {
  display: block;
}

.sheet-note span {
  color: rgba(225, 235, 255, 0.72);
  line-height: 1.35;
}

.sheet-note span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #ffc23b;
}

.profile-detail {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(137, 170, 229, 0.34);
  border-radius: 18px;
  background: rgba(8, 27, 56, 0.64);
}

.profile-detail strong,
.profile-detail span:not(.avatar) {
  display: block;
}

.profile-detail strong {
  font-size: 22px;
}

.profile-detail span:not(.avatar) {
  color: rgba(225, 235, 255, 0.7);
}

.wallet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.wallet-actions .gold-action,
.wallet-actions .blue-action {
  min-height: 52px;
  border-radius: 12px;
  font-size: 16px;
}

.setup-screen {
  gap: 10px;
}

.setup-screen .section-title {
  margin-top: 2px;
}

.setup-screen .section-title h2 {
  font-size: 18px;
}

.setup-header {
  grid-template-columns: 44px 1fr;
  min-height: 58px;
  gap: 9px;
  padding: 9px;
  border-radius: 16px;
}

.setup-header h2 {
  font-size: 21px;
}

.player-select,
.duration-chips {
  gap: 7px;
  padding: 4px;
  border-radius: 15px;
}

.player-select {
  grid-template-columns: repeat(3, 1fr);
}

.player-select button,
.duration-chips button {
  min-height: 44px;
  border-radius: 12px;
  font-size: 16px;
}

.player-select button {
  display: grid;
  place-items: center;
  gap: 0;
}

.player-select button b {
  font-size: 18px;
  line-height: 1;
}

.player-select button span {
  font-size: 11px;
  line-height: 1.1;
}

.point-duration-setup {
  gap: 8px;
}

.setup-screen .stake-grid {
  gap: 7px;
}

.setup-screen .stake-grid button {
  min-height: 48px;
  gap: 6px;
  border-radius: 12px;
  font-size: 17px;
}

.setup-screen .stake-grid button span {
  width: 22px;
  height: 22px;
}

.match-preview {
  gap: 9px;
  padding: 12px;
  border-radius: 18px;
}

.match-preview > h2 {
  font-size: 19px;
}

.preview-grid {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 9px;
}

.preview-details {
  gap: 5px;
}

.preview-details p {
  min-height: 28px;
  gap: 8px;
  font-size: 13px;
}

.preview-details strong {
  font-size: 15px;
}

.rules-summary {
  gap: 4px;
  font-size: 13px;
}

.rules-summary strong {
  font-size: 15px;
}

.setup-screen .gold-action {
  min-height: 56px;
  border-radius: 15px;
  font-size: 20px;
}

@media (max-width: 620px) {
  .wallet-actions {
    grid-template-columns: 1fr;
  }

  .setup-screen {
    gap: 8px;
  }

  .setup-screen .section-title h2 {
    font-size: 16px;
  }

  .setup-header {
    min-height: 52px;
  }

  .setup-header .dock-icon {
    width: 42px;
    min-height: 42px;
  }

  .setup-header span {
    font-size: 11px;
  }

  .setup-header h2 {
    font-size: 18px;
  }

  .player-select {
    grid-template-columns: repeat(3, 1fr);
  }

  .player-select button,
  .duration-chips button {
    min-height: 40px;
  }

  .setup-screen .stake-grid button {
    min-height: 44px;
    font-size: 15px;
  }

  .preview-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rules-summary span {
    line-height: 1.25;
  }
}

.create-modal {
  position: relative;
  display: grid;
  width: min(560px, 100%);
  max-width: calc(100vw - 28px);
  gap: 16px;
  padding: 26px 24px;
  overflow: hidden;
  border: 2px solid #ffc83d;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(circle at 0 0, rgba(42, 113, 220, 0.32), transparent 34%),
    linear-gradient(180deg, rgba(12, 39, 80, 0.98), rgba(3, 15, 34, 0.99));
  box-shadow: 0 0 34px rgba(255, 206, 55, 0.24), 0 28px 80px rgba(0, 0, 0, 0.62);
}

.create-modal > h2 {
  text-align: center;
  font-size: 30px;
}

.result-backdrop {
  z-index: 50;
}

.result-modal {
  display: grid;
  width: min(430px, 100%);
  max-width: calc(100vw - 28px);
  gap: 14px;
  padding: 22px 18px 18px;
  border: 2px solid #ffc83d;
  border-radius: 24px;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(circle at 0 0, rgba(42, 113, 220, 0.32), transparent 34%),
    linear-gradient(180deg, rgba(12, 39, 80, 0.98), rgba(3, 15, 34, 0.99));
  box-shadow: 0 0 34px rgba(255, 206, 55, 0.24), 0 28px 80px rgba(0, 0, 0, 0.62);
}

.result-badge {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 70px;
  height: 70px;
  border: 2px solid #ffd95c;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff6b5 0 18%, #ffc536 19% 60%, #8b5200 61%);
  color: #201300;
  font-size: 34px;
  box-shadow: 0 0 24px rgba(255, 205, 55, 0.34);
}

.result-modal h2 {
  margin: 0;
  font-size: 30px;
}

.result-modal p {
  margin: 0;
  color: rgba(229, 238, 255, 0.78);
  line-height: 1.35;
}

.result-rows {
  display: grid;
  gap: 8px;
}

.result-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(137, 170, 229, 0.34);
  border-radius: 14px;
  background: rgba(7, 25, 52, 0.72);
  text-align: left;
}

.result-row.me {
  border-color: rgba(255, 217, 92, 0.72);
  background: rgba(39, 56, 86, 0.78);
}

.result-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.result-dot.red { background: #ef2417; }
.result-dot.green { background: #18a53e; }
.result-dot.yellow { background: #ffc221; }
.result-dot.blue { background: #0878e0; }

.result-row strong,
.result-row span {
  display: block;
}

.result-row span {
  color: rgba(225, 235, 255, 0.68);
  font-size: 13px;
}

.result-row b {
  color: #83ef55;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 52px;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #fff;
  background: rgba(18, 38, 71, 0.94);
  font-size: 42px;
  line-height: 0;
}

.modal-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.modal-pills span {
  display: grid;
  min-width: 0;
  min-height: 64px;
  place-items: center;
  border: 1px solid rgba(111, 154, 235, 0.58);
  border-radius: 14px;
  background: rgba(10, 33, 67, 0.78);
  text-align: center;
}

.modal-details {
  display: grid;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid rgba(143, 174, 228, 0.48);
  border-radius: 16px;
  background: rgba(11, 32, 63, 0.76);
}

.modal-rules {
  display: grid;
  gap: 8px;
  color: rgba(231, 239, 255, 0.82);
  line-height: 1.35;
}

.rules-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 16px;
}

.rules-check input {
  width: 24px;
  min-height: 24px;
  accent-color: #ffc638;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.outline-action {
  min-height: 64px;
  border: 1px solid #d99f2b;
  color: #fff;
  background: rgba(8, 28, 57, 0.82);
}

.link-action {
  justify-self: center;
  min-height: 34px;
  color: #5da6ff;
  background: transparent;
  text-decoration: underline;
}

.room-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.room-item {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(137, 170, 229, 0.42);
  border-radius: 18px;
  padding: 14px;
  color: #fff;
  background: linear-gradient(180deg, rgba(12, 40, 82, 0.92), rgba(5, 18, 38, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 22px rgba(0, 0, 0, 0.18);
}

.room-item strong {
  color: #fff;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.room-item span {
  color: rgba(225, 235, 255, 0.78);
}

.room-item button {
  min-height: 42px;
  color: #352100;
  background: linear-gradient(#ffe16f, #f0ab20 55%, #ba700c);
}

.game-view {
  margin: -6px -8px 0;
}

.game-shell {
  display: grid;
  gap: 24px;
  min-height: calc(100vh - 24px);
  align-content: start;
  padding: 28px 18px;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(16, 59, 103, 0.34), transparent 38%),
    radial-gradient(circle at 50% 50%, #0b2140 0, #061427 54%, #020b17 100%);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.54);
}

.game-topbar {
  display: flex;
  justify-content: center;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.prize-card {
  display: grid;
  grid-template-columns: 70px auto;
  gap: 18px;
  align-items: center;
  min-width: 325px;
  min-height: 116px;
  padding: 18px 34px;
  border: 2px solid #b9853d;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(180deg, rgba(11, 33, 62, 0.98), rgba(5, 18, 36, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 229, 139, 0.08), 0 14px 34px rgba(0, 0, 0, 0.38);
}

.prize-card span:not(.prize-icon) {
  display: block;
  color: rgba(255, 255, 255, 0.86);
  font-size: 21px;
  letter-spacing: 0.03em;
}

.prize-card strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 42px;
  line-height: 1;
}

.point-only strong {
  color: #73e45a;
}

#pointScoreCard strong {
  font-size: 26px;
  white-space: nowrap;
}

.prize-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  color: #3b2400;
  border-radius: 16px;
  background: linear-gradient(#ffe46f, #f0a719);
  font-size: 36px;
  text-shadow: none;
}

.arena {
  display: grid;
  place-items: center;
}

.arena-players {
  display: grid;
  gap: 26px;
}

.arena-player {
  position: relative;
  display: grid;
  gap: 10px;
  justify-items: center;
  min-height: 170px;
  padding: 46px 12px 14px;
  border: 2px solid #9f6824;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(180deg, #10213d, #071326);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.28);
}

.arena-avatar {
  position: absolute;
  top: -34px;
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  border: 3px solid #f2bd45;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.9), transparent 0 12%, transparent 13%),
    linear-gradient(145deg, #233b62, #0a1425);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  font-size: 32px;
  font-weight: 950;
}

.arena-player-name {
  font-size: 22px;
  font-weight: 900;
}

.arena-player-coins {
  color: #ffd66c;
  font-size: 22px;
  font-weight: 950;
}

.arena-player-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 18px currentColor;
}

.arena-stat {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 2px solid #9f6824;
  border-radius: 20px;
  color: #ffd66c;
  background: linear-gradient(180deg, #0e203d, #071326);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  text-align: center;
}

.arena-stat span {
  max-width: 110px;
  color: #ffd66c;
  font-size: 20px;
  font-weight: 950;
}

.arena-stat strong {
  font-size: 40px;
  line-height: 1;
}

.muted-stat strong {
  color: #98d7ff;
}

.board-zone {
  display: grid;
  place-items: center;
  min-width: 0;
}

.board-frame {
  width: min(92vw, 1030px);
  max-width: 100%;
  padding: 10px;
  border: 6px solid #ffe073;
  border-radius: 42px;
  background:
    linear-gradient(145deg, #4d2b04, #fff09a 9%, #b87516 18%, #ffd85e 34%, #6d3b07 52%, #fff2a2 68%, #c88918 84%, #4c2a04);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.58),
    inset 0 0 0 4px rgba(77, 39, 4, 0.86),
    inset 0 0 0 9px rgba(255, 236, 134, 0.5),
    0 0 0 2px #8f570e;
}

.board {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  border: 3px solid #704108;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.18), transparent 38%),
    #eadfc8;
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.34);
}

.cell {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid rgba(128, 79, 12, 0.82);
  min-width: 0;
  min-height: 0;
}

.yard {
  background: transparent;
  border-width: 0;
}

.yard-decor {
  position: relative;
  z-index: 0;
  display: grid;
  place-items: center;
  border-radius: 0;
  overflow: hidden;
}

.yard-decor::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.18), transparent 20%),
    radial-gradient(circle at 76% 74%, rgba(0, 0, 0, 0.2), transparent 28%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 9px);
}

.yard-decor.red::before {
  background-color: #b7190d;
}

.yard-decor.green::before {
  background-color: #067d25;
}

.yard-decor.yellow::before {
  background-color: #e4a60d;
}

.yard-decor.blue::before {
  background-color: #056fb9;
}

.yard-inner {
  position: relative;
  display: grid;
  width: 76%;
  height: 76%;
  place-items: center;
  border: 4px solid #ffd75d;
  border-radius: 18%;
  background: rgba(255, 255, 255, 0.03);
  box-shadow:
    inset 0 0 0 3px rgba(86, 45, 4, 0.68),
    inset 0 16px 28px rgba(255, 255, 255, 0.12),
    inset 0 -18px 30px rgba(0, 0, 0, 0.17),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.yard-inner::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255, 232, 128, 0.66);
  border-radius: 16%;
}

.yard-inner i {
  display: grid;
  width: 24%;
  aspect-ratio: 1;
  place-items: center;
  border: 4px solid #ffd75d;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #4b2a12, #17110a);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.28);
}

.yard-inner i::before {
  content: "♟";
  color: #f4e5c9;
  font-size: clamp(10px, 3vw, 31px);
  line-height: 1;
}

.base-slot-cell::before {
  content: none;
}

.path {
  background:
    repeating-radial-gradient(circle at center, rgba(141, 105, 56, 0.08) 0 1px, transparent 1px 7px),
    linear-gradient(145deg, #fff4df, #dbc7a8);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.52), inset -2px -2px 3px rgba(87, 51, 8, 0.18);
}

.path.safe::after {
  content: "★";
  z-index: 3;
  color: #fff0a8;
  font-size: clamp(16px, 3.2vw, 37px);
  text-shadow: 0 2px 0 #7a4d0d, 0 0 4px #3d2302;
  pointer-events: none;
}

.path.start::after {
  content: attr(data-arrow);
  z-index: 3;
  font-size: clamp(20px, 4vw, 43px);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7), 0 3px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.path.red,
.home.red {
  background:
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 8px),
    linear-gradient(145deg, #ef2b18, #c6170c);
  color: #e22113;
}

.path.green,
.home.green {
  background:
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 8px),
    linear-gradient(145deg, #18b93c, #087d28);
  color: #0f9d34;
}

.path.yellow,
.home.yellow {
  background:
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 8px),
    linear-gradient(145deg, #ffcf36, #e4a20e);
  color: #e0a20e;
}

.path.blue,
.home.blue {
  background:
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 8px),
    linear-gradient(145deg, #1d9eea, #0568b2);
  color: #0b77bf;
}

.center {
  z-index: 2;
  border-color: rgba(97, 55, 6, 0.58);
  background: transparent;
}

.center::after {
  content: none;
}

.center-decor {
  position: relative;
  z-index: 1;
  border: 4px solid #7d4e0b;
  background:
    linear-gradient(45deg, transparent 49%, #ffd96b 50%, transparent 52%),
    linear-gradient(-45deg, transparent 49%, #ffd96b 50%, transparent 52%),
    conic-gradient(from 45deg, #10a83a 0 25%, #e9aa11 0 50%, #066fb9 0 75%, #c91b0e 0);
  box-shadow: inset 0 0 0 2px #ffd96b, 0 3px 8px rgba(0, 0, 0, 0.28);
}

.token {
  position: absolute;
  z-index: 30;
  display: grid;
  width: 76%;
  height: 118%;
  min-height: 0;
  padding: 0;
  place-items: end center;
  border: 0;
  border-radius: 0;
  color: transparent;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 8px 5px rgba(0, 0, 0, 0.38));
  animation: tokenSettle 0.22s ease-out;
  transform-origin: center bottom;
}

.token img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  user-select: none;
}

.token.can-move {
  z-index: 60;
  width: 86%;
  height: 128%;
}

.token.turn-pulse {
  z-index: 70;
  overflow: visible;
  filter:
    drop-shadow(0 0 8px rgba(255, 216, 68, 0.92))
    drop-shadow(0 9px 6px rgba(0, 0, 0, 0.4));
}

.token.turn-pulse::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2%;
  z-index: -1;
  width: 100%;
  height: 34%;
  border: 3px solid rgba(255, 224, 85, 0.98);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(255, 224, 85, 0.3) 0 30%, rgba(255, 224, 85, 0.12) 48%, transparent 70%);
  box-shadow:
    0 0 16px rgba(255, 207, 43, 0.98),
    0 0 28px rgba(255, 207, 43, 0.45),
    inset 0 0 8px rgba(255, 255, 255, 0.35);
  transform: translateX(-50%) scale(0.9);
  animation: pawnMoveRing 0.92s ease-in-out infinite;
  pointer-events: none;
}

.token.turn-pulse img {
  animation: pawnMoveHeartbeat 0.78s ease-in-out infinite;
  transform-origin: center bottom;
}

.token:disabled {
  opacity: 1;
}

.token-hidden {
  opacity: 0 !important;
}

.token-ghost {
  z-index: 90;
  width: calc(100% / 15 * 0.78);
  height: calc(100% / 15 * 1.2);
  transform: translate(-50%, -88%);
  transition: left 0.16s cubic-bezier(0.18, 0.78, 0.24, 1), top 0.16s cubic-bezier(0.18, 0.78, 0.24, 1);
  pointer-events: none;
  will-change: left, top;
}

.token-ghost.token-hop img {
  animation: pawnStepHop 0.22s ease-out;
}

.token-ghost.token-land img {
  animation: pawnStepLand 0.1s ease-out;
}

.token span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes tokenSettle {
  from {
    transform: translateY(-12%) scale(0.9);
  }
  to {
    transform: translateY(0) scale(1);
  }
}

.token.stack-0 {
  transform: translate(-14%, -14%);
}

.token.stack-1 {
  transform: translate(14%, -14%);
}

.token.stack-2 {
  transform: translate(-14%, 14%);
}

.token.stack-3 {
  transform: translate(14%, 14%);
}

@keyframes pulse {
  from {
    scale: 1;
  }
  to {
    scale: 1.12;
  }
}

@keyframes pawnPulse {
  from {
    scale: 1;
  }
  to {
    scale: 1.13;
  }
}

@keyframes pawnHeartbeat {
  0%, 100% {
    transform: scale(1);
  }
  22% {
    transform: scale(1.12);
  }
  40% {
    transform: scale(1);
  }
  62% {
    transform: scale(1.08);
  }
}

@keyframes pawnMoveHeartbeat {
  0%, 100% {
    transform: translateY(0) scale(1.08);
  }
  22% {
    transform: translateY(-4%) scale(1.24);
  }
  42% {
    transform: translateY(0) scale(1.12);
  }
  66% {
    transform: translateY(-2%) scale(1.2);
  }
}

@keyframes pawnMoveRing {
  0%, 100% {
    opacity: 0.58;
    transform: translateX(-50%) scale(0.82);
  }
  45% {
    opacity: 1;
    transform: translateX(-50%) scale(1.15);
  }
  72% {
    opacity: 0.72;
    transform: translateX(-50%) scale(0.96);
  }
}

@keyframes turnBannerHeartbeat {
  0%, 100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.018);
  }
}

@keyframes turnArrowBounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(5px);
  }
}

@keyframes turnCueBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}

@keyframes diceTurnGlow {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  48% {
    transform: translateY(-2px) scale(1.045);
  }
}

@keyframes pawnStepHop {
  0% {
    transform: translateY(0) scale(1);
  }
  38% {
    transform: translateY(-21%) scale(1.055);
  }
  72% {
    transform: translateY(-7%) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes pawnStepLand {
  0% {
    transform: translateY(0) scale(1.045, 0.96);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.players {
  display: grid;
  gap: 8px;
}

.compact-players {
  display: none;
}

.player-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: #f1f5f9;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.dice {
  --dice-progress: 0deg;
  width: 122px;
  height: 122px;
  min-height: 122px;
  margin: -54px 0 6px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 14px 0 rgba(82, 48, 8, 0.72)) drop-shadow(0 20px 18px rgba(0, 0, 0, 0.42));
  perspective: 500px;
  transform-style: preserve-3d;
}

.dice.timer-active::before {
  content: "";
  position: absolute;
  inset: -10px;
  z-index: -1;
  border-radius: 24px;
  background: conic-gradient(#7cff4e var(--dice-progress), rgba(255, 255, 255, 0.16) 0);
  filter: drop-shadow(0 0 12px rgba(124, 255, 78, 0.35));
}

.dice.timer-active::after {
  content: attr(data-timer);
  position: absolute;
  right: -10px;
  top: -14px;
  display: grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid #ffd95c;
  border-radius: 50%;
  color: #fff;
  background: #06172f;
  font-size: 15px;
  font-weight: 950;
  text-shadow: none;
}

.dice:disabled {
  opacity: 1;
}

.dice.rolling {
  animation: diceKingRoll 0.58s cubic-bezier(0.28, 0.84, 0.42, 1) infinite;
}

.dice-image {
  display: block;
  width: 104%;
  height: 104%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.dice-result,
.dice-idle {
  transform: translateY(0);
}

.dice-rolling-image {
  width: 132%;
  height: 132%;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35));
}

.dice-roll-face {
  animation: diceFaceFlicker 0.12s steps(1, end) infinite;
}

.dice.dice-final-pop .dice-result {
  animation: diceResultPop 0.34s cubic-bezier(0.18, 0.9, 0.24, 1.18);
}

@keyframes shake {
  25% {
    transform: rotate(10deg) translateX(4px);
  }
  50% {
    transform: rotate(-10deg) translateX(-4px);
  }
  75% {
    transform: rotate(8deg) translateX(3px);
  }
}

@keyframes diceSpin {
  0% {
    transform: rotateX(0deg) rotateZ(0deg) translateY(0);
  }
  35% {
    transform: rotateX(220deg) rotateZ(16deg) translateY(-10px);
  }
  70% {
    transform: rotateX(420deg) rotateZ(-12deg) translateY(3px);
  }
  100% {
    transform: rotateX(720deg) rotateZ(0deg) translateY(0);
  }
}

@keyframes diceKingRoll {
  0% {
    transform: translateY(0) rotate(-8deg) scale(1);
  }
  24% {
    transform: translateY(-12%) rotate(13deg) scale(1.08);
  }
  48% {
    transform: translateY(3%) rotate(-18deg) scale(0.98);
  }
  72% {
    transform: translateY(-8%) rotate(18deg) scale(1.06);
  }
  100% {
    transform: translateY(0) rotate(-8deg) scale(1);
  }
}

@keyframes diceFaceFlicker {
  0%, 100% {
    transform: rotate(-6deg) scale(1.04);
  }
  50% {
    transform: rotate(8deg) scale(0.98);
  }
}

@keyframes diceResultPop {
  0% {
    transform: translateY(-10%) rotate(-8deg) scale(1.18);
  }
  52% {
    transform: translateY(3%) rotate(4deg) scale(0.96);
  }
  100% {
    transform: translateY(0) rotate(0) scale(1);
  }
}

.log {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.bottom-dock {
  display: grid;
  grid-template-columns: 72px minmax(180px, 240px) minmax(150px, auto) 72px;
  gap: 18px;
  align-items: center;
  justify-content: center;
  min-height: 118px;
  padding: 8px 18px 14px;
  background: transparent;
  box-shadow: none;
}

.turn-plinth {
  display: grid;
  place-items: center;
  min-height: 122px;
  border: 2px solid #8b5a21;
  border-radius: 24px;
  color: #8aff5d;
  background: linear-gradient(180deg, #10213d, #071326);
}

.turn-plinth h2 {
  color: #8aff5d;
  font-size: 25px;
}

.gold-action {
  min-height: 76px;
  border: 2px solid #ffdf7b;
  border-radius: 16px;
  color: #3b2400;
  background: linear-gradient(#ffe16f, #f0ab20 55%, #ba700c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.24), 0 8px 18px rgba(0, 0, 0, 0.35);
  font-size: 22px;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.game-info-strip {
  display: none;
  gap: 8px;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

.game-info-strip .meta,
.game-info-strip .status {
  color: rgba(255, 255, 255, 0.72);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 30px));
  padding: 13px 16px;
  border-radius: 16px;
  color: #fff;
  background: #111827;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .action-grid {
    grid-template-columns: 1fr;
  }

  .game-shell {
    padding: 10px;
  }

  .game-topbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .prize-card {
    min-width: 0;
    min-height: 72px;
    grid-template-columns: 42px auto;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 16px;
  }

  .prize-card span:not(.prize-icon) {
    font-size: 12px;
  }

  .prize-card strong {
    font-size: 24px;
  }

  .prize-icon {
    width: 38px;
    height: 38px;
    font-size: 23px;
  }

  .hud-button,
  .dock-icon {
    width: 54px;
    min-height: 54px;
    border-radius: 14px;
    font-size: 24px;
  }

  .mode-pill,
  .wallet-pill {
    min-height: 54px;
    border-radius: 15px;
  }

  .mode-icon {
    display: none;
  }

  .mode-pill strong {
    font-size: 17px;
  }

  .mode-pill span:last-child {
    font-size: 13px;
  }

  .wallet-pill {
    gap: 6px;
    padding: 0 7px;
  }

  .wallet-icon,
  .plus-button {
    display: none;
  }

  .wallet-pill strong {
    font-size: 20px;
  }

  .arena {
    gap: 10px;
  }

  .arena-rail {
    display: none;
  }

  .board-zone {
    order: 1;
  }

  .arena-players {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .arena-player {
    min-height: 104px;
    padding: 16px 8px 10px;
  }

  .arena-avatar {
    position: static;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .arena-player-name,
  .arena-player-coins {
    font-size: 14px;
  }

  .arena-stat {
    min-height: 96px;
  }

  .arena-stat span {
    font-size: 13px;
  }

  .arena-stat strong {
    font-size: 26px;
  }

  .board-frame {
    width: min(96vw, 680px);
    padding: 6px;
    border-radius: 24px;
  }

  .bottom-dock {
    grid-template-columns: 48px minmax(108px, 1fr) minmax(118px, 1fr) 48px;
    gap: 8px;
    min-height: 106px;
    padding: 0 8px 10px;
  }

  .turn-plinth {
    min-height: 86px;
  }

  .turn-plinth h2 {
    font-size: 17px;
  }

  .gold-action {
    min-height: 54px;
    font-size: 15px;
  }

  .dice {
    width: 76px;
    height: 76px;
    min-height: 76px;
    margin: -36px 0 2px;
    border-radius: 18px;
    font-size: 34px;
  }
}

@media (max-width: 620px) {
  body {
    background: #101827;
  }

  .shell {
    padding: 10px;
  }

  .phone-card {
    border-radius: 26px;
  }

  .auth-hero {
    min-height: 230px;
  }

  .hero-board {
    width: 96px;
  }

  .topbar {
    top: 8px;
    border-radius: 20px;
  }

  .top-actions {
    gap: 7px;
  }

  .socket-pill b {
    display: none;
  }

  .coin-pill,
  .socket-pill {
    min-height: 38px;
    padding: 0 10px;
  }

  .lobby-hero {
    align-items: stretch;
    min-height: 170px;
    border-radius: 24px;
  }

  .lobby {
    gap: 14px;
    padding-bottom: 18px;
  }

  .home-tabs button {
    min-height: 48px;
    font-size: 19px;
  }

  .home-profile {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 14px;
  }

  .home-profile-actions {
    justify-content: space-between;
  }

  .home-profile .avatar {
    width: 62px;
    height: 62px;
    font-size: 30px;
  }

  .online-dot {
    left: 46px;
  }

  .home-profile .profile-chip strong {
    font-size: 24px;
  }

  .settings-button {
    width: 48px;
    min-height: 48px;
    font-size: 23px;
  }

  .refer-banner {
    grid-template-columns: 64px 1fr 24px;
    min-height: 86px;
    padding: 12px;
  }

  .refer-icon {
    width: 58px;
    height: 58px;
    font-size: 28px;
  }

  .refer-banner strong,
  .match-preview > h2 {
    font-size: 21px;
  }

  .refer-banner span:not(.refer-icon) {
    font-size: 14px;
  }

  .section-title h2 {
    font-size: 22px;
  }

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

  .mode-card {
    min-height: 124px;
    padding: 12px 8px;
  }

  .mode-card strong {
    font-size: 18px;
  }

  .mode-visual {
    width: 64px;
    height: 54px;
    font-size: 31px;
  }

  .time-chips {
    gap: 4px;
  }

  .time-chips em {
    min-height: 30px;
    font-size: 13px;
  }

  .player-select {
    grid-template-columns: 1fr;
  }

  .stake-grid {
    gap: 8px;
  }

  .stake-grid button {
    min-width: 0;
    min-height: 56px;
    gap: 5px;
    padding: 0 5px;
    font-size: 18px;
  }

  .stake-grid button span {
    width: 24px;
    height: 24px;
  }

  .match-preview {
    padding: 14px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .preview-art {
    display: none;
  }

  .home-actions,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .bottom-nav button {
    min-height: 62px;
    font-size: 20px;
  }

  .bottom-nav button span {
    font-size: 11px;
  }

  .create-modal {
    gap: 12px;
    padding: 22px 14px 18px;
    border-radius: 22px;
  }

  .create-modal > h2 {
    padding-right: 42px;
    font-size: 26px;
  }

  .modal-close {
    width: 44px;
    min-height: 44px;
    font-size: 34px;
  }

  .modal-pills {
    gap: 7px;
  }

  .modal-pills span {
    min-height: 58px;
    padding: 4px;
    font-size: 13px;
  }

  .modal-details {
    padding: 10px;
  }

  .preview-details p,
  .modal-details p {
    gap: 8px;
    font-size: 14px;
  }

  .preview-details strong,
  .modal-details b {
    font-size: 15px;
  }

  .stake-box {
    min-width: 78px;
    min-height: 78px;
  }

  .join-row {
    grid-template-columns: 1fr;
  }

  .board {
    border-width: 3px;
    border-radius: 18px;
  }

  .panel {
    border-radius: 20px;
    padding: 14px;
  }

  .game-topbar {
    grid-template-columns: 1fr 1fr;
  }

  .hud-button,
  .dock-icon {
    width: 44px;
    min-height: 44px;
    font-size: 20px;
  }

  .arena-rail {
    display: none;
  }

  .compact-players {
    display: grid;
  }

  .bottom-dock {
    grid-template-columns: 44px minmax(104px, 1fr) minmax(100px, 1fr) 44px;
  }

  .bottom-dock .dock-icon:last-child {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .setup-screen {
    gap: 8px;
  }

  .setup-screen .section-title {
    margin-top: 0;
  }

  .setup-screen .section-title h2 {
    font-size: 16px;
  }

  .setup-header {
    grid-template-columns: 42px 1fr;
    min-height: 52px;
    gap: 8px;
    padding: 8px;
    border-radius: 15px;
  }

  .setup-header .dock-icon {
    width: 42px;
    min-height: 42px;
  }

  .setup-header span {
    font-size: 11px;
  }

  .setup-header h2 {
    font-size: 18px;
  }

  .player-select {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
  }

  .player-select button,
  .duration-chips button {
    min-height: 40px;
    font-size: 14px;
  }

  .player-select button b {
    font-size: 17px;
  }

  .player-select button span {
    font-size: 10px;
  }

  .duration-chips {
    gap: 6px;
  }

  .setup-screen .stake-grid {
    gap: 7px;
  }

  .setup-screen .stake-grid button {
    min-height: 44px;
    gap: 4px;
    padding: 0 4px;
    font-size: 15px;
  }

  .setup-screen .stake-grid button span {
    width: 20px;
    height: 20px;
  }

  .match-preview {
    gap: 8px;
    padding: 11px;
  }

  .match-preview > h2 {
    font-size: 18px;
  }

  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
  }

  .preview-details p {
    gap: 6px;
    min-height: 26px;
    font-size: 12px;
  }

  .preview-details strong {
    font-size: 13px;
  }

  .rules-summary {
    gap: 3px;
    font-size: 12px;
  }

  .rules-summary strong {
    font-size: 14px;
  }

  .setup-screen .gold-action {
    min-height: 52px;
    border-radius: 14px;
    font-size: 18px;
  }

  .wallet-actions {
    grid-template-columns: 1fr;
  }
}

/* Dashboard v2 final cascade */
.lobby {
  max-width: 430px;
  gap: 18px;
  padding: 44px 16px 100px;
}

.home-screen {
  gap: 22px;
}

.home-profile.compact-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 128px;
  padding: 22px 24px;
  border: 2px solid rgba(255, 205, 75, 0.76);
  border-radius: 34px;
}

.mode-grid {
  gap: 16px;
}

.mode-card {
  min-height: 166px;
  padding: 16px 12px 14px;
}

.mode-card strong {
  font-size: 26px;
}

.mode-visual {
  width: 108px;
  height: 72px;
}

.bottom-nav {
  width: min(392px, calc(100vw - 28px));
}

@media (max-width: 620px) {
  .lobby {
    max-width: 390px;
    gap: 16px;
    padding: 28px 14px 96px;
  }

  .home-screen {
    gap: 16px;
  }

  .home-profile.compact-profile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 140px;
    padding: 18px;
  }

  .home-profile-actions {
    justify-content: end;
  }

  .mode-grid {
    gap: 12px;
  }

  .mode-card {
    min-height: 152px;
    padding: 13px 8px;
  }

  .mode-card strong {
    font-size: 22px;
  }

  .mode-visual {
    width: 92px;
    height: 64px;
  }

  .bottom-nav {
    width: min(360px, calc(100vw - 28px));
  }
}

/* Final mode icon safety override */
.mode-card { grid-template-rows: 44px auto auto; gap: 12px; }
.mode-visual { width: 64px; height: 44px; }
.mode-visual img { max-height: 44px; }
.mode-dice-img { width: 40px; }
.mode-pawn-img.single { height: 44px; }
.mode-pawn-pair { width: 62px; height: 44px; }
.mode-pawn-pair img { width: 29px; }
.mini-board-icon { grid-template-columns: repeat(2, 14px); grid-template-rows: repeat(2, 14px); gap: 3px; padding: 5px; border-width: 2px; }
.mode-card strong { font-size: 20px; }
.mode-card small { font-size: 12px; }
.time-chips { max-width: 124px; }
.time-chips em { min-height: 25px; font-size: 12px; }
@media (max-width: 620px) {
  .mode-card { grid-template-rows: 40px auto auto; gap: 11px; }
  .mode-visual { width: 58px; height: 40px; }
  .mode-visual img { max-height: 40px; }
  .mode-dice-img { width: 36px; }
  .mode-pawn-img.single { height: 40px; }
  .mode-pawn-pair { width: 58px; height: 40px; }
  .mode-pawn-pair img { width: 27px; }
  .mini-board-icon { grid-template-columns: repeat(2, 13px); grid-template-rows: repeat(2, 13px); }
  .mode-card strong { font-size: 18px; }
}

/* Ludo King external room flow */
.king-screen {
  display: grid;
  gap: 18px;
}

.king-profile {
  min-height: 122px;
}

.king-title h2 {
  color: #ffdc65;
  text-shadow: 0 2px 16px rgba(255, 187, 38, 0.34);
}

.king-subtitle {
  margin: -8px 0 12px;
  text-align: center;
  color: rgba(218, 230, 255, 0.76);
  font-size: 14px;
}

.king-room-panel,
.king-entries-panel {
  padding: 14px;
  border-color: rgba(116, 159, 233, 0.46);
}

.king-room-list {
  display: grid;
  gap: 14px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-actions .mini-action {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
}

.king-room-card,
.proof-summary-card,
.proof-card {
  border: 1px solid rgba(130, 166, 231, 0.48);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0, rgba(21, 101, 217, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(13, 49, 103, 0.95), rgba(5, 20, 47, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 18px 34px rgba(0, 0, 0, 0.24);
}

.king-room-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 96px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-left: 2px solid #ffca38;
}

.king-badge {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid #ffd45f;
  border-radius: 18px;
  color: #ffd95c;
  background: linear-gradient(145deg, rgba(91, 48, 155, 0.9), rgba(7, 28, 66, 0.9));
  font-size: 28px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
}

.king-room-main > span,
.king-room-main p span,
.king-room-side span {
  display: block;
  color: rgba(219, 229, 255, 0.74);
  font-size: 12px;
}

.king-room-main strong {
  display: block;
  margin: 3px 0 10px;
  color: #fff;
  font-size: 28px;
  letter-spacing: 0;
}

.king-room-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(170, 196, 244, 0.24);
}

.king-room-meta p {
  margin: 0;
}

.king-room-meta b {
  color: #fff;
  font-size: 18px;
}

.king-room-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.king-room-side em {
  min-width: 74px;
  padding: 5px 10px;
  border-radius: 9px;
  text-align: center;
  color: #fff;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
  background: linear-gradient(#bc7216, #8b4302);
}

.king-room-side em.open {
  background: linear-gradient(#26c74d, #057326);
}

.king-room-side button {
  min-width: 88px;
  min-height: 44px;
  border: 2px solid rgba(255, 217, 92, 0.92);
  border-radius: 14px;
  color: #ffd95c;
  background: linear-gradient(180deg, rgba(10, 31, 68, 0.98), rgba(3, 13, 32, 0.98));
  box-shadow: 0 0 18px rgba(255, 197, 45, 0.26);
  font-size: 20px;
  font-weight: 900;
}

.king-room-side button:disabled {
  opacity: 0.46;
}

.proof-summary-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
}

.proof-summary-card dl {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(170, 196, 244, 0.24);
}

.proof-summary-card dt {
  color: rgba(219, 229, 255, 0.72);
  font-size: 12px;
}

.proof-summary-card dd {
  margin: 2px 0 0;
  color: #fff;
  font-weight: 900;
}

.proof-success {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(#2bd859, #037d25);
  font-size: 34px;
  font-weight: 900;
}

.proof-summary-card strong {
  display: block;
  color: #57ff55;
  font-size: 18px;
}

.proof-summary-card span,
.proof-joined span,
.proof-card p {
  color: rgba(219, 229, 255, 0.76);
}

.proof-joined {
  text-align: right;
}

.proof-joined b {
  display: block;
  color: #fff;
  font-size: 22px;
}

.proof-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.proof-card h2 {
  margin: 0;
  color: #ffdc65;
  font-size: 20px;
}

.result-select {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.result-select button,
.outline-action {
  min-height: 50px;
  border: 1px solid rgba(130, 166, 231, 0.58);
  border-radius: 14px;
  color: #eaf1ff;
  background: rgba(9, 31, 70, 0.92);
}

.result-select button.active {
  color: #ffdc65;
  border-color: #ffcf3d;
  box-shadow: 0 0 18px rgba(255, 198, 45, 0.26);
}

.upload-box {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 3px;
  min-height: 116px;
  padding: 10px;
  overflow: hidden;
  border: 2px dashed rgba(94, 142, 255, 0.84);
  border-radius: 18px;
  background: rgba(5, 20, 48, 0.54);
  cursor: pointer;
}

.upload-box span {
  color: #4d83ff;
  font-size: 42px;
}

.upload-box strong {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: #fff;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-box small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #63a0ff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#kingUploadCard,
#kingUploadCard > * {
  min-width: 0;
  max-width: 100%;
}

.proof-preview {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.proof-preview > div {
  min-width: 0;
  overflow: hidden;
}

.king-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.approval-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.approval-card p {
  grid-column: 1 / -1;
  margin: 0;
}

.king-empty {
  padding: 34px 12px;
  text-align: center;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  min-height: 74px;
  overflow: visible;
}

.bottom-nav button {
  min-width: 0;
  gap: 4px;
  font-size: 24px;
}

.bottom-nav button span {
  font-size: 12px;
}

.bottom-nav .nav-dashboard {
  position: relative;
  top: -22px;
  width: 76px;
  height: 76px;
  min-height: 76px;
  justify-self: center;
  border: 2px solid #f6a72d;
  border-radius: 50%;
  color: #ffd95c;
  background: radial-gradient(circle at 50% 25%, rgba(255, 220, 101, 0.2), rgba(10, 37, 80, 0.98) 56%);
  box-shadow: 0 0 22px rgba(255, 197, 45, 0.26), 0 12px 20px rgba(0, 0, 0, 0.34);
}

.bottom-nav .nav-dashboard span {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
}

@media (max-width: 420px) {
  .king-room-card {
    grid-template-columns: 52px minmax(0, 1fr) 78px;
    gap: 8px;
    padding: 11px;
  }

  .king-badge {
    width: 48px;
    height: 48px;
    font-size: 23px;
  }

  .king-room-main strong {
    font-size: 23px;
  }

  .king-room-side button {
    min-width: 74px;
    min-height: 40px;
    font-size: 17px;
  }

  .result-select {
    grid-template-columns: 1fr;
  }

  .proof-summary-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* King room list v2 */
.king-screen {
  gap: 20px;
}

.king-profile.home-profile.compact-profile {
  min-height: 126px;
  border-radius: 28px;
}

.king-profile .home-profile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.king-wallet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 58px;
  padding: 0 22px;
  border: 1px solid rgba(193, 159, 255, 0.72);
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(145deg, #7540e4, #37147e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26), 0 9px 24px rgba(75, 31, 158, 0.32);
  font-size: 18px;
  font-weight: 900;
}

.king-room-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
  margin: 16px 0 14px;
}

.king-room-tabs {
  display: flex;
  gap: 8px;
}

.king-room-tabs button,
.king-refresh-button {
  min-height: 56px;
  border: 1px solid rgba(94, 133, 201, 0.62);
  border-radius: 11px;
  color: rgba(224, 233, 255, 0.86);
  background: rgba(7, 24, 55, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 16px;
  font-weight: 900;
}

.king-room-tabs button {
  min-width: 0;
  padding: 0 18px;
}

.king-room-tabs button.active {
  color: #fff;
  border-color: rgba(145, 110, 255, 0.95);
  background: linear-gradient(145deg, #5a34cc, #24105f);
  box-shadow: 0 0 20px rgba(120, 72, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.king-refresh-button {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 28px;
}

.king-room-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.king-room-card {
  grid-template-columns: 82px minmax(104px, 1.15fr) minmax(80px, 0.82fr) minmax(82px, 0.82fr) minmax(104px, 0.96fr) 104px;
  min-height: 124px;
  padding: 18px 18px;
  gap: 16px;
  border: 1px solid rgba(88, 132, 202, 0.7);
  border-left: 1px solid rgba(88, 132, 202, 0.7);
  border-radius: 18px;
  background:
    radial-gradient(circle at 15% 0, rgba(48, 105, 192, 0.2), transparent 42%),
    linear-gradient(180deg, rgba(10, 38, 82, 0.96), rgba(4, 18, 42, 0.98));
}

.king-badge {
  width: 62px;
  height: 62px;
  border-radius: 15px;
  color: #ffd950;
  background: linear-gradient(145deg, #351382, #180846);
  font-size: 31px;
}

.king-room-main {
  min-width: 0;
}

.king-room-main > span,
.king-room-stat span {
  display: block;
  color: rgba(218, 227, 250, 0.76);
  font-size: 15px;
  line-height: 1.2;
}

.king-room-main strong {
  margin: 8px 0 0;
  font-size: 25px;
  line-height: 1;
}

.king-room-stat {
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid rgba(136, 170, 228, 0.18);
}

.king-room-stat b {
  display: block;
  margin-top: 9px;
  color: #fff;
  font-size: 21px;
  line-height: 1;
}

.players-stat b {
  color: #62e28e;
}

.king-room-side {
  align-self: stretch;
  align-content: center;
  justify-items: stretch;
}

.king-room-side em {
  min-width: 0;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(#27d04d, #057923);
  font-size: 14px;
  letter-spacing: 0;
}

.king-room-side em.locked {
  background: linear-gradient(#ff951f, #c95d05);
}

.king-room-side button {
  min-width: 0;
  min-height: 42px;
  border-radius: 11px;
  font-size: 18px;
  background: linear-gradient(180deg, rgba(10, 31, 68, 0.98), rgba(3, 13, 32, 0.98));
}

.king-room-side button.entry-approved {
  color: #71ff7c;
  border-color: rgba(84, 255, 111, 0.75);
}

.king-room-side button.entry-pending {
  color: #ffd95c;
}

.king-room-side button.entry-rejected {
  color: #ff8f83;
  border-color: rgba(255, 118, 104, 0.75);
}

.king-fair-note {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(88, 132, 202, 0.55);
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(11, 38, 80, 0.78), rgba(4, 18, 42, 0.9));
}

.king-fair-note span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #6ea0ff;
  border: 2px solid rgba(90, 138, 255, 0.78);
  border-radius: 14px;
}

.king-fair-note p {
  margin: 0;
  color: rgba(225, 234, 255, 0.82);
  font-size: 17px;
  line-height: 1.45;
}

@media (max-width: 620px) {
  .king-profile.home-profile.compact-profile {
    min-height: 118px;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .king-profile .home-profile-actions {
    justify-content: space-between;
  }

  .king-wallet-button {
    min-height: 44px;
    padding: 0 14px;
    font-size: 15px;
  }

  .king-room-toolbar {
    grid-template-columns: minmax(0, 1fr) 50px;
  }

  .king-room-tabs button {
    min-height: 48px;
    padding: 0 12px;
    font-size: 14px;
  }

  .king-refresh-button {
    min-height: 50px;
  }

  .king-room-card {
    grid-template-columns: 54px minmax(0, 1fr) 82px;
    min-height: 112px;
    gap: 10px;
    padding: 12px;
  }

  .king-badge {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .king-room-main strong {
    font-size: 22px;
  }

  .king-room-stat {
    padding-left: 0;
    border-left: 0;
  }

  .king-room-card .king-room-stat {
    grid-column: 2 / 3;
    display: inline-grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: baseline;
    gap: 8px;
  }

  .king-room-stat span,
  .king-room-main > span {
    font-size: 12px;
  }

  .king-room-stat b {
    margin-top: 0;
    font-size: 15px;
  }

  .king-room-side {
    grid-column: 3 / 4;
    grid-row: 1 / span 4;
  }

  .king-room-side em {
    min-height: 30px;
    font-size: 12px;
  }

  .king-room-side button {
    min-height: 38px;
    font-size: 16px;
  }

  .king-fair-note {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 13px;
  }

  .king-fair-note span {
    width: 36px;
    height: 36px;
  }

  .king-fair-note p {
    font-size: 13px;
  }
}

/* King room compact density pass */
.lobby {
  padding-top: 18px;
  gap: 12px;
}

.king-screen {
  gap: 10px;
}

.king-profile.home-profile.compact-profile {
  min-height: 92px;
  padding: 14px 16px;
  border-radius: 22px;
}

.king-profile .avatar {
  width: 58px;
  height: 58px;
  font-size: 30px;
}

.king-profile .profile-chip strong {
  font-size: 25px;
}

.king-profile .profile-chip span:not(.avatar):not(.online-dot) {
  font-size: 16px;
}

.king-profile .coin-pill {
  min-height: 44px;
  padding: 0 14px;
}

.king-wallet-button {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 13px;
  font-size: 15px;
}

.king-title {
  margin-top: 4px;
}

.king-title h2 {
  font-size: 28px;
}

.king-subtitle {
  margin: -6px 0 8px;
  font-size: 14px;
}

.king-room-toolbar {
  margin: 8px 0 10px;
}

.king-room-tabs button,
.king-refresh-button {
  min-height: 42px;
  border-radius: 10px;
  font-size: 14px;
}

.king-refresh-button {
  font-size: 23px;
}

.king-room-list {
  gap: 8px;
}

.king-room-card {
  grid-template-columns: 42px minmax(74px, 0.8fr) minmax(76px, 0.82fr) minmax(78px, 0.82fr) minmax(92px, 0.94fr) 72px;
  min-height: 66px;
  padding: 8px 10px;
  gap: 8px;
  border-radius: 13px;
}

.king-badge {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  font-size: 22px;
}

.king-room-main > span,
.king-room-stat span {
  font-size: 11px;
}

.king-room-main strong {
  margin-top: 3px;
  font-size: 19px;
}

.king-room-stat {
  padding-left: 8px;
}

.king-room-stat b {
  margin-top: 5px;
  font-size: 16px;
}

.king-room-side {
  gap: 5px;
}

.king-room-side em {
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 11px;
}

.king-room-side button {
  min-height: 30px;
  border-radius: 8px;
  font-size: 14px;
}

.king-fair-note {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 13px;
}

.king-fair-note span {
  width: 34px;
  height: 34px;
}

.king-fair-note p {
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 620px) {
  .lobby {
    padding-top: 12px;
    gap: 10px;
  }

  .king-profile.home-profile.compact-profile {
    min-height: 82px;
    gap: 7px;
    padding: 11px 12px;
  }

  .king-profile .avatar {
    width: 50px;
    height: 50px;
    font-size: 26px;
  }

  .king-profile .profile-chip strong {
    font-size: 21px;
  }

  .king-profile .profile-chip span:not(.avatar):not(.online-dot) {
    font-size: 14px;
  }

  .king-profile .coin-pill,
  .king-wallet-button {
    min-height: 36px;
    font-size: 13px;
  }

  .king-title h2 {
    font-size: 23px;
  }

  .king-subtitle {
    font-size: 12px;
  }

  .king-room-toolbar {
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
  }

  .king-room-tabs button,
  .king-refresh-button {
    min-height: 38px;
    font-size: 12px;
  }

  .king-room-tabs button {
    padding: 0 9px;
  }

  .king-room-card {
    grid-template-columns: 38px minmax(0, 1fr) 58px;
    min-height: 76px;
    padding: 8px;
    gap: 6px;
    border-radius: 11px;
  }

  .king-badge {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .king-room-main strong {
    font-size: 17px;
  }

  .king-room-card .king-room-stat {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 4px;
  }

  .king-room-main > span,
  .king-room-stat span {
    font-size: 10px;
  }

  .king-room-stat b {
    font-size: 12px;
  }

  .king-room-side em {
    min-height: 22px;
    font-size: 9px;
  }

  .king-room-side button {
    min-height: 28px;
    font-size: 12px;
  }

  .bottom-nav {
    min-height: 64px;
  }
}

/* Keep every room detail in one compact row on phones */
.king-room-card {
  grid-template-columns: minmax(92px, 1fr) minmax(76px, 0.8fr) minmax(76px, 0.8fr) minmax(90px, 0.9fr) 76px;
}

.created-stat b {
  color: #fff;
}

.created-stat span {
  margin-top: 4px;
}

@media (max-width: 620px) {
  .king-room-list {
    gap: 7px;
  }

  .king-room-card {
    grid-template-columns: minmax(66px, 1fr) 50px 43px 52px 50px;
    grid-template-rows: 1fr;
    align-items: center;
    min-height: 56px;
    padding: 6px 7px;
    gap: 5px;
    overflow: hidden;
  }

  .king-room-card .king-room-stat {
    grid-column: auto;
    grid-row: 1;
    display: block;
    min-width: 0;
    padding: 0 0 0 3px;
    border-left: 1px solid rgba(136, 170, 228, 0.16);
  }

  .king-room-main > span,
  .king-room-stat span {
    overflow: hidden;
    font-size: 8px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .king-room-stat b {
    overflow: hidden;
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .created-stat b {
    color: #fff;
    font-size: 10px;
  }

  .created-stat span {
    margin-top: 3px;
    color: rgba(218, 227, 250, 0.72);
    font-size: 9px;
  }

  .king-room-side {
    grid-column: 5;
    grid-row: 1;
    align-self: center;
    gap: 3px;
  }

  .king-room-side em {
    min-height: 17px;
    padding: 2px;
    border-radius: 5px;
    font-size: 8px;
  }

  .king-room-side button {
    min-height: 24px;
    padding: 0 2px;
    border-width: 1px;
    border-radius: 6px;
    font-size: 10px;
  }
}

@media (max-width: 360px) {
  .king-room-card {
    grid-template-columns: minmax(58px, 1fr) 44px 38px 47px 42px;
    gap: 3px;
    padding: 5px;
  }

  .king-room-stat b {
    font-size: 8px;
  }
}

/* Responsive room list: compact phones, expanded tablets */
#kingRoomScreen .room-money {
  overflow: visible;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-overflow: clip;
}

@media (max-width: 620px) {
  #kingRoomScreen .king-room-card {
    grid-template-columns: 50px 46px minmax(62px, 1fr) minmax(62px, 1fr) minmax(58px, 0.9fr);
    gap: 3px;
    padding-inline: 5px;
  }

  #kingRoomScreen .king-room-card .king-room-stat {
    padding-left: 3px;
  }

  #kingRoomScreen .king-room-stat b.room-money {
    font-size: clamp(8px, 2.65vw, 10px);
  }
}

@media (min-width: 621px) {
  .shell {
    width: 100%;
    max-width: 980px;
    padding-inline: 24px;
  }

  .lobby {
    width: min(720px, 100%);
    max-width: none;
  }

  .common-player-header.home-profile.compact-profile {
    width: min(720px, calc(100vw - 48px));
  }

  .common-player-header .profile-chip strong,
  .common-player-header .profile-chip span:not(.avatar):not(.online-dot) {
    max-width: 300px;
  }

  .bottom-nav {
    width: min(560px, calc(100vw - 48px)) !important;
  }

  #kingRoomScreen .king-room-toolbar {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  #kingRoomScreen .king-room-card {
    grid-template-columns:
      minmax(76px, 0.8fr)
      minmax(92px, 0.9fr)
      minmax(110px, 1fr)
      minmax(110px, 1fr)
      minmax(112px, 1fr);
    height: 68px;
    min-height: 68px;
    gap: 8px;
    padding: 7px 10px;
  }

  #kingRoomScreen .king-room-card .king-room-stat {
    height: 42px;
    padding-left: 9px;
  }

  #kingRoomScreen .king-room-stat span {
    font-size: 10px;
    line-height: 13px;
  }

  #kingRoomScreen .king-room-stat b,
  #kingRoomScreen .created-stat b {
    margin-top: 3px;
    font-size: 13px;
    line-height: 16px;
  }

  #kingRoomScreen .created-stat span {
    font-size: 10px;
  }

  #kingRoomScreen .king-room-side button {
    min-height: 34px;
    font-size: 12px;
  }

  .king-fair-note p {
    font-size: 14px;
  }
}

@media (min-width: 900px) {
  .lobby,
  .common-player-header.home-profile.compact-profile {
    width: min(820px, calc(100vw - 64px));
  }

  #kingRoomScreen .king-room-card {
    grid-template-columns:
      minmax(86px, 0.8fr)
      minmax(110px, 0.9fr)
      minmax(132px, 1fr)
      minmax(132px, 1fr)
      minmax(130px, 0.9fr);
  }
}

/* Ludo King room detail page */
.king-detail-header {
  margin-bottom: 10px;
}

.king-room-detail {
  display: grid;
  gap: 12px;
}

.detail-hero-card,
.detail-grid > div,
.detail-policy-card {
  border: 1px solid rgba(88, 132, 202, 0.62);
  background:
    radial-gradient(circle at 100% 0, rgba(76, 119, 228, 0.15), transparent 44%),
    linear-gradient(180deg, rgba(10, 38, 82, 0.96), rgba(4, 18, 42, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 14px 24px rgba(0, 0, 0, 0.22);
}

.detail-hero-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 88px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
}

.detail-hero-card span,
.detail-grid span {
  display: block;
  color: rgba(218, 227, 250, 0.75);
  font-size: 12px;
}

.detail-hero-card strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 28px;
}

.detail-hero-card small {
  display: block;
  margin-top: 4px;
  color: rgba(218, 227, 250, 0.62);
}

.detail-hero-card em {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 9px;
  color: #fff;
  font-style: normal;
  font-weight: 900;
  background: linear-gradient(#27d04d, #057923);
}

.detail-hero-card em.locked {
  background: linear-gradient(#ff951f, #c95d05);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-grid > div {
  min-height: 76px;
  padding: 12px;
  border-radius: 14px;
}

.detail-grid b {
  display: block;
  margin-top: 8px;
  color: #ffdc65;
  font-size: 19px;
}

.detail-policy-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
}

.detail-policy-card h3 {
  margin: 0;
  color: #ffdc65;
  font-size: 18px;
}

.detail-policy-card p {
  margin: 0;
  color: rgba(230, 238, 255, 0.78);
  font-size: 13px;
  line-height: 1.42;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-actions button {
  min-height: 52px;
}

@media (max-width: 620px) {
  .king-detail-header {
    margin-bottom: 6px;
  }

  .detail-hero-card {
    grid-template-columns: 44px minmax(0, 1fr) 68px;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
  }

  .detail-hero-card .king-badge {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .detail-hero-card strong {
    font-size: 22px;
  }

  .detail-hero-card em {
    min-height: 28px;
    font-size: 11px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid > div {
    min-height: 60px;
    padding: 10px;
  }

  .detail-grid b {
    margin-top: 5px;
    font-size: 16px;
  }

  .detail-policy-card {
    padding: 11px;
  }

  .detail-policy-card p {
    font-size: 12px;
  }

  .detail-actions button {
    min-height: 46px;
  }
}

/* Player top bar compact header */
.common-player-header.home-profile.compact-profile {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 40;
  width: min(390px, calc(100vw - 28px));
  min-height: 60px;
  height: 60px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 7px 10px;
  transform: translateX(-50%);
  border-radius: 16px;
}

.common-player-header .profile-chip {
  min-width: 0;
  gap: 9px;
}

.common-player-header .avatar {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.common-player-header .online-dot {
  width: 12px;
  height: 12px;
}

.common-player-header .profile-chip strong {
  overflow: hidden;
  max-width: 148px;
  font-size: 17px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.common-player-header .profile-chip span:not(.avatar):not(.online-dot) {
  overflow: hidden;
  max-width: 148px;
  font-size: 12px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.common-player-header .home-profile-actions {
  gap: 7px;
  justify-content: end;
}

.common-player-header .coin-pill {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
}

.common-player-header .coin-wallet-button {
  color: #fff;
  background: rgba(7, 24, 55, 0.9);
  border: 1px solid rgba(137, 170, 229, 0.44);
  cursor: pointer;
}

@media (max-width: 380px) {
  .common-player-header .profile-chip strong,
  .common-player-header .profile-chip span:not(.avatar):not(.online-dot) {
    max-width: 108px;
  }
}

.lobby {
  padding-top: 92px !important;
}

.history-sheet {
  padding-top: 88px;
}

.history-panel {
  max-height: min(calc(100vh - 190px), 680px);
}

/* Final fixed player bottom navigation */
.bottom-nav {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(8px, env(safe-area-inset-bottom)) !important;
  z-index: 30 !important;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: center !important;
  width: min(390px, calc(100vw - 20px)) !important;
  height: 54px !important;
  min-height: 54px !important;
  padding: 4px 8px !important;
  overflow: visible !important;
  transform: translateX(-50%) !important;
  border: 1px solid rgba(84, 132, 204, 0.62) !important;
  border-radius: 18px !important;
  background: linear-gradient(180deg, rgba(8, 31, 69, 0.96), rgba(3, 14, 34, 0.98)) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.09) !important;
}

.bottom-nav button {
  position: relative !important;
  top: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  width: auto !important;
  height: 46px !important;
  min-height: 46px !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 12px !important;
  color: #8ea2c5 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 18px !important;
  line-height: 1 !important;
  text-align: center !important;
}

.bottom-nav button span {
  position: static !important;
  display: block !important;
  width: auto !important;
  max-width: 64px !important;
  overflow: hidden !important;
  transform: none !important;
  color: inherit !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.bottom-nav button.active {
  color: #ffd95c !important;
}

.bottom-nav button.active::before {
  content: "" !important;
  position: absolute !important;
  top: -5px !important;
  left: 50% !important;
  width: 26px !important;
  height: 3px !important;
  transform: translateX(-50%) !important;
  border-radius: 999px !important;
  background: #ffd95c !important;
  box-shadow: 0 0 12px rgba(255, 217, 92, 0.7) !important;
}

.bottom-nav .nav-dashboard {
  top: -16px !important;
  width: 50px !important;
  height: 50px !important;
  min-height: 50px !important;
  justify-self: center !important;
  border: 2px solid rgba(255, 184, 38, 0.95) !important;
  border-radius: 50% !important;
  color: #fff !important;
  background: radial-gradient(circle at 50% 25%, #8d5cff, #4a20bc 62%, #180946) !important;
  box-shadow: 0 0 22px rgba(129, 83, 255, 0.5), 0 10px 18px rgba(0, 0, 0, 0.34) !important;
  font-size: 20px !important;
}

.bottom-nav .nav-dashboard span {
  position: absolute !important;
  top: 51px !important;
  left: 50% !important;
  width: 82px !important;
  transform: translateX(-50%) !important;
  color: #8d5cff !important;
  font-size: 10px !important;
}

.lobby {
  padding-bottom: 86px !important;
}

/* Compact Ludo King room rows */
#kingRoomScreen .king-room-list {
  gap: 6px;
}

#kingRoomScreen .king-room-card {
  display: grid;
  grid-template-columns: 64px 58px 44px 44px minmax(58px, 1fr);
  align-items: center;
  width: 100%;
  height: 65px;
  min-height: 65px;
  padding: 6px 7px;
  gap: 4px;
  overflow: hidden;
}

#kingRoomScreen .king-room-card .king-room-stat {
  display: flex;
  min-width: 0;
  height: 38px;
  padding: 0 0 0 5px;
  border-left: 1px solid rgba(136, 170, 228, 0.18);
  flex-direction: column;
  justify-content: center;
}

#kingRoomScreen .king-room-card .created-stat {
  padding-left: 0;
  border-left: 0;
}

#kingRoomScreen .king-room-stat span {
  margin: 0;
  overflow: hidden;
  color: rgba(205, 218, 246, 0.72);
  font-size: 8px;
  line-height: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#kingRoomScreen .king-room-stat b {
  display: block;
  margin: 2px 0 0;
  overflow: hidden;
  color: #fff;
  font-size: 10px;
  line-height: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#kingRoomScreen .created-stat b {
  font-size: 10px;
}

#kingRoomScreen .created-stat span {
  margin-top: 1px;
  font-size: 9px;
}

#kingRoomScreen .king-room-side {
  display: flex;
  min-width: 0;
  height: 100%;
  align-items: center;
  justify-content: flex-end;
}

#kingRoomScreen .king-room-side em {
  display: none;
}

#kingRoomScreen .king-room-side button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

#kingRoomScreen .king-room-side button:disabled {
  border-color: rgba(123, 145, 181, 0.48);
  background: rgba(27, 47, 78, 0.72);
  color: rgba(195, 208, 232, 0.58);
  cursor: not-allowed;
}

@media (max-width: 360px) {
  #kingRoomScreen .king-room-card {
    grid-template-columns: 57px 50px 39px 39px minmax(53px, 1fr);
    padding-inline: 5px;
    gap: 3px;
  }

  #kingRoomScreen .king-room-card .king-room-stat {
    padding-left: 3px;
  }

  #kingRoomScreen .king-room-stat b {
    font-size: 9px;
  }
}

.proof-preview {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(91, 151, 255, 0.52);
  border-radius: 8px;
  background: rgba(7, 29, 66, 0.78);
}

.proof-preview[hidden] {
  display: none;
}

.proof-preview img {
  width: 88px;
  height: 88px;
  border: 1px solid rgba(255, 211, 84, 0.5);
  border-radius: 7px;
  object-fit: cover;
  background: #07152c;
}

.proof-preview strong,
.proof-preview small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proof-preview strong {
  color: #fff;
  font-size: 13px;
}

.proof-preview small {
  margin-top: 4px;
  color: #84e779;
  font-size: 10px;
}

.proof-preview-actions {
  display: flex;
  gap: 7px;
  margin-top: 9px;
}

.proof-preview-actions button {
  min-height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 11px;
}

.proof-preview-actions .danger-action {
  border-color: rgba(255, 104, 91, 0.6);
  color: #ffc2bc;
  background: rgba(135, 33, 29, 0.38);
}

/* Stable proof submission/status layout */
#kingProofPane {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 12px;
}

#kingProofPane[hidden] {
  display: none;
}

#kingProofPane > * {
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

#kingProofPane .king-title {
  margin-top: 2px;
}

#kingProofPane .king-subtitle {
  padding: 0 14px;
  color: rgba(214, 225, 248, 0.76);
  text-align: center;
  line-height: 1.3;
}

#kingProofPane .proof-summary-card,
#kingProofPane .proof-card {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
}

#kingProofPane .approval-card {
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
}

#kingProofPane .approval-card h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

#kingProofPane .approval-card .mini-badge {
  max-width: 145px;
  overflow: hidden;
  padding-inline: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#kingProofPane .king-actions {
  width: 100%;
}

#kingProofPane.status-only .king-actions {
  grid-template-columns: 1fr;
}

#kingProofPane.status-only #showKingEntriesButton {
  width: 100%;
}

@media (max-width: 620px) {
  #kingProofPane {
    gap: 10px;
  }

  #kingProofPane .proof-summary-card {
    grid-template-columns: 54px minmax(0, 1fr) 64px;
    gap: 10px;
    padding: 14px;
  }

  #kingProofPane .proof-success {
    width: 50px;
    height: 50px;
    font-size: 29px;
  }

  #kingProofPane .proof-summary-card strong {
    font-size: 16px;
    line-height: 1.15;
  }

  #kingProofPane .proof-summary-card > div:nth-child(2) span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
  }

  #kingProofPane .proof-joined b {
    font-size: 19px;
  }

  #kingProofPane .proof-summary-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin-top: 2px;
  }

  #kingProofPane .proof-summary-card dt {
    font-size: 10px;
  }

  #kingProofPane .proof-summary-card dd {
    font-size: 14px;
  }

  #kingProofPane .proof-card {
    gap: 10px;
    padding: 14px;
  }

  #kingProofPane .proof-card h2 {
    font-size: 18px;
    line-height: 1.2;
  }

  #kingProofPane .approval-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  #kingProofPane .approval-card .mini-badge {
    max-width: 125px;
    font-size: 9px;
  }

  #kingProofPane .approval-card p {
    font-size: 13px;
    line-height: 1.35;
  }

  #kingProofPane .king-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #kingProofPane .king-actions button {
    width: 100%;
  }
}

/* Compact popup and bottom-sheet scale */
.history-panel {
  width: min(390px, 100%);
  padding: 14px;
  border-radius: 18px;
  font-size: 13px;
}

.history-panel .panel-head {
  min-height: 36px;
  margin-bottom: 10px;
}

.history-panel .panel-head h2 {
  font-size: 17px;
  line-height: 1.2;
}

.history-panel .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 20px;
}

.history-panel .history-list {
  gap: 8px;
}

.history-panel .nav-summary {
  gap: 4px;
  padding: 13px 14px;
  border-radius: 13px;
}

.history-panel .nav-summary span {
  font-size: 12px;
}

.history-panel .nav-summary strong {
  font-size: 25px;
}

.history-panel .wallet-actions {
  gap: 8px;
}

.history-panel .sheet-action,
.history-panel .sheet-note,
.history-panel .profile-detail {
  gap: 8px;
  padding: 11px;
  border-radius: 12px;
}

.history-panel .sheet-action label {
  gap: 6px;
  font-size: 11px;
}

.history-panel input,
.history-panel textarea,
.history-panel select {
  min-height: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.history-panel button:not(.icon-button) {
  min-height: 38px;
  height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.history-panel .wallet-actions button {
  padding-inline: 8px;
  font-size: 11px;
}

.history-panel .sheet-note strong {
  font-size: 13px;
}

.history-panel .sheet-note span {
  font-size: 11px;
  line-height: 1.35;
}

.history-panel .sheet-note span::before {
  width: 5px;
  height: 5px;
  margin-right: 6px;
}

.history-panel .history-item {
  gap: 8px;
  padding: 10px 11px;
  border-radius: 11px;
}

.history-panel .history-item strong {
  font-size: 12px;
}

.history-panel .history-item span {
  margin-top: 2px;
  font-size: 10px;
}

.history-panel .history-item b {
  font-size: 13px;
}

.history-panel .profile-detail .avatar {
  width: 42px;
  height: 42px;
  font-size: 21px;
}

.history-panel .profile-detail strong {
  font-size: 14px;
}

.history-panel .profile-detail span:not(.avatar) {
  font-size: 11px;
}

.create-modal,
.result-modal {
  font-size: 13px;
}

.create-modal {
  padding: 18px;
  border-radius: 18px;
}

.create-modal > h2,
.result-modal > h2 {
  font-size: 20px;
}

.create-modal button,
.result-modal button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 12px;
}

.create-modal input,
.create-modal textarea,
.create-modal select {
  min-height: 40px;
  font-size: 13px;
}

.create-modal .modal-close {
  width: 36px;
  min-height: 36px;
  font-size: 25px;
}

/* Dashboard width and mode-card alignment */
#homeLobbyScreen.home-screen {
  width: min(375px, calc(100vw - 43px));
  margin-inline: auto;
  gap: 14px;
}

#homeLobbyScreen > .section-title,
#homeLobbyScreen .home-mode-wrap,
#homeLobbyScreen .room-list-panel {
  width: 100%;
  min-width: 0;
  margin-inline: 0;
}

#homeLobbyScreen .mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 12px;
}

#homeLobbyScreen .mode-card {
  width: 100%;
  min-width: 0;
  margin: 0;
}

#homeLobbyScreen .room-list-panel {
  padding: 12px;
  border-radius: 18px;
}

#homeLobbyScreen .room-list-panel .panel-head {
  margin-bottom: 7px;
}

#homeLobbyScreen .room-list-panel .panel-head h2 {
  font-size: 17px;
  line-height: 1.1;
}

#homeLobbyScreen #refreshRoomsButton.icon-button {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
}

#homeLobbyScreen .room-list {
  grid-template-columns: 1fr;
  gap: 7px;
  max-height: 288px;
  overflow: auto;
  padding-right: 1px;
  -webkit-overflow-scrolling: touch;
}

#homeLobbyScreen .room-list .hint {
  min-height: 0;
  place-items: start;
  color: rgba(183, 200, 239, 0.68);
  font-size: 11px;
}

#homeLobbyScreen .room-item {
  grid-template-columns: minmax(0, 1fr) 76px;
  grid-template-areas:
    "code action"
    "players action"
    "timer action";
  align-items: center;
  gap: 3px 10px;
  min-height: 72px;
  padding: 10px 11px;
  border-radius: 13px;
  border-color: rgba(111, 151, 219, 0.38);
  background:
    linear-gradient(135deg, rgba(17, 58, 116, 0.96), rgba(5, 21, 48, 0.98)),
    #071935;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

#homeLobbyScreen .room-item strong {
  grid-area: code;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#homeLobbyScreen .room-item span {
  color: rgba(225, 235, 255, 0.72);
  font-size: 11px;
  line-height: 1.2;
}

#homeLobbyScreen .room-item span:not(.hint) {
  grid-area: players;
}

#homeLobbyScreen .room-item .hint {
  grid-area: timer;
  overflow: hidden;
  color: rgba(143, 165, 204, 0.84);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#homeLobbyScreen .room-item button {
  grid-area: action;
  width: 76px;
  min-height: 38px;
  border-radius: 11px;
  color: #2c1b00;
  background: linear-gradient(#ffe16f, #f2b11e 58%, #ba700c);
  font-size: 12px;
}

/* Compact game HUD and clear dice zone */
.game-shell {
  gap: 12px;
  padding: 12px 10px 24px;
}

.game-topbar {
  display: grid;
  grid-template-columns: 40px repeat(2, minmax(0, 1fr));
  width: min(390px, calc(100vw - 20px));
  margin-inline: auto;
  gap: 7px;
  align-items: stretch;
}

.game-topbar .game-back-button {
  width: 40px;
  min-width: 40px;
  min-height: 54px;
  height: 100%;
  padding: 0;
  border: 1px solid rgba(255, 198, 53, 0.78);
  border-radius: 12px;
  color: #ffd85b;
  background: linear-gradient(180deg, rgba(15, 49, 94, 0.98), rgba(5, 19, 41, 0.98));
  font-size: 22px;
}

.game-topbar .prize-card {
  grid-template-columns: 30px minmax(0, 1fr);
  min-width: 0;
  min-height: 54px;
  padding: 7px 8px;
  gap: 6px;
  border-width: 1px;
  border-radius: 12px;
}

.game-topbar .prize-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 15px;
}

.game-topbar .prize-card span:not(.prize-icon) {
  font-size: 9px;
  line-height: 1.1;
}

.game-topbar .prize-card strong,
.game-topbar #pointScoreCard strong {
  margin-top: 2px;
  font-size: 17px;
}

.game-topbar:has(.point-only:not([hidden])) {
  grid-template-columns: 40px repeat(2, minmax(0, 1fr));
}

.game-topbar .point-only:not([hidden]) {
  display: grid;
}

.game-topbar .point-only:not([hidden]) ~ .prize-card {
  min-height: 48px;
}

.game-turn-banner {
  --turn-color: #ffd85b;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 30px;
  align-items: center;
  width: min(390px, calc(100vw - 20px));
  min-height: 46px;
  margin: -4px auto 0;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--turn-color) 72%, #ffffff 8%);
  border-radius: 14px;
  color: #ffffff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--turn-color) 20%, transparent), rgba(6, 22, 48, 0.96) 42%, rgba(6, 22, 48, 0.98)),
    #071326;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 8px 26px color-mix(in srgb, var(--turn-color) 26%, transparent);
}

.turn-color-dot {
  width: 22px;
  height: 22px;
  border: 2px solid #ffe279;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.game-turn-banner strong,
.game-turn-banner small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-turn-banner strong {
  font-size: 13px;
  line-height: 1.05;
}

.game-turn-banner small {
  margin-top: 2px;
  color: #c9d7ee;
  font-size: 11px;
  font-weight: 750;
}

.turn-arrow-cue {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #061326;
  background: var(--turn-color);
  font-size: 18px;
  line-height: 1;
  opacity: 0.55;
}

.game-turn-banner.my-turn {
  border-width: 2px;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--turn-color) 28%, transparent),
    0 0 24px color-mix(in srgb, var(--turn-color) 62%, transparent),
    inset 0 0 18px color-mix(in srgb, var(--turn-color) 22%, transparent);
  animation: turnBannerHeartbeat 0.92s ease-in-out infinite;
}

.game-turn-banner.my-turn small {
  color: #7cff4e;
}

.game-turn-banner.my-turn .turn-arrow-cue {
  opacity: 1;
  animation: turnCueBounce 0.72s ease-in-out infinite;
}

.arena,
.board-zone {
  width: 100%;
}

.bottom-dock {
  display: grid;
  grid-template-columns: minmax(0, 150px);
  justify-content: center;
  min-height: 112px;
  padding: 8px 0 0;
  gap: 8px;
}

.turn-plinth {
  --turn-color: #ffd85b;
  position: relative;
}

.turn-plinth.my-turn-plinth::before {
  content: "YOUR TURN";
  position: absolute;
  left: 50%;
  top: -22px;
  z-index: 4;
  padding: 3px 9px;
  border-radius: 999px;
  color: #071326;
  background: var(--turn-color);
  box-shadow: 0 0 18px color-mix(in srgb, var(--turn-color) 75%, transparent);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
  transform: translateX(-50%);
  animation: turnArrowBounce 0.72s ease-in-out infinite;
}

.dice.my-turn-dice {
  border-color: var(--turn-color);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--turn-color) 24%, transparent),
    0 0 26px color-mix(in srgb, var(--turn-color) 70%, transparent),
    0 10px 24px rgba(0, 0, 0, 0.42);
}

.dice.opponent-turn-dice {
  border-color: color-mix(in srgb, var(--turn-color) 82%, #ffffff 8%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--turn-color) 18%, transparent),
    0 0 18px color-mix(in srgb, var(--turn-color) 38%, transparent);
}

.dice.rolled-dice {
  animation: diceTurnGlow 0.95s ease-in-out infinite;
}

.board.my-turn-board {
  box-shadow:
    inset 0 0 34px rgba(0, 0, 0, 0.34),
    0 0 0 3px color-mix(in srgb, var(--turn-color) 65%, transparent),
    0 0 24px color-mix(in srgb, var(--turn-color) 44%, transparent);
}

.turn-plinth {
  display: grid;
  grid-template-rows: 76px auto;
  width: 150px;
  min-height: 118px;
  padding: 0 8px 8px;
  row-gap: 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
}

.dice {
  position: relative;
  z-index: 3;
  width: 76px;
  height: 76px;
  min-height: 76px;
  margin: 0;
  justify-self: center;
  filter: drop-shadow(0 7px 0 rgba(82, 48, 8, 0.64)) drop-shadow(0 10px 12px rgba(0, 0, 0, 0.38));
}

.dice.timer-active::before {
  inset: -6px;
  border-radius: 18px;
}

.dice.timer-active::after {
  top: -7px;
  right: -7px;
  min-width: 25px;
  height: 25px;
  border-width: 1px;
  font-size: 11px;
}

.turn-plinth h2 {
  overflow: hidden;
  width: 100%;
  margin: 0;
  color: #83ef55;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-dock #startGameButton:not([hidden]) {
  width: 150px;
  min-height: 40px;
  margin-top: 4px;
  font-size: 12px;
}

@media (max-width: 620px) {
  .game-view {
    margin-inline: -10px;
  }

  .game-shell {
    padding-top: 10px;
  }

  .game-topbar {
    grid-template-columns: 38px repeat(2, minmax(0, 1fr));
  }

  .game-topbar .game-back-button {
    width: 38px;
    min-width: 38px;
  }

  .board-frame {
    width: min(calc(100vw - 20px), 680px);
  }
}

/* Final responsive app shell and Ludo King room rows */
#kingRoomScreen .room-money {
  overflow: visible !important;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-overflow: clip !important;
}

@media (max-width: 620px) {
  #kingRoomScreen .king-room-card {
    grid-template-columns:
      50px
      46px
      minmax(62px, 1fr)
      minmax(62px, 1fr)
      minmax(58px, 0.9fr);
    gap: 3px;
    padding-inline: 5px;
  }

  #kingRoomScreen .king-room-card .king-room-stat {
    padding-left: 3px;
  }

  #kingRoomScreen .king-room-stat b.room-money {
    font-size: clamp(8px, 2.65vw, 10px);
  }
}

@media (min-width: 621px) {
  .shell {
    width: 100%;
    max-width: 980px;
    padding-inline: 24px;
  }

  .lobby {
    width: min(720px, 100%);
    max-width: none;
  }

  .common-player-header.home-profile.compact-profile {
    width: min(720px, calc(100vw - 48px));
  }

  .common-player-header .profile-chip strong,
  .common-player-header .profile-chip span:not(.avatar):not(.online-dot) {
    max-width: 300px;
  }

  .bottom-nav {
    width: min(560px, calc(100vw - 48px)) !important;
  }

  #kingRoomScreen .king-room-toolbar {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  #kingRoomScreen .king-room-card {
    grid-template-columns:
      minmax(76px, 0.8fr)
      minmax(92px, 0.9fr)
      minmax(110px, 1fr)
      minmax(110px, 1fr)
      minmax(112px, 1fr);
    height: 68px;
    min-height: 68px;
    gap: 8px;
    padding: 7px 10px;
  }

  #kingRoomScreen .king-room-card .king-room-stat {
    height: 42px;
    padding-left: 9px;
  }

  #kingRoomScreen .king-room-stat span {
    font-size: 10px;
    line-height: 13px;
  }

  #kingRoomScreen .king-room-stat b,
  #kingRoomScreen .created-stat b {
    margin-top: 3px;
    font-size: 13px;
    line-height: 16px;
  }

  #kingRoomScreen .created-stat span {
    font-size: 10px;
  }

  #kingRoomScreen .king-room-side button {
    min-height: 34px;
    font-size: 12px;
  }

  .king-fair-note p {
    font-size: 14px;
  }
}

@media (min-width: 900px) {
  .lobby,
  .common-player-header.home-profile.compact-profile {
    width: min(820px, calc(100vw - 64px));
  }

  #kingRoomScreen .king-room-card {
    grid-template-columns:
      minmax(86px, 0.8fr)
      minmax(110px, 0.9fr)
      minmax(132px, 1fr)
      minmax(132px, 1fr)
      minmax(130px, 0.9fr);
  }
}

/* Authoritative responsive rules: keep this block last. */
html,
body,
.app,
.shell,
.lobby,
.app-page,
.home-screen,
.setup-screen,
.king-room-panel,
.king-room-detail,
.proof-card,
.history-panel,
.create-modal,
.result-modal {
  min-width: 0;
}

img,
video,
canvas {
  max-width: 100%;
}

.app-page,
.home-screen,
.setup-screen,
.king-room-panel,
.king-room-detail,
.proof-card,
.policy-content,
.payment-guide,
.compact-form,
.match-preview,
.profile-page-card,
.referral-card,
.notification-card,
.transaction-row {
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .app-page,
  #homeLobbyScreen.home-screen {
    width: min(100%, calc(100vw - 43px));
  }

  .setup-screen,
  #joinPanel,
  .king-room-panel {
    width: 100%;
    max-width: 100%;
  }

  .wallet-method-grid button,
  .page-tabs button,
  .player-select button,
  .duration-chips button,
  .stake-grid button {
    min-width: 0;
  }

  .wallet-method-grid button span,
  .page-tabs button,
  .player-select button span,
  .stake-grid button {
    white-space: normal;
  }

  .profile-page-card,
  .transaction-row,
  .profile-page-card > div,
  .transaction-row > div {
    min-width: 0;
  }

  .profile-page-card strong,
  .profile-page-card span:not(.avatar),
  .transaction-row strong,
  .transaction-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .create-modal,
  .result-modal,
  .history-panel {
    width: min(100%, calc(100vw - 24px));
    max-width: none;
  }
}

@media (min-width: 621px) {
  #homeLobbyScreen.home-screen {
    width: min(520px, calc(100vw - 96px));
  }

  #homeLobbyScreen .mode-grid {
    gap: 14px;
  }

  #homeLobbyScreen .mode-card {
    min-height: 184px;
  }

  #homeLobbyScreen .room-list-panel {
    min-height: 180px;
  }

  .app-page {
    width: min(580px, calc(100vw - 96px));
  }

  .wallet-page {
    width: min(620px, calc(100vw - 96px));
  }

  #walletDepositPane {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  #walletDepositPane .wallet-method-grid,
  #walletDepositPane .compact-form {
    grid-column: 1 / -1;
  }

  #walletDepositPane .deposit-qr-box,
  #walletDepositPane .payment-guide {
    height: 100%;
    min-height: 230px;
  }

  #walletDepositPane .deposit-qr-box {
    align-content: center;
  }

  #walletDepositPane .payment-guide {
    align-content: start;
  }

  .profile-page-card {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    padding: 14px 16px;
  }

  .profile-page-card .avatar {
    width: 52px;
    height: 52px;
  }

  .profile-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-list,
  .transaction-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-list:has(> :only-child),
  .transaction-list:has(> :only-child) {
    grid-template-columns: 1fr;
  }

  .setup-screen {
    width: min(688px, calc(100vw - 80px));
    margin-inline: auto;
  }

  #kingProofPane,
  #kingEntriesPane {
    width: min(640px, 100%);
    margin-inline: auto;
  }

  .history-panel {
    width: min(600px, calc(100vw - 64px));
  }

  .create-modal,
  .result-modal {
    width: min(560px, calc(100vw - 64px));
    max-width: none;
  }
}

@media (min-width: 900px) {
  #homeLobbyScreen.home-screen {
    width: min(600px, calc(100vw - 120px));
  }

  .app-page {
    width: min(660px, calc(100vw - 120px));
  }

  .wallet-page {
    width: min(720px, calc(100vw - 120px));
  }
}

/* Final game-board responsive fit */
.game-view {
  width: 100%;
  margin: 0;
}

.game-shell {
  --game-board-size: min(92vw, calc(100vh - 255px), 680px);
  width: min(100%, 980px);
  min-height: 100vh;
  margin-inline: auto;
  gap: 12px;
  align-content: start;
  justify-items: center;
  padding: 12px 14px 22px;
  overflow: hidden auto;
}

.game-topbar {
  width: min(var(--game-board-size), calc(100vw - 28px));
  max-width: 100%;
}

.arena,
.board-zone {
  width: min(var(--game-board-size), calc(100vw - 28px));
  max-width: 100%;
}

.board-frame {
  box-sizing: border-box;
  width: min(var(--game-board-size), calc(100vw - 28px));
  max-width: 100%;
  padding: clamp(5px, 1vw, 10px);
  border-width: clamp(3px, 0.75vw, 6px);
  border-radius: clamp(18px, 3vw, 34px);
}

.board {
  border-width: clamp(1px, 0.4vw, 3px);
  border-radius: clamp(14px, 2.4vw, 28px);
}

.bottom-dock {
  width: min(var(--game-board-size), calc(100vw - 28px));
  max-width: 100%;
  min-height: 100px;
  padding-top: 2px;
}

@media (min-width: 900px) {
  .game-shell {
    --game-board-size: min(calc(100vh - 255px), 58vw, 760px);
    min-height: 100vh;
    padding-top: 14px;
  }

  .game-topbar {
    width: min(520px, var(--game-board-size));
  }
}

@media (min-width: 1200px) {
  .game-shell {
    --game-board-size: min(calc(100vh - 255px), 56vw, 800px);
  }
}

@media (max-height: 760px) and (min-width: 621px) {
  .game-shell {
    --game-board-size: min(calc(100vh - 225px), 56vw, 640px);
    gap: 8px;
    padding-top: 8px;
  }

  .bottom-dock {
    min-height: 86px;
  }

  .dice {
    width: 64px;
    height: 64px;
    min-height: 64px;
  }

  .turn-plinth {
    grid-template-rows: 64px auto;
    min-height: 92px;
  }
}

@media (max-width: 620px) and (min-height: 760px) {
  .game-view {
    width: 100%;
    margin-inline: auto;
  }

  .game-shell {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 14px;
    padding-bottom: 18px;
  }

  .game-topbar {
    flex: 0 0 auto;
  }

  .arena {
    margin-top: auto;
  }

  .bottom-dock {
    margin-bottom: auto;
    min-height: 96px;
  }
}

@media (max-width: 620px) and (max-height: 759px) {
  .game-view {
    width: 100%;
    margin-inline: auto;
  }

  .game-shell {
    width: 100%;
    max-width: 100%;
  }

  .game-shell {
    align-content: start;
  }
}

/* Final app fit: keep every main page at a 10px side gutter on all devices. */
:root {
  --app-side-gap: 10px;
  --app-fit-width: min(100%, calc(100dvw - (var(--app-side-gap) * 2)));
}

.shell {
  width: var(--app-fit-width) !important;
  max-width: none !important;
  margin-inline: auto !important;
  padding-inline: 0 !important;
}

.lobby,
.app-page,
.home-screen,
#homeLobbyScreen.home-screen,
.setup-screen,
.king-room-panel,
.king-room-detail,
#kingProofPane,
#kingEntriesPane,
.wallet-page,
.profile-page,
.notification-page,
.common-player-header.home-profile.compact-profile,
.home-profile.compact-profile,
.king-profile.home-profile.compact-profile,
.room-list-panel,
.match-preview,
.bottom-nav,
.legal-links {
  width: var(--app-fit-width) !important;
  max-width: none !important;
  margin-inline: auto !important;
}

.app-page,
.home-screen,
.setup-screen,
.king-room-panel,
.king-room-detail {
  min-width: 0 !important;
}

.game-view {
  width: 100% !important;
  margin-inline: auto !important;
}

.game-shell {
  width: 100% !important;
  max-width: none !important;
  padding-left: var(--app-side-gap) !important;
  padding-right: var(--app-side-gap) !important;
}

.game-topbar,
.game-turn-banner,
.arena,
.board-zone,
.board-frame,
.bottom-dock {
  width: min(var(--game-board-size), var(--app-fit-width)) !important;
  max-width: none !important;
}

@media (min-width: 621px) {
  .lobby {
    padding-bottom: 96px;
  }

  #homeLobbyScreen .mode-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .profile-menu,
  .notification-list,
  .transaction-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (min-width: 900px) {
  #kingRoomScreen .king-room-card {
    grid-template-columns:
      minmax(94px, 0.62fr)
      minmax(120px, 0.7fr)
      minmax(150px, 0.85fr)
      minmax(150px, 0.85fr)
      minmax(150px, 0.75fr);
  }
}
