@import url('https://fonts.googleapis.com/css2?family=Russo+One&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&display=swap');

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #121212;
  font-family: Arial, Helvetica, sans-serif;
  color: #fff;
}

body {
  position: relative;
  --btn-red-border: rgba(255, 42, 42, 0.82);
  --btn-red-glow: rgba(255, 42, 42, 0.22);
  --btn-red-glow-strong: rgba(255, 42, 42, 0.38);
  --game-accent: #ff2a2a;
  --game-accent-soft: rgba(255, 42, 42, 0.18);
  --game-line: rgba(255, 255, 255, 0.10);
}

/* =========================
   THEMES
   ========================= */

body[data-theme="classic"] {
  --game-accent: #d7b169;
  --game-accent-soft: rgba(215, 177, 105, 0.20);
  --btn-red-border: #d7b169;
  --btn-red-glow: rgba(215, 177, 105, 0.35);
  --btn-red-glow-strong: rgba(215, 177, 105, 0.55);
}

body[data-theme="cyber"] {
  --game-accent: #8d63ff;
  --game-accent-soft: rgba(141, 99, 255, 0.22);
  --btn-red-border: #8d63ff;
  --btn-red-glow: rgba(141, 99, 255, 0.35);
  --btn-red-glow-strong: rgba(141, 99, 255, 0.55);
}

body[data-theme="ice"] {
  --game-accent: #78dcff;
  --game-accent-soft: rgba(120, 220, 255, 0.22);
  --btn-red-border: #78dcff;
  --btn-red-glow: rgba(120, 220, 255, 0.35);
  --btn-red-glow-strong: rgba(120, 220, 255, 0.55);
}

/* =========================
   SCREENS
   ========================= */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  background-color: #121212;
}

.screen.active {
  display: block;
}

.screen-art {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
  z-index: 0;
  pointer-events: none;
}

.bg-menu       { background-image: url('/assets/bg/bg-menu.png'); }
.bg-ton        { background-image: url('/assets/bg/bg-ton.png'); }
.bg-matching   { background-image: url('/assets/bg/bg-matching.png'); }
.bg-rules      { background-image: url('/assets/bg/bg-rules.png'); }
.bg-settings   { background-image: url('/assets/bg/bg-settings.png'); }
.bg-themes     { background-image: url('/assets/bg/bg-win.png'); }
.bg-win        { background-image: url('/assets/bg/bg-win-city.jpeg?v=1'); }
.bg-lose       { background-image: url('/assets/bg/bg-lose.png'); }
.bg-profit     { background-image: url('/assets/bg/bg-profit.jpg'); }
.bg-top        { background-image: url('/assets/bg/bg-top.jpg'); }
.bg-tournament {
  background-image: url('/assets/bg/bg-tournament.jpg?v=2');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #000;
}

@media (min-width: 900px) {
  .screen-art {
    background-size: auto 100%;
  }
}

/* =========================
   BUTTON LOOK
   ========================= */

.btn,
.btn.secondary,
.btn-inline,
.bet-btn,
.themes-btn,
.ton-connect-btn,
.ton-back-btn,
.rules-back-btn,
.settings-btn,
.settings-back-btn,
.themes-back-btn,
.profile-back,
.win-btn,
.lose-btn,
.menu-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1.5px solid var(--btn-red-border);
  background: rgba(10, 10, 10, 0.42);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  box-shadow:
    0 0 10px var(--btn-red-glow),
    inset 0 0 8px rgba(255,255,255,0.03);
  text-shadow: 0 0 6px rgba(255,255,255,0.10);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.08s ease, box-shadow 0.12s ease;
  opacity: 1;
  visibility: visible;
}

.btn::before,
.btn.secondary::before,
.btn-inline::before,
.bet-btn::before,
.themes-btn::before,
.ton-connect-btn::before,
.ton-back-btn::before,
.rules-back-btn::before,
.settings-btn::before,
.settings-back-btn::before,
.themes-back-btn::before,
.profile-back::before,
.win-btn::before,
.lose-btn::before,
.menu-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.08) 0%,
    rgba(255,255,255,0.02) 35%,
    rgba(255,255,255,0.00) 100%
  );
  pointer-events: none;
}

