@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* RBL Brand Colors */
  --rbl-navy: #071D49;
  --rbl-blue: #0086D6;
  --rbl-bright-blue: #19A9FF;
  --rbl-green: #008884;
  --rbl-bright-green: #5ec4b6;
  --rbl-red: #ed1b34;

  /* Gradients using RBL colors */
  --primary-gradient: linear-gradient(135deg, #0086D6 0%, #19A9FF 100%);
  --secondary-gradient: linear-gradient(135deg, #008884 0%, #5ec4b6 100%);
  --success-gradient: linear-gradient(135deg, #008884 0%, #5ec4b6 100%);
  --gold-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  --dark-gradient: linear-gradient(135deg, #071D49 0%, #0086D6 20%, #071D49 100%);

  /* Background colors - darker blue theme */
  --bg-primary: #0a0e27;
  --bg-secondary: #151935;
  --bg-tertiary: #1e2444;

  --text-primary: #ffffff;
  --text-secondary: #a8c7e7;
  --text-accent: #19A9FF;

  --border-color: rgba(100, 255, 218, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(100, 126, 234, 0.5);

  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(0, 134, 214, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(25, 169, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(0, 136, 132, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

#app {
  position: relative;
  z-index: 2;
}

.game-header {
  background: linear-gradient(180deg, rgba(30, 36, 68, 0.95) 0%, rgba(21, 25, 53, 0.95) 100%);
  backdrop-filter: blur(20px);
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.game-header h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--spacing-md);
  filter: drop-shadow(0 4px 20px rgba(255, 215, 0, 0.3));
  animation: glow 2s ease-in-out infinite alternate;
}

.game-logo {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 2.5em;
  font-weight: 700;
  color: white;
  text-decoration: none;
  display: block;
  text-align: center;
  margin-bottom: var(--spacing-md);
}

.game-logo span {
  color: #19A9FF;
}

@keyframes glow {
  from {
    filter: drop-shadow(0 4px 20px rgba(255, 215, 0, 0.3));
  }
  to {
    filter: drop-shadow(0 4px 30px rgba(255, 215, 0, 0.5));
  }
}

.header-controls {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.control-btn {
  background: linear-gradient(135deg, rgba(0, 134, 214, 0.1) 0%, rgba(25, 169, 255, 0.1) 100%);
  color: var(--text-primary);
  border: 1px solid rgba(0, 134, 214, 0.3);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
}

.control-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(25, 169, 255, 0.3) 0%, transparent 70%);
  transition: width 0.6s, height 0.6s;
  transform: translate(-50%, -50%);
}

.control-btn:hover {
  background: linear-gradient(135deg, rgba(0, 134, 214, 0.2) 0%, rgba(25, 169, 255, 0.2) 100%);
  border-color: var(--text-accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 134, 214, 0.3);
}

.control-btn:hover::before {
  width: 300px;
  height: 300px;
}

.control-btn:active {
  transform: translateY(0);
}

.game-container {
  display: flex;
  padding: var(--spacing-xl);
  gap: var(--spacing-xl);
  max-width: 1600px;
  margin: 0 auto;
  animation: fadeIn 0.8s ease-out 0.3s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(30, 36, 68, 0.6) 0%, rgba(21, 25, 53, 0.6) 100%);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  min-height: 600px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.game-board::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}

.game-board:hover::before {
  opacity: 0.1;
}

.category-header {
  background: linear-gradient(135deg, #0086D6 0%, #19A9FF 100%);
  padding: 0.3rem 0.2rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 30px rgba(0, 134, 214, 0.3);
  position: relative;
  overflow: hidden;
  animation: categorySlide 0.6s ease-out backwards;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  line-height: 1.15;
  transition: font-size 0.2s ease;
  /* Font size dynamically adjusted by JavaScript */
}

.category-header.adjusted {
  /* Keep the same settings */
}

.category-header:nth-child(1) { animation-delay: 0.1s; }
.category-header:nth-child(2) { animation-delay: 0.2s; }
.category-header:nth-child(3) { animation-delay: 0.3s; }
.category-header:nth-child(4) { animation-delay: 0.4s; }
.category-header:nth-child(5) { animation-delay: 0.5s; }
.category-header:nth-child(6) { animation-delay: 0.6s; }

@keyframes categorySlide {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.category-header::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0%, 100% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  50% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.question-cell {
  background: linear-gradient(135deg, rgba(0, 134, 214, 0.15) 0%, rgba(25, 169, 255, 0.15) 100%);
  border: 1px solid rgba(0, 134, 214, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-base);
  border-radius: var(--radius-md);
  min-height: 100px;
  color: #FFD700;
  text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
  position: relative;
  overflow: hidden;
  animation: cellAppear 0.5s ease-out backwards;
}

.question-cell:nth-child(n+7):nth-child(-n+12) { animation-delay: 0.7s; }
.question-cell:nth-child(n+13):nth-child(-n+18) { animation-delay: 0.8s; }
.question-cell:nth-child(n+19):nth-child(-n+24) { animation-delay: 0.9s; }
.question-cell:nth-child(n+25):nth-child(-n+30) { animation-delay: 1.0s; }
.question-cell:nth-child(n+31):nth-child(-n+36) { animation-delay: 1.1s; }

@keyframes cellAppear {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.question-cell::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--transition-base);
}

.question-cell:hover:not(.used) {
  transform: translateY(-4px) scale(1.05);
  background: linear-gradient(135deg, rgba(0, 134, 214, 0.25) 0%, rgba(25, 169, 255, 0.25) 100%);
  border-color: var(--text-accent);
  box-shadow: 0 15px 40px rgba(0, 134, 214, 0.4);
}

.question-cell:hover:not(.used)::before {
  transform: translate(-50%, -50%) scale(1.5);
}

.question-cell.used {
  background: rgba(10, 14, 39, 0.6);
  color: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.05);
  animation: fadeOut 0.5s ease-out;
}

@keyframes fadeOut {
  from {
    transform: scale(1.1);
    opacity: 1;
  }
  to {
    transform: scale(1);
    opacity: 0.3;
  }
}

.question-cell.daily-double {
  animation: pulseGold 2s infinite;
}

@keyframes pulseGold {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
  }
  50% {
    box-shadow: 0 0 20px 10px rgba(255, 215, 0, 0.3);
  }
}

.sidebar {
  width: 350px;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  animation: slideIn 0.8s ease-out 0.5s both;
}

@keyframes slideIn {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.players-section, .scores-section {
  background: linear-gradient(135deg, rgba(30, 36, 68, 0.6) 0%, rgba(21, 25, 53, 0.6) 100%);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.players-section h3, .scores-section h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#players-list {
  display: flex;
  flex-direction: column;
}

.player-item, .score-item {
  padding: var(--spacing-sm) var(--spacing-md);
  margin: var(--spacing-xs) 0;
  background: linear-gradient(135deg, rgba(0, 134, 214, 0.1) 0%, rgba(25, 169, 255, 0.1) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(0, 134, 214, 0.2);
  transition: all var(--transition-fast);
  animation: slideInLeft 0.3s ease-out backwards;
}

.player-item.has-control {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.2) 100%);
  border: 2px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
  font-weight: 600;
  order: -1; /* Move to top */
  animation: controlPulse 2s ease-in-out infinite;
}

@keyframes controlPulse {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
  }
  50% {
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.player-item:hover, .score-item:hover {
  background: linear-gradient(135deg, rgba(0, 134, 214, 0.2) 0%, rgba(25, 169, 255, 0.2) 100%);
  transform: translateX(4px);
  border-color: var(--text-accent);
}

.player-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5ec4b6;
  box-shadow: 0 0 10px rgba(94, 196, 182, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
}

.score-item {
  font-size: 1rem;
  font-weight: 600;
}

.score-item:first-child {
  background: var(--gold-gradient);
  color: var(--bg-primary);
  font-weight: 800;
  font-size: 1.1rem;
  border: none;
  box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
  animation: winner 1s ease-in-out infinite alternate;
}

@keyframes winner {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.02);
  }
}

.score-item:nth-child(2) {
  background: linear-gradient(135deg, #C0C0C0 0%, #B8B8B8 100%);
  color: var(--bg-primary);
}

.score-item:nth-child(3) {
  background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
  color: var(--bg-primary);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(10px);
  animation: modalFade 0.3s ease-out;
}

@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: linear-gradient(135deg, rgba(30, 36, 68, 0.98) 0%, rgba(21, 25, 53, 0.98) 100%);
  margin: 2% auto;
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 900px;
  max-height: 96vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  position: relative;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlide 0.4s ease-out;
}

/* Custom scrollbar for modal */
.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: rgba(25, 169, 255, 0.3);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(25, 169, 255, 0.5);
}

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

.close {
  color: var(--text-secondary);
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  font-size: 2rem;
  font-weight: 300;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: all var(--transition-fast);
}

.close:hover {
  color: var(--text-accent);
  background: rgba(100, 255, 218, 0.1);
  transform: rotate(90deg);
}

.question-display {
  min-height: auto;
  max-height: none;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-md);
}

