/* CSS Custom Properties */
:root {
  /* Colors */
  --color-primary-cyan: #27cdff;
  --color-primary-blue: #04779a;
  --color-primary-blue-dark: #004878;
  --color-accent-purple: #a637c6;
  --color-accent-purple-hover: #8b2ca3;
  --color-accent-green: #5f9b16;
  --color-accent-green-hover: #4d8513;
  --color-accent-yellow: #fc9c00;
  --color-accent-lime: #7bd400;
  --color-accent-bright-green: #82da17;
  --color-success: #4ecdc4;
  --color-error: #eb4d4b;
  --color-white: #ffffff;
  --color-black: #000000;
  --color-dark-slate: #1e293b;

  /* Backgrounds */
  --bg-overlay-dark: rgba(0, 0, 0, 0.7);
  --bg-overlay-darker: rgba(0, 0, 0, 0.8);
  --bg-overlay-light: rgba(0, 0, 0, 0.4);
  --bg-overlay-lighter: rgba(0, 0, 0, 0.3);
  --bg-overlay-lightest: rgba(0, 0, 0, 0.2);

  /* Gradients */
  --gradient-blue-vertical: linear-gradient(
    to bottom,
    rgba(4, 119, 154, 0.1) 0%,
    rgba(4, 119, 154, 0.7) 53.365%,
    rgba(4, 119, 154, 0.1) 100%
  );
  --gradient-blue-horizontal: linear-gradient(
    90deg,
    rgba(4, 119, 154, 0.08) 0%,
    rgba(4, 119, 154, 0.56) 30.77%,
    rgba(39, 205, 255, 0.8) 50%,
    rgba(4, 119, 154, 0.56) 74.52%,
    rgba(4, 119, 154, 0.08) 100%
  );
  --gradient-background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* Shadows */
  --shadow-large: 0px 20px 28px 0px rgba(0, 0, 0, 0.55);
  --shadow-button: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
    0px 24px 34px -8px rgba(0, 0, 0, 0.65);
  --shadow-inset: 0px 1px 1px 0px inset rgba(0, 0, 0, 0.31);
  --shadow-multi: 0px 12px 36px 0px rgba(0, 0, 0, 0.25),
    0px 12px 100px 0px #000000;
  --shadow-text: rgba(0, 0, 0, 0.92) 0px 4px 6px;
  --shadow-text-light: rgba(0, 0, 0, 0.4) 0px 1px 2px;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 40px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;

  /* Font Families */
  --font-primary: "Roboto", sans-serif;
  --font-heading: "Trinos", sans-serif;
  --font-alt: "Rubik One", sans-serif;

  /* Transitions */
  --transition-fast: all 0.2s ease;
  --transition-smooth: all 0.3s ease;
}

/* Minimal CSS Reset */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  min-height: 100svh;
  max-height: 100svh;
}

body {
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100svh;
  max-height: 100svh;
}