.btn:hover,
.btn.secondary:hover,
.btn-inline:hover,
.bet-btn:hover,
.themes-btn:hover,
.ton-connect-btn:hover,
.ton-back-btn:hover,
.rules-back-btn:hover,
.settings-btn:hover,
.settings-back-btn:hover,
.themes-back-btn:hover,
.profile-back:hover,
.win-btn:hover,
.lose-btn:hover,
.menu-btn:hover {
  background: rgba(10, 10, 10, 0.56);
  box-shadow:
    0 0 16px var(--btn-red-glow-strong),
    inset 0 0 10px rgba(255,255,255,0.04);
}

.btn:active,
.btn.secondary:active,
.btn-inline:active,
.bet-btn:active,
.themes-btn:active,
.ton-connect-btn:active,
.ton-back-btn:active,
.rules-back-btn:active,
.settings-btn:active,
.settings-back-btn:active,
.themes-back-btn:active,
.profile-back:active,
.win-btn:active,
.lose-btn:active,
.menu-btn:active {
  transform: scale(0.98);
}

button.pressed {
  transform: scale(0.95);
  filter: brightness(0.85);
}

@keyframes neonPulse {
  0%   { box-shadow: 0 0 8px var(--btn-red-glow); }
  50%  { box-shadow: 0 0 14px var(--btn-red-glow-strong); }
  100% { box-shadow: 0 0 8px var(--btn-red-glow); }
}

.btn,
.bet-btn,
.menu-btn,
.settings-btn,
.themes-btn {
  animation: neonPulse 2.8s ease-in-out infinite;
}

/* =========================
   TITLE PLATES
   ========================= */

.game-title,
.panel-title {
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  margin: 0;
  z-index: 6;
}

.title-plate-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.title-plate-line {
  display: inline-block;
  width: fit-content;
  max-width: 92vw;
  padding: 4px 10px;
  white-space: nowrap;
  font-size: inherit;
  line-height: 1.02;
  background: #2f5cff;
  color: #fff;
  box-shadow: 0 0 12px rgba(47, 92, 255, 0.55);
}

/* =========================
   MENU
   panel anchor: left 43.8%, top 77% (matches bg art's "console" area)
   ========================= */

#screen-menu .menu-title {
  position: absolute;
  left: 58.5%;
  top: 4%;
  transform: translate(-50%, -50%);
  width: auto;
  text-align: center;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 900;
  letter-spacing: 0.8px;
  line-height: 1;
  z-index: 6;
  text-shadow:
    0 0 12px rgba(255,255,255,0.22),
    0 0 24px rgba(255,255,255,0.10);
}

#screen-menu .panel-menu {
  position: absolute;
  left: 51%;
  top: 71%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(72vw, 240px);
  z-index: 4;
}

#screen-menu .panel-menu .menu-btn {
  width: 100%;
  height: 44px;
  flex: 0 0 auto;
}

#screen-menu .panel-menu .menu-btn:first-child {
  width: 56% !important;
  align-self: center !important;
  transform: translate(70px, -30px);
}

#screen-menu .panel-menu .menu-btn-ton {
  color: #00ff88;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.55);
}

/* =========================
   TON
   panel anchor: left 24.5%, top 67.5% (matches bg art's lit panel)
   ========================= */

#screen-ton .panel-ton {
  position: absolute;
  left: 78%;
  top: 22%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(78vw, 260px);
  z-index: 4;
}

#screen-ton .ton-title {
  width: auto;
  text-align: center;
  font-size: clamp(22px, 5.5vw, 30px);
  font-weight: 900;
  margin-bottom: 4px;
}

#screen-ton .ton-wallet-text {
  width: 100%;
  text-align: center;
  font-size: clamp(13px, 2.4vw, 17px);
  line-height: 1.34;
  color: #f2f2f2;
  text-shadow: 0 0 8px rgba(0,0,0,0.40);
}

#screen-ton .bet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

#screen-ton .bet-btn {
  width: 100%;
  height: 38px;
  font-size: 13px;
  padding: 0;
}

#screen-ton .ton-connect-btn {
  width: min(60vw, 200px);
  height: 44px;
}

#screen-ton .ton-back-btn {
  width: min(60vw, 200px);
  height: 44px;
  margin-top: 12px;
}

#screen-ton .panel-ton-actions {
  position: absolute;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(80vw, 280px);
  z-index: 5;
}

/* =========================
   MATCHING
   panel anchor: left 41%, top 40%
   ========================= */

#screen-matching .panel-matching {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: min(80vw, 300px);
  z-index: 4;
}