#question-category {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-accent);
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  animation: slideDown 0.5s ease-out;
}

#question-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-md);
  animation: scaleIn 0.5s ease-out 0.1s both;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

#question-text {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  line-height: 1.4;
  margin: var(--spacing-md);
  font-weight: 500;
  animation: fadeInUp 0.5s ease-out 0.2s both;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@keyframes fadeInUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#question-answer {
  font-size: 1.5rem;
  font-weight: 600;
  color: #5ec4b6;
  margin: var(--spacing-sm);
  padding: var(--spacing-md);
  background: linear-gradient(135deg, rgba(0, 136, 132, 0.1) 0%, rgba(94, 196, 182, 0.1) 100%);
  border-radius: var(--radius-md);
  border: 1px solid rgba(94, 196, 182, 0.3);
  animation: answerReveal 0.5s ease-out;
}

@keyframes answerReveal {
  from {
    transform: scale(0.9) rotateX(90deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotateX(0);
    opacity: 1;
  }
}

#timer-display {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-md);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-accent);
  font-family: 'Bebas Neue', sans-serif;
  animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

#timer-display.warning {
  color: #ff5555;
  animation: timerWarning 0.5s infinite;
}

@keyframes timerWarning {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
}

#buzz-queue {
  margin: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: linear-gradient(135deg, rgba(0, 134, 214, 0.1) 0%, rgba(25, 169, 255, 0.1) 100%);
  border-radius: var(--radius-md);
  min-height: 60px;
  border: 1px solid rgba(0, 134, 214, 0.2);
}

