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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.game-info span {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* Main content */
main {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

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

.primary-btn {
    background: #667eea;
    color: white;
}

.primary-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.secondary-btn {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
}

.secondary-btn:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.role-btn {
    background: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.role-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

/* Menu options */
.menu-options {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.menu-options > * {
    margin-bottom: 1.5rem;
    width: 100%;
}

.create-game-section, .join-game-section {
    display: flex;
    gap: 10px;
}

.create-game-section input, .join-game-section input {
    flex: 1;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
}

.create-game-section button, .join-game-section button {
    flex-shrink: 0;
}

.instructions-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
}

.instructions-link:hover {
    text-decoration: underline;
}

/* Game phases */
.game-phase {
    min-height: 400px;
}

.hidden {
    display: none !important;
}

/* Players */
.players-list, .players-grid {
    margin: 1.5rem 0;
}

.players-list ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.players-list li, .player-card {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    text-align: center;
}

.player-card.dead {
    background: #f8d7da;
    border-color: #f5c6cb;
    opacity: 0.7;
}

.player-card.dead::after {
    content: " ☠️";
}

/* Host Panel */
.host-panel {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.host-panel h3 {
    color: #667eea;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.2rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.setting-item select {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.setting-item select:focus {
    outline: none;
    border-color: #667eea;
}

.share-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.share-section label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
}

.share-link-container input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    font-size: 0.85rem;
    font-family: monospace;
}

.share-link-container button {
    padding: 8px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Role Configuration */
.role-config-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.role-config-section h4 {
    color: #667eea;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.1rem;
}

.role-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.kick-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.kick-btn:hover {
    background: #c82333;
}

/* Host Controls */
.host-controls {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    margin-top: 1rem;
}

.host-controls .primary-btn {
    min-width: 150px;
    font-weight: 600;
}

/* Lobby */
.lobby-controls {
    text-align: center;
    max-width: 400px;
    margin: 2rem auto;
}

.lobby-controls input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* Game controls */
.game-controls {
    text-align: center;
    margin-bottom: 2rem;
}

/* Phase content */
.phase-content {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* Night actions */
#night-actions {
    text-align: center;
}

.target-selection {
    margin: 1rem 0;
}

.target-selection h4 {
    margin-bottom: 1rem;
}

.target-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.target-btn {
    padding: 10px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.target-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.target-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Role coordination styles */
.role-coordination {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.rolemates-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 6px;
}

.rolemates-section h4 {
    margin: 0 0 10px 0;
    color: #495057;
}

.rolemates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rolemate {
    background: #6c757d;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 500;
}

.voting-status {
    margin: 15px 0;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
}

.voting-status h5 {
    margin: 0 0 8px 0;
    color: #856404;
}

.vote-tally {
    font-size: 0.9em;
    color: #856404;
    margin: 2px 0;
}

/* Voting */
#voting-options {
    text-align: center;
}

.vote-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.vote-btn {
    padding: 15px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.vote-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
}

.vote-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.no-murder-btn {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

.no-murder-btn:hover {
    background: #218838 !important;
    border-color: #218838 !important;
}

/* Game log */
.game-log {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.game-log h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.log-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.log-entry:last-child {
    border-bottom: none;
}

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

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

#role-display {
    font-size: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
    border: 2px solid #667eea;
}

/* Instructions */
.instructions {
    max-width: 800px;
    margin: 0 auto;
}

.instructions section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #dee2e6;
}

.instructions section:last-child {
    border-bottom: none;
}

.instructions h2 {
    color: #667eea;
    margin-bottom: 1rem;
}

.team-objectives, .game-flow, .roles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}

.team, .phase, .role {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.team h3, .phase h3, .role h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

.instructions ul {
    margin-left: 1.5rem;
}

.instructions li {
    margin-bottom: 0.5rem;
}

.back-link {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    font-size: 1rem;
}

.back-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Error messages */
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 1rem 0;
    text-align: center;
}

/* Loading */
#loading {
    text-align: center;
    padding: 2rem;
    color: #667eea;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .join-game-section {
        flex-direction: column;
    }
    
    .team-objectives, .game-flow, .roles {
        grid-template-columns: 1fr;
    }
    
    .vote-buttons, .target-buttons {
        grid-template-columns: 1fr;
    }
}

/* Host Dashboard */
.host-dashboard {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 2px solid #667eea;
}

.host-dashboard h3 {
    color: #667eea;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.host-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.role-assignments, .player-status {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.role-assignments h4, .player-status h4 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-align: center;
}

.role-group {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.role-group h5 {
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 1rem;
}

.role-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.role-group li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.role-group li.alive {
    color: #28a745;
}

.role-group li.dead {
    color: #dc3545;
    text-decoration: line-through;
    opacity: 0.7;
}

.status-summary {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #e9ecef;
    border-radius: 6px;
}

.alive-count {
    color: #28a745;
    font-weight: bold;
}

.dead-count {
    color: #dc3545;
    font-weight: bold;
}

.player-details {
    display: grid;
    gap: 0.5rem;
}

.player-status {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.player-status.alive {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.player-status.dead {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    text-decoration: line-through;
    opacity: 0.7;
}

#host-game-log {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
}

#host-game-log h4 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-align: center;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Responsive design for host dashboard */
@media (max-width: 768px) {
    .host-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
}