/* ========================================
   JACKPOT TAMBOLA - BASE STYLES
   Modern, Clean, Cross-theme CSS
   ======================================== */

/* === ROOT CSS VARIABLES (Theme-Agnostic) === */
:root {
  /* Layout & Spacing */
  --ticket-min: clamp(240px, 18vw, 320px);
  --ticket-max: clamp(280px, 22vw, 360px);
  /* Search results specific sizing (desktop-only density tuning) */
  --search-ticket-min: clamp(220px, 14vw, 300px);
  --search-ticket-max: clamp(260px, 18vw, 360px);
  --ticket-h: clamp(66px, 10.5vw, 96px);
  --border-w: clamp(4px, 0.5vw, 6px);
  --gap: 12px;
  
  /* Shadows (Universal) */
  --shadow-light: rgba(0, 0, 0, 0.08);
  --shadow-medium: rgba(0, 0, 0, 0.14);
  --shadow-dark: rgba(0, 0, 0, 0.22);
  --shadow-extra-dark: rgba(0, 0, 0, 0.32);
  
  /* Overlays (Universal) */
  --overlay-light: rgba(0, 0, 0, 0.02);
  --overlay-medium: rgba(0, 0, 0, 0.06);
  --overlay-dark: rgba(0, 0, 0, 0.3);
  --overlay-deep: rgba(0, 0, 0, 0.5);
  
  /* Theme Colors (will be overridden by theme files) */
  --bg: #ffffff;
  --card: #f8f9fa;
  --text: #2c2c54;
  --text-light: #5a6c7d;
  --accent: #d84d7c;
  --accent-light: #e67fb0;
  --border: #f76c5e;
  --primary: #ff9d5c;
  --secondary: #f76c5e;
  /* New-number highlight (starts dark-pink, then transitions to theme color) */
  --highlight-new: #e91e63;
  /* Most-recently-called ball highlight for announcement strip */
  --latest-called-ball-bg: #ffd54a;
  --latest-called-ball-text: #222222;
}

/* === RESET & BASE STYLES === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: "Comic Neue", "Comic Sans MS", system-ui, sans-serif;
  color: var(--text);
  background: #cfcfcf;
  min-height: 100vh;
  position: relative;
  padding-bottom: 80px;
  font-size: 16px;
  line-height: 1.5;
}

.player-page {
  touch-action: pan-x pan-y;
}

body {
  background: #cfcfcf;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* === PAGE BACKGROUND === */
.page-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cfcfcf;
  z-index: -1;
}

/* === HEADER / BANNER === */
.banner {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0) 20%),
    linear-gradient(135deg, #5a3118 0%, #7e4c2d 22%, #3b2317 48%, #8a532f 100%);
  color: white;
  padding: clamp(12px, 3vw, 18px) clamp(10px, 2vw, 16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -4px 14px rgba(0,0,0,0.26), 0 10px 22px rgba(0,0,0,0.24);
  position: relative;
  z-index: 2;
  border-bottom: 3px solid #cf9b51;
}
.banner .title {
  text-align: center;
}

.banner h1 {
  font-size: clamp(30px, 4vw, 28px);
  font-weight: 700;
  letter-spacing: 1px;
  color: white;
  width: auto;
}

.banner .subtitle {
  font-size: clamp(20px, 2.5vw, 16px);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.banner .trees {
  font-size: clamp(20px, 5vw, 28px);
}

/* Tree animation */
.trees{
  display: inline-block;
  font-size: 28px;
  animation: floatGlow 3s ease-in-out infinite;
}

@keyframes floatGlow {
  0% {
    transform: translateY(0) scale(1);
    text-shadow: 0 0 5px rgba(0,255,150,0.4);
  }
  50% {
    transform: translateY(-8px) scale(1.1);
    text-shadow: 0 0 15px rgba(0,255,150,0.8);
  }
  100% {
    transform: translateY(0) scale(1);
    text-shadow: 0 0 5px rgba(0,255,150,0.4);
  }
}

/* Banner snowfall container */
.banner{
  position: relative;
  overflow: hidden;
}

/* Snowflake */
.snowflake{
  position: absolute;
  top: -10px;
  color: white;
  font-size: 14px;
  opacity: 0.8;
  pointer-events: none;
  animation: snowFall linear forwards;
}

/* Tambola numbered ball (replaces snowflake visuals) */
.tball{
  position: absolute;
  top: -10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  pointer-events: none;
  animation: snowFall linear forwards;
}

/* Slightly larger variant used by random sizing logic */
.tball.small{ width: 28px; height: 28px; font-size: 12px; }
.tball.large{ width: 44px; height: 44px; font-size: 16px; }

@keyframes snowFall {
  from {
    top: -20px;
    opacity: 0.8;
  }
  to {
    top: 100%;
    opacity: 0;
  }
}

/* === TOOLBAR === */
.toolbar {
  max-width: clamp(320px, 90vw, 480px);
  margin: clamp(10px, 2vw, 16px) auto;
  padding: clamp(10px, 2vw, 14px);
  z-index: 2;
  position: relative;
}

.toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(8px, 1.5vw, 12px);
  color: var(--text);
  flex-wrap: wrap;
  gap: clamp(6px, 1vw, 12px);
}

.date, .time {
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 26%, #3c2417 100%);
  border: 2px solid #cf9b51;
  padding: clamp(6px, 1.2vw, 10px) clamp(8px, 1.5vw, 14px);
  border-radius: clamp(6px, 1vw, 8px);
  color: #f5e3b1;
  font-weight: 700;
  font-size: clamp(13px, 2.5vw, 15px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 18px rgba(0,0,0,0.18);
}

.time {
  margin-right: clamp(6px, 1vw, 10px);
}

.clock {
  font-size: clamp(12px, 2.2vw, 14px);
  color: white;
  opacity: 0.95;
}

/* === ICONS ROW === */
.icons-row {
  display: flex;
  gap: clamp(12px, 3vw, 24px);
  flex-wrap: wrap;
  margin-bottom: clamp(12px, 2vw, 16px);
  justify-content: center;
  align-items: flex-start;
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.5vw, 10px);
  flex: 0 1 auto;
}

.icon-btn {
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 26%, #3c2417 100%);
  color: white;
  border: 3px solid #cf9b51;
  padding: 0;
  border-radius: 50%;
  width: clamp(40px, 8vw, 56px);
  height: clamp(40px, 8vw, 56px);
  font-weight: 700;
  font-size: clamp(10px, 2vw, 13px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 18px rgba(0,0,0,0.2);
  text-align: center;
  cursor: pointer;
  font-family: "Comic Neue", "Comic Sans MS", system-ui, sans-serif;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  transform: translateY(-2px);
}

.icon-label {
  font-size: clamp(10px, 1.8vw, 12px);
  font-weight: 700;
  color: #2d1a11;
  text-align: center;
  letter-spacing: 0.5px;
}

.icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.icon-circle.whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.icon-circle.call {
  background: linear-gradient(135deg, #ff7e47 0%, #ffae47 100%);
}

.icon-circle.agent {
  background: linear-gradient(135deg, #4d9dff 0%, #80c7ff 100%);
}

/* === CHECK BUTTON === */
.check-row {
  text-align: center;
  margin-top: clamp(6px, 1.5vw, 10px);
}

.check-btn {
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 26%, #3c2417 100%);
  color: #f5e3b1;
  padding: clamp(10px, 2vw, 14px) clamp(16px, 3vw, 24px);
  border-radius: clamp(6px, 1vw, 10px);
  border: 3px solid #cf9b51;
  font-weight: 800;
  font-size: clamp(13px, 2.8vw, 17px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 18px rgba(0,0,0,0.2);
  width: clamp(240px, 85%, 360px);
  margin: 0 auto;
  cursor: pointer;
  font-family: "Comic Neue", "Comic Sans MS", system-ui, sans-serif;
  transition: all 0.2s ease;
}

.check-btn:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 22px rgba(0,0,0,0.24);
}

/* === TICKET COUNTS === */
#ticketCounts {
  max-width: clamp(320px, 92%, 480px);
  margin: 12px auto 0;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(0,0,0,0.08));
  border: 2px solid rgba(207,155,81,0.7);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 18px rgba(0,0,0,0.16);
}

#ticketCounts .count-box {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 26%, #3c2417 100%);
  border: 2px solid #cf9b51;
  border-radius: 10px;
  color: #f5e3b1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 6px 14px rgba(0,0,0,0.14);
}

#ticketCounts .count-box.center {
  align-items: center;
}

