/* Werewolf Game Styles */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: #333;
    min-height: 100vh;
    transition: background 2s ease-in-out;
}

/* Game Phase Backgrounds */
body.phase-waiting {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

body.phase-mayoralCandidacy {
    background: linear-gradient(135deg, #FFE5B4 0%, #FFC87C 50%, #FFD700 100%);
}

body.phase-mayoralElection {
    background: linear-gradient(135deg, #FFB6C1 0%, #FFA07A 50%, #FFD700 100%);
}

body.phase-day {
    background: linear-gradient(135deg, #87CEEB 0%, #4A90E2 50%, #87CEEB 100%);
}

body.phase-voting,
body.phase-mayoralVeto,
body.phase-mayoralTiebreaker {
    background: linear-gradient(135deg, #FF6B6B 0%, #FFA500 50%, #8B4789 100%);
}

body.phase-night {
    background: linear-gradient(135deg, #0F2027 0%, #203A43 50%, #2C5364 100%);
}

#app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #2c3e50;
    font-size: 2em;
}

#gameInfo {
    display: flex;
    gap: 20px;
    font-size: 1.2em;
    font-weight: bold;
}

#phaseDisplay {
    color: #4a5568;
}

#timerDisplay {
    color: #e74c3c;
    font-family: 'Courier New', monospace;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.debug-buttons {
    display: none; /* Hidden by default until /cheat is entered */
    gap: 5px;
}

.debug-buttons.visible {
    display: flex;
}

.btn-debug {
    background-color: #ff9800;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7em;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-debug:hover {
    background-color: #f57c00;
    transform: scale(1.05);
}

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

.btn-debug:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-debug:disabled:hover {
    background-color: #ccc;
    transform: none;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Welcome Screen */
.welcome-box {
    background: white;
    padding: 60px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    margin: 100px auto;
}

.welcome-box h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.welcome-box p {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 40px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #4a5568;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2d3748;
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-secondary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85em;
}

.role-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Difficulty Selector */
.difficulty-selector {
    margin: 30px 0;
}

.difficulty-selector h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.difficulty-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-difficulty {
    flex: 1;
    max-width: 160px;
    padding: 15px 20px;
    background: white;
    border: 3px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.btn-difficulty:hover {
    border-color: #4a5568;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 85, 104, 0.2);
}

.btn-difficulty.active {
    border-color: #4a5568;
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.btn-difficulty.active .difficulty-label,
.btn-difficulty.active .difficulty-desc {
    color: white;
}

.difficulty-label {
    font-size: 1.1em;
    font-weight: bold;
    color: #2c3e50;
}

.difficulty-desc {
    font-size: 0.8em;
    color: #666;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Game Container */
.game-container {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 20px;
    min-height: 600px;
}

/* Panels */
.players-panel, .chat-section, .actions-panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Players Panel */
.players-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #2c3e50;
    padding-bottom: 10px;
}

#playersList {
    margin-bottom: 20px;
}

.player-item {
    padding: 10px;
    margin: 8px 0;
    background: var(--player-bg-color, #f8f9fa);
    border-radius: 5px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border-left: 4px solid var(--player-color, #4a5568);
}

.player-item .player-avatar {
    font-size: 1.2em;
    flex-shrink: 0;
}

.player-item .player-name-text {
    flex-grow: 1;
    font-weight: 500;
    color: var(--player-color, #333);
}

.player-item.dead {
    opacity: 0.7;
}

.player-item.dead .player-avatar,
.player-item.dead .player-name-text {
    text-decoration: line-through;
}

.death-info {
    width: 100%;
    font-size: 0.75em;
    color: #666;
    font-style: italic;
    margin-top: 4px;
    text-decoration: none;
}

.player-item.user {
    background: #e3f2fd;
    font-weight: bold;
}

.player-votes {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.9em;
}

.your-role {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.your-role h4 {
    margin-bottom: 10px;
    color: #666;
}

#roleDisplay {
    padding: 15px;
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    border-radius: 5px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

.other-werewolf-info {
    margin-top: 10px;
    padding: 10px;
    background: linear-gradient(135deg, #8b2e2e 0%, #5c1a1a 100%);
    color: white;
    border-radius: 5px;
    text-align: center;
    font-size: 0.95em;
    font-weight: 500;
}

/* Chat Section */
.chat-section {
    display: flex;
    flex-direction: column;
    height: 750px;
}

/* Players tab - only visible on small screens (hidden by default) */
#playersTab {
    display: none;
}

.chat-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.chat-tab {
    padding: 10px 20px;
    border: none;
    background: #f8f9fa;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    transition: all 0.3s;
}

.chat-tab.active {
    background: #4a5568;
    color: white;
}

.chat-box {
    display: none;
    flex: 1;
    overflow-y: auto;
    border: 2px solid #eee;
    border-radius: 5px;
    padding: 15px;
    background: #f8f9fa;
    margin-bottom: 15px;
}

.chat-box.active-chat {
    display: block;
}

/* Vote Results tab specific styling - centering is handled by #votingVisualization */

/* Show placeholder text only when votingAvatars is empty */
#votingAvatars:empty::before {
    content: 'Vote results will appear here during voting phases';
    color: #999;
    font-style: italic;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.message {
    margin-bottom: 12px;
    padding: 10px;
    background: var(--player-bg-color, white);
    border-radius: 5px;
    border-left: 3px solid var(--player-color, #4a5568);
}

.message .message-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.message .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.message .message-left {
    display: flex;
    align-items: center;
    gap: 5px;
}

.message .player-avatar {
    font-size: 1.2em;
    flex-shrink: 0;
}

.message .player-name {
    font-weight: bold;
    color: var(--player-color, #4a5568);
}

.message .timestamp {
    font-size: 0.8em;
    color: #999;
    white-space: nowrap;
}

.message .message-text {
    color: #333;
    width: 100%;
    word-break: break-word;
}

.message.werewolf-msg {
    border-left-color: #e74c3c;
    background: #ffe6e6;
}

.message.user-msg {
    border-left-color: #27ae60;
    background: #e8f8f5;
}

/* AI Rationale Display (shown after game over) */
.message.has-rationale {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-rationale {
    margin-top: 8px;
    padding: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 5px;
    border-left: 3px solid #6c757d;
    font-size: 0.9em;
}

.message-rationale .rationale-label,
.message-rationale .thinking-label {
    font-weight: bold;
    color: #6c757d;
    margin-bottom: 5px;
    font-size: 0.85em;
}

/* Collapsible thinking section */
.message-rationale .thinking-collapsible {
    margin-top: 12px;
}

.message-rationale .thinking-collapsible summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    font-weight: bold;
    color: #6c757d;
    font-size: 0.85em;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.message-rationale .thinking-collapsible summary:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.message-rationale .thinking-collapsible summary::-webkit-details-marker {
    display: none;
}

.message-rationale .thinking-collapsible summary::before {
    content: '▶ ';
    display: inline-block;
    transition: transform 0.2s;
}

.message-rationale .thinking-collapsible[open] summary::before {
    transform: rotate(90deg);
}

.message-rationale .rationale-text,
.message-rationale .thinking-text {
    color: #495057;
    font-style: italic;
    line-height: 1.4;
}

.message-rationale .thinking-text {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid #dee2e6;
}

/* Markdown formatting in thinking text */
.message-rationale .thinking-text strong {
    font-weight: bold;
    font-style: normal;
    color: #343a40;
}

.message-rationale .thinking-text em {
    font-style: italic;
}

.message-rationale .thinking-text code {
    background: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    font-style: normal;
}

/* Note about rationale in game over info */
.rationale-note {
    font-size: 0.9em;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 5px;
    margin-top: 10px;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

#chatInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 5px;
    font-size: 1em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    min-height: 44px;
    max-height: 200px;
    overflow-y: auto;
}

#chatInput:focus {
    outline: none;
    border-color: #4a5568;
}

/* Actions Panel */
.actions-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #2c3e50;
    padding-bottom: 10px;
}

.phase-info {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 20px;
}

#votingPanel h4, #nightActionsPanel h4 {
    margin-bottom: 15px;
    color: #4a5568;
}

.vote-option, .action-option {
    padding: 10px;
    margin: 8px 0;
    background: #f8f9fa;
    border: 2px solid #eee;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.vote-option:hover, .action-option:hover {
    background: #e3e8ed;
    border-color: #4a5568;
}

.vote-option.selected, .action-option.selected {
    background: #4a5568;
    color: white;
    border-color: #4a5568;
}

/* Rules Accordion */
.rules-accordion {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.rules-accordion summary {
    cursor: pointer;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-weight: bold;
    color: #4a5568;
}

.rules-content {
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9em;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Game Over Screen */
.game-over-box {
    background: white;
    padding: 60px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    margin: 100px auto;
}

.game-over-box h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
}

#finalRoles {
    text-align: left;
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
}

.final-role-item {
    padding: 10px;
    margin: 5px 0;
    border-left: 3px solid #4a5568;
}

.final-role-item.dead {
    opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr;
    }
    
    .players-panel, .actions-panel {
        grid-column: 1;
    }
    
    /* Hide the players panel on small screens - it will be shown in the Players tab instead */
    .players-panel {
        display: none;
    }
    
    /* Show the Players tab on small screens */
    #playersTab {
        display: block;
    }
    
    /* Style the mobile players list similar to the desktop version */
    #playersListMobile {
        margin-bottom: 20px;
    }
    
    .your-role-mobile {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 2px solid #eee;
    }
    
    .your-role-mobile h4 {
        margin-bottom: 10px;
        color: #666;
    }
    
    #roleDisplayMobile {
        padding: 15px;
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
        color: white;
        border-radius: 5px;
        text-align: center;
        font-size: 1.2em;
        font-weight: bold;
    }
    
    #roleDescriptionMobile {
        margin-top: 8px;
        padding: 8px;
        background: #f0f3ff;
        border-radius: 4px;
        font-size: 0.85em;
        color: #555;
        text-align: center;
        font-style: italic;
    }
}

/* Small screen optimizations */
@media (max-width: 768px) {
    /* Reduce padding on main container and header */
    #app {
        padding: 10px;
    }
    
    header {
        padding: 15px;
        margin-bottom: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    #gameInfo {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        font-size: 1em;
    }
    
    .timer-container {
        width: 100%;
        align-items: flex-start;
    }
    
    /* Wrap debug buttons to prevent horizontal stretching */
    .debug-buttons {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .btn-debug {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    /* Scale down voting visualization to fit small screens */
    #votingVisualization {
        min-height: 260px;
        padding: 5px;
    }
    
    /* Adjust avatar sizes in voting visualization for small screens */
    .voting-avatar-circle {
        border-width: 3px;
    }
    
    /* Reduce padding on panels */
    .players-panel, .chat-section, .actions-panel {
        padding: 15px;
    }

    .chat-tab {
        padding: 10px 10px;
    }

    #sendBtn{
        padding: 12px 12px;
    }
    
    /* Reduce welcome box padding */
    .welcome-box {
        padding: 30px 20px;
        margin: 50px auto;
    }
    
    .welcome-box h2 {
        font-size: 1.8em;
    }
    
    /* Stack difficulty buttons vertically on small screens */
    .difficulty-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-difficulty {
        max-width: 100%;
    }
    
    /* Game over box adjustments */
    .game-over-box {
        padding: 30px 20px;
        margin: 50px auto;
    }
    
    .game-over-box h2 {
        font-size: 1.8em;
    }
}

/* Notifications */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

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

.notification.error {
    border-left: 4px solid #e74c3c;
}

.notification.success {
    border-left: 4px solid #27ae60;
}

.notification.info {
    border-left: 4px solid #3498db;
}

/* Voting Buttons */
.voting-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.btn-vote {
    background: #4a5568;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-vote .vote-btn-avatar {
    font-size: 1.3em;
    flex-shrink: 0;
}

.btn-vote .vote-btn-name {
    flex-grow: 1;
    font-weight: 500;
}

.btn-vote:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-vote:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Abstain button styling */
.btn-vote.btn-abstain {
    background: #6c757d;
    border-left: 4px solid #495057;
}

.btn-vote.btn-abstain:hover:not(:disabled) {
    background: #5a6268;
}

.note {
    color: #e67e22;
    font-style: italic;
    margin-top: 10px;
    padding: 10px;
    background: #fef5e7;
    border-radius: 5px;
    border-left: 3px solid #e67e22;
}

/* Streaming message styles */
.streaming-cursor {
    display: inline-block;
    margin-left: 2px;
    animation: blink 1s infinite;
    color: #4a5568;
    font-weight: bold;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.streaming-message .message-text {
    display: inline;
}

/* Animated Sun for Day Phase */
#sun {
    display: none;
    position: fixed;
    top: 10%;
    left: 0%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 80px rgba(255, 165, 0, 0.5);
    z-index: -1;
    pointer-events: none;
    --animation-duration: 300s;
    --animation-delay: 0s;
}

#sun.visible {
    display: block;
    animation: sunMove var(--animation-duration) linear forwards;
    animation-delay: var(--animation-delay);
}

/* Sun animation - moves from left to right during day phase */
@keyframes sunMove {
    0% {
        left: -80px;
        top: 10%;
    }
    50% {
        left: calc(50%);
        top: 5%;
    }
    100% {
        left: calc(100%);
        top: 10%;
    }
}

/* Voting Visualization */
#votingVisualization {
    background: transparent;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 520px;
}

#voteResultsTitle {
    color: #2c3e50;
    font-size: 1.3em;
    margin-bottom: 10px;
    text-align: center;
    min-height: 1.5em;
}