#screen-matching .matching-title {
  width: 100%;
  text-align: center;
  font-size: clamp(18px, 4.6vw, 24px);
  font-weight: 900;
}

#screen-matching .matching-text {
  position: absolute !important;
  left: 42% !important;
  top: 40% !important;
  transform: translate(-50%, -50%) !important;
  width: min(80vw, 280px) !important;
  text-align: center;
  font-size: clamp(13px, 2.4vw, 17px);
  line-height: 1.34;
  color: #f2f2f2;
  text-shadow: 0 0 8px rgba(0,0,0,0.40);
  z-index: 5;
}

/* CANCEL button pinned to viewport bottom (kept from old layout) */
#screen-matching .matching-cancel-btn {
  position: fixed !important;
  bottom: 130px !important;
  left: 41% !important;
  transform: translateX(-50%) !important;
  width: min(50vw, 180px) !important;
  height: 40px !important;
  font-size: 13px !important;
  z-index: 100 !important;
}

/* =========================
   RULES
   panel anchor: left 23.5%, top 66%
   ========================= */

#screen-rules .panel-rules {
  position: absolute;
  left: 30%;
  top: 35%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(82vw, 300px);
  z-index: 4;
}

#screen-rules .panel-rules-scroll {
  position: absolute;
  left: 40%;
  top: 65%;
  transform: translate(-50%, -50%);
  width: min(60vw, 220px);
  height: min(45vh, 320px);
  z-index: 4;
}

#screen-rules .panel-rules-scroll .rules-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding-right: 6px;
}

#screen-rules .panel-rules-actions {
  position: absolute;
  left: 40%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(80vw, 280px);
  z-index: 5;
}

#screen-rules .rules-title {
  width: auto;
  text-align: center;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 500;
  flex: 0 0 auto;
}

#screen-rules .rules-scroll {
  width: 100%;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 6px;
}

#screen-rules .rules-copy {
  font-size: clamp(14px, 2.45vw, 16px);
  line-height: 1.48;
  color: #f3f3f3;
  text-shadow:
    0 0 8px rgba(0,0,0,0.45),
    0 0 14px rgba(0,0,0,0.18);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
}

#screen-rules .rules-back-btn {
  width: min(60vw, 200px);
  height: 44px;
  flex: 0 0 auto;
}

/* =========================
   SETTINGS
   panel anchor: left 24.5%, top 64.5%
   ========================= */

#screen-settings .panel-settings {
  position: absolute;
  left: 70%;
  top: 8%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(78vw, 260px);
  z-index: 4;
}

#screen-settings .panel-settings-info {
  position: absolute;
  left: 50%;
  top: 78%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(82vw, 280px);
  z-index: 4;
}

#screen-settings .panel-settings-controls {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(80vw, 240px);
  z-index: 4;
}

#screen-settings .panel-settings-actions {
  position: absolute;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(80vw, 240px);
  z-index: 4;
}

#screen-settings .settings-title {
  width: 100%;
  text-align: center;
  font-size: clamp(22px, 5.5vw, 32px);
  font-weight: 900;
}

#screen-settings .settings-text,
#screen-settings #player-name-label,
#screen-settings #sound-state-label {
  width: 100%;
  text-align: center;
  font-family: "Russo One", sans-serif;
  letter-spacing: 1px;
  font-size: clamp(13px, 2.4vw, 16px);
}

#screen-settings .settings-btn,
#screen-settings .settings-back-btn {
  width: min(80vw, 220px);
  height: 44px;
}

#screen-settings .settings-back-btn {
  margin-top: 8px;
}

#screen-settings .panel-settings-info-btn {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(80vw, 220px);
  z-index: 4;
}

#screen-settings .settings-info-btn {
  width: 100%;
  height: 44px;
}

/* =========================
   THEMES
   panel anchor: left 71.5%, top 75%
   ========================= */

#screen-themes .panel-themes {
  position: absolute;
  left: 80%;
  top: 32%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(72vw, 220px);
  z-index: 4;
}

#screen-themes .panel-themes-buttons {
  position: absolute;
  left: 35%;
  top: 68%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(72vw, 220px);
  z-index: 4;
}

#screen-themes .panel-themes-actions {
  position: absolute;
  left: 35%;
  bottom: 50px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(72vw, 220px);
  z-index: 4;
}

#screen-themes .themes-title {
  width: auto;
  text-align: center;
  font-size: clamp(22px, 5.5vw, 30px);
  font-weight: 900;
  margin-bottom: 6px;
}

