* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e0e0e0;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#game-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    grid-template-rows: 100px 1fr;
    height: 100vh;
    gap: 15px;
    padding: 15px;
    background: url('https://www.transparenttextures.com/patterns/crissxcross.png');
}

#hud {
    grid-column: 1 / -1;
    background: rgba(26, 26, 46, 0.95);
    border: none;
    border-radius: 16px;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 
                0 0 0 1px rgba(255, 215, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    background-image: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#hud::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: linear-gradient(45deg, transparent 40%, rgba(240, 230, 140, 0.02) 50%, transparent 60%);
    animation: hudShimmer 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hudShimmer {
    0%, 100% { transform: translateX(-100%) rotate(45deg); }
    50% { transform: translateX(100%) rotate(45deg); }
}

#turn-info {
    font-size: 24px;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 2px 8px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
}

#turn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#civ-info {
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(160, 140, 91, 0.2);
    min-width: 300px;
}

#civ-info h3 {
    color: #f0e68c;
    margin-bottom: 5px;
    font-size: 20px;
}

#resources {
    display: flex;
    gap: 15px;
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.6) 0%, rgba(22, 33, 62, 0.6) 100%);
    padding: 8px 15px;
    border-radius: 12px;
    border: 1px solid rgba(100, 200, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#resources span {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#resources span:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 215, 0, 0.15) 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.4);
}

#victory-progress {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.8;
}

#victory-progress div {
    padding: 8px 12px;
    margin: 6px 0;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #a08c5b;
    border-radius: 0 6px 6px 0;
    transition: all 0.3s ease;
}

#victory-progress div:hover {
    background: rgba(240, 230, 140, 0.1);
    border-left-color: #f0e68c;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#victory-progress strong {
    color: #f0e68c;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

#victory-progress span {
    float: right;
    font-weight: bold;
    color: #a08c5b;
}

#game-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

#game-controls button {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3), 
                0 2px 4px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

#game-controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#game-controls button:hover::before {
    left: 100%;
}

#game-controls button:hover {
    background: linear-gradient(135deg, #5ba3f5 0%, #4a90e2 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.4), 
                0 4px 8px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#game-controls button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3), 
                0 1px 4px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#audio-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid #444;
}

#mute-btn {
    background: #444;
    border: 1px solid #666;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
    min-width: 40px;
}

#mute-btn:hover {
    background: #555;
}

#music-volume, #sound-volume {
    width: 60px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#music-volume::-webkit-slider-thumb, #sound-volume::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: #a08c5b;
    border-radius: 50%;
    cursor: pointer;
}

#music-volume::-moz-range-thumb, #sound-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #a08c5b;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

#end-turn-btn {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4), 
                0 2px 4px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: pulseGlow 2s ease-in-out infinite;
}

#end-turn-btn:hover {
    background: linear-gradient(135deg, #f5ab35 0%, #f39c12 100%);
    box-shadow: 0 8px 20px rgba(243, 156, 18, 0.5), 
                0 4px 8px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: none;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4), 
                    0 2px 4px rgba(0, 0, 0, 0.2),
                    inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px rgba(243, 156, 18, 0.6), 
                    0 2px 8px rgba(0, 0, 0, 0.3),
                    inset 0 1px 0 rgba(255, 255, 255, 0.3),
                    0 0 30px rgba(243, 156, 18, 0.3);
    }
}

#game-board {
    background: radial-gradient(circle at center, #0f1419 0%, #000 70%);
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 
                0 0 0 1px rgba(74, 144, 226, 0.2),
                inset 0 2px 4px rgba(255, 255, 255, 0.03);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#game-board:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), inset 0 2px 6px rgba(255, 255, 255, 0.08), 0 0 20px rgba(160, 140, 91, 0.2);
}

#game-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(240, 230, 140, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(160, 140, 91, 0.05) 0%, transparent 50%),
        linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.02) 100%);
    pointer-events: none;
    z-index: 1;
    animation: mapAmbient 25s ease-in-out infinite;
}

@keyframes mapAmbient {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

#map-canvas {
    display: block;
    cursor: crosshair;
    transition: filter 0.3s ease;
    position: relative;
    z-index: 2;
}