button,
input,
select,
textarea {
  font-family: inherit;
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul,
ol {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

[disabled] {
  cursor: not-allowed;
}

@font-face {
  font-family: "Trinos";
  src: url("fonts/trinos-trinos-solid-400.woff") format("woff");
}

body {
  background: var(--gradient-background);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Fixed Top Navigation */
.topnav {
  position: relative;
  flex-shrink: 0;
  background: var(--gradient-blue-horizontal), var(--color-black);
  box-shadow: var(--shadow-large);
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: var(--spacing-md) 0;
}

.topnav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("images/carbon-pattern.png");
  background-repeat: repeat;
  background-size: auto;
  opacity: 0.05;
  pointer-events: none;
}

.topnav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 40px;
  flex: 1;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nova-logo {
  height: 44px;
  width: 121.18px;
  object-fit: cover;
}

.topnav-balance {
  background: var(--bg-overlay-lighter);
  background-image: linear-gradient(
    to bottom,
    rgba(0, 153, 255, 0.1) 0%,
    rgba(0, 0, 0, 0.3) 32.212%,
    rgba(0, 0, 0, 1) 100%
  );
  border: 1px solid var(--color-primary-cyan);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  box-shadow: var(--shadow-multi);
  flex-shrink: 0;
}

.balance-group {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.balance-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.balance-label {
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.36px;
  line-height: 2;
}

.balance-input-field {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 149px;
  position: relative;
  margin-top: 8px;
}

.balance-display {
  background: var(--color-dark-slate);
  border: 1px solid var(--color-primary-cyan);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  flex: 1;
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.48px;
  text-align: right;
  line-height: 1;
}

.balance-icon {
  position: absolute;
  left: 0;
  top: -8px;
  width: 30px;
  height: 32px;
  z-index: 10;
}

.balance-icon img {
  width: 100%;
  object-fit: contain;
}

.balance-data {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  align-items: flex-start;
}

.players-online {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  justify-content: flex-end;
}

.player-count {
  color: #82da17;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
}

.player-icon {
  width: 18px;
  height: 19.091px;
}

.player-icon img {
  width: 100%;
  object-fit: contain;
}

.action-buttons {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

.action-btn {
  background: var(--bg-overlay-darker);
  border: 1px solid var(--color-primary-cyan);
  border-radius: var(--radius-md);
  padding: 0;
  width: 35px;
  height: 35px;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-button);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: var(--color-primary-cyan);
}

.action-btn img {
  width: 15px;
  height: 15px;
  object-fit: contain;
}

.game-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.marble-title,
.roll-title {
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: normal;
  line-height: normal;
  text-align: center;
  text-transform: uppercase;
  text-shadow: var(--shadow-text);
  margin: 0;
  display: block;
}

/* Full Screen Race Container */
.race-container {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  background-position: 0% 0%, 50% 50%;
  background-size: auto, cover;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  position: relative;
  width: 100%;
  overflow: hidden;
}

.race-header {
  background: var(--bg-overlay-dark);
  color: white;
  padding: 15px 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  backdrop-filter: blur(10px);
  position: relative;
}

.race-header .game-title {
  font-size: 1.8rem;
  font-weight: bold;
}

.betting-button {
  font-size: 1.1rem;
  padding: 12px 20px;
  border-radius: 25px;
  animation: pulse-glow 2s infinite;
}

/* Full Screen Race Track */
.race-track {
  border: 8px solid var(--color-black);
  border-radius: var(--radius-2xl);
  position: relative;
  overflow: hidden;
  width: 886px;
  flex: 1;
  min-height: 0;
  margin: 0;
}

/* Prevent canvas from extending race-container height */
#canvas3d {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
}

/* Results Overlay */
.results-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 468px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  background: var(--bg-overlay-dark);
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 468 436" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" height="100%" width="100%" fill="url(%23grad)" opacity="1"/><defs><radialGradient id="grad" gradientUnits="userSpaceOnUse" cx="0" cy="0" r="10" gradientTransform="matrix(1.3884e-14 -20.82 28.99 7.6251e-14 234 436.46)"><stop stop-color="rgba(0,176,229,1)" offset="0"/><stop stop-color="rgba(0,161,210,0.8)" offset="0.10096"/><stop stop-color="rgba(4,119,154,0)" offset="0.70673"/><stop stop-color="rgba(4,119,154,0)" offset="1"/></radailGradient></defs></svg>');
  border: 1px solid var(--color-primary-blue);
  flex-direction: column;
  border-radius: var(--radius-md);
  box-shadow: 0px 12px 36px 0px rgba(0, 0, 0, 0.25), 0px 12px 100px 0px #000000;
  z-index: 60;
  display: none;
  opacity: 1;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

/* Popup Header */
.popup-header {
  background: var(--bg-overlay-dark);
  background-image: var(--gradient-blue-vertical);
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-title {
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: normal;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: var(--shadow-text);
  letter-spacing: 0.6px;
  margin: 0;
}

/* Popup Main - Podium */
.popup-main {
  background: var(--bg-overlay-light);
  padding: var(--spacing-md);
  flex: 1;
}

.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 8px 0;
}

.podium-item {
  background: var(--bg-overlay-dark);
  background-image: var(--gradient-blue-vertical);
  border-radius: var(--radius-md);
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 8px;
  position: relative;
  box-shadow: var(--shadow-large);
}

.podium-item.first-place {
  border: 2px solid #27cdff;
  padding-top: 8px;
}

.podium-item.second-place {
  border: 1px solid #fc9c00;
  padding-top: 8px;
}

.podium-item.third-place {
  border: 1px solid #7bd400;
  padding-top: 8px;
}

/* Crown for 1st place */
.crown {
  position: absolute;
  top: -2px;
  left: 10px;
  width: 50px;
  height: 40px;
  z-index: 10;
}

.crown-image {
  width: 100%;
  object-fit: contain;
  filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.45));
}

/* Marble Display */
.marble-display {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.first-place .marble-display {
  width: 104px;
  height: 104px;
}

.marble-sphere {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  filter: drop-shadow(0px 0px 19.385px rgba(255, 255, 255, 0.65));
}

.first-place .marble-sphere {
  width: 60px;
  height: 60px;
  filter: drop-shadow(0px 0px 28px rgba(255, 255, 255, 0.65));
}

.marble-image {
  width: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.marble-reflection {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 23.538px;
  overflow: hidden;
  opacity: 0.6;
}

.first-place .marble-reflection {
  width: 78px;
  height: 34px;
}

.marble-reflection-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 50%;
  transform: scaleY(-1);
  filter: blur(1px);
  opacity: 0.3;
}

/* Marble Info */
.marble-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: auto;
  text-align: center;
}

.position-text {
  font-family: var(--font-primary);
  font-weight: bold;
  font-size: 24px;
  line-height: 1;
  text-align: center;
}

.first-place .position-text {
  font-weight: 600;
  font-size: 32px;
  color: var(--color-primary-cyan);
  text-shadow: rgba(0, 0, 0, 0.45) 0px 2px 4px;
}

.second-place .position-text {
  color: var(--color-accent-yellow);
}

.third-place .position-text {
  color: var(--color-accent-lime);
}

.podium-item .marble-name {
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  text-align: left;
  word-wrap: break-word;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: var(--spacing-md);
  flex-grow: 1;
}

/* Popup Footer - Payout */
.popup-footer {
  padding: var(--spacing-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  width: 100%;
  box-shadow: var(--shadow-large);
}

.payout-container {
  background: var(--bg-overlay-light);
  border: 1px solid var(--color-primary-blue-dark);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  width: 100%;
  flex: 1;
  min-height: 0;
}

.payout-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
}