#ticketCounts .count-box.right {
  align-items: flex-end;
}

#ticketCounts .count-label {
  font-size: 13px;
  font-weight: 600;
  color: #f5e3b1;
}

#ticketCounts .count-value {
  font-weight: 800;
  font-size: clamp(18px, 4vw, 24px);
  font-family: "Comic Neue", "Comic Sans MS", system-ui, sans-serif;
  text-align: center;
  color: #f5e3b1;
}

#ticketCounts.low-stock {
  border-color: #cf9b51;
}

/* === NUMBER BOARD - CLEAN IMPLEMENTATION === */
.toolbar .small-number-board {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: clamp(3px, 1.2vw, 6px);
  width: 100%;
  max-width: 440px;
  margin: 16px auto;
  padding: 14px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #8b6f47 0%, #a0825a 50%, #8b6f47 100%);
  border-radius: 12px;
  position: relative;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -2px 4px rgba(0, 0, 0, 0.25);
  border: 3px solid #5a4630;
}

/* Wooden grain effect for board background */
.toolbar .small-number-board::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background-image: 
    repeating-linear-gradient(90deg, transparent 0, transparent 2px, rgba(0, 0, 0, 0.05) 2px, rgba(0, 0, 0, 0.05) 4px),
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(255, 255, 255, 0.03) 3px, rgba(255, 255, 255, 0.03) 6px);
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
}

.toolbar .small-number-board > .num {
  position: relative;
  z-index: 1;
}

#userNumberBoard, .called-numbers {
  display: none !important;
}

.user-show-boards #userNumberBoard {
  display: grid !important;
}

.user-show-boards .called-numbers {
  display: flex !important;
}

.user-hide-tickets #ticketsWrap, .user-hide-tickets #checkAvailable {
  display: none !important;
}

#userSearchArea {
  max-width: 420px;
  margin: 10px auto;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

#userSearchArea input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #cf9b51;
  width: 100%;
  font-weight: 700;
  background: rgba(255,255,255,0.05);
  color: #2b241a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -2px 6px rgba(0,0,0,0.12);
}

#userSearchArea button {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(207, 155, 81, 0.9);
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  color: #f8e7cf;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 6px rgba(0,0,0,0.18), 0 6px 12px rgba(0,0,0,0.18);
}

.toolbar .small-number-board .num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  font-weight: 800;
  font-size: clamp(12px, 4vw, 16px);
  background: linear-gradient(135deg, #e8d5b7 0%, #d9c099 50%, #c4a974 100%);
  color: #4a3820;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  position: relative;
  isolation: isolate;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  box-shadow: 
    0 3px 6px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.1);
  -webkit-tap-highlight-color: transparent;
}

.toolbar .small-number-board .num-value {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
  text-align: center;
  min-width: 0;
  pointer-events: none;
}

.toolbar .small-number-board .num-x {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
  transition: opacity 0.15s ease;
}

.toolbar .small-number-board .num-x::before {
  content: '';
  position: absolute;
  inset: 12%;
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent calc(50% - 2.5px), rgba(196, 30, 58, 0.82) calc(50% - 2.5px), rgba(196, 30, 58, 0.82) calc(50% + 2.5px), transparent calc(50% + 2.5px)),
    linear-gradient(-45deg, transparent calc(50% - 2.5px), rgba(196, 30, 58, 0.82) calc(50% - 2.5px), rgba(196, 30, 58, 0.82) calc(50% + 2.5px), transparent calc(50% + 2.5px));
}

/* Subtle wood grain on individual tiles */
.toolbar .small-number-board .num::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background-image: 
    repeating-linear-gradient(90deg, transparent 0, transparent 1px, rgba(0, 0, 0, 0.04) 1px, rgba(0, 0, 0, 0.04) 2px),
    repeating-linear-gradient(0deg, transparent 0, transparent 2px, rgba(255, 255, 255, 0.02) 2px, rgba(255, 255, 255, 0.02) 4px);
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}

/* Subtle highlight effect on unannounced tiles */
.toolbar .small-number-board .num::after {
  content: '';
  position: absolute;
  top: 8%;
  left: 12%;
  width: 45%;
  height: 30%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.1));
  pointer-events: none;
  opacity: 0.5;
  z-index: 2;
}

