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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-top: 10px; /* Ensure title isn't cut off */
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Mobile viewport fixes */
@media (max-width: 768px) {
    body {
        padding: 5px;
        margin: 0;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    #game-container {
        width: 100%;
        max-width: 100vw;
        padding: 5px;
        margin: 0;
        box-sizing: border-box;
    }
    
    header {
        padding: 8px;
        margin-bottom: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    header h1 {
        font-size: 18px;
        margin-bottom: 8px;
        text-align: center;
    }
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

header {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

header h1 {
    color: #4a5568;
    margin-bottom: 10px;
}

#player-info {
    font-size: 18px;
    font-weight: bold;
    color: #2d3748;
}

#moves-counter {
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    border: 2px solid #4fd1c7;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    text-align: center;
    font-weight: bold;
    color: #2d3748;
}

#moves-counter.moves-warning {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    border-color: #f56565;
    animation: pulse-warning 1s infinite;
}

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

#game-board {
    display: grid !important;
    grid-template-columns: 260px 1fr 260px !important;
    grid-template-areas: "status board events" !important;
    gap: 15px;
    margin-bottom: 20px;
    min-height: 600px;
    align-items: start;
    width: 100%;
}

#status-panel {
    grid-area: status;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#events-panel {
    grid-area: events;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#board-container {
    grid-area: board;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
}

#game-map {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    flex: 1;
}

/* Handle 16 locations in a 4x4 grid */
.board-location:nth-child(n+17) {
    display: none; /* Hide any extra locations beyond 16 */
}

.board-location {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 120px;
}

.board-location:hover {
    border-color: #4299e1;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.3);
}

.board-location.active {
    border-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    box-shadow: 0 0 20px rgba(72, 187, 120, 0.4);
}

.location-icon {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.location-name {
    font-weight: bold;
    color: #2d3748;
    text-align: center;
    font-size: 14px;
}

.player-token {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 10;
}

.player-emoji {
    font-size: 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.player-token.current-player {
    animation: pulse 2s infinite;
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.player-token:nth-child(1) { top: -12px; left: -12px; }
.player-token:nth-child(2) { top: -12px; right: -12px; }
.player-token:nth-child(3) { bottom: -12px; left: -12px; }
.player-token:nth-child(4) { bottom: -12px; right: -12px; }

#multiplayer-status {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.player-status {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 5px;
    background: #f7fafc;
    transition: all 0.3s ease;
}

.player-status.current-player {
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    border: 2px solid #4fd1c7;
    transform: scale(1.02);
}

.player-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.player-details {
    font-size: 13px;
    line-height: 1.3;
}

.end-turn-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-left: 15px;
    transition: all 0.3s ease;
}

.end-turn-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.4);
}

#game-setup {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 600px;
    margin: 50px auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

#game-setup h2 {
    color: #4a5568;
    margin-bottom: 20px;
}

#player-count-selection {
    margin: 20px 0;
}

#player-count-selection label {
    font-weight: bold;
    color: #2d3748;
}

#player-count {
    margin-left: 10px;
    padding: 8px;
    border-radius: 5px;
    border: 2px solid #e2e8f0;
}

#players-setup {
    margin: 20px 0;
    text-align: left;
}

.player-setup-item {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #e2e8f0;
}

.player-setup-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.player-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.player-setup-header h4 {
    color: #2d3748;
    margin: 0;
}

.player-setup-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.name-input-group {
    display: flex;
    flex-direction: column;
}

.name-input-group label {
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 5px;
}

.name-input-group input {
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    font-size: 14px;
}

.character-selection label {
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 10px;
    display: block;
}

.character-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.character-option {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.character-option:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.2);
}

.character-option.selected {
    border-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.3);
}

.character-avatar {
    font-size: 24px;
    margin-bottom: 5px;
}

/* Personality-focused styles */
.personality-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.personality-option {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.personality-option:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.2);
}

.personality-option.selected {
    border-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.3);
}

.personality-avatar {
    font-size: 24px;
    margin-bottom: 5px;
}

.personality-type {
    font-weight: bold;
    color: #2d3748;
    font-size: 14px;
    margin-bottom: 4px;
}

.personality-description {
    font-size: 11px;
    color: #718096;
    line-height: 1.3;
}

.character-name {
    font-size: 12px;
    font-weight: bold;
    color: #2d3748;
}

.character-description {
    font-size: 10px;
    color: #718096;
    margin-top: 4px;
    line-height: 1.2;
    text-align: center;
}

#start-game {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-top: 20px;
    transition: all 0.3s ease;
}

#start-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

/* AI Player Setup Styles */
.player-type-selection {
    display: flex;
    flex-direction: column;
}

.player-type-selection label {
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 5px;
}

.player-type-selection select {
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    font-size: 14px;
    background: white;
}

.ai-personality-selection {
    display: flex;
    flex-direction: column;
}

.ai-personality-selection label {
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 5px;
}

.ai-personality-selection select {
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    max-width: 100%;
}

/* Character selection adjustments */
.character-selection {
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .player-setup-controls {
        gap: 10px;
    }
    
    .character-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .personality-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .ai-personality-selection select {
        font-size: 12px;
    }
}

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

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #f56565);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

#status-panel h3, #action-panel h3, #events-panel h3 {
    color: #4a5568;
    margin-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5px;
}

#status-panel div {
    margin-bottom: 10px;
    padding: 8px;
    background: #f7fafc;
    border-radius: 5px;
    border-left: 4px solid #4299e1;
}

#actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-btn {
    padding: 15px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

.action-btn:active {
    transform: translateY(0);
}

#events-log {
    max-height: 200px;
    overflow-y: auto;
}

.event-item {
    padding: 10px;
    margin-bottom: 8px;
    background: #f7fafc;
    border-radius: 5px;
    border-left: 4px solid #48bb78;
    font-size: 14px;
}

.event-item.negative {
    border-left-color: #f56565;
}

.event-player {
    font-weight: bold;
    margin-right: 5px;
}

.event-week {
    color: #718096;
    font-size: 12px;
    margin-right: 5px;
}

.event-message {
    color: #2d3748;
}

.portfolio-item {
    background: #f7fafc;
    padding: 10px;
    border-radius: 5px;
    border-left: 4px solid #4299e1;
    margin-bottom: 10px;
}