.payout-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 8px 16px 0;
  color: var(--color-white);
  text-align: center;
  text-transform: uppercase;
  line-height: 1;
}

.payout-label {
  font-family: var(--font-primary);
  font-weight: 800;
  font-style: italic;
  line-height: 1.5;
  font-size: 18px;
  margin-right: 8px;
}

.payout-amount {
  font-family: "roboto", sans-serif;
  font-size: 24px;
  font-style: italic;
  line-height: 1.5;
  font-weight: bold;
  letter-spacing: 0.6px;
}

.payout-divider {
  width: 100%;
  height: 1px;
  margin: 0;
}

.divider-line {
  width: 100%;
  object-fit: fill;
}

.payout-details {
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  gap: var(--spacing-lg);
  padding: 8px 24px;
}

.payout-detail {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-sm);
  color: var(--color-white);
  font-size: 14px;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

/* Detailed Payout Results Styles */
.payout-detailed-results {
  padding: var(--spacing-md);
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid #004878;
  max-height: 240px;
  overflow-y: auto;
}

.payout-results-title {
  font-family: var(--font-primary);
  font-weight: bold;
  font-size: 12px;
  color: var(--color-white);
  text-align: center;
  margin-bottom: 12px;
  text-transform: uppercase;
  text-shadow: rgba(0, 0, 0, 0.7) 0px 0px 4px;
}

/* Table Header */
.payout-results-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: var(--spacing-sm);
  padding: 8px var(--spacing-sm);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-family: var(--font-primary);
  font-weight: bold;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-marble {
  text-align: left;
}

.header-bet,
.header-outcome {
  text-align: center;
}

.header-result {
  text-align: right;
}

.payout-result-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--color-white);
}

.payout-result-item.win {
  border-left: 3px solid #4ecdc4;
  background: rgba(78, 205, 196, 0.1);
}

.payout-result-item.lose {
  border-left: 3px solid #eb4d4b;
  background: rgba(235, 77, 75, 0.1);
}

.result-marble {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-marble-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.result-marble-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-bet {
  font-weight: 500;
  text-align: center;
}

.result-outcome {
  font-weight: bold;
  text-align: center;
}

.result-outcome.win {
  color: var(--color-success);
}

.result-outcome.lose {
  color: var(--color-error);
}

.result-value {
  font-weight: bold;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.result-value.win {
  color: var(--color-success);
}

.result-value.lose {
  color: var(--color-error);
}

.result-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.detail-label {
  font-family: var(--font-primary);
  font-weight: bold;
  margin-right: 8px;
  font-size: 16px;
}

.detail-amount {
  font-family: "roboto", sans-serif;
  font-weight: bold;
  font-size: 16px;
}

/* Result Modal Action Buttons */
.result-modal-actions {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  justify-content: center;
  width: 100%;
}

.btn-close-result {
  background: rgba(255, 153, 0, 0.01);
  border: 1px solid #ff9900;
  border-radius: var(--radius-md);
  color: var(--color-white);
  padding: 12px 32px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  letter-spacing: 0.48px;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
    0px 24px 34px -8px rgba(0, 0, 0, 0.65);
  flex: 1;
  max-width: 160px;
}

.btn-close-result:hover {
  background: rgba(255, 153, 0, 0.15);
  transform: translateY(-1px);
}

.btn-open-bet-result {
  background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.5) 0%,
        rgba(168, 168, 168, 0.5) 9%,
        rgba(0, 0, 0, 0.35) 66.5%,
        rgba(0, 0, 0, 0.5) 100%
      ),
      #a739bf;
  background-blend-mode: overlay, normal;
  border: 1px solid var(--color-primary-cyan);
  border-radius: var(--radius-md);
  color: var(--color-white);
  padding: 12px 32px;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  letter-spacing: 0.48px;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
    0px 24px 34px -8px rgba(0, 0, 0, 0.65);
  flex: 1;
  max-width: 160px;
}

.btn-open-bet-result:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: var(--color-primary-cyan);
  transform: translateY(-1px);
}

/* Betting Modal */
.betting-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 80px;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(100vh - 80px);
  background-color: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(5px);
}

.betting-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.betting-modal-content {
  background: rgba(0, 0, 0, 0.2);
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 856 600" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" height="100%" width="100%" fill="url(%23grad)" opacity="1"/><defs><radialGradient id="grad" gradientUnits="userSpaceOnUse" cx="0" cy="0" r="10" gradientTransform="matrix(1.3884e-14 -20.82 28.99 7.6251e-14 428 600)"><stop stop-color="rgba(0,176,229,1)" offset="0"/><stop stop-color="rgba(0,161,210,0.8)" offset="0.10096"/><stop stop-color="rgba(4,119,154,0)" offset="0.70673"/><stop stop-color="rgba(4,119,154,0)" offset="1"/></radialGradient></defs></svg>');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  border: 1px solid var(--color-primary-blue);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 856px;
  height: auto;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  position: relative;
}

.betting-modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("images/carbon-pattern.png");
  background-repeat: repeat;
  background-size: auto;
  opacity: 0.1;
  border-radius: var(--radius-md);
  pointer-events: none;
}

.betting-modal-header {
  background: var(--bg-overlay-dark);
  background-image: var(--gradient-blue-vertical);
  padding: 16px 0;
  box-shadow: var(--shadow-large);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  position: relative;
}