.toolbar .small-number-board .num.drawn {
  background: linear-gradient(135deg, #3d2010 0%, #2a1508 50%, #1a0f05 100%);
  color: #f0f0f0;
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}

.toolbar .small-number-board .num.drawn .num-x {
  opacity: 1;
}

.toolbar .small-number-board .num.drawn .num-value {
  color: #f0f0f0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.toolbar .small-number-board .num.current {
  background: linear-gradient(135deg, #2a1810 0%, #1a0f08 50%, #0a0500 100%);
  color: #fff9f0;
  transform: scale(1.15);
  box-shadow: 
    0 8px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 6px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Animate newly-highlighted numbers: premium red appearance for special/winning state */
.toolbar .small-number-board .num.just-called {
  background: linear-gradient(135deg, #c41e3a 0%, #a01830 50%, #6b1225 100%);
  color: #ffffff;
  box-shadow: 
    0 8px 16px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 6px rgba(0, 0, 0, 0.35);
  transform: scale(1.15);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.toolbar .small-number-board .num:focus {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 1px;
}

/* Special styling for number 90 - premium red game piece */
.toolbar .small-number-board .num[data-num="90"] {
  background: linear-gradient(135deg, #e8d5b7 0%, #d9c099 50%, #c4a974 100%);
  color: #4a3820;
}

.toolbar .small-number-board .num[data-num="90"].drawn {
  background: linear-gradient(135deg, #3d2010 0%, #2a1508 50%, #1a0f05 100%);
  color: #f0f0f0;
}

.toolbar .small-number-board .num[data-num="90"].current {
  background: linear-gradient(135deg, #2a1810 0%, #1a0f08 50%, #0a0500 100%);
  color: #fff9f0;
}


/* === CALLED NUMBERS === */
.called-numbers {
  max-width: 420px;
  margin: 14px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  box-sizing: border-box;
  background: none;
  border-radius: none;
  position: relative;
  z-index: 9999 !important;
}

.number-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 32px;
  flex-wrap: nowrap;
}

.called-ball {
  flex: 0 0 auto;
  width: clamp(32px, 8vw, 42px);
  height: clamp(32px, 8vw, 42px);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: clamp(14px, 3vw, 18px);
  box-shadow: 0 6px 14px var(--shadow-dark);
  transform: translateY(100px) scale(0.8);
  /* default visible: ensure wood material is visible from initial render */
  opacity: 1;
  will-change: transform, opacity;
  position: relative;
  /* Light oak wood as default */
  background: linear-gradient(180deg, #d4a574 0%, #c99260 45%, #a87540 100%);
}

.called-ball.animate-rise {
  animation: riseToPosition 2s cubic-bezier(0.2, 0.85, 0.25, 1.2) forwards;
  filter: drop-shadow(0 8px 14px var(--overlay-deep));
}

.called-ball.landed {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Wooden Tambola ball visuals (shared across called numbers and decorative balls)
   Uses layered gradients + subtle repeating grain overlay + inset highlight + drop shadow
*/
.called-ball.wood-variant-0,
.tball.wood-variant-0 {
  /* Light oak */
  background: linear-gradient(180deg,#e9d6bb 0%,#d0b78a 45%,#b48959 100%) !important;
}
.called-ball.wood-variant-1,
.tball.wood-variant-1 {
  /* Warm tan */
  background: linear-gradient(180deg,#f1dcc0 0%,#d9b787 45%,#b88652 100%) !important;
}
.called-ball.wood-variant-2,
.tball.wood-variant-2 {
  /* Light brown */
  background: linear-gradient(180deg,#dfc29a 0%,#c79b67 45%,#a06f3a 100%) !important;
}
.called-ball.wood-variant-3,
.tball.wood-variant-3 {
  /* Medium warm brown */
  background: linear-gradient(180deg,#d4b18a 0%,#b58757 45%,#8c5530 100%) !important;
}
.called-ball.wood-variant-4,
.tball.wood-variant-4 {
  /* Slightly darker wood */
  background: linear-gradient(180deg,#c9a379 0%,#9f6f46 45%,#7a4828 100%) !important;
}
.called-ball.wood-variant-5,
.tball.wood-variant-5 {
  /* Rich honey oak */
  background: linear-gradient(180deg,#f4dbb6 0%,#d9b57e 45%,#b17a46 100%) !important;
}

/* Fine grain overlay and small imperfections: use ::before so grain appears on top of base wood but below gloss/highlight */
.called-ball::before,
.tball::before{
  content: '';
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  border-radius: 50%;
  pointer-events: none;
  background-image: 
    repeating-linear-gradient(120deg, rgba(0,0,0,0.03) 0 1px, rgba(255,255,255,0) 1px 6px),
    linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0));
  mix-blend-mode: multiply;
  opacity: 0.28;
  transform: translateZ(0);
}

/* Polished clear-coat highlight stays above grain */
.called-ball::after,
.tball::after{
  content: '';
  position: absolute;
  left: 8%; top: 6%;
  width: 60%; height: 34%;
  border-radius: 50%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.06));
  transform: rotate(-22deg) scaleX(1.1);
  opacity: 0.18;
  mix-blend-mode: overlay;
}

/* Common wooden finish treatments */
.called-ball,
.tball {
  color: #2b190f !important; /* darker number color for contrast on wood */
  text-shadow: 0 1px 0 rgba(255,255,255,0.12) !important;
  border: 1px solid rgba(0,0,0,0.12) !important;
  box-shadow: 0 6px 14px rgba(0,0,0,0.25), inset 0 10px 18px rgba(255,255,255,0.06) !important;
}

/* Polished clear-coat gloss + fine grain overlay for realistic wooden finish */
.called-ball::after,
.tball::after{
  content: '';
  position: absolute;
  left: 8%;
  top: 6%;
  width: 60%;
  height: 34%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.06));
  transform: rotate(-22deg);
  opacity: 0.22;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* subtle inner contour and grain to sell the spherical depth */
.called-ball,
.tball{
  box-shadow: 0 12px 22px rgba(0,0,0,0.24), inset 0 10px 20px rgba(255,255,255,0.05), inset 0 -8px 14px rgba(0,0,0,0.12) !important;
  background-size: 200% 200%;
  overflow: visible;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  font-weight: 800;
  -webkit-font-smoothing: antialiased;
}

/* Text treatment to look engraved/printed while remaining readable */
.called-ball,
.tball{
  text-shadow: 0 1px 0 rgba(255,255,255,0.28), 0 -1px 0 rgba(0,0,0,0.28);
  color: #2b190f !important;
}

/* ensure called-ball animations preserve previous behaviors */
.called-ball.animate-rise { filter: drop-shadow(0 8px 14px rgba(0,0,0,0.18)); }

/* Per-number color palette removed so wood-variant styling applies consistently.
   Original fixed color block intentionally omitted to avoid transient colored flashes
   and to allow wooden materials to show on called-number balls from first frame.
*/

@keyframes riseToPosition {
  0% {
    transform: translateY(100vh) scale(1);
    opacity: 1;
  }
  60% {
    transform: translateY(-10px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 420px) {
  .called-numbers {
    max-width: 96%;
    padding: clamp(8px, 2vw, 12px);
    min-height: clamp(72px, 15vw, 84px);
  }
  .number-row {
    gap: clamp(6px, 1.5vw, 10px);
  }
  .called-ball {
    width: clamp(26px, 5.5vw, 32px);
    height: clamp(26px, 5.5vw, 32px);
    font-size: clamp(12px, 2.5vw, 16px);
  }
}

/* === TICKETS WRAP === */
.tickets-wrap {
  /* Make tickets area responsive using CSS Grid for the user panel only */
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: var(--gap);
  /* allow the grid to use full available width while keeping vertical spacing */
  max-width: 100%;
  margin: clamp(12px, 3vw, 18px) auto clamp(100px, 20vh, 140px);
  position: relative;
  z-index: 2;
  padding: clamp(6px, 1vw, 10px);
  box-sizing: border-box;
}

/* Ensure each ticket card fills its grid cell and we rely on grid gap
   instead of per-card bottom margin (prevents doubled spacing). */
.tickets-wrap .ticket-card {
  width: 100%;
  margin-bottom: 0;
}

/* Tablet: 2 columns (covers iPad, Galaxy Tab, etc.) */
@media (min-width: 720px) and (max-width: 1279px) {
  .tickets-wrap {
    grid-template-columns: repeat(2, 1fr);
    max-width: calc(100% - 40px);
  }
}

/* Desktop / Laptop: 10 columns */

/* Highlight drawn/current numbers inside search results (match main ticket styles) */
#userTicketSearchResults .ticket-table td.num {
  position: relative;
  isolation: isolate;
  padding: 0;
  aspect-ratio: 1 / 1;
  min-height: 0;
}

#userTicketSearchResults .ticket-table td.num.drawn {
  background: #d98245;
  color: white;
  box-shadow: 0 4px 10px var(--shadow-light);
  border-radius: 4px;
}

#userTicketSearchResults .ticket-table td.num.drawn::after {
  content: '';
  position: absolute;
  inset: 8%;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(45deg, transparent calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(-45deg, transparent calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% + 2px), transparent calc(50% + 2px));
  opacity: 1;
}

#userTicketSearchResults .ticket-table td.num .num-text {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
  text-align: center;
}

#userTicketSearchResults .ticket-table td.num.current {
  background: var(--accent);
  color: white;
  transform: scale(1.08);
  box-shadow: 0 8px 16px var(--shadow-medium);
}
@media (min-width: 1280px) {
  .tickets-wrap {
    /* allow each column to respect the ticket sizing variables */
    grid-template-columns: repeat(3, minmax(var(--ticket-min), 1fr));
    grid-auto-rows: auto;
    align-items: start;
    justify-content: center;
    width: 100%;
    max-width: 100%;
  }
}

.ticket-card {
  border: 4px solid #cf9b51;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 18%),
    linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  margin-bottom: clamp(14px, 3vw, 24px);
  padding: clamp(10px, 2vw, 14px);
  position: relative;
  transition: none;
  will-change: auto;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    inset 0 -3px 10px rgba(0,0,0,0.25),
    0 12px 22px rgba(0,0,0,0.24);
}

.ticket-card:hover, .ticket-card:focus-within {
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    inset 0 -3px 10px rgba(0,0,0,0.25),
    0 12px 22px rgba(0,0,0,0.24);
  border-color: #cf9b51;
}

.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(12px, 2vw, 16px);
  position: relative;
  gap: clamp(12px, 2vw, 16px);
}

.ticket-index {
  background: linear-gradient(135deg, #3a1d12 0%, #180d09 100%);
  color: #f4ddae;
  width: clamp(48px, 10vw, 60px);
  height: clamp(48px, 10vw, 60px);
  border-radius: 50%;
  border: 3px solid #cf9b51;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 3vw, 22px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 6px 14px rgba(0,0,0,0.25);
  flex-shrink: 0;
}

.ticket-number,
.search-card .ticket-number,
.dw-ticket {
  background: linear-gradient(135deg, #3a1d12 0%, #180d09 100%);
  color: #f4ddae;
  width: clamp(48px, 10vw, 60px);
  height: clamp(48px, 10vw, 60px);
  border-radius: 50%;
  border: 3px solid #cf9b51;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(16px, 3vw, 22px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 6px 14px rgba(0,0,0,0.25);
  flex-shrink: 0;
  line-height: 1;
}

.search-card .ticket-number {
  margin-right: 12px;
}

.modal-winner-card .ticket-number {
  width: clamp(56px, 12vw, 60px);
  height: clamp(56px, 12vw, 60px);
  font-size: clamp(18px, 3.6vw, 28px);
}

.ticket-actions {
  position: relative;
  z-index: 5;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  width: auto;
  flex-shrink: 0;
}

.ticket-actions button {
  border: none;
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ticket-actions .book-btn {
  min-width: 56px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, #1abf6b 0%, #0f9a56 100%);
  color: white;
  box-shadow: 0 6px 14px rgba(16, 154, 86, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ticket-actions .book-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px var(--shadow-medium);
}

.ticket-actions .sold-btn {
  min-width: 56px;
  padding: 8px 12px;
  margin-top: -9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: #666666;
  color: white;
  box-shadow: 0 4px 10px var(--shadow-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(4px);
}

@media (max-width: 720px) {
  .ticket-actions .book-btn {
    font-size: 12px;
    min-width: auto;
    padding: 6px 10px;
  }
}

@media (max-width: 520px) {
  .ticket-actions .book-btn {
    min-width: auto;
    padding: 5px 8px;
    font-size: 11px;
  }
  .ticket-actions .sold-btn {
    min-width: auto;
    padding: 5px 8px;
  }
}

.ticket-grid {
  border: 4px solid #cf9b51;
  padding: 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b3218 0%, #3c1f13 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 18px rgba(0,0,0,0.2);
}

body:not(.user-show-boards) #ticketsWrap .ticket-grid {
  background: #ffffff !important;
}

.ticket-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  table-layout: fixed;
}

.ticket-table td {
  width: 11.11%;
  min-width: 0;
  border: 2px solid rgba(68, 42, 29, 0.95);
  text-align: center;
  vertical-align: middle;
  font-weight: 800;
  color: #382617;
  font-size: clamp(0.9rem, 1.45vw, 1.1rem);
  padding: clamp(4px, 0.9vw, 6px);
  background: linear-gradient(135deg, #f0dfbd 0%, #d7ba83 52%, #c39a64 100%);
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  height: auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -2px 4px rgba(0,0,0,0.08);
}

.ticket-table td.blank {
  background: rgba(75, 51, 32, 0.35);
  color: transparent;
  border: 2px solid rgba(68, 42, 29, 0.95);
  opacity: 0.8;
}

.booked {
  opacity: 0.8;
}

.booked .ticket-actions button {
  background: #666666;
  color: white;
}

.ticket-left {
  display: flex;
  flex-direction: row;
  gap: clamp(8px, 2vw, 12px);
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  min-width: 0;
}

.ticket-number-text {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 800;
  color: white;
}

.ticket-status {
  font-size: clamp(12px, 2.5vw, 15px);
  font-weight: 900;
  color: white;
  padding: clamp(4px, 1vw, 8px) clamp(8px, 1.5vw, 12px);
  border-radius: 6px;
  background: rgba(216, 77, 123, 0);
  display: inline-block;
  width: fit-content;
  white-space: nowrap;
}

.ticket-status.status-unsold {
  color: #f6e9c9;
  background: linear-gradient(135deg, #3d2016 0%, #1b110d 100%);
  padding: 5px;
  padding-top: 2px !important;
  padding-bottom: 4px !important;
  border: 1px solid rgba(207, 155, 81, 0.8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.ticket-status.status-sold {
  color: #f6e9c9;
  background: linear-gradient(135deg, #3d2016 0%, #1b110d 100%);
  padding: 5px;
  padding-top: 2px !important;
  padding-bottom: 4px !important;
  border: 1px solid rgba(207, 155, 81, 0.8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.player-name {
  margin-top: 6px;
  font-size: 14px;
  color: #f8e7cf;
  font-weight: 700;
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-block;
  border: 1px solid rgba(207, 155, 81, 0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 6px rgba(0,0,0,0.18);
  transition: all 0.18s ease;
}

.ticket-table td.num.drawn {
  background: linear-gradient(135deg, #a5abb2 0%, #8b929a 50%, #7a828b 100%) !important;
  color: #2a2d31 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 10px rgba(0,0,0,0.12);
  border-radius: 4px;
}

#userTicketSearchResults .ticket-table td.num:not(.drawn):not(.current):not(.just-called) {
  background: linear-gradient(135deg, #d7d9dd 0%, #b4b9be 52%, #9ca3ab 100%) !important;
  color: #3a3d40 !important;
  border: 2px solid rgba(82, 86, 92, 0.7) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -2px 6px rgba(0,0,0,0.08) !important;
}

.ticket-table td.num.current,
.ticket-table td.num.just-called,
#userTicketSearchResults .ticket-table td.num.just-called,
#userTicketSearchResults .ticket-table td.num.current {
  background: linear-gradient(135deg, #d93b3b 0%, #b81f1f 50%, #8d1212 100%) !important;
  color: #fff8f8 !important;
  transform: scale(1.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 8px 16px rgba(0,0,0,0.18);
}

body.theme-default .ticket-card,
body.theme-glassmorph .ticket-card,
body.theme-neon .ticket-card,
body.theme-pastel .ticket-card,
body.theme-darkpremium .ticket-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 18%), linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%) !important;
  border: 4px solid #cf9b51 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -3px 10px rgba(0,0,0,0.25), 0 12px 22px rgba(0,0,0,0.24) !important;
}

body.theme-default .ticket-grid,
body.theme-glassmorph .ticket-grid,
body.theme-neon .ticket-grid,
body.theme-pastel .ticket-grid,
body.theme-darkpremium .ticket-grid {
  background: linear-gradient(135deg, #5b3218 0%, #3c1f13 100%) !important;
  border: 4px solid #cf9b51 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 18px rgba(0,0,0,0.2) !important;
}

body.theme-default .ticket-table td,
body.theme-glassmorph .ticket-table td,
body.theme-neon .ticket-table td,
body.theme-pastel .ticket-table td,
body.theme-darkpremium .ticket-table td {
  background: linear-gradient(135deg, #f0dfbd 0%, #d7ba83 52%, #c39a64 100%) !important;
  color: #382617 !important;
  border: 2px solid rgba(68, 42, 29, 0.95) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -2px 4px rgba(0,0,0,0.08) !important;
}

body.theme-default .ticket-status.status-unsold,
body.theme-glassmorph .ticket-status.status-unsold,
body.theme-neon .ticket-status.status-unsold,
body.theme-pastel .ticket-status.status-unsold,
body.theme-darkpremium .ticket-status.status-unsold,
body.theme-default .ticket-status.status-sold,
body.theme-glassmorph .ticket-status.status-sold,
body.theme-neon .ticket-status.status-sold,
body.theme-pastel .ticket-status.status-sold,
body.theme-darkpremium .ticket-status.status-sold {
  background: linear-gradient(135deg, #3d2016 0%, #1b110d 100%) !important;
  color: #f6e9c9 !important;
  border: 1px solid rgba(207, 155, 81, 0.8) !important;
}

#genControls {
  max-width: 420px;
  margin: 12px auto 0;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 8px;
}

/* === AVAILABLE MODAL === */
.avail-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: auto;
  display: block;
}

.avail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(20, 13, 9, 0.36);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: availBackdropIn 0.22s ease-out;
}

@keyframes availBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.avail-panel {
  position: fixed;
  z-index: 2;
  left: 0;
  top: 0;
  width: min(92vw, 960px);
  height: min(76vh, 620px);
  max-width: 960px;
  max-height: 620px;
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 26%, #3c2417 100%);
  border: 3px solid #cf9b51;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 22px 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 24px 50px rgba(0,0,0,0.28);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.avail-modal:not([hidden]) .avail-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.avail-header {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(0,0,0,0.08));
  color: #f5e3b1;
  padding: 8px 52px 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: 46px;
  border-radius: 10px;
  border: 2px solid rgba(207,155,81,0.8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  margin-bottom: 8px;
  overflow: visible;
  flex-wrap: nowrap;
}

.avail-count {
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 26%, #3c2417 100%);
  border: 2px solid #cf9b51;
  color: #f5e3b1;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  font-weight: 700;
}

.avail-header .small-number-board {
  display: flex !important;
  gap: 10px !important;
  overflow-x: auto !important;
  padding: 10px 6px !important;
  width: 100%;
}

.avail-header .small-number-board .num {
  flex: 0 0 auto;
  min-width: 40px;
  text-align: center;
}

.avail-header h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 1px;
  font-weight: 700;
}

.avail-close {
  position: absolute;
  right: 12px;
  top: 4px;
  background: rgba(0,0,0,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fffaf2;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: bold;
  transition: all 0.2s ease;
  z-index: 10;
}

.avail-close:hover {
  background: rgba(255,255,255,0.14);
  transform: scale(1.04);
}

.avail-header.avail-header-end {
  justify-content: space-between;
}

.selection-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  margin: 0 8px;
  padding: 2px 0;
  max-height: 38px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.chip {
  background: linear-gradient(135deg, #f1dcb0 0%, #d9b77d 100%);
  color: #2b180e;
  border: 1px solid rgba(68, 42, 29, 0.85);
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 3px 8px rgba(0,0,0,0.12);
  line-height: 1.1;
  flex: 0 0 auto;
  min-width: 0;
}

.chip:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 5px 10px rgba(0,0,0,0.14);
}

.chip .remove {
  color: #ff6b6b;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
}

.chip .remove:hover {
  color: #ff5252;
}

.avail-frame {
  padding: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(0,0,0,0.08));
  border: 2px solid rgba(207,155,81,0.8);
  border-radius: 10px;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  overflow: auto;
  max-height: none;
}

.avail-grid {
  width: 100%;
  max-width: 1100px;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(0,0,0,0.08));
  padding: calc(var(--gap) * 0.75);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--ticket-min), 1fr));
  gap: var(--gap);
  justify-content: center;
}

.ticket-btn {
  background: var(--bg);
  border-radius: 10px;
  width: 100%;
  max-width: var(--ticket-max);
  height: var(--ticket-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  text-align: center;
  font-weight: 800;
  font-size: clamp(15px, 2.2vw, 20px);
  color: var(--text);
  border-width: var(--border-w);
  border-style: solid;
  border-color: var(--secondary);
  cursor: pointer;
  box-shadow: 0 6px 14px var(--shadow-medium);
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: all 0.26s ease;
  opacity: 0;
  transform: translateY(10px);
}

.ticket-btn.revealed {
  opacity: 1;
  transform: none;
}

.ticket-btn.selected {
  background: linear-gradient(135deg, #f7d669 0%, #e7b82d 100%);
  color: #2d1d0e;
  border-color: #e7b82d;
  box-shadow: 0 12px 30px rgba(231, 184, 45, 0.45);
  transform: translateY(-4px);
}

.ticket-btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--overlay-medium), 0 6px 18px var(--shadow-medium);
  transform: translateY(-2px);
}

.ticket-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px var(--overlay-medium) inset;
}

.ticket-btn.sold {
  background: linear-gradient(135deg, #7a4a2a 0%, #57321b 52%, #3d2415 100%);
  color: #f6e6c7;
  border-color: #b98248;
}

.ticket-btn.sold.selected {
  background: linear-gradient(135deg, #8e5e3a 0%, #684425 100%);
  color: #f6e6c7;
  border-color: #c78d52;
  transform: none;
}

.ticket-btn.sold::before {
  content: "SOLD";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  font-weight: 900;
  font-size: calc(var(--ticket-h, 72px) * 0.36 - 4px);
  color: rgb(149 23 23);
  opacity: 0.9;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: -1;
}

@media (max-width: 900px) {
  .avail-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 520px) {
  :root {
    --border-w: 3px;
  }
  .avail-grid {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 10px;
  }
  .avail-panel {
    height: 80%;
    width: 98%;
    padding: 10px;
  }
  .ticket-btn {
    height: clamp(60px, 12vw, 84px);
  }
}

@media (max-width: 420px) {
  .avail-panel {
    max-width: 360px;
    padding: 12px;
  }
  .avail-grid {
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }
}

.avail-modal[hidden] {
  display: none !important;
}

.avail-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 12px 0;
  flex: 0 0 auto;
  margin-top: auto;
}

.book-btn {
  display: inline-block;
  position: relative;
  width: auto;
  min-width: 150px;
  height: 38px;
  border-radius: 28px;
  border: none;
  padding: 10px 22px;
  font-size: 16px;
  background: linear-gradient(135deg, #1abf6b 0%, #0f9a56 100%);
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 154, 86, 0.35);
  text-align: center;
  z-index: 60;
  transition: all 0.15s ease;
}

.book-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px var(--shadow-dark);
}

@media (max-width: 420px) {
  .book-btn {
    min-width: 110px;
    height: 34px;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 24px;
  }
}

/* === DASHBOARD === */
.dash-panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 340px;
  max-width: calc(100% - 32px);
  max-height: 60vh;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 12px 32px var(--shadow-dark);
  overflow: hidden;
  z-index: 400000;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--secondary);
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: white;
}

.dash-title {
  font-weight: 800;
  font-size: 16px;
}

.dash-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.dash-close:hover {
  transform: scale(1.15);
}

.dash-grid {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  overflow: auto;
  align-content: flex-start;
}

.dash-item {
  min-width: 52px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 8px;
  text-align: center;
  font-weight: 800;
  color: var(--text);
  border: 2px solid var(--secondary);
  cursor: default;
}

.dash-item.sold {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: white;
  border-color: var(--accent);
}

/* === SEARCH RESULTS === */
#userTicketSearchResults {
  /* Use CSS Grid to mirror user tickets responsiveness */
  max-width: 100%;
  margin: 10px auto 20px;
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: clamp(14px, 3vw, 22px);
  box-sizing: border-box;
  padding: 0 clamp(6px, 2vw, 16px);
  justify-content: center;
  align-items: start;
}

#userTicketSearchResults .search-card {
  border: 4px solid #cf9b51;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 18%), linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  padding: clamp(10px, 1.5vw, 14px);
  position: relative;
  transition: all 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
  box-shadow: 0 6px 16px var(--shadow-medium);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 0;
  display: block;
  overflow: visible;
}

body.user-show-boards #userTicketSearchResults .search-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 18%), linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%) !important;
  border: 3px solid #cf9b51 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -3px 10px rgba(0,0,0,0.25), 0 12px 22px rgba(0,0,0,0.24) !important;
}

body.user-show-boards #userTicketSearchResults .ticket-grid {
  background: #ffffff !important;
}

body.user-show-boards #userTicketSearchResults .ticket-table td {
  background: linear-gradient(135deg, #f0dfbd 0%, #d7ba83 52%, #c39a64 100%) !important;
  color: #382617 !important;
  border: 2px solid rgba(68, 42, 29, 0.95) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -2px 4px rgba(0,0,0,0.08) !important;
}

body.user-show-boards #userTicketSearchResults .ticket-table td.blank {
  background: rgba(75, 51, 32, 0.35) !important;
  border: 2px solid rgba(68, 42, 29, 0.95) !important;
}

/* MOBILE: 1 column (below 768px) */
@media (max-width: 767px) {
  #userTicketSearchResults {
    grid-template-columns: repeat(1, 1fr);
    padding: 0 clamp(8px, 3vw, 16px);
  }
}

/* TABLET: 2 columns (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  #userTicketSearchResults {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 clamp(10px, 3vw, 20px);
  }
}

/* DESKTOP / LAPTOP: 3 columns (1024px and up) */
@media (min-width: 1024px) {
  #userTicketSearchResults {
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    max-width: 100%;
    padding: 0 clamp(12px, 3vw, 28px);
    justify-content: center;
  }
}

/* Make search card ticket grids match regular ticket proportions */
#userTicketSearchResults .search-card {
  display: block;
  box-sizing: border-box;
  min-width: 0;
}

#userTicketSearchResults .ticket-grid {
  border: 4px solid #cf9b51;
  padding: clamp(3px, 0.6vw, 6px);
  border-radius: 12px;
  background: #ffffff;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  overflow: visible;
  flex: 1;
}