#map-canvas:hover {
    filter: brightness(1.05) contrast(1.02);
}

#info-panel {
    background: rgba(26, 26, 46, 0.95);
    border: none;
    border-radius: 16px;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 
                0 0 0 1px rgba(74, 144, 226, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    background-image: linear-gradient(145deg, rgba(15, 52, 96, 0.3) 0%, rgba(22, 33, 62, 0.2) 50%, rgba(26, 26, 46, 0.1) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

#info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #a08c5b, #f0e68c, #a08c5b);
    z-index: 1;
}

#tabs {
    display: flex;
    background: #333;
    border-bottom: 2px solid #a08c5b;
}

.tab-button {
    flex: 1;
    padding: 16px 8px;
    background: rgba(15, 52, 96, 0.3);
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-right: 1px solid rgba(74, 144, 226, 0.1);
    cursor: pointer;
    font-weight: 600;
    font-family: 'Segoe UI', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(240, 230, 140, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tab-button:hover::before {
    opacity: 1;
}

.tab-button:hover {
    color: #fff;
    background: rgba(74, 144, 226, 0.2);
    transform: translateY(-1px);
}

.tab-button.active {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4), 
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                inset 0 -2px 0 rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.tab-button.active::before {
    opacity: 0.5;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

#tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    position: relative;
}

#tab-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(160, 140, 91, 0.3), transparent);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

#info-panel h3, #info-panel h4 {
    color: #f0e68c;
    border-bottom: 2px solid #a08c5b;
    padding-bottom: 8px;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    position: relative;
    font-size: 18px;
}

#info-panel h3::after, #info-panel h4::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #f0e68c, transparent);
}

#tile-info {
    line-height: 1.5;
    font-size: 14px;
}

#action-buttons button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 14px 16px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-weight: 600;
    font-family: 'Segoe UI', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3), 
                0 2px 4px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: 0.3px;
}

#action-buttons button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.4s ease;
}

#action-buttons button:hover::before {
    left: 100%;
}

#action-buttons button:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4), 
                0 4px 8px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#action-buttons button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3), 
                0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Tech & Building Panels */
.tech-item, .building-item {
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.4) 0%, rgba(22, 33, 62, 0.3) 100%);
    border: 1px solid rgba(74, 144, 226, 0.2);
    padding: 14px 16px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.tech-item::before, .building-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(240, 230, 140, 0.1), transparent);
    transition: left 0.5s ease;
}

.tech-item:hover::before, .building-item:hover::before {
    left: 100%;
}

.tech-item:hover, .building-item:hover {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.3) 0%, rgba(53, 122, 189, 0.2) 100%);
    border-color: rgba(74, 144, 226, 0.5);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 
                0 0 20px rgba(74, 144, 226, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tech-item.researched, .building-item.built {
    background: rgba(0, 100, 0, 0.2);
    border-color: #3e8e41;
    opacity: 0.8;
}

.tech-item.unavailable, .building-item.unavailable {
    background: rgba(100, 0, 0, 0.2);
    border-color: #8b0000;
    opacity: 0.6;
    cursor: not-allowed;
}

.tech-name, .building-name {
    font-weight: bold;
    color: #f0e68c;
}

.tech-description, .building-description {
    font-size: 12px;
    color: #bbb;
    margin-top: 4px;
}

.tech-cost, .building-cost {
    font-size: 11px;
    color: #aaa;
    float: right;
}

#research-progress {
    background: #111;
    border: 1px solid #a08c5b;
    height: 22px;
    margin-top: 10px;
    padding: 2px;
}

#research-progress-bar {
    background: linear-gradient(to right, #6c5833, #f0e68c);
    height: 100%;
}

#tooltip {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(40, 40, 40, 0.9) 100%);
    color: #f0e68c;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid #a08c5b;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(240, 230, 140, 0.1);
    backdrop-filter: blur(4px);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-family: 'Times New Roman', Times, serif;
    white-space: pre-line;
    max-width: 300px;
    animation: tooltipFadeIn 0.3s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #a08c5b 0%, #8c7853 100%);
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #b8941f 0%, #a08c5b 100%);
    box-shadow: 0 0 8px rgba(240, 230, 140, 0.3);
}