.betting-modal-header h2 {
  color: var(--color-white);
  font-family: "Rubik One", sans-serif;
  font-size: 24px;
  font-weight: normal;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: var(--shadow-text);
  letter-spacing: 0.6px;
  margin: 0;
}

.betting-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--color-white);
  font-size: 28px;
  font-weight: semibold;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-fast);
  z-index: 10;
}

.betting-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ff6b6b;
  transform: scale(1.1);
}

.betting-countdown {
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

.betting-modal-main {
  background: var(--bg-overlay-light);
  padding: var(--spacing-sm);
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

.marble-slots {
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.slots-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  flex: 1;
  width: 100%;
}

.slots-divider {
  display: none;
}

.marble-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.marble-row {
  display: flex;
  align-items: center;
  justify-content: left;
  padding: var(--spacing-sm);
  background: var(--color-black);
  border: 1px solid var(--color-primary-cyan);
  border-radius: var(--radius-md);
  gap: var(--spacing-sm);
  height: 48px;
  margin-bottom: 0;
  box-shadow: var(--shadow-large);
  width: 100%;
  box-sizing: border-box;
}

.marble-row-left {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 0;
}

.marble-checkbox {
  padding: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marble-checkbox input[type="checkbox"] {
  display: none;
}

.marble-checkbox label {
  width: 18px;
  height: 18px;
  border: 1px solid var(--color-primary-blue);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.marble-checkbox input[type="checkbox"]:checked + label::after {
  content: "✓";
  color: white;
  font-size: 12px;
  font-weight: bold;
}
.marble-number {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.marble-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  aspect-ratio: 1;
  flex-shrink: 0;
}

.marble-row .marble-name {
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  padding: 0 var(--spacing-sm);
  min-width: 0;
}

.bet-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-minus {
  width: 30px;
  height: 30px;
  background: var(--color-accent-green);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-white);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  box-shadow: 0px 8px 4px -4px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

.btn-plus {
  width: 30px;
  height: 30px;
  background: var(--color-accent-purple);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-white);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-minus:hover {
  background: #4d8513;
}

.btn-plus:hover {
  background: var(--color-accent-purple-hover);
}

.bet-input {
  width: 72px;
  flex-shrink: 0;
  position: relative;
}

.bet-input input {
  width: 100%;
  background: var(--color-black);
  border: 1px solid var(--color-primary-blue);
  border-radius: var(--radius-md);
  padding: 6px 20px 6px 6px;
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 16px;
  text-align: right;
  letter-spacing: 0.48px;
}

.bet-gem-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  z-index: 10;
  pointer-events: none;
}

.bet-input input:focus {
  outline: none;
  border-color: var(--color-accent-purple);
}

/* Updated betting bottom bar styles based on Figma design */
/* Current Bet Display */
.current-bet-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  align-items: center;
  justify-content: center;
  margin: 16px;
  width: calc(100% - 32px);
}

.current-bet-header {
  display: flex;
  gap: var(--spacing-lg);
  align-items: center;
  justify-content: center;
}

.current-bet-title {
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 14px;
  color: white;
  text-align: center;
  letter-spacing: 0.42px;
  text-shadow: var(--shadow-text-light);
}

.current-bet-total {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  justify-content: center;
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 14px;
  color: white;
  text-align: center;
  letter-spacing: 0.42px;
  text-shadow: var(--shadow-text-light);
}

.current-bet-chips-container {
  border: 1px solid #a7eaff;
  border-radius: var(--radius-md);
  padding: 4px;
  width: 100%;
  background: var(--color-black);
}

.current-bet-chips {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 4px;
  padding: 4px 0;
  min-height: 40px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
}

.current-bet-chips::-webkit-scrollbar {
  display: none;
}

.current-bet-chip {
  display: flex !important;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
  padding: 2px 6px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  flex-shrink: 0 !important;
  white-space: nowrap;
  min-width: auto;
  width: auto;
  max-width: 120px;
}

.current-bet-chip-marble {
  width: 24px;
  height: 24px;
  position: relative;
  flex-shrink: 0;
  margin-right: 4px;
}

.current-bet-chip-marble img {
  width: 100%;
  object-fit: contain;
}

.current-bet-chip-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  color: white;
  line-height: 1;
  gap: 2px;
}

.current-bet-chip-name {
  font-size: 10px;
  white-space: nowrap;
}

.current-bet-chip-amount {
  font-size: 12px;
  white-space: nowrap;
}

.marble-info-cell {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.marble-color-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.betting-bottom-bar {
  background: var(--bg-overlay-light);
  padding: 2px;
  box-shadow: var(--shadow-large);
}

.betting-bottom-content {
  background: var(--bg-overlay-light);
  border: 1px solid var(--color-primary-blue-dark);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  position: relative;
  box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.25);
}

.betting-bottom-content::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--color-primary-blue-dark);
  border-radius: 9px;
  box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.betting-bottom-content::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: 0px 1px 1px 0px inset rgba(0, 0, 0, 0.31);
  pointer-events: none;
}

.betting-totals {
  display: flex;
  gap: var(--spacing-md);
  align-items: start;
  width: 100%;
}

.total-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  flex-grow: 1;
}

.total-input label {
  color: var(--color-white);
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 14px;
  text-align: left;
  letter-spacing: 0.42px;
  line-height: normal;
  white-space: nowrap;
}