#userTicketSearchResults .ticket-grid .ticket-table {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: clamp(1px, 0.35vw, 4px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: #ffffff !important;
}

#userTicketSearchResults .ticket-grid .ticket-table tbody,
#userTicketSearchResults .ticket-grid .ticket-table tr {
  display: contents;
}

#userTicketSearchResults .ticket-table td {
  width: auto;
  height: auto;
  min-width: 0;
  border: 1px solid rgba(68, 42, 29, 0.95);
  text-align: center;
  vertical-align: middle;
  font-weight: 800;
  color: #382617;
  font-size: clamp(0.9rem, 1.45vw, 1.1rem);
  line-height: 1;
  padding: 0;
  background: linear-gradient(135deg, #f0dfbd 0%, #d7ba83 52%, #c39a64 100%);
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
}

#userTicketSearchResults .ticket-table td.num {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 0;
  min-height: 0;
}

#userTicketSearchResults .ticket-table td.blank {
  background: rgba(75, 51, 32, 0.35);
  color: transparent;
  border: 1px solid rgba(68, 42, 29, 0.95);
  opacity: 0.8;
}

.search-card-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04));
  border: 2px solid #89726f;
  border-radius: 50%;
  color: #74a3b0;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 5;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 6px 12px rgba(0,0,0,0.16);
}