.portfolio-summary {
    background: #e6fffa;
    padding: 10px;
    border-radius: 5px;
    border-left: 4px solid #38b2ac;
    margin: 10px 0;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    position: relative;
    overflow-y: auto;
    margin: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-specific modal improvements */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
        position: fixed;
        touch-action: none;
    }
    
    .modal-content {
        width: 100%;
        max-width: none;
        max-height: 85vh;
        border-radius: 8px;
        padding: 15px;
        padding-top: 40px; /* Extra space for close button */
        touch-action: pan-y;
    }
    
    .close {
        position: fixed;
        right: 20px;
        top: 30px;
        font-size: 32px;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.hidden {
    display: none;
}

/* Stock Ticker */
#stock-ticker {
    background: linear-gradient(135deg, #1a202c, #2d3748);
    color: #e2e8f0;
    padding: 8px 0;
    margin-bottom: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.ticker-content {
    display: flex;
    animation: scroll-ticker 30s linear infinite;
    white-space: nowrap;
}

.ticker-item {
    margin-right: 40px;
    font-weight: bold;
    font-size: 14px;
}

@keyframes scroll-ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* House Interior Modal */
.house-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

/* Mobile-specific house modal improvements */
@media (max-width: 768px) {
    .house-modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 90vh;
        border-radius: 10px;
        padding: 15px;
    }
}

.close-house {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-house:hover {
    color: #000;
}

#house-interior {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.house-room {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #e2e8f0;
}

/* Rent and Transport Sections */
.rent-due {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.rent-due h4 {
    color: #dc2626;
    margin: 0 0 10px 0;
}

.transport-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.transport-options button {
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.transport-options button:hover:not(:disabled) {
    background: #e5f3ff;
    border-color: #3b82f6;
}

.transport-options button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.transport-options button small {
    display: block;
    color: #6b7280;
    font-size: 0.8em;
    margin-top: 5px;
}

/* Turn Banner Styles */
.turn-banner {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: 3px solid #6366f1;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    animation: pulse-turn 2s infinite;
}

.turn-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: white;
}

.turn-avatar {
    font-size: 2em;
    margin-right: 15px;
    animation: bounce 1s infinite;
}

.turn-text {
    flex-grow: 1;
}

.turn-label {
    font-size: 0.8em;
    font-weight: bold;
    opacity: 0.9;
    letter-spacing: 1px;
}

.turn-player-name {
    font-size: 1.4em;
    font-weight: bold;
    margin-top: 2px;
}

.turn-moves {
    font-size: 1.1em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes pulse-turn {
    0% { box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
    50% { box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5); }
    100% { box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

/* End Game Button Styles */
.end-game-btn {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.end-game-btn:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.end-game-btn:active {
    transform: translateY(0);
}

/* Header buttons container */
.header-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 10px;
}

.header-buttons .end-turn-btn {
    margin-left: 0;
}

.header-buttons .end-game-btn {
    margin-left: auto;
}

/* Status info sections */
.status-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0;
    font-size: 0.9em;
}

.status-info div {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    border-left: 3px solid #4299e1;
}

#stress-fill {
    background: linear-gradient(90deg, #f56565, #e53e3e);
}

#stress-bar label {
    color: #e53e3e;
}

/* Progress Tracker Styles */
.progress-category {
    font-size: 0.8em;
    text-align: center;
    margin-top: 5px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-category small {
    font-weight: normal;
    opacity: 0.8;
    font-size: 0.9em;
}

#progress-bar {
    margin-bottom: 15px;
}

#progress-fill {
    transition: all 0.3s ease;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

/* Mini progress bars for multiplayer */
.mini-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 4px 0;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 4px;
}

/* Game Ended Overlay Styles */
.game-ended-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.game-ended-message {
    background: linear-gradient(135deg, #1f2937, #374151);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 3px solid #6b7280;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 400px;
}

.game-ended-message h2 {
    margin-bottom: 15px;
    color: #f59e0b;
}

.game-ended-message p {
    margin-bottom: 20px;
    color: #d1d5db;
}

.game-ended-message .popup-button {
    margin: 5px 10px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.game-ended-message .popup-button:hover {
    transform: translateY(-2px);
}

/* Final Results Popup Styles */
.final-results-popup {
    background: rgba(0, 0, 0, 0.95) !important;
}

.final-results-popup .popup-content {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.final-rankings {
    margin: 20px 0;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
}

.ranking-item.winner {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a1a;
    border-color: #ffd700;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.rank-medal {
    font-size: 2em;
    margin-right: 15px;
    min-width: 60px;
    text-align: center;
}

.player-info {
    flex-grow: 1;
}

.player-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.player-header .player-avatar {
    font-size: 1.5em;
    margin-right: 10px;
}

.progress-bar-small {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    margin: 5px 0;
    overflow: hidden;
}

.progress-fill-small {
    height: 100%;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.final-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 10px;
    font-size: 0.9em;
}

.final-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.restart-button {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: #10b981 !important;
}

/* Health Warning and Game Over Styles */
.game-over-popup {
    background: rgba(139, 0, 0, 0.95) !important;
    border: 3px solid #dc2626 !important;
}

.game-over-popup .popup-content {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 2px solid #dc2626;
    color: #7f1d1d;
}

.game-over-popup h2 {
    color: #dc2626;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    font-size: 1.5em;
    margin-bottom: 15px;
}

.critical-warning {
    background: rgba(220, 38, 38, 0.95) !important;
    border: 3px solid #dc2626 !important;
    animation: pulse-red 1s infinite;
}

.critical-warning .popup-content {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 2px solid #dc2626;
    color: #7f1d1d;
}

.final-stats {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #d1d5db;
}

.final-stats h3 {
    color: #374151;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.final-stats p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #4b5563;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* New Animation Effects */
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes money-gain {
    0% { transform: translateY(0) scale(1); opacity: 1; color: #48bb78; }
    50% { transform: translateY(-10px) scale(1.1); opacity: 0.8; }
    100% { transform: translateY(-20px) scale(0.8); opacity: 0; }
}

@keyframes money-loss {
    0% { transform: translateY(0) scale(1); opacity: 1; color: #f56565; }
    50% { transform: translateY(-10px) scale(1.1); opacity: 0.8; }
    100% { transform: translateY(-20px) scale(0.8); opacity: 0; }
}

@keyframes stat-change {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes location-glow {
    0% { box-shadow: 0 0 5px rgba(66, 153, 225, 0.3); }
    50% { box-shadow: 0 0 20px rgba(66, 153, 225, 0.6); }
    100% { box-shadow: 0 0 5px rgba(66, 153, 225, 0.3); }
}

/* Hover shimmer effect for locations */
.board-location {
    position: relative;
    overflow: hidden;
}

.board-location::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
    z-index: 1;
}

.board-location:hover::before {
    left: 100%;
}

/* Work location highlighting */
.work-location {
    animation: location-glow 2s infinite;
}

/* Money change animations */
.money-gain {
    animation: money-gain 1s ease-out forwards;
    position: absolute;
    font-weight: bold;
    font-size: 1.2em;
    pointer-events: none;
    z-index: 1000;
}

.money-loss {
    animation: money-loss 1s ease-out forwards;
    position: absolute;
    font-weight: bold;
    font-size: 1.2em;
    pointer-events: none;
    z-index: 1000;
}

/* Stat bar animation */
.stat-change {
    animation: stat-change 0.3s ease-in-out;
}

/* Character expression change animations */
.expression-change {
    animation: expression-bounce 0.5s ease-in-out;
}

@keyframes expression-bounce {
    0% { transform: scale(1); }
    25% { transform: scale(1.2) rotate(-5deg); }
    50% { transform: scale(1.3) rotate(5deg); }
    75% { transform: scale(1.1) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Enhanced player token animations */
.player-token .player-emoji {
    transition: all 0.3s ease;
    display: inline-block;
}

.player-token.current-player .player-emoji {
    animation: current-player-glow 2s infinite;
}

@keyframes current-player-glow {
    0% { text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
    50% { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8); }
    100% { text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
}

/* Turn avatar expression animation */
#turn-avatar {
    transition: all 0.3s ease;
    display: inline-block;
}

#turn-avatar.expression-change {
    animation: turn-avatar-change 0.6s ease-in-out;
}

@keyframes turn-avatar-change {
    0% { transform: scale(1) rotate(0deg); }
    20% { transform: scale(1.3) rotate(-10deg); }
    40% { transform: scale(1.4) rotate(10deg); }
    60% { transform: scale(1.2) rotate(-5deg); }
    80% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Health bar critical styling */
.health-critical {
    background: linear-gradient(90deg, #dc2626, #ef4444) !important;
    animation: pulse-red 1s infinite;
}

.health-critical::after {
    content: "💀 CRITICAL";
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7em;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.house-room h3 {
    color: #4a5568;
    margin-bottom: 10px;
    text-align: center;
}

.room-items {
    min-height: 100px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

.appliance-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: 12px;
}

.appliance-item.owned {
    border-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
}

.appliance-item.available {
    border-color: #4299e1;
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
}

.empty-room {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #718096;
    font-style: italic;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px dashed #e2e8f0;
}

.buy-appliance-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 5px;
}

.appliance-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

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

.house-btn, #eat-food-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.house-btn:hover, #eat-food-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

/* Health, Hunger, and Experience Bars */
#hunger-bar, #health-bar, #work-experience-bar {
    margin-bottom: 10px;
}

#hunger-bar label, #health-bar label, #work-experience-bar label {
    font-size: 12px;
    font-weight: bold;
    color: #4a5568;
}

#hunger-fill {
    background: linear-gradient(90deg, #f56565, #48bb78);
}

#health-fill {
    background: linear-gradient(90deg, #f56565, #48bb78);
}

#experience-fill {
    background: linear-gradient(90deg, #4299e1, #48bb78);
}

#happiness-fill {
    background: linear-gradient(90deg, #f56565, #fbd38d, #48bb78);
}

/* Food warning styles */
.hunger-warning {
    animation: pulse-warning 1s infinite;
}

.health-warning {
    animation: pulse-warning 1s infinite;
}

/* Winner Screen Styles */
.winner-modal {
    background: rgba(0, 0, 0, 0.95) !important;
    z-index: 10000;
}

.winner-modal-content {
    background: linear-gradient(135deg, #1a202c, #2d3748);
    color: white;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px;
    border: 3px solid #ffd700;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    margin: 2% auto;
    padding: 0;
}

.winner-screen-container {
    padding: 30px;
}

/* Winner Announcement */
.winner-announcement {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-radius: 15px;
    color: #1a1a1a;
}

.winner-title {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: winner-glow 2s infinite alternate;
}

.winner-avatar {
    font-size: 4em;
    margin: 15px 0;
    animation: winner-bounce 1s infinite;
}

.winner-subtitle {
    font-size: 1.2em;
    margin: 0;
    font-weight: bold;
}

/* Celebration and Encouragement Messages */
.celebration-message {
    font-size: 1.1em;
    margin: 15px 0 5px 0;
    font-weight: bold;
    color: #2d3748;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.celebration-subtext {
    font-size: 0.95em;
    margin: 5px 0 0 0;
    color: #4a5568;
    font-style: italic;
}

.encouragement-message {
    font-size: 1.1em;
    margin: 15px 0 5px 0;
    font-weight: bold;
    color: #e53e3e;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.encouragement-subtext {
    font-size: 0.95em;
    margin: 5px 0 0 0;
    color: #718096;
    font-style: italic;
}

.somber-message {
    font-size: 1.0em;
    margin: 15px 0 5px 0;
    color: #718096;
    font-style: italic;
}

/* Perfect Game specific styling */
.winner-modal.perfect-game .celebration-message {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    animation: text-glow 2s infinite alternate;
}

.winner-modal.perfect-game .celebration-subtext {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes text-glow {
    0% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7); }
    100% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 255, 255, 0.5); }
}

/* Rankings Section */
.rankings-section {
    margin-bottom: 30px;
}

.rankings-title {
    text-align: center;
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.rankings-table {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Ranking Row */
.ranking-row {
    display: grid;
    grid-template-columns: 60px 1fr 150px;
    gap: 15px;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.ranking-row:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.ranking-row.winner-row {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a1a;
    border-color: #ffd700;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

.ranking-row.dead-row {
    background: rgba(139, 0, 0, 0.3);
    border-color: #8b0000;
}

/* Rank Position */
.rank-position {
    font-size: 2em;
    text-align: center;
    font-weight: bold;
}

/* Player Info Section */
.player-info-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.player-avatar {
    font-size: 1.8em;
}

.player-name {
    font-size: 1.3em;
    font-weight: bold;
}

.player-status {
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
}

.alive-status {
    background: rgba(72, 187, 120, 0.3);
    color: #48bb78;
}

.dead-status {
    background: rgba(220, 38, 38, 0.3);
    color: #dc2626;
}

/* Achievement Level */
.achievement-level {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9em;
}

.achievement-level.complete-victory {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a1a;
}

.achievement-level.major-victory {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.achievement-level.victory {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
}

.achievement-level.partial-success {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
}

.achievement-level.none {
    background: linear-gradient(135deg, #718096, #4a5568);
    color: white;
}

/* Goal Progress Indicators */
.goal-progress-indicators {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.goal-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.goal-icon {
    font-size: 1.2em;
}

.goal-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f56565, #fbd38d, #48bb78);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.goal-indicator.achieved .goal-progress-fill {
    background: linear-gradient(90deg, #48bb78, #38a169);
}

.goal-percentage {
    font-size: 0.8em;
    font-weight: bold;
}

/* Final Stats Section */
.final-stats-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: bold;
}

/* Winner Actions */
.winner-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.winner-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.new-game-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.new-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.6);
}

.main-menu-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

.main-menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.6);
}

/* Celebration Effects */
.winner-modal.complete-victory .winner-announcement {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a1a;
    animation: complete-victory-glow 2s infinite alternate;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

.winner-modal.major-victory .winner-announcement {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    animation: major-victory-pulse 1.5s infinite;
}

.winner-modal.victory .winner-announcement {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    animation: victory-shine 2s infinite;
}

.winner-modal.partial-success .winner-announcement {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    animation: partial-success-glow 2s infinite;
}

.winner-modal.no-winner .winner-announcement {
    background: linear-gradient(135deg, #718096, #4a5568);
    color: white;
}

.winner-modal.death-ending .winner-announcement {
    background: linear-gradient(135deg, #8b0000, #dc2626);
    color: white;
    border: 2px solid #dc2626;
}

.winner-modal.perfect-game .winner-announcement {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 300% 300%;
    color: white;
    animation: perfect-game-rainbow 3s infinite, perfect-game-glow 2s infinite alternate;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10001;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    animation: confetti-fall 3s linear infinite;
}

/* Fireworks Animation */
.fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10002;
    overflow: hidden;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
}

.firework-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ffd700;
    border-radius: 50%;
    animation: firework-burst 1.5s ease-out forwards;
    --end-x: 50px;
    --end-y: 50px;
}

@keyframes firework-burst {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--end-x), var(--end-y)) scale(1);
        opacity: 0;
    }
}

/* Screen Effects */
.screen-shake {
    animation: screen-shake 1s ease-in-out;
}

.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10003;
    pointer-events: none;
    animation: flash-fade 1s ease-out forwards;
}

@keyframes flash-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Winner Screen Animations */
@keyframes winner-glow {
    0% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); }
    100% { text-shadow: 2px 2px 20px rgba(255, 215, 0, 0.8); }
}

@keyframes winner-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes complete-victory-glow {
    0% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    100% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}

@keyframes major-victory-pulse {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(72, 187, 120, 0.5); }
    50% { transform: scale(1.02); box-shadow: 0 0 20px rgba(72, 187, 120, 0.8); }
    100% { transform: scale(1); box-shadow: 0 0 10px rgba(72, 187, 120, 0.5); }
}

@keyframes victory-shine {
    0% { box-shadow: 0 0 15px rgba(66, 153, 225, 0.5); }
    50% { box-shadow: 0 0 25px rgba(66, 153, 225, 0.8); }
    100% { box-shadow: 0 0 15px rgba(66, 153, 225, 0.5); }
}

@keyframes partial-success-glow {
    0% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
    100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.7); }
}

@keyframes perfect-game-rainbow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes perfect-game-glow {
    0% { box-shadow: 0 0 30px rgba(255, 255, 255, 0.5); }
    100% { box-shadow: 0 0 50px rgba(255, 255, 255, 0.8); }
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes screen-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Responsive Design for Winner Screen */
@media (max-width: 768px) {
    .winner-modal-content {
        margin: 1% auto;
        max-width: 95%;
    }
    
    .winner-screen-container {
        padding: 20px;
    }
    
    .winner-title {
        font-size: 2em;
    }
    
    .winner-avatar {
        font-size: 3em;
    }
    
    .ranking-row {
        grid-template-columns: 50px 1fr;
        gap: 10px;
    }
    
    .final-stats-section {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-around;
        margin-top: 10px;
    }
    
    .winner-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .goal-progress-indicators {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    #game-board {
        grid-template-columns: 1fr !important;
        grid-template-areas: "board" "status" "events" !important;
    }
    
    #actions-grid {
        grid-template-columns: 1fr;
    }
    
    .house-modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    #house-interior {
        grid-template-columns: 1fr;
    }
}

