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

:root {
  --fire-orange: #ff6b35;
  --fire-yellow: #ffc107;
  --fire-red: #dc3545;
  --night-blue: #1a1a2e;
  --night-purple: #16213e;
  --day-warm: #4a3728;
  --day-light: #8b7355;
  --text-light: #f8f9fa;
  --text-muted: #adb5bd;
  --survivor-green: #28a745;
  --cannibal-red: #dc3545;
  --guard-blue: #007bff;
  --tracker-purple: #6f42c1;
  --card-bg: #2d2d2d;
  --card-border: #444;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--night-blue) 0%, var(--night-purple) 100%);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding: 1rem;
}

.screen.active {
  display: flex;
}

.logo {
  text-align: center;
  padding: 3rem 1rem;
}

.logo h1 {
  font-size: 2.5rem;
  color: var(--fire-orange);
  text-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--text-muted);
  font-style: italic;
}

.menu-container {
  max-width: 320px;
  margin: 0 auto;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 1rem;
  backdrop-filter: blur(10px);
}

input[type="text"] {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  border: 2px solid var(--card-border);
  border-radius: 0.5rem;
  background: var(--card-bg);
  color: var(--text-light);
  margin-bottom: 1rem;
  text-align: center;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--fire-orange);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

.btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--fire-orange), var(--fire-red));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-light);
  border: 2px solid var(--fire-orange);
}

.btn-warning {
  background: linear-gradient(135deg, var(--fire-yellow), var(--fire-orange));
  color: var(--night-blue);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.join-section {
  display: flex;
  gap: 0.5rem;
}

.join-section input {
  flex: 1;
  margin-bottom: 0;
  text-transform: uppercase;
}

.join-section .btn {
  padding: 1rem;
}

.room-header {
  text-align: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.room-header h2 {
  color: var(--fire-orange);
}

#display-room-code {
  font-family: monospace;
  font-size: 1.5rem;
  letter-spacing: 3px;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 1rem;
  flex: 1;
}

.player-card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.player-card.host {
  border-color: var(--fire-orange);
}

.player-card .player-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.player-card .player-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.waiting-actions {
  padding: 1rem;
  text-align: center;
}

.waiting-text {
  color: var(--text-muted);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.game-header {
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.phase-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#current-phase {
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
}

#current-phase.night {
  color: #6c7ae0;
}

#current-phase.day {
  color: var(--fire-yellow);
}

.campfire-area {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.campfire {
  position: absolute;
  width: 80px;
  height: 80px;
  z-index: 10;
}

.fire {
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at bottom, var(--fire-yellow) 0%, var(--fire-orange) 40%, transparent 70%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 0.5s ease-in-out infinite alternate;
  box-shadow: 0 0 60px var(--fire-orange), 0 0 100px var(--fire-yellow);
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-2deg); }
  100% { transform: scale(1.05) rotate(2deg); }
}

.player-circle {
  position: absolute;
  width: 280px;
  height: 280px;
}

.player-circle .player-seat {
  position: absolute;
  width: 60px;
  height: 70px;
  transform: translate(-50%, -50%);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.player-seat .avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 0.25rem;
  transition: all 0.3s ease;
}

.player-seat.alive .avatar {
  border-color: var(--survivor-green);
}

.player-seat.dead .avatar {
  border-color: var(--cannibal-red);
  opacity: 0.5;
  filter: grayscale(100%);
}

.player-seat.dead::after {
  content: '💀';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
}

.player-seat.selected .avatar {
  border-color: var(--fire-yellow);
  box-shadow: 0 0 15px var(--fire-yellow);
}

.player-seat .seat-name {
  font-size: 0.7rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
}

.player-seat.is-me .avatar {
  border-width: 4px;
}