#votingAvatars {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}

.voting-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: absolute;
    transition: all 0.3s ease;
    /* Width is set to AVATAR_SIZE_PERCENT% of container for proper centering */
    width: 16%;
}

.voting-avatar-circle {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.5em, 5vw, 2.5em);
    border: 4px solid var(--player-color, #4a5568);
    background: white;
    position: relative;
    transition: all 0.3s ease;
}

.voting-avatar.thinking .voting-avatar-circle {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 85, 104, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(74, 85, 104, 0);
    }
}

.voting-avatar.voted .voting-avatar-circle {
    border-color: #4CAF50;
    background: #E8F5E9;
}

.voting-avatar.waiting .voting-avatar-circle {
    opacity: 0.6;
}

/* Mayor observing state (during lynching vote, mayor cannot vote) */
.voting-avatar.mayor-observing .voting-avatar-circle {
    border-color: #FFD700; /* Golden border for mayor */
    background: #FFFDE7;
}

.voting-avatar.mayor-observing .voting-status-indicator {
    background: #FFD700;
    border-color: #FFA000;
}

/* Mayor hat overlay */
.mayor-hat-overlay {
    position: absolute;
    top: clamp(-25px, -30%, -30px);
    left: 50%;
    transform: translateX(-50%) scale(0) rotate(-30deg);
    font-size: clamp(1.5em, 6vw, 3em);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    z-index: 10;
}