.total-display {
  color: var(--color-white);
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-size: 16px;
  text-align: right;
  letter-spacing: 0.48px;
  line-height: normal;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.total-gem-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.multi-inject-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.multi-inject-checkbox {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-2xl);
  transition: var(--transition-smooth);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.multi-inject-checkbox:checked + .toggle-slider {
  background-color: #a637c6;
  border-color: var(--color-accent-purple);
}

.multi-inject-checkbox:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-switch:hover .toggle-slider {
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

.multi-inject-input {
  width: 60px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--color-white);
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  padding: 0 4px;
}

.multi-inject-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.multi-inject-input:focus {
  outline: none;
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.multi-inject-input-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.multi-inject-gem-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.betting-actions-container {
  display: flex;
  flex-direction: row;
  gap: var(--spacing-md);
  width: 100%;
}

.betting-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: end;
}

.btn-reset {
  background: rgba(201, 44, 69, 0.01);
  border: 1px solid #ffffff;
  border-radius: var(--radius-md);
  color: var(--color-white);
  padding: 8px 20px;
  width: 96px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.48px;
  line-height: normal;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
    0px 24px 34px -8px rgba(0, 0, 0, 0.65);
}

.btn-repeat {
  background: var(--color-accent-green);
  border: 1px solid rgba(102, 102, 102, 0.7);
  border-radius: var(--radius-md);
  color: var(--color-white);
  padding: 8px 20px;
  width: 96px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.48px;
  line-height: normal;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
    0px 24px 34px -8px rgba(0, 0, 0, 0.65);
}

.btn-cancel {
  background: rgba(255, 153, 0, 0.01);
  border: 1px solid #ff9900;
  border-radius: var(--radius-md);
  color: var(--color-white);
  padding: 8px 20px;
  width: 96px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.48px;
  line-height: normal;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
    0px 24px 34px -8px rgba(0, 0, 0, 0.65);
}

.btn-reset:hover {
  background: rgba(201, 44, 69, 0.1);
}

.btn-repeat:hover {
  background: var(--color-accent-green-hover);
}

.btn-cancel:hover {
  background: rgba(255, 153, 0, 0.15);
}

.play-button-container {
  flex: 1;
  display: flex;
  align-items: stretch;
}

.btn-play {
  background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.5) 0%,
        rgba(168, 168, 168, 0.5) 9%,
        rgba(0, 0, 0, 0.35) 66.5%,
        rgba(0, 0, 0, 0.5) 100%
      ),
      #a739bf;
    background-blend-mode: overlay, normal;
    box-shadow: 0 6px 5px -4px rgba(0, 0, 0, 0.55),
      0 24px 34px -8px rgba(0, 0, 0, 0.65);
  border: 1px solid var(--color-primary-cyan);
  border-radius: var(--radius-lg);
  color: var(--color-white);
  padding: 20px 56px;
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 24px;
  text-align: center;
  letter-spacing: 0.72px;
  cursor: pointer;
  transition: var(--transition-fast);
  text-transform: uppercase;
  box-shadow: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
    0px 24px 34px -8px rgba(0, 0, 0, 0.65);
  width: 100%;
  line-height: normal;
  white-space: nowrap;
}

.btn-play:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: var(--color-primary-cyan);
  transform: translateY(-1px);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-50px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
  }
}

.error-message {
  color: #dc3545;
  font-weight: bold;
  text-align: center;
  min-height: 10px;
}