/* Player Switch Notification Styles */
.player-switch-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease-out;
}

.player-switch-header h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 24px;
}

.player-switch-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    gap: 20px;
}

.previous-player, .next-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.player-avatar.current {
    animation: pulse 2s infinite;
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.switch-arrow {
    font-size: 30px;
    color: #4a5568;
    animation: bounce 1s infinite;
}

.player-name {
    font-weight: bold;
    font-size: 18px;
    color: #2d3748;
}

.player-status {
    font-size: 14px;
    color: #718096;
}

.next-player .player-status {
    color: #48bb78;
    font-weight: bold;
}

.player-switch-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.player-switch-footer p {
    color: #718096;
    margin-bottom: 15px;
    font-size: 14px;
}

.continue-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(0);
    }
    40% {
        transform: translateX(-5px);
    }
    60% {
        transform: translateX(5px);
    }
}

/* Mobile responsiveness for notification */
@media (max-width: 480px) {
    .player-switch-content {
        padding: 20px;
        margin: 20px;
    }
    
    .player-switch-body {
        flex-direction: column;
        gap: 15px;
    }
    
    .switch-arrow {
        transform: rotate(90deg);
        font-size: 24px;
    }
    
    .player-avatar {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
}

/* Enhanced Education System Styles */
.education-list {
    background: #f7fafc;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
}

.education-item {
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    border: 2px solid #4fd1c7;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 5px 0;
    font-weight: bold;
    color: #2d3748;
}

.completed-education {
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    border: 2px solid #48bb78;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 5px 0;
    font-weight: bold;
    color: #2d3748;
}

.locked-education {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    border: 2px solid #f56565;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 5px 0;
    font-weight: bold;
    color: #c53030;
    opacity: 0.8;
}

/* Compact layout improvements */
#status-panel div {
    margin-bottom: 8px;
    padding: 6px;
    background: #f7fafc;
    border-radius: 4px;
    border-left: 3px solid #4299e1;
    font-size: 13px;
}