.buzz-item {
  padding: var(--spacing-sm) var(--spacing-md);
  margin: var(--spacing-xs);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 165, 0, 0.1) 100%);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  animation: buzzSlide 0.3s ease-out;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

@keyframes buzzSlide {
  from {
    transform: translateX(-100%) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.buzz-item:first-child {
  background: var(--gold-gradient);
  color: var(--bg-primary);
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 10px 30px rgba(255, 215, 0, 0.4);
  animation: buzzFirst 0.5s ease-out;
}

@keyframes buzzFirst {
  0% {
    transform: translateX(-100%) scale(0.8);
    opacity: 0;
  }
  50% {
    transform: translateX(0) scale(1.1);
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.question-controls {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  flex-wrap: wrap;
  justify-content: center;
}

.loading-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-xl);
  animation: fadeIn 1s ease-out;
}

.loading-message h2 {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-lg);
}

.loading-message p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xl);
}

#qr-code img {
  max-width: 300px;
  margin: var(--spacing-lg) auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

#join-url {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-accent);
  margin-top: var(--spacing-lg);
  word-break: break-all;
  padding: var(--spacing-md);
  background: rgba(25, 169, 255, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(25, 169, 255, 0.3);
}

.hidden {
  display: none !important;
}

.player-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  max-height: 100vh;
  padding: var(--spacing-sm);
  overflow: hidden;
}

.player-container {
  max-width: 600px;
  width: 100%;
  text-align: center;
  animation: fadeIn 0.5s ease-out;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.player-view .game-logo {
  font-size: 1.8em;
  margin-bottom: var(--spacing-md);
}

.player-container h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 8vw, 5rem);
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-xl);
  filter: drop-shadow(0 4px 20px rgba(255, 215, 0, 0.3));
}

