* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
}

/* Start Menu Styles */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.menu-container {
    position: relative;
    z-index: 1001;
    text-align: center;
    max-width: 800px;
    padding: 40px;
}

.menu-header {
    margin-bottom: 50px;
}

.game-title {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    letter-spacing: 3px;
}

.title-3d {
    color: #00ffff;
    text-shadow: 0 0 30px #00ffff, 0 0 60px #00ffff;
}

.title-auto {
    color: #ffffff;
    margin: 0 20px;
}

.title-battler {
    color: #0099ff;
    text-shadow: 0 0 30px #0099ff, 0 0 60px #0099ff;
}

.subtitle {
    font-size: 1.2rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
}

.menu-content {
    display: flex;
    gap: 60px;
    align-items: flex-start;
    justify-content: center;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 250px;
}

.menu-btn {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 2px solid #333;
    color: #fff;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn.primary {
    background: linear-gradient(145deg, #0066cc, #0099ff);
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.menu-btn.primary:hover {
    background: linear-gradient(145deg, #0099ff, #00ccff);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.6);
    transform: translateY(-3px);
}

.menu-btn.secondary:hover {
    background: linear-gradient(145deg, #2a2a3e, #26314e);
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 20px;
}

.btn-text {
    flex: 1;
    text-align: left;
}

.game-preview {
    max-width: 300px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

.preview-text p {
    margin-bottom: 15px;
    color: #ccc;
    font-size: 14px;
    line-height: 1.6;
}

.preview-text p:first-child {
    font-size: 16px;
    color: #00ffff;
    font-weight: bold;
    margin-bottom: 20px;
}

/* Background Effects */
.menu-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1000;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(0, 153, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(0, 255, 255, 0.05) 0%, transparent 50%);
    animation: particleFloat 15s ease-in-out infinite alternate;
}

@keyframes particleFloat {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-20px) rotate(5deg); }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-container {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 2px solid #00ffff;
    border-radius: 15px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.modal-header {
    background: linear-gradient(145deg, #0066cc, #0099ff);
    padding: 20px 30px;
    border-radius: 13px 13px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #fff;
    font-size: 24px;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-content {
    padding: 30px;
}

.instruction-section, .credits-section {
    margin-bottom: 25px;
}

.instruction-section h3, .credits-section h3 {
    color: #00ffff;
    font-size: 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instruction-section p, .credits-section p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 10px;
}

.instruction-section ul, .credits-section ul {
    color: #ccc;
    padding-left: 20px;
    line-height: 1.6;
}

.instruction-section ol {
    color: #ccc;
    padding-left: 20px;
    line-height: 1.8;
}

.instruction-section li strong {
    color: #00ffff;
}

/* Game Container Styles */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.panel {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 15px;
    pointer-events: auto;
    backdrop-filter: blur(5px);
}

#phase-display {
    top: 20px;
    left: 50%;
    /*transform: translateX(-50%);*/
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #666;
    pointer-events: none;
}

#phase-display h2 {
    color: #4CAF50;
    margin-bottom: 5px;
    font-size: 24px;
}

#turn-counter {
    color: #ccc;
    font-size: 16px;
}

#unit-panel {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 200px;
}

#unit-panel h3 {
    color: #4CAF50;
    margin-bottom: 10px;
    text-align: center;
}

#unit-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.unit-btn {
    background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
    border: 2px solid #444;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.unit-btn:hover {
    background: linear-gradient(145deg, #3c3c3c, #2a2a2a);
    border-color: #4CAF50;
    transform: translateY(-2px);
}

.unit-btn:active {
    transform: translateY(0);
}

.unit-btn.selected {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    border-color: #4CAF50;
}

#upgrade-panel {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 350px;
    text-align: center;
    border-color: #4CAF50;
}

#upgrade-panel h3 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 20px;
}