#events-log {
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    padding: 8px;
    margin-bottom: 6px;
    background: #f7fafc;
    border-radius: 4px;
    border-left: 3px solid #48bb78;
    font-size: 13px;
}

/* Health warning styles */
.health-critical {
    background: linear-gradient(135deg, #fed7d7, #feb2b2) !important;
    border-left-color: #f56565 !important;
    animation: pulse-warning 1s infinite;
}

.hunger-critical {
    background: linear-gradient(135deg, #fef5e7, #fbd38d) !important;
    border-left-color: #ed8936 !important;
    animation: pulse-warning 1s infinite;
}

/* Multi-Step Education Progress Styles */
.education-progress {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    border: 2px solid #e2e8f0;
}

.progress-item {
    background: white;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    border-left: 4px solid #4299e1;
}

.progress-bar-small {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill-small {
    height: 100%;
    background: linear-gradient(90deg, #4299e1, #48bb78);
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* Enhanced status display */
#education-status {
    font-size: 12px;
    line-height: 1.4;
}

.education-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.education-badge {
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    border: 1px solid #4fd1c7;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    color: #2d3748;
}

/* Compact modal styles */
.modal-content {
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content button {
    margin: 3px 0;
    padding: 8px 12px;
    font-size: 13px;
}

/* Job progression indicators */
.job-tier-basic {
    border-left-color: #68d391 !important;
}

.job-tier-skilled {
    border-left-color: #4299e1 !important;
}

.job-tier-professional {
    border-left-color: #9f7aea !important;
}

.job-tier-executive {
    border-left-color: #f6ad55 !important;
}

/* Congratulations Popup Styles */
.congratulations-content {
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    border: 3px solid #48bb78;
    border-radius: 20px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    animation: celebrationBounce 0.6s ease-out;
}

.congratulations-header h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.congratulations-body p {
    color: #2d3748;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 25px;
}

.congratulations-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.congratulations-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(72, 187, 120, 0.4);
}

@keyframes celebrationBounce {
    0% { 
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }
    50% { 
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }
    100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Optimized Layout - No Scrolling */
#events-log {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

#status-panel h3, #events-panel h3 {
    color: #4a5568;
    margin-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5px;
    font-size: 16px;
    flex-shrink: 0;
}

#status-panel div {
    margin-bottom: 6px;
    padding: 4px 6px;
    background: #f7fafc;
    border-radius: 3px;
    border-left: 3px solid #4299e1;
    font-size: 12px;
    line-height: 1.3;
}

.event-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #f7fafc;
    border-radius: 3px;
    border-left: 3px solid #48bb78;
    font-size: 12px;
    line-height: 1.3;
}

/* Compact board locations */
.board-location {
    min-height: 90px;
    padding: 8px;
}

.location-icon {
    font-size: 2em;
    margin-bottom: 4px;
}

.location-name {
    font-size: 12px;
    font-weight: bold;
}

/* Compact header */
header h1 {
    font-size: 20px;
    margin-bottom: 5px;
}

#player-info {
    font-size: 14px;
}

#moves-counter {
    padding: 4px 8px;
    margin: 4px 0;
    font-size: 12px;
}