.join-form {
  background: linear-gradient(135deg, rgba(30, 36, 68, 0.95) 0%, rgba(21, 25, 53, 0.95) 100%);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.join-form h2 {
  font-size: 1.8rem;
  margin-bottom: var(--spacing-lg);
  color: var(--text-accent);
}

.join-form input {
  width: 100%;
  padding: var(--spacing-md);
  font-size: 1.1rem;
  margin: var(--spacing-md) 0;
  border: 2px solid rgba(0, 134, 214, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.join-form input:focus {
  outline: none;
  border-color: var(--text-accent);
  background: rgba(25, 169, 255, 0.05);
  box-shadow: 0 0 20px rgba(25, 169, 255, 0.2);
}

.buzzer-btn {
  width: min(60vw, 280px);
  height: min(60vw, 280px);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ed1b34 0%, #cc0000 100%);
  border: 5px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 2rem;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow:
    0 20px 40px rgba(204, 0, 0, 0.4),
    inset 0 -10px 30px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.buzzer-btn::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  width: 30%;
  height: 30%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  border-radius: 50%;
}

.buzzer-btn:hover {
  transform: scale(1.05);
  box-shadow:
    0 25px 50px rgba(204, 0, 0, 0.5),
    inset 0 -10px 30px rgba(0, 0, 0, 0.3);
}

.buzzer-btn:active {
  transform: scale(0.95);
  box-shadow:
    0 10px 20px rgba(204, 0, 0, 0.4),
    inset 0 10px 30px rgba(0, 0, 0, 0.3);
}

.buzzer-btn.buzzed {
  background: radial-gradient(circle at 30% 30%, #5ec4b6 0%, #008884 100%);
  animation: buzzerSuccess 0.6s ease-out;
}

@keyframes buzzerSuccess {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

.player-info {
  margin: var(--spacing-sm) 0;
  padding: var(--spacing-sm);
  background: linear-gradient(135deg, rgba(30, 36, 68, 0.95) 0%, rgba(21, 25, 53, 0.95) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
}

.player-info h2 {
  font-size: 1.3rem;
  margin: 0 0 var(--spacing-xs) 0;
}

.player-score {
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.final-jeopardy-input {
  background: linear-gradient(135deg, rgba(30, 36, 68, 0.95) 0%, rgba(21, 25, 53, 0.95) 100%);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin: var(--spacing-lg) 0;
  backdrop-filter: blur(20px);
}

.final-jeopardy-input input,
.final-jeopardy-input textarea {
  width: 100%;
  padding: var(--spacing-md);
  font-size: 1.1rem;
  margin: var(--spacing-md) 0;
  border: 2px solid rgba(0, 134, 214, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.final-jeopardy-input input:focus,
.final-jeopardy-input textarea:focus {
  outline: none;
  border-color: var(--text-accent);
  background: rgba(25, 169, 255, 0.05);
  box-shadow: 0 0 20px rgba(25, 169, 255, 0.2);
}

.final-jeopardy-input textarea {
  min-height: 120px;
  resize: vertical;
}

@media (max-width: 768px) {
  .game-container {
    flex-direction: column;
    padding: var(--spacing-md);
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    animation: none;
  }

  .players-section, .scores-section {
    flex: 1;
  }

  .game-board {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
  }

  .category-header {
    padding: 0.2rem 0.15rem;
    min-height: 60px;
    letter-spacing: -0.02em;
    font-size: 0.55rem;
    line-height: 1.1;
    /* Font size dynamically adjusted by JavaScript */
  }

  .question-cell {
    font-size: 1.2rem;
    min-height: 70px;
  }

  .modal-content {
    width: 95%;
    margin: 2% auto;
    padding: var(--spacing-sm);
    max-height: 96vh;
    overflow-y: auto;
  }

  #question-text {
    font-size: 1.2rem;
  }

  .question-display {
    padding: var(--spacing-sm);
  }

  .buzzer-btn {
    width: min(50vw, 200px);
    height: min(50vw, 200px);
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.notification {
  position: fixed;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(25, 169, 255, 0.95) 0%, rgba(0, 134, 214, 0.95) 100%);
  color: var(--bg-primary);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 2000;
  animation: notificationSlide 0.3s ease-out;
  box-shadow: 0 10px 30px rgba(25, 169, 255, 0.3);
}

@keyframes notificationSlide {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Fullscreen Game Mode */
.fullscreen-mode .game-header {
  display: none;
}

.fullscreen-mode .game-container {
  padding: var(--spacing-md);
  max-width: 100%;
  height: 100vh;
  display: flex;
  gap: var(--spacing-lg);
}

.fullscreen-mode .game-board {
  flex: 1;
  height: calc(100vh - var(--spacing-lg) * 2);
}

.fullscreen-mode .sidebar {
  height: calc(100vh - var(--spacing-lg) * 2);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.fullscreen-mode .category-header {
  min-height: 100px;
  padding: var(--spacing-md) var(--spacing-sm);
  letter-spacing: 0.02em;
  line-height: 1.2;
  /* Font size controlled by JavaScript adjustCategoryFontSize() */
}

.fullscreen-mode .players-section,
.fullscreen-mode .scores-section {
  flex: 1;
  overflow-y: auto;
  max-height: calc(50vh - var(--spacing-lg) * 2);
}

/* Fullscreen Exit Hint */
.fullscreen-hint {
  position: fixed;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.fullscreen-mode .fullscreen-hint {
  opacity: 0.8;
  animation: fadeInOut 5s ease-in-out;
}

@keyframes fadeInOut {
  0%, 100% {
    opacity: 0;
  }
  10%, 90% {
    opacity: 0.8;
  }
}