/* Mobile Responsive - Results Overlay */
@media (max-width: 768px) {
  .results-overlay {
    top: 10px !important;
    bottom: 10px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: calc(100vh - 20px) !important;
    transform: none !important;
    overflow-y: auto !important;
  }

  .popup-footer {
    padding: var(--spacing-sm);
  }

  .podium-container {
    gap: 4px;
  }

  .podium-item {
    width: 100px;
    padding: 16px 4px 12px;
  }

  .podium-item.first-place {
    padding-top: 24px;
  }

  .podium-item.second-place {
    padding-top: 16px;
  }

  .podium-item.third-place {
    padding-top: 8px;
  }

  .marble-display {
    width: 54px;
    height: 54px;
  }

  .first-place .marble-display {
    width: 78px;
    height: 78px;
  }

  .marble-sphere {
    width: 40px;
    height: 40px;
    top: 4px;
  }

  .first-place .marble-sphere {
    width: 60px;
    height: 60px;
    top: 6px;
  }

  .marble-reflection {
    width: 40px;
    height: 17px;
  }

  .first-place .marble-reflection {
    width: 60px;
    height: 26px;
  }

  .position-text {
    font-size: 18px;
  }

  .first-place .position-text {
    font-size: 24px;
  }

  .marble-name {
    font-size: 12px;
  }

  .crown {
    width: 42px;
    height: 37px;
    left: 10px;
    top: -4px;
  }

  .payout-details {
    gap: var(--spacing-md);
    padding: 4px 16px 0;
  }

  .result-modal-actions {
    flex-direction: row;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
  }

  .btn-close-result,
  .btn-open-bet-result {
    padding: 10px 20px;
    font-size: 14px;
    max-width: none;
  }

  .payout-detailed-results {
    max-height: 180px;
  }

  .payout-results-header {
    grid-template-columns: 1.5fr 0.8fr 0.8fr 1fr;
    font-size: 9px;
    padding: 6px 4px;
    gap: 4px;
  }

  .payout-result-item {
    grid-template-columns: 1.5fr 0.8fr 0.8fr 1fr;
    font-size: 10px;
    padding: 6px 4px;
    gap: 4px;
    margin-bottom: 4px;
  }

  .result-marble {
    gap: 4px;
  }

  .result-marble-icon {
    width: 14px;
    height: 14px;
  }

  .result-marble-name {
    font-size: 9px;
  }

  .result-bet {
    font-size: 10px;
  }

  .result-outcome {
    font-size: 9px;
  }

  .result-value {
    font-size: 10px;
    gap: 2px;
  }

  .result-icon {
    width: 12px;
    height: 12px;
  }

  .topnav {
    padding: 10px 0;
  }

  .topnav-content {
    flex-direction: column;
    gap: 12px;
    padding: 0 16px;
    position: relative;
  }

  .logo {
    order: 1;
    align-self: flex-start;
  }

  .nova-logo {
    height: 40px;
    width: auto;
  }

  .game-logo {
    order: 2;
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
    padding-right: 8px;
  }

  .game-logo::before {
    content: "MARBLE";
    color: var(--color-white);
    font-family: var(--font-heading);
    font-size: 11.04px;
    line-height: normal;
    text-transform: uppercase;
    text-shadow: rgba(0, 0, 0, 0.92) 0px 1.92px 2.88px;
    margin: 0;
    display: block;
  }

  .game-logo::after {
    content: "ROLL";
    color: var(--color-white);
    font-family: var(--font-heading);
    font-size: 11.04px;
    line-height: normal;
    text-transform: uppercase;
    text-shadow: rgba(0, 0, 0, 0.92) 0px 1.92px 2.88px;
    margin: 0;
    display: block;
  }

  .game-logo img {
    display: none;
  }

  /* Balance section with improved layout */
  .topnav-balance {
    order: 3;
    width: 100%;
  }

  .balance-group {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-end;
    width: 100%;
  }

  /* Balance inputs container - create flex layout for 2 columns */
  .balance-group {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-sm);
  }

  .balance-group .balance-input:first-child,
  .balance-group .balance-input:nth-child(2) {
    flex: 1;
  }

  .balance-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .balance-label {
    color: var(--color-white);
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.36px;
    line-height: normal;
  }

  .balance-input-field {
    position: relative;
    width: 100%;
  }

  .balance-display {
    background: var(--color-dark-slate);
    border: 1px solid var(--color-primary-cyan);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    padding-left: 24px;
    color: var(--color-white);
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0.48px;
    text-align: right;
    line-height: normal;
    width: 100%;
    box-sizing: border-box;
  }

  .balance-icon {
    position: absolute;
    left: 0;
    top: -8px;
    width: 30px;
    height: 32px;
    z-index: 10;
  }

  .balance-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Right section with player count and buttons */
  .balance-data {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: flex-end;
    flex-shrink: 0;
  }

  .players-online {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .player-count {
    color: #a7eaff;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
    line-height: normal;
  }

  .player-icon {
    width: 18px;
    height: 19.091px;
  }

  .action-buttons {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .action-btn {
    background: var(--bg-overlay-darker);
    border: 1px solid var(--color-primary-cyan);
    border-radius: var(--radius-md);
    padding: 0;
    width: 35px;
    height: 35px;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0px 6px 5px -4px rgba(0, 0, 0, 0.55),
      0px 24px 34px -8px rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--color-primary-cyan);
  }

  .action-btn img {
    width: 15px;
    height: 15px;
    object-fit: contain;
  }

  .race-container {
    gap: 20px;
    padding: 8px 0;
  }

  .race-track {
    width: 95%;
    max-width: 450px;
    min-height: 150px;
    border-width: 8px;
    border-radius: var(--radius-xl);
  }

  .race-header {
    padding: 10px 15px;
    text-align: center;
  }

  .game-title {
    font-size: 1.3rem;
  }

  .betting-button {
    font-size: 1rem;
    padding: 10px 15px;
  }

  .race-status {
    font-size: 1.5rem;
    padding: 15px 25px;
  }

  .betting-modal {
    top: 140px;
    height: calc(100vh - 140px);
  }

  .betting-modal.active {
    padding-top: 10px;
  }

  .betting-modal-content {
    width: 95%;
    max-width: 95vw;
    height: calc(100vh - 160px);
    max-height: calc(100vh - 160px);
  }

  .betting-modal-header h2 {
    font-size: 18px;
    letter-spacing: 2px;
    font-weight: 400;
  }

  .marble-slots {
    background: var(--bg-overlay-light);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 4px;
  }

  .slots-divider {
    width: 100%;
    height: 2px;
    background: var(--color-accent-purple);
  }

  .marble-slot {
    display: flex;
    align-items: center;
    padding: 16px 8px;
    background: var(--bg-overlay-dark);
    background-image: linear-gradient(
      90deg,
      rgba(4, 119, 154, 0.1) 0%,
      rgba(4, 119, 154, 0.7) 53.365%,
      rgba(4, 119, 154, 0.1) 100%
    );
    border: 1px solid var(--color-primary-cyan);
    border-radius: var(--radius-md);
    gap: var(--spacing-sm);
    box-shadow: var(--shadow-large);
    margin-bottom: 8px;
  }

  .marble-number {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }

  .marble-icon {
    width: 24px;
    height: 24px;
    object-fit: cover;
    aspect-ratio: 1;
    flex-shrink: 0;
  }

  .marble-name {
    font-size: 14px;
  }

  .btn-minus,
  .btn-plus {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .bet-input input {
    font-size: 14px;
    padding: 4px;
  }

  .betting-bottom-bar {
    padding: var(--spacing-sm);
  }

  .betting-bottom-content {
    flex-direction: column;
    gap: 12px;
    padding: var(--spacing-sm);
  }

  .betting-totals {
    gap: 12px;
  }

  .total-input label {
    font-size: 12px;
  }

  .total-display {
    font-size: 14px;
  }

  .multi-inject-controls {
    gap: 6px;
  }

  .betting-actions-container {
    flex-direction: row;
    gap: 12px;
  }

  .play-button-container {
    flex: 1;
  }

  .multi-inject-input {
    width: 50px;
    height: 26px;
    font-size: 12px;
  }

  .btn-reset,
  .btn-repeat {
    padding: 6px 16px;
    font-size: 14px;
    width: auto;
    min-width: 80px;
  }

  .btn-play {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.5) 0%,
        rgba(168, 168, 168, 0.5) 9%,
        rgba(0, 0, 0, 0.35) 66.5%,
        rgba(0, 0, 0, 0.5) 100%
      ),
      #a739bf;
    background-blend-mode: overlay, normal;
    box-shadow: 0 6px 5px -4px rgba(0, 0, 0, 0.55),
      0 24px 34px -8px rgba(0, 0, 0, 0.65);
    padding: 12px 24px;
    font-size: 18px;
  }

  .betting-modal-footer {
    padding: 4px 0;
  }

  .betting-modal-footer h3 {
    font-size: 14px;
    text-align: center;
    color: #ff0000;
  }

  .results-overlay {
    bottom: 10px;
    left: 10px;
    right: 10px;
    max-height: 200px;
    padding: 15px;
  }

  .racing-marble {
    width: 25px;
    height: 25px;
    font-size: 0.8rem;
  }

  .finish-line {
    right: 15px;
    padding: 10px 20px;
    font-size: 1.2rem;
  }

  #canvas3d {
    height: 80% !important;
  }
}