.search-card-close:hover,
.search-card-close:focus-visible {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 8px 16px rgba(0,0,0,0.22);
}

/* === DIVISIONS === */
.divisions-wrap {
  max-width: 420px;
  margin: 10px auto 140px;
  display: none !important;
}

.user-show-boards .divisions-wrap {
  display: grid !important;
}

.division-card {
  background: transparent;
  border: 2px solid #cf9b51;
  padding: 12px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 8px rgba(0,0,0,0.18), 0 8px 16px rgba(0,0,0,0.14);
}

.division-view-btn {
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  color: #f8e7cf;
  border: 1px solid #cf9b51;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 6px rgba(0,0,0,0.18), 0 6px 14px var(--shadow-medium);
  transition: all 0.2s ease;
}

.division-view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-medium);
}

.division-winners-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.division-winner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.division-winner-center {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  color: var(--text) !important;
  font-weight: 800 !important;
}

.division-winner-center .dw-name {
  color: var(--text);
  font-weight: 800;
  font-size: clamp(14px, 2.6vw, 16px);
  margin-left: -120px;
}

.division-winner-center .dw-ticket {
  background: transparent !important;
  color: var(--text) !important;
  width: auto !important;
  height: auto !important;
  border: none !important;
  border-radius: 0 !important;
  margin-top: 6px !important;
  box-shadow: none !important;
  padding: 0 6px !important;
  font-size: clamp(13px, 2.4vw, 15px) !important;
}