#screen-themes .themes-btn,
#screen-themes .themes-back-btn {
  width: 100%;
  height: 44px;
}

#screen-themes .themes-back-btn {
  margin-top: 8px;
}

/* =========================
   WIN / LOSE
   panel anchor: center, top 63%
   ========================= */

#screen-win .panel-win {
  position: absolute;
  left: 70%;
  top: 18%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(82vw, 300px);
  z-index: 40;
}

#screen-lose .panel-lose {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(82vw, 300px);
  z-index: 40;
}

#screen-win .panel-win-text,
#screen-lose .panel-lose-text {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(82vw, 300px);
  z-index: 40;
}

#screen-win .panel-win-text {
  top: 64%;
}

#screen-lose .panel-lose-text {
  top: 64%;
}

#screen-win .panel-win-actions,
#screen-lose .panel-lose-actions {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(80vw, 240px);
  z-index: 40;
}

#screen-win .win-title,
#screen-lose .lose-title {
  width: 100%;
  text-align: center;
  z-index: 50;
}

#screen-win .win-title .title-plate-line,
#screen-lose .lose-title .title-plate-line {
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.02;
}

#screen-win .win-text,
#screen-lose .lose-text {
  width: 100%;
  text-align: center;
  font-size: clamp(15px, 2.8vw, 18px);
  line-height: 1.3;
  z-index: 50;
}

#screen-win .win-text,
#screen-lose .lose-text {
  font-family: 'Russo One', sans-serif;
  font-weight: 900;
  letter-spacing: 1px;
  color: #00ff88;
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.8);
}

#screen-win .win-text,
#screen-lose .lose-text {
  text-shadow: none;
}

#screen-win .win-btn,
#screen-lose .lose-btn {
  width: min(60vw, 200px);
  height: 44px;
  z-index: 50;
}

/* =========================
   TOP / LEADERBOARD
   panel anchor: center column near top
   ========================= */

#screen-top .panel-top {
  position: absolute;
  left: 65%;
  top: 8%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(85vw, 320px);
  z-index: 4;
}

#screen-top .panel-top-list {
  position: absolute;
  left: 58%;
  top: 56%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(72vw, 280px);
  height: min(52vh, 305px);
  z-index: 4;
}

#screen-top .panel-top-list #top-list {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  padding-right: 6px;
  color: #00ff88;
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.8);
  font-family: "Russo One", sans-serif;
  letter-spacing: 1px;
  font-size: 13px;
  line-height: 1.45;
}

#screen-top .panel-top-actions {
  position: absolute;
  left: 38%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(80vw, 240px);
  z-index: 4;
}

#screen-top .top-title {
  width: auto;
  text-align: center;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 900;
  letter-spacing: 0.8px;
  font-family: inherit;
  flex: 0 0 auto;
}

#screen-top #top-list {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding-right: 6px;
  color: #00ff88;
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.8);
  font-family: "Russo One", sans-serif;
  letter-spacing: 1px;
  font-size: 13px;
  line-height: 1.45;
}

#screen-top #top-list::-webkit-scrollbar {
  width: 6px;
}
#screen-top #top-list::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 136, 0.6);
  border-radius: 3px;
}
#screen-top #top-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

#screen-top #top-list .top-row,
#screen-top #top-list .panel-text {
  color: #00ff88;
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.8);
  font-family: "Russo One", sans-serif;
  letter-spacing: 1px;
}

#screen-top #top-list .top-row {
  margin-bottom: 8px;
  padding: 4px 0;
}

#screen-top #top-list .lb-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

#screen-top .top-back {
  width: 58%;
  max-width: 138px;
  height: 44px;
  font-size: 13px;
  font-weight: 900;
  padding: 0 16px;
  flex: 0 0 auto;
}

/* =========================
   PROFILE
   panel anchor: full screen column starting near top
   ========================= */

#screen-profit .panel-profit {
  position: absolute;
  left: 65%;
  top: 6%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(82vw, 320px);
  background: transparent;
  border: 0;
  box-shadow: none;
  z-index: 30;
}

#screen-profit .panel-profit-avatar {
  position: absolute;
  left: 35%;
  top: 26%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

#screen-profit .panel-profit-tg {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(82vw, 320px);
  z-index: 30;
}

#screen-profit .panel-profit-stats {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(82vw, 320px);
  z-index: 30;
}