#upgrade-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upgrade-btn {
    background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
    border: 2px solid #444;
    color: #fff;
    padding: 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.upgrade-btn:hover {
    background: linear-gradient(145deg, #3c3c3c, #2a2a2a);
    border-color: #4CAF50;
    transform: translateY(-2px);
}

.upgrade-title {
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 5px;
}

.upgrade-description {
    color: #ccc;
    font-size: 14px;
}

/* Unit Upgrade Window Styles */
.upgrade-window {
    position: fixed;
    top: 50%;
    left: 20%;
    transform: translateY(-50%);
    width: 400px;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 2px solid #00ffff;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    z-index: 1000;
    pointer-events: auto;
}

.upgrade-window-header {
    background: linear-gradient(145deg, #0066cc, #0099ff);
    padding: 15px 20px;
    border-radius: 13px 13px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade-window-header h3 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

.upgrade-window-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.unit-upgrade-btn {
    background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
    border: 2px solid #444;
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    margin-bottom: 10px;
    width: 100%;
    display: block;
}

.unit-upgrade-btn:hover {
    background: linear-gradient(145deg, #3c3c3c, #2a2a2a);
    border-color: #00ffff;
    transform: translateY(-2px);
}

.unit-upgrade-btn:disabled {
    background: #333;
    border-color: #666;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.upgrade-btn-title {
    font-weight: bold;
    color: #00ffff;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade-btn-cost {
    color: #FFD700;
    font-size: 14px;
}

.upgrade-btn-description {
    color: #ccc;
    font-size: 14px;
    line-height: 1.4;
}

/* Character Window Styles */
.character-window {
    position: fixed;
    top: 50%;
    right: 20%;
    transform: translateY(-50%);
    width: 300px;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 2px solid #4CAF50;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.3);
    z-index: 1000;
    pointer-events: auto;
}

.character-window-header {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    padding: 15px 20px;
    border-radius: 13px 13px 0 0;
    text-align: center;
}

.character-window-header h3 {
    color: #fff;
    font-size: 18px;
    margin: 0;
    text-transform: capitalize;
}

.character-window-content {
    padding: 20px;
}

.character-image {
    text-align: center;
    margin-bottom: 20px;
}

.unit-image-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 3px solid #4CAF50;
    background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
}

.unit-image-placeholder.spearman {
    background: linear-gradient(145deg, #8B4513, #654321);
}

.unit-image-placeholder.archer {
    background: linear-gradient(145deg, #228B22, #1a6b1a);
}

.unit-image-placeholder.swordsman {
    background: linear-gradient(145deg, #4169E1, #2e4bc7);
}

.unit-image-placeholder.knight {
    background: linear-gradient(145deg, #800080, #5c005c);
}

.unit-image-placeholder::before {
    content: '⚔️';
}

.unit-image-placeholder.spearman::before {
    content: '🗡️';
}

.unit-image-placeholder.archer::before {
    content: '🏹';
}

.unit-image-placeholder.swordsman::before {
    content: '⚔️';
}

.unit-image-placeholder.knight::before {
    content: '🐎';
}

.character-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid #444;
}

.stat-label {
    color: #ccc;
    font-weight: bold;
}

.stat-value {
    color: #4CAF50;
    font-weight: bold;
}

#controls-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    text-align: center;
}

#currency-display {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #FFD700;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
}

#ready-btn, #next-turn-btn {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    border: 4px solid #4CAF50;
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    width: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#ready-btn::before, #next-turn-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(45deg, #666, #999, #666, #999);
    border-radius: 16px;
    z-index: -2;
}

#ready-btn::after, #next-turn-btn::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #333, #555, #333, #555);
    border-radius: 14px;
    z-index: -1;
}

#ready-btn:hover, #next-turn-btn:hover {
    background: linear-gradient(145deg, #5CBF60, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.5);
}

#ready-btn:disabled {
    background: #666;
    border-color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.mechanical-border {
    position: relative;
    padding: 15px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 3px solid #666;
    border-radius: 15px;
    box-shadow: 
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(76, 175, 80, 0.3);
}

.mechanical-border::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(45deg, 
        #444 0%, #666 25%, #888 50%, #666 75%, #444 100%);
    border-radius: 20px;
    z-index: -1;
}

.mechanical-border::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, 
        #333 0%, #555 25%, #777 50%, #555 75%, #333 100%);
    border-radius: 18px;
    z-index: -1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .menu-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .menu-container {
        padding: 20px;
    }
    
    .modal-container {
        margin: 20px;
        max-width: calc(100vw - 40px);
    }
}