.division-view-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.division-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: clamp(10px, 2vw, 20px);
  overflow-y: auto;
  background: var(--overlay-dark);
}

.division-modal[open] {
  display: flex;
}

.division-modal-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.division-modal-content {
  position: relative;
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  background: var(--bg);
  border: 4px solid var(--secondary);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px var(--shadow-extra-dark);
  margin: auto;
  z-index: 1301;
}

.division-modal-header {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: clamp(16px, 3vw, 20px);
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}

.division-modal-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.division-modal-close:hover {
  transform: scale(1.15);
}

.division-tickets-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--ticket-min), 1fr));
  gap: var(--gap);
  padding: clamp(14px, 3vw, 20px);
  background: var(--card);
  border-radius: 10px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.division-ticket-item {
  border: 3px solid var(--secondary);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, rgba(255, 157, 92, 0.3) 100%);
  padding: clamp(10px, 2vw, 14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 120px;
  box-shadow: 0 8px 18px var(--shadow-dark);
  transition: all 0.2s ease;
}

.division-ticket-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px var(--shadow-medium);
}

.division-ticket-item .ticket-index {
  margin: 0;
}

.division-ticket-item .player-name {
  margin: 0;
  font-size: clamp(12px, 2.5vw, 14px);
}

@media (max-width: 520px) {
  .division-modal-content {
    max-height: 85vh;
    width: 95%;
  }
  .division-tickets-wrap {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 12px;
    padding: 12px;
  }
  .division-modal {
    padding: 8px;
  }
}