#screen-profit .profile-winloss-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
}

#screen-profit .profile-winloss-row #profile-wins,
#screen-profit .profile-winloss-row #profile-loses {
  width: auto;
}

#screen-profit .panel-profit-actions {
  position: absolute;
  left: 72%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(80vw, 280px);
  z-index: 30;
}

#screen-profit #profile-avatar-wrap {
  width: 92px;
  height: 92px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid rgba(255,42,42,0.9);
  box-shadow: 0 0 14px rgba(255,42,42,0.25);
  flex: 0 0 auto;
}

#screen-profit #profile-avatar-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}

#screen-profit .profile-title {
  text-align: center;
  margin-top: 6px;
}

#screen-profit .profile-title .title-plate-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#screen-profit .profile-title .title-plate-line {
  font-size: clamp(22px, 5.5vw, 32px);
  line-height: 1;
  padding: 6px 14px;
}

#screen-profit #profile-name,
#screen-profit #profile-telegram-username,
#screen-profit #profile-telegram-id,
#screen-profit #profile-wins,
#screen-profit #profile-loses {
  width: 100%;
  text-align: center;
  font-family: "Russo One", sans-serif;
  letter-spacing: 1px;
  color: #00ff88;
  font-size: 17px;
  line-height: 1.25;
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.8);
  margin: 0;
}

#screen-profit #profile-wins,
#screen-profit #profile-loses {
  font-size: 22px;
}

#screen-profit #profile-balance,
#screen-profit #profile-wallet {
  display: none;
}

#screen-profit .profile-back {
  width: min(40vw, 134px);
  height: 44px;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 900;
  padding: 0 16px;
  flex: 0 0 auto;
}

/* =========================
   TOURNAMENT
   ========================= */

#screen-tournament .panel-tournament {
  position: absolute;
  left: 50%;
  top: 14%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(94vw, 360px);
  padding-top: 24px;
  z-index: 4;
}

#screen-tournament .tournament-title {
  display: none;
}

#screen-tournament .tournament-text {
  font-family: 'Russo One', sans-serif;
  font-size: clamp(11px, 3.4vw, 14px);
  font-weight: 900;
  color: #00ff88;
  text-shadow: 0 0 6px rgba(0,255,136,0.45);
  text-align: center;
  letter-spacing: 0.3px;
  line-height: 1.4;
  white-space: nowrap;
}

#screen-tournament .panel-tournament-actions {
  position: absolute;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(80vw, 280px);
  z-index: 5;
}

#screen-tournament .tournament-prize-above-back {
  margin-bottom: 60px;
}
#screen-tournament .tournament-prize-above-back:empty {
  display: none;
}

#screen-tournament .tournament-register-btn,
#screen-tournament .tournament-unregister-btn {
  font-family: 'Russo One', sans-serif;
  width: min(60vw, 220px);
  height: 44px;
}

#screen-tournament .tournament-back-btn {
  font-family: 'Russo One', sans-serif;
  width: min(65vw, 220px);
  height: 44px;
}

/* =========================
   ROLL DAY (overlay over menu)
   ========================= */

.roll-day-btn {
  display: none !important;
}

body:has(#screen-menu.active) .roll-day-btn {
  position: fixed !important;
  top: 110px !important;
  left: 32% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  width: 110px !important;
  height: 110px !important;
  min-height: 110px !important;
  max-width: 110px !important;
  max-height: 110px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 22px !important;
  font-family: 'Russo One', sans-serif !important;
  font-size: 22px !important;
  line-height: 1.05 !important;
  letter-spacing: 1px !important;
  color: #ff2a2a !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  z-index: 99999 !important;
}

@keyframes rollDayFlicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% {
    opacity: 1;
    text-shadow: 0 0 4px #fff, 0 0 11px #fff, 0 0 19px #fff;
  }
  20%, 24%, 55% {
    opacity: 0.3;
    text-shadow: none;
  }
  62% { opacity: 0.85; }
  64% { opacity: 0.2; }
  66% { opacity: 1; }
}

.roll-day-btn .roll-day-text {
  display: inline-block;
}

body:has(#screen-menu.active) .roll-day-btn .roll-day-text {
  animation: rollDayFlicker 2.5s infinite steps(1, end);
}

/* =========================================
   GAME SCREEN  (responsive — kept)
   ========================================= */

