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

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

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

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Setup Screens */
.setup-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.setup-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 40px;
    max-width: 500px;
    width: 100%;
    animation: slideIn 0.3s ease-out;
}

.setup-card.wide {
    max-width: 700px;
}

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

.setup-card h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
    font-size: 32px;
}

.setup-card h2 {
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
    font-size: 28px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.setup-section {
    margin-bottom: 25px;
}

.setup-section label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.setup-section input[type="text"],
.setup-section select,
.setup-section textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.setup-section input[type="text"]:focus,
.setup-section select:focus,
.setup-section textarea:focus {
    outline: none;
    border-color: #667eea;
}

.setup-section textarea {
    min-height: 150px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.help-text a {
    color: #667eea;
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.button-group button {
    flex: 1;
}

header {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.header-logo {
    margin-bottom: 12px;
}

.game-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

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

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

button:hover {
    background: #5568d3;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #667eea;
    padding: 14px 28px;
    font-size: 16px;
    width: 100%;
}

.btn-primary:hover {
    background: #5568d3;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    padding: 14px 28px;
    font-size: 16px;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-back {
    background: #6c757d;
    margin-top: 20px;
    width: auto;
}

.btn-copy {
    padding: 8px 16px;
    white-space: nowrap;
}

.btn-rejoin {
    background: #1abc9c;
    padding: 12px 24px;
    font-size: 14px;
    width: 100%;
    margin-top: 10px;
}

.btn-rejoin:hover {
    background: #16a085;
}

.btn-leave {
    background: #e74c3c;
    margin-left: auto;
}

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

/* Nuke Counter */
.nuke-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(231, 76, 60, 0.6);
    }
}

.nuke-icon {
    font-size: 20px;
    animation: nuke-glow 2s infinite;
}

@keyframes nuke-glow {
    0%, 100% {
        filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
    }
}

.nuke-label {
    font-size: 14px;
    opacity: 0.9;
}

#nukeCounter {
    font-size: 24px;
    min-width: 30px;
    text-align: center;
}

/* Turn Indicator */
.turn-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #667eea;
}

.turn-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.turn-label {
    color: #666;
}

.turn-phase {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    padding: 4px 12px;
    background: white;
    border-radius: 4px;
}

.active-player {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 4px;
}

.active-player.your-turn {
    background: #2ecc71;
    animation: pulse-green 2s infinite;
}

.active-player.ai-thinking {
    background: #6c757d;
    animation: pulse-thinking 1.5s ease-in-out infinite;
}

@keyframes pulse-thinking {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(46, 204, 113, 0);
    }
}

/* Turn Controls */
.turn-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
}

.btn-skip {
    background: #f39c12;
    padding: 12px 24px;
    flex: 1;
}

.btn-skip:hover {
    background: #e67e22;
}

.btn-end-turn {
    background: #2ecc71;
    padding: 12px 24px;
    flex: 2;
    font-size: 16px;
    font-weight: bold;
}

.btn-end-turn:hover:not(:disabled) {
    background: #27ae60;
}

.btn-end-turn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e0e0e0;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.divider span {
    background: white;
    padding: 0 15px;
    color: #999;
    font-size: 12px;
    font-weight: 600;
}

.info {
    margin-left: auto;
    padding: 10px 15px;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 14px;
}

