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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Common Styles */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 3rem;
  margin-bottom: 30px;
  text-align: center;
  background: linear-gradient(45deg, #00d4ff, #7b2cbf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: #00d4ff;
}

.btn-primary {
  background: linear-gradient(45deg, #00d4ff, #7b2cbf);
  border: none;
  padding: 15px 40px;
  font-size: 1.2rem;
  color: white;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-weight: bold;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #00d4ff;
  padding: 10px 30px;
  font-size: 1rem;
  color: #00d4ff;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #00d4ff;
  color: #1a1a2e;
}

/* Board View Styles */
.board-view .game-header {
  width: 100%;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.score-board {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.player-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 30px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
}

.player-score.p1 {
  border: 2px solid #00d4ff;
}

.player-score.p2 {
  border: 2px solid #ff006e;
}

.player-score.active {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.player-name {
  font-size: 0.9rem;
  opacity: 0.7;
}

.score {
  font-size: 2rem;
  font-weight: bold;
}

.lines {
  font-size: 0.8rem;
  opacity: 0.6;
}

.turn-indicator {
  font-size: 1.5rem;
  font-weight: bold;
  color: #00d4ff;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.game-container {
  margin-top: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 20px;
}

/* Question Panel */
.question-panel {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #00d4ff;
  border-radius: 20px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  text-align: center;
  z-index: 200;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.category {
  display: inline-block;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.8rem;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.category[data-category="qatar"] {
  background: #8b5cf6;
}

.category[data-category="medicine"] {
  background: #ef4444;
}

.category[data-category="math"] {
  background: #10b981;
}

.category[data-category="science"] {
  background: #3b82f6;
}

.question-box h3 {
  font-size: 1.5rem;
  margin: 15px 0;
}

.hint {
  font-size: 1rem;
  opacity: 0.8;
}

.hint strong {
  color: #00d4ff;
  font-size: 1.5rem;
}

/* Challenge Panel */
.challenge-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #7b2cbf, #ff006e);
  border-radius: 30px;
  padding: 50px;
  text-align: center;
  z-index: 300;
  box-shadow: 0 20px 60px rgba(123, 44, 191, 0.5);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.02); }
}

.challenge-box h2 {
  color: #fff;
  font-size: 2.5rem;
  margin-bottom: 20px;
}

.countdown {
  font-size: 5rem;
  font-weight: bold;
  color: #fff;
  margin: 20px 0;
}

/* Room Code */
.room-code {
  font-size: 4rem;
  font-weight: bold;
  letter-spacing: 10px;
  color: #00d4ff;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px 40px;
  border-radius: 15px;
  margin: 20px 0;
}

.join-instructions {
  background: rgba(0, 212, 255, 0.1);
  border: 2px solid #00d4ff;
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
}

.join-instructions p {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.join-instructions code {
  display: block;
  background: rgba(0, 0, 0, 0.5);
  padding: 15px;
  border-radius: 10px;
  font-size: 1.2rem;
  color: #00d4ff;
  margin: 10px 0;
  word-break: break-all;
}

.join-instructions .btn-secondary {
  margin-top: 10px;
}

.join-room-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
}

.join-room-section p {
  margin-bottom: 15px;
  opacity: 0.8;
}

.join-room-section input {
  width: 100%;
  padding: 15px;
  font-size: 1.5rem;
  text-align: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 5px;
  margin-bottom: 15px;
}

.join-room-section input:focus {
  outline: none;
  border-color: #00d4ff;
}

.join-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-role {
  padding: 12px 25px;
  font-size: 1rem;
  border: 2px solid;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: bold;
}

.btn-role.p1 {
  background: rgba(0, 212, 255, 0.1);
  border-color: #00d4ff;
  color: #00d4ff;
}

.btn-role.p1:hover {
  background: #00d4ff;
  color: #1a1a2e;
}

.btn-role.p2 {
  background: rgba(255, 0, 110, 0.1);
  border-color: #ff006e;
  color: #ff006e;
}

.btn-role.p2:hover {
  background: #ff006e;
  color: #fff;
}

/* Player View Styles */
.player-view {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 100%);
  min-height: 100vh;
}

.player-view .screen {
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.player-view #game.screen {
  padding: 10px;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 400px;
}

.join-form input {
  padding: 20px;
  font-size: 1.5rem;
  text-align: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 5px;
}

.join-form input:focus {
  outline: none;
  border-color: #00d4ff;
}

.role-select {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.btn-role {
  padding: 20px;
  font-size: 1.2rem;
  border: 2px solid;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: bold;
}

#join-p1 {
  background: rgba(0, 212, 255, 0.1);
  border-color: #00d4ff;
  color: #00d4ff;
}

#join-p1:hover {
  background: #00d4ff;
  color: #1a1a2e;
}