#screen-game {
  position: absolute !important;
  inset: 0 !important;
  overflow: hidden !important;
}

#screen-game .game-surface {
  position: absolute !important;
  inset: 0 !important;
  background:
    radial-gradient(circle at center, rgba(255, 0, 0, 0.04) 0%, rgba(0,0,0,0) 40%),
    linear-gradient(180deg, #060606 0%, #111111 55%, #050505 100%) !important;
}

#screen-game .top-bar {
  position: absolute !important;
  top: 10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: min(94vw, 430px) !important;
  min-height: 56px !important;
  padding: 0 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  border-radius: 16px !important;
  background: linear-gradient(180deg, rgba(18,18,18,0.94) 0%, rgba(8,8,8,0.98) 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 18px rgba(255,42,42,0.18) !important;
  z-index: 20 !important;
}

#screen-game #player-left,
#screen-game #player-right {
  position: static !important;
  width: auto !important;
  max-width: 34% !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  color: #ffffff !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#screen-game #player-right {
  text-align: right !important;
}

#screen-game .dice-wrap {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-width: 86px !important;
}

#screen-game .die {
  position: static !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 10px !important;
  border: 2px solid rgba(255, 55, 55, 0.85) !important;
  background: linear-gradient(180deg, rgba(24,24,24,0.98) 0%, rgba(8,8,8,1) 100%) !important;
  color: #ffffff !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  box-shadow:
    0 0 16px rgba(255, 0, 0, 0.14),
    inset 0 0 8px rgba(255,255,255,0.03),
    inset 0 -8px 14px rgba(0,0,0,0.55) !important;
}

#screen-game #board {
  position: absolute !important;
  left: 50% !important;
  top: 52.5% !important;
  transform: translate(-50%, -50%) !important;
  width: min(94vw, 430px) !important;
  aspect-ratio: 1.18 / 1 !important;
  border-radius: 22px !important;
  z-index: 10 !important;
}

#screen-game .controls {
  position: absolute !important;
  left: 50% !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  transform: translateX(-50%) !important;
  width: min(94vw, 430px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  z-index: 20 !important;
}

#screen-game .controls .btn,
#screen-game #roll-btn,
#screen-game #menu-btn {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: calc((min(94vw, 430px) - 12px) / 2) !important;
  max-width: 209px !important;
  height: 52px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  white-space: nowrap !important;
  border-radius: 16px !important;
  border: 2px solid rgba(255, 50, 50, 0.82) !important;
  background: linear-gradient(180deg, rgba(34,34,34,0.96) 0%, rgba(12,12,12,0.98) 45%, rgba(0,0,0,1) 100%) !important;
  color: #fff !important;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.05),
    inset 0 -8px 12px rgba(0,0,0,0.92),
    0 0 12px rgba(255, 0, 0, 0.12) !important;
}

#screen-game .controls .btn::before,
#screen-game .controls .btn::after {
  display: none !important;
}

@media (max-height: 760px) {
  #screen-game .top-bar { top: 8px !important; }
  #screen-game #board {
    top: 53.5% !important;
    width: min(92vw, 410px) !important;
  }
  #screen-game .controls {
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
    width: min(92vw, 410px) !important;
  }
  #screen-game .controls .btn,
  #screen-game #roll-btn,
  #screen-game #menu-btn { height: 50px !important; }
}

/* =========================================
   REAL DICE STAGE
   ========================================= */

body #screen-game .dice-stage {
  position: absolute !important;
  left: 50% !important;
  top: 100px !important;
  transform: translateX(-50%) !important;
  width: 200px !important;
  height: 90px !important;
  z-index: 16 !important;
  pointer-events: none !important;
  display: block !important;
}

body #screen-game .real-die {
  position: absolute !important;
  width: 72px !important;
  height: 72px !important;
  border-radius: 16px !important;
  border: 2px solid rgba(255, 70, 70, 0.85) !important;
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,0.30) 0%, rgba(255,255,255,0.10) 18%, transparent 40%),
    linear-gradient(145deg, rgba(38,38,38,0.98) 0%, rgba(12,12,12,1) 55%, rgba(3,3,3,1) 100%) !important;
  box-shadow:
    0 0 20px rgba(255, 0, 0, 0.18),
    0 14px 24px rgba(0,0,0,0.45),
    inset 0 2px 10px rgba(255,255,255,0.08),
    inset 0 -10px 16px rgba(0,0,0,0.62) !important;
  transform-style: preserve-3d !important;
  backface-visibility: hidden !important;
}