.mayor-hat-overlay.show {
    transform: translateX(-50%) scale(1) rotate(0deg);
    opacity: 1;
}

.voting-avatar-name {
    font-weight: 600;
    font-size: clamp(0.65em, 2vw, 0.9em);
    color: var(--player-color, #333);
    text-align: center;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.voting-status-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    width: clamp(20px, 6vw, 32px);
    height: clamp(20px, 6vw, 32px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.7em, 2vw, 1.1em);
    background: white;
    border: 2px solid #ccc;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.voting-status-indicator-front,
.voting-status-indicator-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.voting-status-indicator-front {
    background: inherit;
}

.voting-status-indicator-back {
    background: white;
    color: black;
    transform: rotateY(180deg);
    border: 2px solid var(--player-color, #4a5568);
}

.voting-status-indicator.flipped {
    transform: rotateY(180deg);
}

.voting-avatar.thinking .voting-status-indicator {
    background: #FFF9C4;
    border-color: #FBC02D;
}

.voting-avatar.voted .voting-status-indicator {
    background: #4CAF50;
    border-color: #2E7D32;
    color: white;
}

/* Vote arrow line (drawn across circle) */
.vote-arrow-line {
    position: absolute;
    height: 3px;
    background: var(--arrow-color, #4a5568);
    transform-origin: left center;
    pointer-events: none;
    z-index: 1;
}

.vote-arrow-line::after {
    content: '▶';
    position: absolute;
    right: -10px; /* Position arrowhead at end of line */
    top: -8px; /* Center arrowhead vertically on line */
    font-size: 1em;
    color: var(--arrow-color, #4a5568);
}

/* Vote reveal animation */
.vote-arrow {
    position: absolute;
    width: 60px;
    height: 3px;
    background: var(--player-color, #4a5568);
    transform-origin: left center;
    opacity: 0;
    pointer-events: none;
}

.vote-arrow::after {
    content: '▶';
    position: absolute;
    right: -10px;
    top: -8px;
    font-size: 1em;
    color: var(--player-color, #4a5568);
}

.vote-arrow.reveal {
    animation: drawArrow 0.5s ease-out forwards;
}



@keyframes drawArrow {
    0% {
        opacity: 0;
        width: 0;
    }
    100% {
        opacity: 1;
        width: 60px;
    }
}

.voting-avatar.revealing {
    animation: highlight 0.6s ease-in-out;
}

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

/* Lynch Role Reveal Animation */
.lynch-role-reveal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 2.5em;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10;
    pointer-events: none;
}

.lynch-role-reveal.revealed {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #999;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    max-width: 90vw;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.85em;
    font-weight: normal;
    white-space: normal;
    word-wrap: break-word;

    /* Position the tooltip - JavaScript will set exact position */
    position: fixed;
    z-index: 10000;
    
    /* Fade in tooltip */
    opacity: 0;
    transition: opacity 0.3s;
}

/* Arrow pointing up (tooltip below element) - default */
.tooltip .tooltiptext::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #555 transparent;
}

/* Arrow pointing down (tooltip above element) - applied via JavaScript */
.tooltip .tooltiptext.above::before {
    bottom: auto;
    top: 100%;
    border-color: #555 transparent transparent transparent;
}

/* Legacy arrow removed - not needed */
.tooltip .tooltiptext::after {
    display: none;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Role description under user's role */
#roleDescription {
    margin-top: 8px;
    padding: 8px;
    background: #f0f3ff;
    border-radius: 4px;
    font-size: 0.85em;
    color: #555;
    text-align: center;
    font-style: italic;
}

/* Game Over Info in Actions Panel */
.game-over-info {
    text-align: center;
}

.game-over-info h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.game-over-info p {
    margin-bottom: 15px;
    color: #666;
}

.final-roles-accordion {
    margin-top: 15px;
    text-align: left;
}

.final-roles-accordion summary {
    cursor: pointer;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-weight: bold;
    color: #4a5568;
}

.final-roles-list {
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
}

.final-roles-list .final-role-item {
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 5px;
}

.final-roles-list .final-role-item.dead {
    opacity: 0.6;
    text-decoration: line-through;
}

/* Werewolf Kill Animation Overlay */
#werewolfKillOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#werewolfKillOverlay.active {
    display: flex;
}

.werewolf-kill-scene {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.werewolf-kill-victim {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 1s ease-in-out;
}

.werewolf-kill-victim-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    border: 6px solid var(--player-color, #4a5568);
    background: white;
    transition: all 1s ease-in-out;
}

.werewolf-kill-victim-name {
    font-weight: 700;
    font-size: 1.3em;
    color: white;
    text-align: center;
}

.werewolf-kill-victim.killed .werewolf-kill-victim-circle {
    transform: rotate(180deg) scaleY(0.3);
    filter: grayscale(100%);
}

.werewolf-kill-role {
    position: absolute;
    font-size: 3em;
    opacity: 0;
    transform: scale(0);
    transition: all 0.5s ease-out;
}

.werewolf-kill-role.revealed {
    opacity: 1;
    transform: scale(1);
    margin-left: 100px;
}

.werewolf-attacker {
    position: absolute;
    font-size: 5em;
    opacity: 0;
    transition: all 0.8s ease-in-out;
}

.werewolf-attacker.approaching {
    opacity: 1;
}

/* Werewolf approaches from left side */
.werewolf-attacker.from-left {
    left: -100px;
}

.werewolf-attacker.from-left.approaching {
    left: calc(50% - 120px);
}

/* Werewolf attack shake animation */
@keyframes attackShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.werewolf-kill-victim.attacked {
    animation: attackShake 0.5s ease-in-out;
}

/* Disclaimer Footer */
.disclaimer {
    /*background: rgba(255, 255, 255, 0.95);*/
    /*padding: 15px 20px;*/
    text-align: center;
    /*border-radius: 10px;*/
    margin: 20px auto;
    max-width: 1400px;
    /*box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);*/
}

.disclaimer p {
    margin: 0;
    color: black;
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.5;
}

/* View Past Games Section */
.past-games-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    margin: 50px auto;
}

.past-games-box h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2em;
    text-align: center;
}

.password-section {
    text-align: center;
}

.password-section p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.password-section input {
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    width: 300px;
    max-width: 100%;
    margin-bottom: 15px;
}

.password-section input:focus {
    outline: none;
    border-color: #4a5568;
}

.password-section button {
    margin: 0 10px;
}

.error-message {
    color: #e74c3c;
    margin-top: 10px;
    font-size: 0.9em;
}

.games-list {
    margin-top: 20px;
}

.info-text {
    color: #666;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1em;
}

.games-list-content {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.game-item {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.game-item:hover {
    background: #e9ecef;
    border-color: #4a5568;
    transform: translateX(5px);
}

.game-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.game-item-id {
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.1em;
}

.game-item-difficulty {
    background: #4a5568;
    color: white;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 0.85em;
}

.game-item-details {
    color: #666;
    font-size: 0.9em;
}

.game-item-details span {
    margin-right: 15px;
}

.status-finished {
    color: #28a745;
    font-weight: 600;
}

.status-active {
    color: #ffc107;
    font-weight: 600;
}

.btn-tertiary {
    background: #17a2b8;
    color: white;
}

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