/* Compact multiplayer status */
.player-status {
    padding: 4px;
    margin-bottom: 3px;
}

.player-details {
    font-size: 11px;
}

/* Stock ticker compact */
#stock-ticker {
    padding: 4px 0;
    margin-bottom: 5px;
}

.ticker-item {
    font-size: 12px;
}

/* Responsive adjustments */
@media (max-height: 800px) {
    #game-container {
        padding: 5px;
    }
    
    header {
        padding: 8px 12px;
        margin-bottom: 5px;
    }
    
    #game-board {
        gap: 8px;
    }
    
    #status-panel, #events-panel {
        padding: 8px;
    }
    
    .board-location {
        min-height: 75px;
        padding: 6px;
    }
    
    .location-icon {
        font-size: 1.8em;
    }
}/* Vic
tory Screen Styles */
.victory-screen {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.victory-screen h2 {
  color: #4a5568;
  margin-bottom: 20px;
  font-size: 28px;
}

.victory-screen h3 {
  color: #48bb78;
  margin-bottom: 15px;
  font-size: 22px;
}

.rankings {
  text-align: left;
  margin: 20px 0;
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background: #f7fafc;
  border-radius: 8px;
  border-left: 4px solid #e2e8f0;
}

.ranking-item.podium {
  background: linear-gradient(135deg, #f0fff4, #c6f6d5);
  border-left-color: #48bb78;
}

.ranking-item:first-child {
  background: linear-gradient(135deg, #fef5e7, #fbd38d);
  border-left-color: #f6ad55;
}

.ranking-item:nth-child(2) {
  background: linear-gradient(135deg, #f7fafc, #e2e8f0);
  border-left-color: #a0aec0;
}

.ranking-item:nth-child(3) {
  background: linear-gradient(135deg, #fef5e7, #f6ad55);
  border-left-color: #ed8936;
}

.rank {
  font-size: 24px;
  font-weight: bold;
  margin-right: 15px;
  min-width: 40px;
  text-align: center;
}

.player-info {
  flex: 1;
}

.player-info strong {
  font-size: 16px;
  color: #2d3748;
}

.score-breakdown {
  font-size: 12px;
  color: #718096;
  margin-top: 5px;
  line-height: 1.4;
}

.play-again-btn {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  margin-top: 20px;
  transition: all 0.3s ease;
}

.play-again-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

/* Turn confirmation styles */
.turn-confirmation {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #f6ad55;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.turn-confirmation h3 {
  color: #ed8936;
  margin-bottom: 15px;
}

.turn-confirmation button {
  margin: 5px 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.confirm-btn {
  background: #48bb78;
  color: white;
}

.cancel-btn {
  background: #f56565;
  color: white;
}
/* Hide redundant basic stats between game board and buttons */
#player-info > #current-player-indicator,
#player-info > #player-stats,
#player-info > #moves-counter {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Goals Progress Panel */
.goals-panel {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 10px 0;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.goals-header {
    font-weight: bold;
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
    text-align: center;
}

.goals-progress-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.goal-progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    background: #f7fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.goal-progress-label {
    font-size: 11px;
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 4px;
}

.goal-progress-bar {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 2px;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4fd1c7, #38b2ac);
    transition: width 0.3s ease;
}

.goal-progress-text {
    font-size: 10px;
    color: #6b7280;
}

/* Save/Load System Styles */
.save-btn, .load-btn, .download-log-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin: 0 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.save-btn:hover, .load-btn:hover {
    background: linear-gradient(135deg, #3182ce, #2c5282);
    transform: translateY(-1px);
}

.save-load-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: bold;
    color: #718096;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.tab-button.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
}

.tab-button:hover {
    color: #4299e1;
    background: rgba(66, 153, 225, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.save-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.save-input-group label {
    font-weight: bold;
    color: #4a5568;
}

.save-input-group input {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

.save-input-group input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.save-load-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-load-btn:hover {
    background: linear-gradient(135deg, #38a169, #2f855a);
    transform: translateY(-1px);
}

.auto-save-info {
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    border: 2px solid #4fd1c7;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.auto-save-info p {
    margin: 0;
    color: #2d3748;
}

.save-slot-section {
    margin-bottom: 25px;
}

.save-slot-section h4 {
    color: #4a5568;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e2e8f0;
}

.save-slot {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.save-slot:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.save-slot.has-save {
    cursor: pointer;
}

.save-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-metadata {
    flex: 1;
}

.save-name {
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 5px;
}

.save-details {
    font-size: 12px;
    color: #718096;
    line-height: 1.4;
}

.save-actions {
    display: flex;
    gap: 8px;
}

.load-save-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-save-btn:hover {
    background: linear-gradient(135deg, #3182ce, #2c5282);
}

.delete-save-btn {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-save-btn:hover {
    background: linear-gradient(135deg, #e53e3e, #c53030);
}

.no-saves-message {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 20px;
}

.save-timestamp {
    font-size: 11px;
    color: #a0aec0;
}/* 
Food Inventory Styling */
#food-inventory {
    margin: 8px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#food-inventory label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
    color: #2d3748;
}

#food-inventory-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

#food-inventory-details div {
    display: flex;
    justify-content: space-between;
    padding: 2px 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#food-inventory-details span {
    font-weight: bold;
    color: #4a5568;
}/* 
Hide Save and Load buttons */
#save-game-btn,
#load-game-btn {
    display: none !important;
}

/* Auto-control checkboxes styling */
.auto-control {
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    font-size: 12px;
    color: #4a5568;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.auto-control input[type="checkbox"] {
    margin-right: 5px;
    transform: scale(1.1);
    cursor: pointer;
}

.auto-control:hover {
    color: #2d3748;
}

/* Disabled state for auto-control */
.auto-control input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auto-control:has(input:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
    color: #a0aec0;
}

.auto-control:has(input:disabled):hover {
    color: #a0aec0;
}

.header-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}/* 
Goal Setting System */
.goal-setting-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.goal-setting-container h2 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 10px;
}

.goal-setting-container p {
    text-align: center;
    color: #6b7280;
    margin-bottom: 15px;
    font-size: 14px;
}

.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.goal-item {
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.goal-item:hover {
    border-color: #4fd1c7;
    transform: translateY(-2px);
}

.goal-item label {
    display: block;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 6px;
    color: #4a5568;
}

.goal-item input[type="range"] {
    width: 100%;
    margin: 6px 0;
    -webkit-appearance: none;
    height: 5px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
}

.goal-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4fd1c7;
    cursor: pointer;
    transition: all 0.3s ease;
}

.goal-item input[type="range"]::-webkit-slider-thumb:hover {
    background: #38b2ac;
    transform: scale(1.1);
}

.goal-item span {
    display: inline-block;
    background: #4fd1c7;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 12px;
    min-width: 25px;
    text-align: center;
}

.goal-category {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.goal-category:hover {
    border-color: #4fd1c7;
    transform: translateY(-2px);
}

.goal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.goal-icon {
    font-size: 24px;
    margin-right: 10px;
}

.goal-name {
    font-weight: bold;
    font-size: 18px;
    color: #2d3748;
    flex-grow: 1;
}

.goal-value {
    font-size: 20px;
    font-weight: bold;
    color: #4fd1c7;
    min-width: 40px;
    text-align: right;
}

.goal-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    margin-bottom: 10px;
    cursor: pointer;
}

.goal-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4fd1c7;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.goal-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4fd1c7;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.goal-description {
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
}

.goal-total {
    text-align: center;
    background: #f0fff4;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #22c55e;
    margin-bottom: 30px;
}

.goal-total strong {
    font-size: 18px;
    color: #2d3748;
}

.difficulty-indicator {
    margin-top: 10px;
    font-size: 16px;
    font-weight: bold;
}

.goal-presets {
    text-align: center;
    margin-bottom: 30px;
}

.goal-presets h3 {
    color: #4a5568;
    margin-bottom: 15px;
}

.preset-btn {
    background: #e2e8f0;
    border: 2px solid #cbd5e0;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: #4fd1c7;
    border-color: #4fd1c7;
    color: white;
    transform: translateY(-2px);
}

.goal-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.start-game-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.back-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #4b5563;
    transform: translateY(-2px);
}/* Vict
ory Screen */
.victory-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.5s ease-in;
}

.victory-content {
    background: linear-gradient(135deg, #fef3c7, #fbbf24);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.5s ease-out;
}

.victory-content h1 {
    font-size: 48px;
    color: #92400e;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.victory-content h2 {
    font-size: 24px;
    color: #b45309;
    margin-bottom: 30px;
}

.victory-stats {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 16px;
}

.stat-label {
    font-weight: bold;
    color: #374151;
}

.stat-value {
    color: #059669;
    font-weight: bold;
}

.goal-achievements {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.goal-achievements h3 {
    color: #374151;
    margin-bottom: 15px;
}

.achievement-item {
    background: #dcfce7;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    border-left: 4px solid #22c55e;
    text-align: left;
    font-weight: bold;
}

.victory-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.play-again-btn, .continue-btn {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-again-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.continue-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

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

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}/* Basic
 Goal Setting System */
.goal-setting-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.goal-setting-container h2 {
    color: #4a5568;
    margin-bottom: 10px;
}

.goal-setting-container p {
    color: #6b7280;
    margin-bottom: 30px;
}

.goal-actions {
    display: flex;
    justify-content: center;
}

.start-game-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}
/* Cloth
ing Inventory Styling */
#clothing-inventory {
    margin-top: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border-left: 4px solid #8b5cf6;
}

#clothing-inventory label {
    color: #8b5cf6;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

#clothing-inventory-details {
    font-size: 12px;
    line-height: 1.4;
}

#clothing-inventory-details div {
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
}

#current-outfit {
    font-weight: bold;
    color: #6b46c1;
}

#outfit-condition {
    font-weight: bold;
}

#outfit-condition:contains("New") {
    color: #10b981;
}

#outfit-condition:contains("Good") {
    color: #059669;
}

#outfit-condition:contains("Worn") {
    color: #d97706;
}