body #screen-game .real-die::before {
  content: "" !important;
  position: absolute !important;
  inset: 6px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,0.05) !important;
  pointer-events: none !important;
}

body #screen-game .real-die::after {
  content: "" !important;
  position: absolute !important;
  left: 14% !important;
  top: 10% !important;
  width: 45% !important;
  height: 18% !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.12) !important;
  filter: blur(2px) !important;
  transform: rotate(-12deg) !important;
  pointer-events: none !important;
}

body #screen-game .die-stage-left  { left: 10px !important; right: auto !important; top: 10px !important; }
body #screen-game .die-stage-right { left: auto !important; right: 10px !important; top: 10px !important; }

body #screen-game .pip {
  position: absolute !important;
  width: 10px !important;
  height: 10px !important;
  border-radius: 50% !important;
  background:
    radial-gradient(circle at 35% 35%, #ffffff 0%, #f4f4f4 35%, #d7d7d7 70%, #bdbdbd 100%) !important;
  box-shadow:
    0 0 6px rgba(255,255,255,0.25),
    inset 0 1px 1px rgba(255,255,255,0.45),
    inset 0 -1px 2px rgba(0,0,0,0.18) !important;
  display: none !important;
}

body #screen-game .pip-1 { top: 12px !important; left: 12px !important; }
body #screen-game .pip-2 { top: 12px !important; left: 50% !important; transform: translateX(-50%) !important; }
body #screen-game .pip-3 { top: 12px !important; right: 12px !important; }
body #screen-game .pip-4 { top: 50% !important; left: 12px !important; transform: translateY(-50%) !important; }
body #screen-game .pip-5 { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%) !important; }
body #screen-game .pip-6 { top: 50% !important; right: 12px !important; transform: translateY(-50%) !important; }
body #screen-game .pip-7 { bottom: 12px !important; left: 12px !important; }
body #screen-game .pip-8 { bottom: 12px !important; left: 50% !important; transform: translateX(-50%) !important; }
body #screen-game .pip-9 { bottom: 12px !important; right: 12px !important; }

body #screen-game .real-die.value-1 .pip-5 { display: block !important; }
body #screen-game .real-die.value-2 .pip-1,
body #screen-game .real-die.value-2 .pip-9 { display: block !important; }
body #screen-game .real-die.value-3 .pip-1,
body #screen-game .real-die.value-3 .pip-5,
body #screen-game .real-die.value-3 .pip-9 { display: block !important; }
body #screen-game .real-die.value-4 .pip-1,
body #screen-game .real-die.value-4 .pip-3,
body #screen-game .real-die.value-4 .pip-7,
body #screen-game .real-die.value-4 .pip-9 { display: block !important; }
body #screen-game .real-die.value-5 .pip-1,
body #screen-game .real-die.value-5 .pip-3,
body #screen-game .real-die.value-5 .pip-5,
body #screen-game .real-die.value-5 .pip-7,
body #screen-game .real-die.value-5 .pip-9 { display: block !important; }
body #screen-game .real-die.value-6 .pip-1,
body #screen-game .real-die.value-6 .pip-3,
body #screen-game .real-die.value-6 .pip-4,
body #screen-game .real-die.value-6 .pip-6,
body #screen-game .real-die.value-6 .pip-7,
body #screen-game .real-die.value-6 .pip-9 { display: block !important; }

body #screen-game .real-die.rolling-left,
body #screen-game .real-die.rolling-right {
  animation: slotDiceSpin 0.16s linear infinite !important;
}

body #screen-game .real-die.slot-stop {
  animation: slotDiceStop 0.22s ease-out !important;
}

@keyframes slotDiceSpin {
  0%   { transform: translateY(-12px) scale(0.96); filter: blur(0.2px); }
  25%  { transform: translateY(-4px)  scale(1.00); filter: blur(0.6px); }
  50%  { transform: translateY(8px)   scale(1.03); filter: blur(1px); }
  75%  { transform: translateY(-2px)  scale(1.00); filter: blur(0.6px); }
  100% { transform: translateY(-12px) scale(0.96); filter: blur(0.2px); }
}

@keyframes slotDiceStop {
  0%   { transform: translateY(-10px) scale(0.98); }
  60%  { transform: translateY(6px)   scale(1.03); }
  100% { transform: translateY(0)     scale(1); }
}
