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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(135deg, #1c1c1c 0%, #2F4F4F 25%, #36454F 50%, #708090 75%, #696969 100%);
    color: #f5f5f5;
    line-height: 1.4;
    font-size: 16px;
    background-attachment: fixed;
}

#gameContainer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-content {
    display: flex;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

/* Modal Styles */
.modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal-content {
    background: linear-gradient(135deg, #36454F 0%, #2F4F4F 50%, #708090 100%);
    margin: 2% auto;
    padding: 20px;
    border: 3px solid #1C1C1C;
    border-top: 3px solid #A9A9A9;
    border-left: 3px solid #A9A9A9;
    border-radius: 3px;
    width: 90%;
    max-width: 600px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 6px 18px rgba(0,0,0,0.6);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: #f5f5f5;
    text-align: center;
    margin-bottom: 15px;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.rules-content {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 15px;
    font-size: 18px;
    color: #f5f5f5;
}

.rules-content h3 {
    color: #f5f5f5;
    margin-top: 15px;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.rules-content ul, .rules-content ol {
    margin-left: 40px;
    margin-bottom: 15px;
}

.rules-content li {
    margin-bottom: 5px;
}

/* Overview Modal Styles */
.overview-modal {
    max-width: 900px;
    width: 95%;
    max-height: 95vh;
    padding: 15px;
}

.overview-content {
    max-height: 75vh;
    overflow-y: auto;
}

.overview-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 5px;
    border: 1px solid #708090;
}

.overview-section h3 {
    color: #f5f5f5;
    margin-bottom: 10px;
    text-align: center;
    font-size: 18px;
}

.overview-section canvas {
    display: block;
    margin: 0 auto;
    background: rgba(255,255,255,0.1);
    border: 1px solid #708090;
    border-radius: 3px;
}

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

#negotiationHistory {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.negotiation-item {
    background: rgba(255,255,255,0.1);
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #708090;
    text-align: center;
    min-width: 120px;
}

.negotiation-collude {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
}

.negotiation-compete {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.2);
}

.negotiation-mixed {
    border-color: #FF9800;
    background: rgba(255, 152, 0, 0.2);
}

#finalStats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    text-align: center;
}

.stat-item {
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #708090;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #f5f5f5;
}

.stat-label {
    font-size: 14px;
    color: #ccc;
}