#outfit-condition:contains("Broken") {
    color: #dc2626;
}

#outfit-wear {
    font-weight: bold;
    color: #ef4444;
}

/* Download Log Button Styling */
.download-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    margin: 0 4px;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

/* Debug Tools Section */
.debug-tools {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.debug-tools .download-btn {
    font-size: 11px;
    padding: 6px 10px;
    opacity: 0.8;
}

/* Feedback Button Styling */
.feedback-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    margin: 0 4px;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.feedback-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    opacity: 1;
}

/* Feedback Modal Styling */
.feedback-modal-content {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.feedback-section {
    margin-bottom: 20px;
}

.feedback-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #374151;
}

.feedback-section select,
.feedback-section input,
.feedback-section textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.feedback-section select:focus,
.feedback-section input:focus,
.feedback-section textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.feedback-section textarea {
    resize: vertical;
    min-height: 120px;
}

.feedback-section small {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}

/* Rating Stars */
.rating-stars {
    display: flex;
    gap: 5px;
    margin: 10px 0;
}

.star {
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.3;
}

.star:hover,
.star.active {
    opacity: 1;
    transform: scale(1.1);
}

/* Feedback Alternatives */
.feedback-alternatives {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.feedback-link {
    display: inline-block;
    margin: 5px 10px;
    padding: 8px 16px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.feedback-link:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* Button Styling */
.popup-btn.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.popup-btn.secondary {
    background: #f3f4f6;
    color: #374151;
}

.popup-btn.primary:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.popup-btn.secondary:hover {
    background: #e5e7eb;
}/* Game 
Over Popup Button Styling */
.popup-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.download-log-popup-btn {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    border: none !important;
    padding: 10px 15px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: bold !important;
    transition: all 0.2s ease !important;
}

.download-log-popup-btn:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3) !important;
}