/* Selection styling */
::selection {
    background: rgba(240, 230, 140, 0.3);
    color: #fff;
}

/* Loading animation for better UX */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading {
    animation: pulse 2s ease-in-out infinite;
}

/* Additional interactive elements */
.city-building {
    background: rgba(34, 139, 34, 0.2);
    border: 1px solid #228b22;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 3px 0;
    font-size: 13px;
    color: #90ee90;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.city-building:hover {
    background: rgba(34, 139, 34, 0.3);
    border-color: #32cd32;
    transform: translateX(3px);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    #game-container {
        grid-template-columns: 1fr 280px;
    }

    #turn-info {
        font-size: 20px;
    }

    #resources {
        gap: 15px;
    }
}

/* Tablet adjustments */
@media (max-width: 968px) {
    #game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        padding: 10px;
        gap: 10px;
    }

    #hud {
        flex-direction: column;
        gap: 10px;
        padding: 12px 15px;
    }

    #turn-info {
        font-size: 18px;
        width: 100%;
    }

    #resources {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 8px 10px;
    }

    #game-controls {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    #game-controls button {
        padding: 10px 18px;
        font-size: 14px;
    }

    #audio-controls {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #444;
        padding-top: 8px;
        width: 100%;
        justify-content: center;
    }

    #info-panel {
        max-height: 300px;
    }

    .tab-button {
        padding: 12px 6px;
        font-size: 13px;
    }
}

/* Mobile portrait adjustments */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    #game-container {
        height: auto;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding: 8px;
        gap: 8px;
    }

    #hud {
        padding: 10px;
    }

    #turn-info {
        font-size: 16px;
        padding: 8px 12px;
    }

    #civ-name {
        font-size: 14px;
    }

    #resources {
        font-size: 13px;
        gap: 8px;
    }

    #resources span {
        padding: 3px 6px;
    }

    #game-controls {
        gap: 8px;
    }

    #game-controls button {
        padding: 10px 14px;
        font-size: 13px;
        flex: 1;
        min-width: 70px;
    }

    #audio-controls {
        width: 100%;
        justify-content: space-around;
        padding-top: 8px;
    }

    #music-volume, #sound-volume {
        width: 80px;
    }

    #game-board {
        height: 60vh;
        min-height: 400px;
        order: 2;
        touch-action: none; /* Better touch handling */
    }

    #map-canvas {
        cursor: pointer;
        touch-action: none;
    }

    #info-panel {
        height: auto;
        max-height: none;
        min-height: 300px;
        order: 3;
    }

    #tab-content {
        padding: 15px;
        max-height: 400px;
    }

    .tab-button {
        padding: 12px 4px;
        font-size: 12px;
    }

    #action-buttons button {
        padding: 14px;
        font-size: 15px;
        margin: 10px 0;
        /* Better touch target size */
        min-height: 44px;
    }

    .tech-item, .building-item {
        padding: 12px;
        margin: 8px 0;
        /* Better touch target size */
        min-height: 44px;
    }

    #tooltip {
        font-size: 12px;
        padding: 10px 14px;
        max-width: 250px;
    }
}

/* Mobile landscape adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #game-container {
        display: grid;
        grid-template-columns: 1fr 280px;
        grid-template-rows: auto 1fr;
        height: 100vh;
        overflow: hidden;
    }

    #hud {
        grid-column: 1 / -1;
        flex-direction: row;
        padding: 8px 12px;
    }

    #turn-info {
        font-size: 14px;
        padding: 6px 10px;
    }

    #resources {
        font-size: 12px;
        gap: 8px;
    }

    #game-controls button {
        padding: 8px 12px;
        font-size: 12px;
    }

    #game-board {
        height: auto;
        order: initial;
    }

    #info-panel {
        height: auto;
        order: initial;
        min-height: 0;
    }

    #tab-content {
        max-height: none;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    #game-container {
        padding: 5px;
        gap: 5px;
    }

    #hud {
        padding: 8px;
    }

    #turn-info {
        font-size: 14px;
        padding: 6px 10px;
        gap: 5px;
    }

    #resources {
        font-size: 12px;
        gap: 6px;
    }

    #resources span {
        padding: 2px 5px;
        font-size: 11px;
    }

    #game-controls button {
        padding: 8px 10px;
        font-size: 12px;
    }

    #game-board {
        height: 50vh;
        min-height: 300px;
        border-width: 2px;
    }

    #info-panel {
        border-width: 2px;
        min-height: 250px;
    }

    #tab-content {
        padding: 10px;
        font-size: 13px;
    }

    .tab-button {
        padding: 10px 3px;
        font-size: 11px;
    }

    #info-panel h3, #info-panel h4 {
        font-size: 16px;
    }

    #action-buttons button {
        padding: 12px;
        font-size: 14px;
    }

    .tech-item, .building-item {
        padding: 10px;
        font-size: 13px;
    }

    .tech-description, .building-description {
        font-size: 11px;
    }
}

/* Toast Notification System */
#toast-container {
    position: fixed;
    top: 120px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.98) 0%, rgba(15, 52, 96, 0.95) 100%);
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(74, 144, 226, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 500;
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 15px;
}