#join-p2 {
  background: rgba(255, 0, 110, 0.1);
  border-color: #ff006e;
  color: #ff006e;
}

#join-p2:hover {
  background: #ff006e;
  color: #fff;
}

.player-header {
  display: flex;
  justify-content: space-between;
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 15px;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}

#player-role {
  font-weight: bold;
  font-size: 1.2rem;
}

#turn-status {
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
}

#turn-status.your-turn {
  background: #00d4ff;
  color: #1a1a2e;
  font-weight: bold;
}

#turn-status.waiting {
  background: rgba(255, 255, 255, 0.1);
}

.mini-board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-top: 80px;
  padding: 20px;
  max-width: 100%;
}

.mini-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
  padding: 10px;
  max-width: 100%;
  overflow-x: auto;
  --mini-hex-size: 26px;
  --mini-hex-height: calc(var(--mini-hex-size) * 1.1547);
  --mini-hex-gap: 1px;
}

.mini-row {
  display: flex;
  justify-content: center;
  margin-bottom: calc(var(--mini-hex-height) * -0.25);
}

.mini-row:nth-child(even) {
  margin-left: calc((var(--mini-hex-size) + var(--mini-hex-gap)) / 2);
}

.mini-hex {
  width: var(--mini-hex-size);
  height: var(--mini-hex-height);
  margin: 0 calc(var(--mini-hex-gap) / 2);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: transform 0.2s;
}

.mini-hex.owned-p1 {
  background: #00d4ff;
  color: #000;
}

.mini-hex.owned-p2 {
  background: #ff006e;
  color: #fff;
}

.mini-hex.answered {
  opacity: 0.6;
}

.mini-hex.selected {
  box-shadow: 0 0 10px #ffd700;
  transform: scale(1.1);
}

/* Answer Panel */
.answer-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.95);
  border-top: 2px solid #00d4ff;
  padding: 30px 20px;
  z-index: 200;
}

.question-display {
  text-align: center;
  margin-bottom: 20px;
}

.question-display h3 {
  font-size: 1.3rem;
  margin: 15px 0;
}

.input-group {
  display: flex;
  gap: 10px;
  max-width: 500px;
  margin: 0 auto;
}

.input-group input {
  flex: 1;
  padding: 15px 20px;
  font-size: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.input-group input:focus {
  outline: none;
  border-color: #00d4ff;
}

/* Challenge */
.challenge-alert {
  text-align: center;
  padding: 40px;
}

.btn-buzz {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: bold;
  border: none;
  background: linear-gradient(135deg, #ff006e, #ff4d00);
  color: #fff;
  cursor: pointer;
  margin-top: 30px;
  box-shadow: 0 10px 40px rgba(255, 0, 110, 0.5);
  transition: transform 0.1s;
}

.btn-buzz:active {
  transform: scale(0.95);
}

.btn-buzz:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Weapons Panel - Clean Design */
.weapons-panel {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 40, 0.9));
  border: 2px solid #ffd700;
  border-radius: 15px;
  padding: 15px;
  margin: 15px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.weapons-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weapon-icon {
  font-size: 1.5rem;
}

#weapon-status {
  font-weight: bold;
  color: #ffd700;
}

