/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  max-width: 90vw;
  color: #333;
  line-height: 1.6;
}

/* Game container */
.game-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 10px;
  min-height: 100vh;
}

/* Header */
.game-header {
  background: white;
  padding: 5px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.game-header h1 {
  color: #2c3e50;
  font-size: 2rem;
  font-weight: 700;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}



/* Panels */
.panel {
  background: white;
  padding: 5px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
}

.panel h3 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 1.3rem;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 6px;
}

/* Disease Panel */
.disease-panel .disease-levels {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  flex-wrap: wrap;
}

.disease-item {
  text-align: center;
  padding: 2px;
  background: transparent;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  min-width: 0;
}



.disease-icon {
  position: relative;
  margin-bottom: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.disease-icon img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.level-indicator {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.level-number {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.level-number.panic-level {
  background: #2c3e50;
}

.disease-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2c3e50;
  text-align: center;
  line-height: 1.2;
  margin-top: 0;
  width: 100%;
}

/* Role Panel */
.role-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-image img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.role-details {
  flex: 1;
}

.role-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 5px;
}

.role-description {
  color: #000000;
  font-size: 0.95rem;
}

/* Dice Container */
.dice-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

/* Infection and Treatment Panel Buttons */
.infection-panel .btn,
.treatment-panel .btn {
  display: block;
  margin: 0 auto;
}

.die {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
}

.die img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.treatment-die {
  border: 3px solid transparent;
}

.treatment-die.clickable:not(.saved) {
  border: 3px dashed #3498db;
  background-color: rgba(52, 152, 219, 0.05);
}

.treatment-die.clickable:not(.saved):hover {
  border: 3px solid #3498db;
  background-color: rgba(52, 152, 219, 0.15);
  transform: scale(1.05);
}

.treatment-die.clickable.selected {
  border: 3px solid #f39c12;
  background-color: rgba(243, 156, 18, 0.15);
  transform: scale(1.05);
  box-shadow: 0 0 0 2px #f39c12, 0 4px 8px rgba(0, 0, 0, 0.2);
}

.treatment-die.saved {
  border-color: #27ae60;
  transform: scale(1.05);
  box-shadow: 0 0 0 3px #27ae60, 0 4px 8px rgba(0, 0, 0, 0.2);
  background-color: rgba(39, 174, 96, 0.1);
  animation: saved-pulse 0.5s ease;
}

.treatment-die.clickable:hover:not(.selected) {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-color: #2980b9;
  background-color: rgba(52, 152, 219, 0.1);
}

.treatment-die.clickable {
  cursor: pointer;
  border: 3px dashed #3498db;
}

.treatment-die.clickable.saved {
  border: 3px solid #27ae60;
}

.treatment-die.locked {
  border: 2px solid #e74c3c;
  background-color: rgba(231, 76, 60, 0.05);
  cursor: not-allowed;
  position: relative;
}

.treatment-die.locked:hover {
  border-color: #e74c3c;
  background-color: rgba(231, 76, 60, 0.08);
  cursor: not-allowed;
}

.lock {
  position: absolute;
  top: -2px;
  left: -2px;
  width: 12px;
  height: 12px;
  background-color: #2c3e50;
  border: 1px solid white;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.lock::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 4px;
  background-color: #2c3e50;
  border: 1px solid white;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Subtle pulse animation for locked dice */
@keyframes lock-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.treatment-die.locked .lock {
  animation: lock-pulse 2s ease-in-out infinite;
}

.checkmark {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 15px;
  height: 15px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Message Panel */
.message-content {
  background: #ecf0f1;
  padding: 12px;
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1.4;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-content.victory-message {
  background: #27ae60;
  color: white;
  font-size: 1.3rem;
  font-weight: bold;
  animation: pulse 2s infinite;
}

.message-content.defeat-message {
  background: #e74c3c;
  color: white;
  font-size: 1.3rem;
  font-weight: bold;
}

/* Treatment hint */
.treatment-hint {
  text-align: center;
  color: #000000;
  font-size: 0.9rem;
  margin-top: 8px;
  font-style: italic;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: white;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

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

/* Rules Modal */
.rules-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.rules-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

.rules-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rules-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.rules-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.rules-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.rules-body {
  padding: 20px;
}

.rules-body h3 {
  color: #2c3e50;
  margin: 20px 0 12px 0;
  font-size: 1.2rem;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 6px;
}

.rules-body h3:first-child {
  margin-top: 0;
}

.rules-body p {
  margin-bottom: 15px;
  line-height: 1.5;
}

.rules-body ol,
.rules-body ul {
  margin-bottom: 15px;
  padding-left: 18px;
}

.rules-body li {
  margin-bottom: 6px;
  line-height: 1.4;
}

.rules-body strong {
  color: #2c3e50;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    padding: 10px;
  }
  
  .game-header {
    flex-direction: column;
    text-align: center;
  }
  
  .game-header h1 {
    font-size: 1.5rem;
  }
  
  .disease-panel .disease-levels {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    flex-wrap: wrap;
  }
  
  .disease-item {
    padding: 2px;
    flex: 1;
    min-width: 0;
  }
  
  .disease-icon img {
    width: 45px;
    height: 45px;
  }
  
  /* Keep role panel horizontal layout on narrow screens */
  .role-info {
    flex-direction: row;
    text-align: left;
    gap: 10px;
  }
  
  .role-image img {
    width: 50px;
    height: 50px;
  }
  
  .role-name {
    font-size: 1.1rem;
  }
  
  .role-description {
    font-size: 0.9rem;
  }
  
  .dice-container {
    gap: 5px;
  }
  
  .die {
    width: 50px;
    height: 50px;
  }
  
  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .rules-modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .rules-body {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .disease-panel .disease-levels {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    flex-wrap: wrap;
  }
  
  .disease-item {
    padding: 2px;
    flex: 1;
    min-width: 0;
  }
  
  .disease-icon img {
    width: 40px;
    height: 40px;
  }
  
  .disease-name {
    font-size: 0.8rem;
  }
  
  /* Keep role panel horizontal layout on very narrow screens */
  .role-info {
    flex-direction: row;
    text-align: left;
    gap: 8px;
  }
  
  .role-image img {
    width: 45px;
    height: 45px;
  }
  
  .role-name {
    font-size: 1rem;
  }
  
  .role-description {
    font-size: 0.85rem;
  }
  
  .panel {
    padding: 15px;
  }
  
  .game-header {
    padding: 15px;
  }
  
  .rules-header {
    padding: 15px;
  }
  
  .rules-header h2 {
    font-size: 1.3rem;
  }
  
  .rules-body {
    padding: 15px;
  }
  
  .rules-body h3 {
    font-size: 1.1rem;
  }
}