@media (max-width: 420px) {
  .division-modal-content {
    max-height: 90vh;
    max-width: 100%;
    width: 98%;
    border-radius: 12px;
  }
  .division-tickets-wrap {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    padding: 10px;
  }
  .division-modal-header {
    padding: 12px 16px;
    font-size: 18px;
  }
  .divisions-wrap {
    max-width: 96%;
    margin: 8px auto 120px;
  }
  .division-card {
    padding: 10px 12px;
    gap: 10px;
  }
  .division-winner-center .dw-name {
    margin-left: 0 !important;
    font-size: 12px;
  }
  .division-winner-center .dw-ticket {
    font-size: 11px;
  }
  .division-view-btn {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* === WINNER TICKET MODAL === */
.winner-ticket-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  background: var(--overlay-dark);
  padding: clamp(10px, 2vw, 20px);
  overflow-y: auto;
}

.winner-ticket-panel {
  position: relative;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px var(--shadow-extra-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

.winner-ticket-close {
  position: absolute;
  top: 21px;
  right: 21px;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255,255,255,0.22);
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: #1e0a0a;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 10px 20px rgba(0,0,0,0.2);
}

.winner-ticket-close:hover,
.winner-ticket-close:focus-visible {
  transform: scale(1.1);
  filter: brightness(1.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 12px 22px rgba(0,0,0,0.24);
}

.winner-ticket-body {
  flex: 1;
  overflow-y: auto;
  padding: clamp(14px, 3vw, 20px);
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 18%), linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  border: 4px solid #cf9b51;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -3px 10px rgba(0,0,0,0.25), 0 12px 22px rgba(0,0,0,0.24);
}

.winner-crest {
  text-align: center;
  padding: clamp(14px, 2vw, 20px);
  background: linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  color: #f8e7cf;
  border: 2px solid #cf9b51;
  border-radius: 12px;
  margin-bottom: clamp(14px, 2vw, 20px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 6px rgba(0,0,0,0.18);
}

.winner-crest-emojis {
  font-size: clamp(32px, 6vw, 48px);
  margin-bottom: 10px;
  animation: pulse 1s ease-in-out infinite;
}

.winner-crest-text {
  font-size: clamp(14px, 2.5vw, 18px);
  font-weight: 800;
}

.winner-crest-division {
  font-size: clamp(12px, 2vw, 14px);
  opacity: 0.95;
  margin-bottom: 6px;
}

.winner-crest-name {
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 900;
  margin-top: 4px;
}

.modal-winner-card {
  border: 4px solid #cf9b51;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 18%),
    linear-gradient(135deg, #5a3118 0%, #7d4a2d 22%, #3f2618 52%, #7d4a2d 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -3px 10px rgba(0,0,0,0.25), 0 12px 22px rgba(0,0,0,0.24);
}

.modal-winner-card .ticket-grid {
  border: 3px solid #cf9b51;
  padding: 6px;
  border-radius: 8px;
  background: #ffffff !important;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  overflow: visible;
  flex: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 18px rgba(0,0,0,0.2);
}

.modal-winner-card .ticket-grid .ticket-table {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: clamp(1px, 0.35vw, 4px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: #ffffff !important;
  table-layout: fixed;
}

.modal-winner-card .ticket-grid .ticket-table tbody,
.modal-winner-card .ticket-grid .ticket-table tr {
  display: contents;
}

.modal-winner-card .ticket-table td {
  width: auto;
  min-width: 0;
  border: 2px solid rgba(68, 42, 29, 0.95);
  text-align: center;
  vertical-align: middle;
  font-weight: 800;
  color: #382617;
  font-size: clamp(0.9rem, 1.45vw, 1.15rem);
  line-height: 1.05;
  padding: 0;
  background: linear-gradient(135deg, #f0dfbd 0%, #d7ba83 52%, #c39a64 100%);
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  height: auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -2px 4px rgba(0,0,0,0.08);
}

.modal-winner-card .ticket-table td.blank {
  background: rgba(75, 51, 32, 0.35);
  color: transparent;
  border: 2px solid rgba(68, 42, 29, 0.95);
  opacity: 0.8;
}

body .modal-winner-card .ticket-table td.num:not(.drawn):not(.current):not(.just-called) {
  background: linear-gradient(135deg, #d7d9dd 0%, #b4b9be 52%, #9ca3ab 100%) !important;
  color: #3a3d40 !important;
  border: 2px solid rgba(82, 86, 92, 0.7) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -2px 6px rgba(0,0,0,0.08) !important;
}

body .modal-winner-card .ticket-table td.num.drawn {
  position: relative;
  isolation: isolate;
  background: linear-gradient(135deg, rgb(220, 202, 165) 0%, rgb(195, 169, 116) 52%, rgb(176, 135, 84) 100%) !important;
  color: #2a2d31 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 10px rgba(0,0,0,0.12) !important;
  border-radius: 4px !important;
}

body .modal-winner-card .ticket-table td.num.drawn::after {
  content: '';
  position: absolute;
  inset: 8%;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(45deg, transparent calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(-45deg, transparent calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% - 2px), rgba(196, 30, 58, 0.45) calc(50% + 2px), transparent calc(50% + 2px));
  opacity: 1;
}

body .modal-winner-card .ticket-table td.num .num-text {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
  text-align: center;
}

body .modal-winner-card .ticket-table td.num.current {
  background: linear-gradient(135deg, rgb(240, 223, 189) 0%, rgb(215, 186, 131) 52%, rgb(195, 154, 100) 100%) !important;
  color: #2a2d31 !important;
  transform: none !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 10px rgba(0,0,0,0.12) !important;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@media (max-width: 520px) {
  .winner-ticket-panel {
    max-height: 85vh;
    width: 95%;
  }
  .winner-ticket-close {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
}

@media (max-width: 420px) {
  .winner-ticket-modal {
    padding: 8px;
  }
  .winner-ticket-panel {
    max-height: 90vh;
    width: 98%;
  }
  .winner-ticket-body {
    padding: 12px;
  }
}

/* === AGENT MODAL === */
#agentModalBackdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 520000;
  background: var(--overlay-dark);
  padding: clamp(10px, 2vw, 20px);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#agentModalBackdrop[style*="display: flex"], #agentModalBackdrop.show {
  display: flex !important;
  opacity: 1 !important;
}

#agentModal {
  background: var(--bg);
  padding: 0;
  border-radius: 16px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 60px var(--shadow-extra-dark);
  border: 4px solid var(--secondary);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
  margin: auto;
  z-index: 520001;
}

.agent-modal-header {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: clamp(16px, 3vw, 20px);
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}

.agent-modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: white;
  font-weight: bold;
  padding: 4px 8px;
  transition: all 0.2s ease;
}

.agent-modal-close:hover {
  transform: scale(1.15);
}

#agentList {
  flex: 1;
  overflow-y: auto;
  padding: clamp(14px, 2vw, 20px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2vw, 14px);
}

.agent-list-body {
  flex: 1;
  overflow-y: auto;
}

.agent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(10px, 1.5vw, 14px);
  background: var(--card);
  border-radius: 10px;
  border: 2px solid var(--secondary);
  transition: all 0.2s ease;
  gap: 10px;
}

.agent-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-medium);
  background: rgba(255, 157, 92, 0.05);
}

.agent-item-info {
  flex: 1;
}

.agent-item-name {
  font-weight: 800;
  font-size: clamp(13px, 2.5vw, 15px);
  color: var(--text);
}

.agent-item-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: clamp(8px, 1.5vw, 10px) clamp(12px, 2vw, 16px);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: clamp(12px, 2vw, 14px);
  transition: all 0.2s ease;
}

.agent-item-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px var(--shadow-medium);
}