.toast-message {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

.toast.success {
    border-left: 4px solid #27ae60;
}

.toast.info {
    border-left: 4px solid #4a90e2;
}

.toast.warning {
    border-left: 4px solid #f39c12;
}

.toast.error {
    border-left: 4px solid #e74c3c;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(-400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-400px);
        opacity: 0;
    }
}

/* Enhanced Progress Bar */
#research-progress {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 8px;
    height: 28px;
    margin-top: 12px;
    padding: 3px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

#research-progress-bar {
    background: linear-gradient(90deg, #4a90e2 0%, #5ba3f5 50%, #4a90e2 100%);
    background-size: 200% 100%;
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: progressShine 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

#research-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressGlide 2s ease-in-out infinite;
}

@keyframes progressShine {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes progressGlide {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Touch-specific styles */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    #game-board:hover {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.05);
    }

    #map-canvas:hover {
        filter: none;
    }

    /* Increase tap target sizes */
    button, .tech-item, .building-item {
        min-height: 44px;
        min-width: 44px;
    }

    /* Disable problematic animations on touch */
    .tab-button:hover {
        transform: none;
    }

    #action-buttons button:hover {
        transform: none;
    }

    #toast-container {
        top: 80px;
        left: 10px;
        right: 10px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

.game-control-link {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 4px;
    color: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.civ-guide-page {
    min-height: 100vh;
    margin: 0;
    color: #f8fafc;
    background:
        radial-gradient(circle at 80% 12%, rgba(234, 179, 8, 0.2), transparent 28rem),
        linear-gradient(145deg, #292524, #0f172a 55%, #020617);
}

.civ-guide-shell {
    width: min(70rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 3rem 0 4rem;
}

.civ-guide-back,
.civ-guide-family a {
    color: #fde68a;
    font-weight: 700;
}

.civ-guide-kicker {
    margin: 3rem 0 0;
    color: #facc15;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.civ-guide-shell > h1 {
    max-width: 16ch;
    margin: 0.75rem 0 0;
    font-family: Georgia, serif;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    line-height: 0.98;
}

.civ-guide-lede {
    max-width: 48rem;
    margin: 1.5rem 0 0;
    color: #cbd5e1;
    font-size: 1.15rem;
    line-height: 1.75;
}

.civ-guide-play {
    display: inline-flex;
    margin-top: 1.8rem;
    padding: 0.9rem 1.2rem;
    border-radius: 0.5rem;
    color: #1c1917;
    background: #facc15;
    font-weight: 800;
    text-decoration: none;
}

.civ-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 3.5rem;
}

.civ-guide-grid article,
.civ-guide-note {
    padding: 1.4rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.8rem;
    background: rgba(15, 23, 42, 0.7);
}

.civ-guide-grid span {
    color: #facc15;
    font-size: 0.78rem;
    font-weight: 900;
}

.civ-guide-grid h2,
.civ-guide-note h2 {
    margin: 0.6rem 0 0;
}

.civ-guide-grid p,
.civ-guide-note p {
    margin-bottom: 0;
    color: #cbd5e1;
    line-height: 1.7;
}

.civ-guide-note {
    margin-top: 1rem;
}

.civ-guide-family {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 680px) {
    .civ-guide-grid {
        grid-template-columns: 1fr;
    }
}