.game-controls {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.role-card {
  perspective: 1000px;
  height: 100px;
  cursor: pointer;
}

.role-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.role-card.flipped .role-card-inner {
  transform: rotateY(180deg);
}

.role-front, .role-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.role-front {
  background: linear-gradient(135deg, var(--card-bg), #1a1a1a);
  border: 2px solid var(--card-border);
}

.tap-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.role-back {
  background: linear-gradient(135deg, var(--card-bg), #1a1a1a);
  border: 2px solid var(--fire-orange);
  transform: rotateY(180deg);
}

.role-back h3 {
  font-size: 1.5rem;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.role-back h3.survivor { color: var(--survivor-green); }
.role-back h3.cannibal { color: var(--cannibal-red); }
.role-back h3.guard { color: var(--guard-blue); }
.role-back h3.tracker { color: var(--tracker-purple); }

#role-description {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.action-panel {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.75rem;
  padding: 1rem;
  display: none;
}

.action-panel.active {
  display: block;
}

.action-panel h3 {
  text-align: center;
  margin-bottom: 0.75rem;
  color: var(--fire-orange);
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.action-buttons .btn {
  flex: 0 0 calc(50% - 0.25rem);
  padding: 0.75rem;
  font-size: 0.875rem;
}

.supplies-panel {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.75rem;
  padding: 1rem;
}

.supplies-panel h3 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.supplies-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  min-height: 40px;
}

.supply-card {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.supply-card.food {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
}

.supply-card.medicine {
  background: linear-gradient(135deg, #2196f3, #1565c0);
}

.supply-card.poison {
  background: linear-gradient(135deg, #9c27b0, #6a1b9a);
}

.supply-card:hover {
  transform: scale(1.1);
}

.supply-card.selected {
  box-shadow: 0 0 10px var(--fire-yellow);
}

.host-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.voting-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 1rem;
  flex: 1;
}

.vote-option {
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.vote-option:hover {
  border-color: var(--fire-orange);
  transform: scale(1.02);
}

.vote-option.voted {
  border-color: var(--fire-yellow);
  background: rgba(255, 193, 7, 0.1);
}

.vote-option .vote-avatar {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.vote-option .vote-name {
  font-weight: 600;
}

.results-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.eliminated-info {
  margin: 2rem 0;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 1rem;
}

.eliminated-info .eliminated-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.eliminated-info .eliminated-role {
  color: var(--text-muted);
  text-transform: uppercase;
}

.game-over-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.game-over-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.game-over-content h2.survivors-win {
  color: var(--survivor-green);
}

.game-over-content h2.cannibals-win {
  color: var(--cannibal-red);
}

#winner-message {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.final-roles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 400px;
}

.final-role-card {
  background: var(--card-bg);
  border-radius: 0.5rem;
  padding: 0.75rem;
  text-align: center;
}

.final-role-card .final-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.final-role-card .final-role {
  font-size: 0.75rem;
  text-transform: uppercase;
}

.final-role-card.survivor .final-role { color: var(--survivor-green); }
.final-role-card.cannibal .final-role { color: var(--cannibal-red); }
.final-role-card.guard .final-role { color: var(--guard-blue); }
.final-role-card.tracker .final-role { color: var(--tracker-purple); }

.final-role-card.dead {
  opacity: 0.5;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--card-bg);
  border: 2px solid var(--fire-orange);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  max-width: 300px;
  margin: 1rem;
}

.modal-content h3 {
  color: var(--fire-orange);
  margin-bottom: 1rem;
}

.modal-content p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.night-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.9), rgba(22, 33, 62, 0.9));
  pointer-events: none;
  z-index: 50;
  transition: opacity 1s ease;
}

.night-overlay.hidden {
  opacity: 0;
}

.moon {
  position: absolute;
  top: 10%;
  right: 10%;
  width: 60px;
  height: 60px;
  background: #f5f5dc;
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(245, 245, 220, 0.5);
}

.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, white, transparent),
    radial-gradient(2px 2px at 40px 70px, white, transparent),
    radial-gradient(1px 1px at 90px 40px, white, transparent),
    radial-gradient(2px 2px at 130px 80px, white, transparent),
    radial-gradient(1px 1px at 160px 30px, white, transparent);
  background-size: 200px 100px;
  animation: twinkle 5s infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  border: 2px solid var(--fire-orange);
  border-radius: 0.5rem;
  padding: 1rem 2rem;
  z-index: 100;
  animation: slideUp 0.3s ease;
}

.notification.hidden {
  display: none;
}

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

.hidden {
  display: none !important;
}

body.day-phase {
  background: linear-gradient(135deg, var(--day-warm) 0%, var(--day-light) 100%);
}

@media (min-width: 768px) {
  .menu-container {
    max-width: 400px;
  }
  
  .players-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .player-circle {
    width: 350px;
    height: 350px;
  }
  
  .voting-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