main {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

/* Game Screen Layout */
.game-main {
    display: block;
}

.game-container-full {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    overflow: auto;
    position: relative;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

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

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
    background: #667eea;
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.modal-instruction {
    font-size: 15px;
    color: #666;
    margin-bottom: 20px;
    text-align: center;
}

.opponents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opponent-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.opponent-card:hover {
    background: #e8f4f8;
    border-color: #667eea;
    transform: translateX(5px);
}

.opponent-card.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.opponent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.opponent-color-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #333;
}

.opponent-name {
    font-weight: 600;
    font-size: 16px;
}

.opponent-hostages {
    font-weight: 600;
    font-size: 14px;
    padding: 6px 12px;
    background: white;
    border-radius: 6px;
    color: #667eea;
}

.opponent-card.selected .opponent-hostages {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.hex-instruction {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border: 2px solid #f39c12;
    border-radius: 8px;
    text-align: center;
}

.hex-instruction p {
    margin-bottom: 8px;
    font-size: 14px;
    color: #856404;
}

.hex-instruction p:last-child {
    margin-bottom: 0;
}

.help-text {
    font-size: 12px;
    opacity: 0.8;
}

/* Hostage Placement Banner */
.hostage-placement-banner {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-out;
    max-width: 90%;
}

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

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

.banner-text {
    font-size: 16px;
    font-weight: 500;
}

.banner-text strong {
    font-weight: 700;
    text-decoration: underline;
}

.banner-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Movement Panel */
.movement-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 320px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.movement-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.movement-info p {
    margin: 8px 0;
    font-size: 14px;
}

.units-to-move {
    margin-bottom: 15px;
}

.units-to-move label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.unit-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-unit-control {
    width: 100%;
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: left;
}

.btn-unit-control:hover {
    background: #5568d3;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#unitsToMoveInput {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

#unitsToMoveInput:focus {
    outline: none;
    border-color: #667eea;
}

.movement-instructions {
    background: #fff3cd;
    border: 2px solid #f39c12;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    text-align: center;
}

.movement-instructions p {
    margin: 0;
    font-size: 14px;
    color: #856404;
    font-weight: 500;
}

.btn-cancel-movement {
    width: 100%;
    padding: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-cancel-movement:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Token Placement Panel */
.token-placement-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    width: 280px;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 2px solid #e0e0e0;
    background: #667eea;
    color: white;
    border-radius: 10px 10px 0 0;
}

.panel-header h4 {
    margin: 0;
    font-size: 16px;
}

.btn-close {
    background: transparent;
    color: white;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.panel-content {
    padding: 15px;
}

.token-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.token-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.btn-token {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s ease;
}

.btn-token:hover {
    background: #5568d3;
    transform: scale(1.1);
}

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

.btn-token:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: scale(1);
}

.token-display {
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
    text-align: center;
}

.quick-set {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.btn-quick-set {
    flex: 1;
    padding: 8px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-quick-set:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Turn Control Panel */
.turn-control-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    width: 280px;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

.turn-action-info {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.action-description {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.btn-skip {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.btn-skip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
}

.btn-end-turn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-end-turn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-end-turn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.game-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 900px;
    overflow: auto;
}

#gameCanvas {
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    cursor: default;
    /* Cursor dynamically controlled by JavaScript based on game state */
}

/* Game Footer */
.game-footer {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-top: 20px;
}

.footer-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.player-stats-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-stats-section h3 {
    color: #667eea;
    font-size: 16px;
    margin: 0;
    white-space: nowrap;
}

.legend-horizontal {
    display: flex;
    align-items: center;
    gap: 15px;
}

.legend-horizontal h3 {
    color: #667eea;
    font-size: 16px;
    margin: 0;
    white-space: nowrap;
}

.legend-items-horizontal {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.legend-item-horizontal {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.legend-color-small {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #333;
    display: inline-block;
}

.legend-hex-canvas {
    display: block;
}

.player-stats-panel {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.player-stat-card {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    min-width: 150px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.player-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.player-stat-name {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.player-stat-details {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

.sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-height: 800px;
    overflow-y: auto;
}

.sidebar h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 20px;
}

.sidebar h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 16px;
}

.sidebar p {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

#mapDataInput {
    width: 100%;
    height: 200px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    margin-bottom: 10px;
}

#importMapBtn {
    width: 100%;
    margin-bottom: 20px;
}

.legend {
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.legend-item:last-child {
    border-bottom: none;
}

.legend-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #333;
}

/* Tabs */
.config-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    background: transparent;
    color: #666;
    border: none;
    padding: 12px 24px;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #667eea;
    background: transparent;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

/* Map Preview */
.map-preview {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Game ID Display */
.game-id-section {
    margin-bottom: 25px;
}

.game-id-display {
    display: flex;
    gap: 10px;
}

.game-id-display input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: #667eea;
}

.game-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.game-info p {
    margin-bottom: 10px;
    font-size: 14px;
}

.game-info p:last-child {
    margin-bottom: 0;
}

/* Player Info in Header */
.player-info,
.game-id-info {
    padding: 10px 15px;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 14px;
}

/* Players Section */
.players-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.players-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 16px;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 5px;
    border: 2px solid #e0e0e0;
}

.player-item.host {
    border-color: #667eea;
    background: #f0f4ff;
}

.player-item.bot {
    border-color: #6c757d;
    background: #f5f5f5;
}

.player-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.player-name {
    flex: 1;
    font-weight: 500;
}

.player-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.player-item.bot .player-badge {
    background: #6c757d;
}

.ai-difficulty {
    font-size: 0.9em;
    color: #888;
    font-weight: normal;
}

.add-bot-section {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin-top: 8px;
}

.bot-difficulty-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 100px;
    flex-shrink: 0;
}

.btn-bot {
    background: #6c757d;
    flex: 1;
    min-width: 0;
    padding: 12px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-bot:hover {
    background: #5a6268;
}

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

.warning-message {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
    border: 1px solid #ffeaa7;
}

.waiting-message {
    background: #d1ecf1;
    color: #0c5460;
    padding: 12px;
    border-radius: 5px;
    text-align: center;
    border: 1px solid #bee5eb;
    margin-top: 10px;
    font-size: 14px;
}

button:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* Color Picker */
.color-picker-container {
    margin-top: 8px;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-option.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #333;
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Lobby Color Selection */
.color-selection-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(243, 156, 18, 0);
    }
}

.color-selection-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 16px;
}

.color-options-lobby {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.color-option-lobby {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-option-lobby:hover:not(.taken):not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-option-lobby.selected {
    border-color: #333 !important;
    box-shadow: 0 0 0 2px white, 0 0 0 5px #333 !important;
    transform: scale(1.05) !important;
}

.color-option-lobby.selected .color-status {
    display: block !important;
}

.color-option-lobby.taken {
    opacity: 0.5;
    cursor: not-allowed;
}

.color-option-lobby.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.color-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    z-index: 10;
}

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        max-height: none;
    }
    
    .setup-card {
        margin: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .legend-items-horizontal {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}


/* Feedback Button (Bottom Right) */
.feedback-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.9);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

/* Rules Reference Modal */
.rules-ref-modal .rules-ref-section {
    margin-bottom: 20px;
}
.rules-ref-modal .rules-ref-section h4 {
    margin-bottom: 10px;
    font-size: 14px;
}
.rules-ref-modal .rules-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.rules-ref-modal .rules-table th,
.rules-ref-modal .rules-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}
.rules-ref-modal .rules-table th {
    background: #f5f5f5;
}
.rules-ref-modal .rules-table tr:nth-child(even) {
    background: #fafafa;
}
.rules-ref-btn {
    right: 70px !important;
}

/* Feedback Modal */
.feedback-modal {
    max-width: 500px;
    width: 90%;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group select {
    cursor: pointer;
}

#submitFeedbackBtn {
    margin-top: 10px;
    padding: 12px;
    font-size: 16px;
}

/* Game Info Bar */
.game-info-bar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Version Info */
.version-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.version-tag {
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-whats-new {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-whats-new:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

/* What's New Modal */
.whats-new-modal {
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.release-notes {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.release-section h4 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 16px;
}

.release-section p {
    margin: 5px 0;
    color: #555;
    line-height: 1.6;
}

.release-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.release-section li {
    margin: 8px 0;
    color: #555;
    line-height: 1.5;
}

.release-footer {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
}

.release-footer p {
    margin: 5px 0;
}

.release-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.release-footer a:hover {
    text-decoration: underline;
}

/* Logo Image Styling */
.logo-image {
    width: 90%;
    height: 90%;
    max-width: 400px;
    max-height: 400px;
    vertical-align: middle;
    border-radius: 12px;
    object-fit: contain;
}

/* Ensure h1 with logo looks good */
h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 20px;
}

h1 img {
    flex-shrink: 0;
}

/* Alert Box Styling */
.alert-box {
    background: rgba(102, 126, 234, 0.9);
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border-left: 4px solid #5a67d8;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* Database Status Indicator */
.db-status-indicator {
    margin: 15px 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.db-status-indicator.checking {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #856404;
}

.db-status-indicator.connected {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #155724;
}

.db-status-indicator.disconnected {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #721c24;
}

.db-status-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.db-status-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.db-status-text {
    flex: 1;
    font-weight: 500;
}

.alert-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

/* Landing Page Version */
.landing-version {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.version-number {
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}