@media (max-width: 520px) {
  #agentModal {
    max-height: 85vh;
    width: 95%;
  }
  #agentList {
    padding: 12px;
  }
}

@media (max-width: 420px) {
  #agentModalBackdrop {
    padding: 8px;
  }
  #agentModal {
    max-height: 90vh;
    width: 98%;
  }
  .agent-modal-header {
    padding: 12px 16px;
    font-size: 18px;
  }
  #agentList {
    padding: 10px;
  }
}

/* Floating crown overlay – does NOT affect title */
.floating-crown{
  position: absolute;
  font-size: 22px;
  pointer-events: none;
  transform-origin: center;
  z-index: 9999;

  /* Glow effect */
  text-shadow:
    0 0 6px rgba(255, 215, 0, 0.8),
    0 0 12px rgba(255, 215, 0, 0.6),
    0 0 20px rgba(255, 165, 0, 0.5);
}
/* === COUNTDOWN TIMER STYLING === */
#userCountdown {
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 800;
  text-align: center;
  margin: 8px 75px;
  color: rgb(223, 52, 52);
  background: rgba(52, 223, 172, 0.1);
  border: 2px solid rgb(223, 52, 52);
  animation: countdownGlow 1.5s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(223, 52, 52, 0.3);
}

/* Glowing border animation */
@keyframes countdownGlow {
  0% {
    border-color: rgb(223, 52, 52);
    box-shadow: 0 0 10px rgba(223, 52, 52, 0.3), inset 0 0 10px rgba(223, 52, 52, 0.1);
    background: rgba(223, 52, 52, 0.1);
  }
  50% {
    border-color: rgb(80, 115, 255);
    box-shadow: 0 0 20px rgba(223, 52, 52, 0.6), inset 0 0 15px rgba(223, 52, 52, 0.15);
    background: rgba(223, 52, 52, 0.15);
  }
  100% {
    border-color: rgb(52, 223, 58);
    box-shadow: 0 0 10px rgba(223, 52, 52, 0.3), inset 0 0 10px rgba(223, 52, 52, 0.1);
    background: rgba(223, 52, 52, 0.1);
  }
}

/* Hide visual border/glow when countdown element is empty (no time set) */
#userCountdown:empty {
  border-color: transparent !important;
  box-shadow: none !important;
  animation: none !important;
  background: transparent !important;
}

/* Most-recent called ball persistent highlight */
.called-numbers .called-ball.just-called {
  background: linear-gradient(180deg, #fff2b0 0%, var(--latest-called-ball-bg) 48%, #f0b400 100%) !important;
  background-color: var(--latest-called-ball-bg) !important;
  opacity: 1 !important;
  visibility: visible !important;
  box-shadow: 0 12px 24px rgba(0,0,0,0.2), 0 0 0 2px rgba(255, 213, 74, 0.45) !important;
  transform: scale(1.06) !important;
  border-color: rgba(117, 77, 0, 0.18) !important;
  color: var(--latest-called-ball-text) !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35), 0 -1px 0 rgba(0,0,0,0.18) !important;
}

.called-numbers .called-ball {
  position: relative;
  overflow: visible;
}

.called-numbers .called-ball .latest-number-entrance-shell {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform, opacity, filter;
  z-index: 3;
}

.called-numbers .called-ball .latest-number-entrance-animation {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: latestNumberEntranceDiagnostic 2000ms cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: center center;
}

@keyframes latestNumberEntranceDiagnostic {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-45deg);
    filter: drop-shadow(0 0 0 rgba(255, 193, 7, 0));
  }
  50% {
    opacity: 1;
    transform: scale(1.5) rotate(20deg);
    filter: drop-shadow(0 0 18px rgba(255, 193, 7, 0.9));
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 0 rgba(255, 193, 7, 0));
  }
}

@media (prefers-reduced-motion: reduce) {
  .called-numbers .called-ball .latest-number-entrance-animation {
    animation: none !important;
  }
}