/* Winner Screen Download Button */
.winner-btn.download-log-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: 2px solid #10b981;
}

.winner-btn.download-log-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3);
}

/* Ensure winner actions have proper spacing */
.winner-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.winner-btn {
    min-width: 140px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
/*
 ===== MOBILE OPTIMIZATION STYLES ===== */

/* Mobile layout detection */
.mobile-layout {
  /* Mobile-specific styles will be applied when this class is present */
}

.mobile-optimized {
  /* Additional mobile optimizations */
}

/* Mobile scrolling fixes */
html, body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile-first responsive design */
@media (max-width: 767px) {
  /* Mobile styles */
  body {
    font-size: 14px;
    line-height: 1.4;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  
  /* Fix header and title display on mobile */
  header {
    margin-top: 10px;
    padding: 15px;
  }
  
  header h1 {
    font-size: 22px;
    text-align: center;
    line-height: 1.2;
  }
  
  /* Make buttons more touch-friendly */
  button {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 6px;
    margin: 4px;
  }
  
  /* Improve touch targets for game locations */
  .board-location {
    min-height: 60px;
    padding: 12px;
    margin: 6px;
    border-radius: 8px;
    transition: transform 0.1s ease, background-color 0.1s ease;
  }
  
  .board-location:active {
    transform: scale(0.95);
    background-color: rgba(0, 0, 0, 0.1);
  }
  
  /* Stack panels vertically on mobile */
  #game-board {
    flex-direction: column;
  }
  
  /* Ensure game container allows scrolling */
  #game-container {
    padding: 10px;
    margin: 0 auto;
  }
  
  #status-panel,
  #events-panel {
    width: 100%;
    margin-bottom: 10px;
  }
  
  /* Make modals mobile-friendly */
  .modal-content {
    width: 95%;
    max-width: none;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Improve form elements for mobile */
  input, select, textarea {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
    border-radius: 6px;
  }
  
  /* Better spacing for mobile */
  .status-info {
    padding: 8px;
    margin: 4px 0;
  }
  
  /* Mobile-first: Collapse status panel by default */
  #status-panel {
    position: relative;
    max-height: 120px; /* Show only essential info */
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  
  #status-panel.expanded {
    max-height: none;
    overflow: visible;
  }
  
  #events-panel {
    position: relative;
    max-height: none;
    overflow: visible;
  }
  
  /* Add toggle button for main status panel only (not mobile status bar) */
  #status-panel .status-toggle {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    margin: 5px 0;
    min-height: 36px;
    display: block;
    width: 100%;
  }
  
  #status-panel .status-toggle:hover {
    background: #0056b3;
  }
}

/* Desktop: Keep status panel fully expanded */
@media (min-width: 769px) {
  #status-panel {
    max-height: none !important;
    overflow: visible !important;
  }
  
  #status-panel .status-toggle {
    display: none; /* Hide main status panel toggle button on desktop */
  }
  
  /* Optimize header for mobile */
  header {
    padding: 10px;
  }
  
  h1 {
    font-size: 24px;
    margin: 10px 0;
  }
  
  h2 {
    font-size: 20px;
    margin: 8px 0;
  }
  
  h3 {
    font-size: 18px;
    margin: 6px 0;
  }
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 1023px) {
  .toast-container {
    top: 80px;
    right: 20px;
    max-width: 350px;
  }
  
  button {
    min-height: 40px;
  }
  
  .board-location {
    min-height: 50px;
  }
}