/* Bottom Navigation */
.bottom-nav {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-overlay-dark);
  background-image: var(--gradient-blue-vertical);
  border: 1px solid var(--color-primary-blue);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-large);
  z-index: 1000;
  padding: 14px;
  width: auto;
}

.bottom-nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("images/checkered-pattern.png");
  background-repeat: repeat;
  background-size: auto;
  opacity: 0.05;
  border-radius: var(--radius-md);
  pointer-events: none;
}

.bottom-nav-content {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-md);
}

/* Phase Timer Display */
.phase-timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.phase-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.phase-timer {
  color: var(--color-accent-yellow);
  font-family: var(--font-primary);
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.54px;
  white-space: nowrap;
}

.race-phase-info {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-md);
}

.phase-text {
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: normal;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: var(--shadow-text);
  letter-spacing: 0.48px;
  white-space: nowrap;
}

.time-remaining {
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.54px;
  white-space: nowrap;
}

.button-primary {
  display: flex;
  padding: 8px 0;
}

.btn-place-bet {
  background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.5) 0%,
        rgba(168, 168, 168, 0.5) 9%,
        rgba(0, 0, 0, 0.35) 66.5%,
        rgba(0, 0, 0, 0.5) 100%
      ),
      #a739bf;
    background-blend-mode: overlay, normal;
    box-shadow: 0 6px 5px -4px rgba(0, 0, 0, 0.55),
      0 24px 34px -8px rgba(0, 0, 0, 0.65);
    padding: 12px 24px;
    font-size: 18px;
  border: 1px solid var(--color-primary-cyan);
  border-radius: var(--radius-lg);
  color: var(--color-white);
  padding: 16px 40px;
  width: 100%;
  font-family: var(--font-heading);
  font-weight: 400;
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0.54px;
  text-shadow: var(--shadow-text-light);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-button);
  white-space: normal;
  line-height: normal;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-place-bet:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: var(--color-primary-cyan);
}

/* Betting Section */
.betting-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  flex: 1;
}

.betting-labels {
  display: flex;
  gap: var(--spacing-lg);
  align-items: center;
  justify-content: center;
}

.current-bet-label {
  color: var(--color-white);
  font-family: "roboto", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  text-shadow: var(--shadow-text-light);
  letter-spacing: 0.42px;
  line-height: normal;
}

.next-bet-label {
  color: #fc9c00;
  font-family: "roboto", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  text-shadow: var(--shadow-text-light);
  letter-spacing: 0.42px;
  line-height: normal;
}

.next-race-section {
  border-top: 1px solid rgba(252, 156, 0, 0.3);
  padding-top: 8px;
  margin-top: 4px;
}

.total-label {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  color: var(--color-white);
  font-family: "roboto", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  text-shadow: var(--shadow-text-light);
  letter-spacing: 0.42px;
  line-height: normal;
}

.total-value {
  color: var(--color-white);
}

.betting-items-container {
  background: var(--color-black);
  border: 1px solid #a7eaff;
  border-radius: var(--radius-md);
  padding: 4px;
  width: 508px;
  max-width: calc(100vw - 40px);
  box-shadow: var(--shadow-large);
}