#weapon-status.has-weapon {
  color: #00ff00;
}

.btn-weapon {
  background: linear-gradient(45deg, #ff006e, #ff4d00);
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-weapon:hover {
  transform: scale(1.05);
}

.btn-weapon.hidden {
  display: none;
}

/* Weapon Modal */
.weapon-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.weapon-modal.hidden {
  display: none;
}

.weapon-modal-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid #ff006e;
  border-radius: 20px;
  padding: 25px;
  width: 90%;
  max-width: 350px;
  text-align: center;
}

.weapon-modal-content h4 {
  color: #ff006e;
  margin-bottom: 10px;
}

#weapon-instruction {
  margin-bottom: 15px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.weapon-targets {
  margin: 15px 0;
}

.weapons-panel h4 {
  margin-bottom: 10px;
  font-size: 0.9rem;
  opacity: 0.7;
}

.weapons-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.weapon-btn {
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s;
}

.weapon-btn.remove {
  background: linear-gradient(135deg, #ff006e, #cc0058);
}

.weapon-btn.swap {
  background: linear-gradient(135deg, #00d4ff, #0099cc);
}

.weapon-btn:hover {
  transform: scale(1.05);
}

.no-weapons {
  opacity: 0.5;
  font-size: 0.9rem;
}

/* Weapon Use Panel */
.weapon-use-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.weapon-targets {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  margin: 20px 0;
}

.target-hex {
  aspect-ratio: 1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.target-hex.selectable {
  border: 2px solid #00d4ff;
  animation: pulse-border 1s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #00d4ff; }
  50% { border-color: #fff; }
}

.target-hex:hover {
  transform: scale(1.1);
}

/* Spinner */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Game Over */
#game-over {
  text-align: center;
}

#winner-display {
  font-size: 3rem;
  margin: 30px 0;
  color: #ffd700;
}

#final-stats {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 30px;
  margin: 20px 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .room-code {
    font-size: 2.5rem;
  }

  .score-board {
    flex-direction: column;
    gap: 10px;
  }

  .game-container {
    margin-top: 150px;
  }
}

/* Board Controls - Only for room creator */
.board-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #00d4ff;
  border-radius: 15px;
  padding: 15px;
  z-index: 400;
  min-width: 200px;
}

.board-controls.hidden {
  display: none;
}

/* Player Info Panel - For players who joined via board screen */
.player-info-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #7b2cbf;
  border-radius: 15px;
  padding: 15px;
  z-index: 400;
  text-align: center;
}

.player-info-panel.hidden {
  display: none;
}

.board-controls h4 {
  margin-bottom: 10px;
  color: #00d4ff;
  text-align: center;
}

.control-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-control {
  padding: 10px 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.btn-control.p1 {
  background: #00d4ff;
  color: #000;
}

.btn-control.p2 {
  background: #ff006e;
  color: #fff;
}

.btn-control.neutral {
  background: #666;
  color: #fff;
}

.btn-control:not(.p1):not(.p2):not(.neutral) {
  background: linear-gradient(45deg, #00d4ff, #7b2cbf);
  color: #fff;
}

.btn-control:hover {
  transform: scale(1.05);
}

.control-hint {
  font-size: 0.8rem;
  opacity: 0.7;
  text-align: center;
  margin-top: 10px;
}

/* Custom Modal */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.custom-modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid #00d4ff;
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2rem;
  cursor: pointer;
  color: #00d4ff;
}

.modal-close:hover {
  color: #fff;
}

#modal-title {
  color: #00d4ff;
  margin-bottom: 15px;
}

#modal-message {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

/* Animations */
.hex-claim-animation {
  animation: claimPop 0.5s ease;
}

@keyframes claimPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.line-complete {
  animation: lineGlow 1s ease infinite alternate;
}

@keyframes lineGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.5); }
}