/* Desktop styles (existing styles remain unchanged) */
@media (min-width: 1024px) {
  .mobile-layout,
  .mobile-optimized {
    /* Reset mobile-specific styles for desktop */
  }
}

/* Touch feedback animations */
@media (hover: none) and (pointer: coarse) {
  /* Touch device specific styles */
  .board-location:hover {
    /* Remove hover effects on touch devices */
    background-color: initial;
  }
  
  .board-location:active {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
  }
  
  button:active {
    transform: scale(0.95);
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: opacity 0.2s ease;
  }
  
  .board-location,
  button {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .toast {
    border: 2px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  button {
    border: 2px solid;
  }
}

/* Large text support */
@media (min-resolution: 2dppx) {
  .toast-icon {
    font-size: 20px;
  }
}

/* Mobile Goal Setting Optimization */
@media (max-width: 767px) {
  .goal-setting-container {
    padding: 10px !important;
    max-height: 100vh;
    overflow-y: auto;
  }
  
  .goal-setting-header h2 {
    font-size: 18px !important;
    margin: 0 0 8px 0 !important;
  }
  
  .player-indicator {
    margin: 8px 0 !important;
    padding: 8px !important;
  }
  
  .player-name {
    font-size: 14px !important;
  }
  
  .player-subtitle, .single-player-subtitle {
    font-size: 12px !important;
    margin: 4px 0 !important;
  }
  
  .goal-instructions {
    font-size: 13px !important;
    margin: 8px 0 12px 0 !important;
    text-align: center;
    color: #666;
  }
  
  .goals-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin: 0 0 16px 0 !important;
  }
  
  .goal-item {
    background: #f8f9fa !important;
    border-radius: 8px !important;
    padding: 10px !important;
    border: 1px solid #e9ecef !important;
  }
  
  .goal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 6px !important;
  }
  
  .goal-item label {
    font-size: 13px !important;
    font-weight: 600 !important;
    margin: 0 !important;
  }
  
  .goal-value {
    background: #007bff !important;
    color: white !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    min-width: 20px !important;
    text-align: center !important;
  }
  
  .goal-item input[type="range"] {
    width: 100% !important;
    height: 6px !important;
    margin: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background: #ddd !important;
    border-radius: 3px !important;
    outline: none !important;
  }
  
  .goal-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    background: #007bff !important;
    border-radius: 50% !important;
    cursor: pointer !important;
  }
  
  .goal-item input[type="range"]::-moz-range-thumb {
    width: 18px !important;
    height: 18px !important;
    background: #007bff !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    border: none !important;
  }
  
  .goal-actions {
    text-align: center !important;
    margin: 16px 0 8px 0 !important;
  }
  
  .start-game-btn {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3) !important;
    transition: all 0.2s ease !important;
  }
  
  .start-game-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4) !important;
  }
  
  .start-game-btn:active {
    transform: translateY(0) !important;
  }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .goals-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  
  .goal-setting-container {
    padding: 8px !important;
  }
  
  .goal-item {
    padding: 8px !important;
  }
}
/* Fixed Status Bar */
.fixed-status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  padding: 8px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  font-weight: bold;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-icon {
  font-size: 16px;
}

.status-label {
  font-size: 12px;
  opacity: 0.9;
}

.status-value {
  font-size: 14px;
  font-weight: bold;
}

/* Adjust body padding when fixed status bar is visible */
body.has-fixed-status {
  padding-top: 50px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: rgba(255, 255, 255, 0.95);
  border-left: 4px solid #48bb78;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: all 0.3s ease;
  pointer-events: auto;
  font-size: 14px;
  line-height: 1.4;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left-color: #48bb78;
}

.toast.warning {
  border-left-color: #f6ad55;
}

.toast.error {
  border-left-color: #f56565;
}

.toast.info {
  border-left-color: #4299e1;
}

.toast-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-message {
  flex: 1;
  color: #2d3748;
  font-weight: 500;
}

.toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #718096;
  padding: 0;
  margin-left: 8px;
  flex-shrink: 0;
}

.toast-close:hover {
  color: #2d3748;
}

/* Mobile toast adjustments */
@media (max-width: 768px) {
  .toast-container {
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
  }
  
  .toast {
    font-size: 13px;
    padding: 10px 12px;
  }
  
  .fixed-status-bar {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .status-item {
    gap: 2px;
  }
  
  .status-icon {
    font-size: 14px;
  }
  
  .status-label {
    font-size: 10px;
  }
  
  .status-value {
    font-size: 12px;
  }
  
  body.has-fixed-status {
    padding-top: 40px;
  }
}

/* Logo Styles */
.game-logo {
  height: 40px;
  border-radius: 6px;
  transition: transform 0.3s ease;
}

.game-logo:hover {
  transform: scale(1.05);
}

.auth-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  padding-left: 30px;
}

.auth-logo:hover {
  transform: scale(1.02);
}

@media (max-width: 768px) {
  .game-logo {
    height: 32px;
  }
  
  .auth-logo {
    width: 18px;
    height: 18px;
    padding-left: 20px;
  }
  
  .game-header {
    flex-direction: column;
    gap: 8px !important;
  }
  
  .game-header h1 {
    font-size: 18px;
  }
}

/* Help Modal Styles */
.help-modal-content {
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
}

.help-content {
  padding: 20px;
}

.help-content h2 {
  color: #2c3e50;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

.help-content h3 {
  color: #34495e;
  margin-top: 25px;
}

.help-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #ddd;
}

.help-tab {
  padding: 10px 20px;
  background: #f8f9fa;
  border: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.help-tab.active {
  background: #fff;
  border-bottom-color: #3498db;
}

.help-section {
  display: none;
}

.help-section.active {
  display: block;
}

.help-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 10px;
}

.help-btn:hover {
  background: #2980b9;
}
/* Hide the fixed status bar */
#fixed-status-bar {
    display: none !important;
}