.betting-items-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
  width: 500px;
  max-width: calc(100vw - 48px);
  scrollbar-width: none;
  -ms-overflow-style: none;
  background-color: #000;
}

.betting-items-scroll::-webkit-scrollbar {
  display: none;
}

.betting-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 3px 4px;
  flex-shrink: 0;
  background: transparent;
}

.betting-item-marble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.betting-item-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 500;
  line-height: normal;
}

.betting-item-name {
  font-size: 10px;
  white-space: nowrap;
}

.betting-item-amount {
  font-size: 12px;
  font-weight: 500;
}

.no-bets-message {
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-primary);
  font-style: italic;
  font-size: 12px;
  text-align: center;
  width: 100%;
  padding: var(--spacing-sm);
}

/* Race Info Display */
.race-info {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  pointer-events: none;
}

.race-info-content {
  background: var(--bg-overlay-dark);
  background-image: var(--gradient-blue-vertical);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  box-shadow: var(--shadow-large);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.race-phase-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.phase-text {
  font-family: 'Rubik One', sans-serif;
  font-size: 18px;
  font-weight: normal;
  color: var(--color-white);
  text-transform: uppercase;
  text-shadow: var(--shadow-text);
  letter-spacing: 1px;
}

.time-remaining {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.5px;
}

/* Modal Phase Info */
.betting-modal-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.modal-header-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
}

.modal-phase-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.modal-phase-text {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-phase-timer {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: bold;
  color: var(--color-accent-yellow);
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .bottom-nav {
    left: 16px;
    right: 16px;
    transform: none;
    width: calc(100% - 32px);
    padding: var(--spacing-md);
  }

  .bottom-nav-content {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
    justify-content: center;
  }

  .betting-section {
    gap: var(--spacing-sm);
    width: 100%;
  }

  .bottom-nav .button-primary {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    justify-content: center;
  }

  .bottom-nav .btn-place-bet {
    box-sizing: border-box !important;
    padding: 16px 16px !important;
  }

  .betting-labels {
    gap: var(--spacing-md);
  }

  .current-bet-label,
  .total-label {
    font-size: 12px;
  }

  .betting-items-container {
    width: 100%;
    max-width: calc(100vw - 32px);
  }

  .betting-items-scroll {
    width: 100%;
    max-width: calc(100vw - 40px);
  }

  .current-bet-chips,
  #bets-table-body {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    width: 100% !important;
  }

  .current-bet-chip {
    display: flex !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    max-width: 100px !important;
    min-width: 80px !important;
    padding: 2px 4px !important;
    white-space: nowrap !important;
  }

  .current-bet-chip-marble {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
  }

  .current-bet-chip-info {
    flex-direction: row !important;
    gap: 2px !important;
  }

  .race-info {
    top: 80px;
  }

  .race-info-content {
    padding: 10px 20px;
  }

  .race-phase-info {
    gap: 2px;
  }

  .phase-text {
    font-size: 16px;
  }

  .time-remaining {
    font-size: 13px;
  }

  .modal-phase-text {
    font-size: 12px;
  }

  .modal-time-remaining {
    font-size: 11px;
  }

  .btn-place-bet {
    padding: 12px 24px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
  }
}

/* Toast Message Styling */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  opacity: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  pointer-events: auto;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

.toast.success {
  background: linear-gradient(135deg, #00d2d3, #4ecdc4);
  border-left: 4px solid #00b894;
}

.toast.error {
  background: linear-gradient(135deg, #ee5a24, #ff6b6b);
  border-left: 4px solid #e74c3c;
}

.toast-icon {
  font-size: 18px;
  font-weight: bold;
}

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.toast-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  .btn-test {
    padding: 6px 10px;
    font-size: 11px;
    min-width: 70px;
  }
}

/* Audio Consent Modal */
.audio-consent-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay-darker);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.audio-consent-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border: 1px solid var(--color-primary-blue);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  color: white;
  font-family: "Roboto", sans-serif;
}

.audio-consent-icon {
  font-size: 60px;
  margin-bottom: 20px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.audio-consent-content h2 {
  font-family: "Rubik One", cursive;
  font-size: 28px;
  margin-bottom: 20px;
  color: #00d2d3;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.audio-consent-content p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 30px;
  color: rgba(255, 255, 255, 0.9);
}

.audio-consent-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.btn-enable-audio,
.btn-disable-audio {
  padding: 14px 28px;
  border-radius: var(--radius-lg);
  border: none;
  font-family: "Roboto", sans-serif;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  min-width: 140px;
}

.btn-enable-audio {
  background: linear-gradient(135deg, #00d2d3, #04779a);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 210, 211, 0.3);
}

.btn-enable-audio:hover {
  background: linear-gradient(135deg, #00b8b9, #035f7f);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 210, 211, 0.4);
}

.btn-disable-audio {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-disable-audio:hover {
  background: linear-gradient(135deg, #5b4bd3, #8b7ffe);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

@media (max-width: 768px) {
  .audio-consent-content {
    margin: 20px;
    padding: 30px 20px;
    max-width: none;
  }

  .audio-consent-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn-enable-audio,
  .btn-disable-audio {
    width: 100%;
    max-width: 280px;
  }
}