.btn-secondary {
    background: linear-gradient(45deg, #708090 0%, #696969 100%);
    color: #ffffff;
    border: 2px solid #36454F;
    border-top: 2px solid #A9A9A9;
    border-left: 2px solid #A9A9A9;
    border-radius: 3px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 8px rgba(0,0,0,0.3);
    transition: all 0.1s ease;
}

.btn-secondary:hover {
    background: linear-gradient(45deg, #696969 0%, #708090 100%);
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.3);
}

/* Header Styles */
#gameHeader {
    background: linear-gradient(45deg, #2F4F4F 0%, #36454F 25%, #4682B4 50%, #708090 75%, #778899 100%);
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 3px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 8px rgba(0,0,0,0.5);
    border: 2px solid #36454F;
    border-top: 2px solid #708090;
    border-left: 2px solid #708090;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-buttons {
    display: flex;
    gap: 10px;
}

.btn-menu {
    background: linear-gradient(45deg, #696969 0%, #778899 100%);
    color: #ffffff;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #36454F;
    border-top: 1px solid #A9A9A9;
    border-left: 1px solid #A9A9A9;
    border-radius: 2px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.btn-menu:hover {
    background: linear-gradient(45deg, #778899 0%, #696969 100%);
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.3);
}

.phase-display {
    display: flex;
    align-items: center;
    gap: 20px;
}



#gameHeader h1 {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

.turn-info {
    display: flex;
    gap: 20px;
    font-size: 20px;
}

/* Player Stats */
#playerStats {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.player-info {
    flex: 1;
    background: linear-gradient(135deg, #4682B4 0%, #708090 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #A9A9A9;
    border-left: 2px solid #A9A9A9;
    border-radius: 3px;
    padding: 8px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 3px 6px rgba(0,0,0,0.4);
}

.rival-info {
    flex: 1;
    background: linear-gradient(135deg, #B22222 0%, #8B0000 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #CD5C5C;
    border-left: 2px solid #CD5C5C;
    border-radius: 3px;
    padding: 8px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 3px 6px rgba(0,0,0,0.4);
}

.player-info h3, .rival-info h3 {
    color: #ffffff;
    margin-bottom: 5px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Company Logos */
.company-logo {
    width: 20px;
    height: 20px;
    display: inline-block;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.player-logo {
    background: linear-gradient(45deg, #ffd700 0%, #ffed4e 100%);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.player-logo::before {
    content: 'P';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #2c3e50;
    font-weight: bold;
    font-size: 16px;
    font-family: 'Courier New', monospace;
}

.rival-logo {
    background: linear-gradient(45deg, #ff6b6b 0%, #ff9ff3 100%);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.rival-logo::before {
    content: 'S';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-weight: bold;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.stat {
    background: linear-gradient(45deg, #36454F 0%, #2F4F4F 100%);
    color: #00FF00;
    padding: 4px 8px;
    border-radius: 2px;
    font-weight: bold;
    flex: 1;
    min-width: 80px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
    border: 1px solid #1C1C1C;
    font-size: 16px;
    text-shadow: 0 0 3px #00FF00;
}

/* Game Board */
#mainGameArea {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#gameBoard {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    flex: 1;
    min-height: 0;
}

.territories-section, .consumer-section {
    flex: 1;
    background: linear-gradient(135deg, #36454F 0%, #2F4F4F 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #778899;
    border-left: 2px solid #778899;
    border-radius: 3px;
    padding: 8px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 3px 6px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.territories-section h3, .consumer-section h3 {
    color: #ffffff;
    margin-bottom: 8px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 19px;
    flex-shrink: 0;
}

.territories-grid, .consumers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(80px, auto);
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

.territory, .consumer {
    background: linear-gradient(45deg, #696969 0%, #778899 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #A9A9A9;
    border-left: 2px solid #A9A9A9;
    border-radius: 3px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.3);
    font-size: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
    color: #f5f5f5;
}

.territory:hover, .consumer:hover {
    background: linear-gradient(45deg, #778899 0%, #B0C4DE 100%);
    transform: translateY(-1px);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2), 0 3px 6px rgba(0,0,0,0.4);
}

.territory.selected, .consumer.selected {
    background: linear-gradient(45deg, #FF8C00 0%, #FFA500 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #FFD700;
    border-left: 2px solid #FFD700;
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 0 10px rgba(255, 140, 0, 0.6);
}

.territory.owned-player {
    background: linear-gradient(45deg, #4682B4 0%, #5F9EA0 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #87CEEB;
    border-left: 2px solid #87CEEB;
}

.territory.owned-rival {
    background: linear-gradient(45deg, #B22222 0%, #DC143C 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #F08080;
    border-left: 2px solid #F08080;
}

.territory.drilled-player {
    background: linear-gradient(45deg, #2F4F4F 0%, #4682B4 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #87CEEB;
    border-left: 2px solid #87CEEB;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 0 15px rgba(70, 130, 180, 0.6);
}

.territory.drilled-rival {
    background: linear-gradient(45deg, #8B0000 0%, #B22222 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #F08080;
    border-left: 2px solid #F08080;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 0 15px rgba(178, 34, 34, 0.6);
}

.territory-name {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 17px;
}

.territory-info {
    font-size: 15px;
    color: #f5f5f5;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    line-height: 1.3;
}

.consumer-name {
    font-weight: bold;
    margin-bottom: 4px;
    color: #f5f5f5;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    font-size: 17px;
}

.consumer-demand {
    font-size: 15px;
    color: #f5f5f5;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    line-height: 1.3;
}

/* Action Panel */
#actionPanel {
    background: linear-gradient(135deg, #2F4F4F 0%, #36454F 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #778899;
    border-left: 2px solid #778899;
    border-radius: 3px;
    padding: 8px;
    margin-bottom: 8px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 3px 6px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.action-buttons {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 6px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(45deg, #FF8C00 0%, #FF6347 100%);
    color: #ffffff;
    width: 100%;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    border: 1px solid #1C1C1C;
    border-top: 1px solid #FFA500;
    border-left: 1px solid #FFA500;
    border-radius: 2px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.3);
}

.btn-primary:hover {
    background: linear-gradient(45deg, #FF6347 0%, #FF8C00 100%);
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.3);
}

.btn-action {
    background: linear-gradient(45deg, #696969 0%, #778899 100%);
    color: #ffffff;
    flex: 1;
    min-width: 80px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    border: 1px solid #1C1C1C;
    border-top: 1px solid #A9A9A9;
    border-left: 1px solid #A9A9A9;
    border-radius: 2px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.3);
}

.btn-action:hover {
    background: linear-gradient(45deg, #778899 0%, #696969 100%);
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.3);
}

.btn-action:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

/* Message Log */
#messageLog {
    background: linear-gradient(135deg, #36454F 0%, #2F4F4F 100%);
    border: 2px solid #1C1C1C;
    border-top: 2px solid #778899;
    border-left: 2px solid #778899;
    border-radius: 3px;
    padding: 8px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 3px 6px rgba(0,0,0,0.4);
    width: 250px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

#messageLog.collapsed {
    width: 40px;
}

#messageLog.collapsed #messages {
    display: none;
}

#messageLog.collapsed .log-header h3 {
    display: none;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-shrink: 0;
}

.log-header h3 {
    color: #ffffff;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 16px;
}

.btn-toggle {
    background: linear-gradient(45deg, #696969 0%, #778899 100%);
    color: #ffffff;
    border: 1px solid #1C1C1C;
    border-top: 1px solid #A9A9A9;
    border-left: 1px solid #A9A9A9;
    padding: 2px 6px;
    font-size: 16px;
    min-width: 20px;
    border-radius: 2px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.btn-toggle:hover {
    background: linear-gradient(45deg, #778899 0%, #696969 100%);
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.3);
}

#messages {
    flex: 1;
    overflow-y: auto;
    background-color: #2c3e50;
    color: #ffffff;
    border: 1px solid #ffffff;
    border-radius: 6px;
    padding: 6px;
    font-size: 14px;
    min-height: 0;
}

.message {
    margin-bottom: 4px;
    padding: 3px;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1.2;
}

.message.player {
    background: linear-gradient(90deg, #4682B4 0%, #5F9EA0 100%);
    border-left: 3px solid #87CEEB;
    color: #ffffff;
}

.message.rival {
    background: linear-gradient(90deg, #B22222 0%, #DC143C 100%);
    border-left: 3px solid #F08080;
    color: #ffffff;
}

.message.system {
    background: linear-gradient(90deg, #696969 0%, #778899 100%);
    border-left: 3px solid #A9A9A9;
    color: #ffffff;
}

/* Responsive Design */
@media (max-width: 768px) {
    #gameContainer {
        padding: 5px;
    }
    
    .game-content {
        flex-direction: column;
    }
    
    #messageLog {
        width: 100% !important;
        order: 2;
    }
    
    #messageLog.collapsed {
        width: 100% !important;
        height: 40px;
    }
    
    #messageLog.collapsed #messages {
        display: none;
    }
    
    #mainGameArea {
        order: 1;
    }
    
    #playerStats {
        flex-direction: column;
        gap: 5px;
    }
    
    #gameBoard {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .territories-grid, .consumers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .phase-display {
        gap: 10px;
    }
    
    .turn-info {
        font-size: 16px;
    }
    

} 