/* Cyberpunk Idle Game - CSS Styles */

/* Base Styles */
:root {
    --primary-color: #ff00ff;
    --secondary-color: #00ffff;
    --background-color: #0a0a0a;
    --panel-color: #1a1a1a;
    --text-color: #ffffff;
    --accent-color: #ff9900;
    --success-color: #00ff00;
    --danger-color: #ff0000;
    --neon-glow: 0 0 5px rgba(255, 0, 255, 0.7), 0 0 10px rgba(255, 0, 255, 0.5), 0 0 15px rgba(255, 0, 255, 0.3);
    --cyan-glow: 0 0 5px rgba(0, 255, 255, 0.7), 0 0 10px rgba(0, 255, 255, 0.5), 0 0 15px rgba(0, 255, 255, 0.3);
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Rajdhani', 'Orbitron', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Orbitron', 'Rajdhani', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0;
}

h1 {
    color: var(--primary-color);
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: var(--neon-glow);
}

h2 {
    color: var(--secondary-color);
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    text-shadow: var(--cyan-glow);
}

h3 {
    color: var(--accent-color);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.game-header {
    text-align: center;
    padding: 1rem 0;
    position: relative;
    z-index: 1;
}

.game-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

/* Resources Panel */
.resources-panel {
    background-color: var(--panel-color);
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    padding: 1rem;
    box-shadow: var(--neon-glow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Add indicator for scrolled state */
.resources-panel::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff9900'%3E%3Cpath d='M16,12V4H17V2H7V4H8V12L6,14V16H18V14L16,12M10,4H14V4H10V4M13.5,14.5H10.5V12.5H13.5V14.5Z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0;
    transition: all 0.3s ease;
}

.resources-panel.scrolled::after {
    transform: translateY(-50%) scale(1);
    opacity: 0.8;
}

/* Scrolled state styling */
.resources-panel.scrolled {
    border-radius: 0 0 5px 5px;
    padding: 0.5rem 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
    border-top: none;
    border-left: 1px solid var(--accent-color);
    border-right: 1px solid var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
}

/* Make the resources more compact when scrolled */
.resources-panel.scrolled .resources-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.resources-panel.scrolled h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.resources-panel.scrolled .resource-container {
    padding: 0.3rem;
}

.resources-panel.scrolled .resource-value {
    font-size: 1.2rem;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    transition: all 0.3s ease;
}

.resource-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.resource-container:hover {
    transform: translateY(-2px);
    box-shadow: var(--cyan-glow);
}

.resource-name {
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 0.3rem;
}

.resource-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 0.3rem;
}

.resource-rate {
    font-size: 0.8rem;
    color: var(--accent-color);
}

.operations-panel {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
    background-color: var(--panel-color);
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.operation-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    background-color: var(--panel-color);
    color: var(--text-color);
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--primary-color);
    min-width: 150px;
    text-align: center;
}

.operation-button:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
    transform: translateY(-2px);
    box-shadow: var(--neon-glow);
}

.operation-button:active {
    transform: translateY(1px);
}

.tabs-container {
    display: flex;
    flex-direction: column;
    background-color: var(--panel-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background-color: rgba(0, 0, 0, 0.3);
}

.tab {
    padding: 0.8rem 1.5rem;
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-grow: 1;
    text-align: center;
    border-bottom: 2px solid transparent;
}

.tab:hover {
    background-color: rgba(255, 0, 255, 0.1);
}

.tab.active {
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.tab-content {
    padding: 1.5rem;
    display: none;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
}

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

/* Specific sizes for tech tree and territories tabs */
#techTree-tab, #territories-tab {
    max-height: 85vh;
    padding-bottom: 2rem;
}

/* Upgrades */
.upgrades-list, .research-list, .districts-list, .operations-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.upgrade-item, .research-item, .district-item, .operation-item {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.upgrade-item:hover, .research-item:hover, .district-item:hover, .operation-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--cyan-glow);
}

.upgrade-item h3, .research-item h3, .district-item h3, .operation-item h3 {
    color: var(--secondary-color);
    margin-top: 0;
}

.upgrade-item p, .research-item p, .district-item p, .operation-item p {
    margin: 0.5rem 0;
}

.upgrade-item button, .research-item button, .district-item button, .operation-item button {
    background-color: var(--panel-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    transition: all 0.3s ease;
    width: 100%;
}

.upgrade-item button:hover, .research-item button:hover, .district-item button:hover, .operation-item button:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
    box-shadow: var(--neon-glow);
}

.upgrade-item button:disabled, .research-item button:disabled, .district-item button:disabled, .operation-item button:disabled {
    background-color: #333;
    color: #666;
    border-color: #444;
    cursor: not-allowed;
    box-shadow: none;
}

.upgrade-item button.active, .district-item button.active {
    background-color: var(--success-color);
    color: var(--background-color);
    border-color: var(--success-color);
}

/* Log */
.log-panel {
    background-color: var(--panel-color);
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    padding: 1rem;
    margin-top: 1rem;
    position: relative;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.log-container {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 0.5rem;
    height: 150px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.log-entry {
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.log-time {
    color: var(--accent-color);
    margin-right: 0.5rem;
}

/* Achievements */
.achievements-button {
    background-color: var(--panel-color);
    color: var(--text-color);
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 1rem;
    display: block;
    width: 100%;
    text-align: center;
}

.achievements-button:hover {
    background-color: var(--accent-color);
    color: var(--background-color);
    box-shadow: 0 0 5px rgba(255, 153, 0, 0.7), 0 0 10px rgba(255, 153, 0, 0.5);
}

/* Prestige Button */
.prestige-button {
    background-color: var(--panel-color);
    color: var(--text-color);
    border: 1px solid #9b59b6;
    border-radius: 5px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 1rem;
    display: block;
    width: 100%;
    text-align: center;
}

.prestige-button:hover {
    background-color: #9b59b6;
    color: var(--background-color);
    box-shadow: 0 0 5px rgba(155, 89, 182, 0.7), 0 0 10px rgba(155, 89, 182, 0.5);
}

/* Attack GigaCorp button styling */
.prestige-button.attack-ready {
    background-color: var(--panel-color);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.prestige-button.attack-ready:hover {
    background-color: var(--danger-color);
    color: var(--background-color);
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.7), 0 0 10px rgba(255, 0, 0, 0.5);
}

.attack-stats {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--danger-color);
    border-radius: 5px;
    padding: 0.8rem;
    margin: 1rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.attack-stats span {
    display: block;
}

.attack-button {
    background-color: var(--danger-color) !important;
    color: white !important;
    font-size: 1.2rem !important;
    padding: 0.8rem 1.5rem !important;
    margin-top: 1rem !important;
    width: 100% !important;
}

.achievements-section {
    background-color: var(--panel-color);
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    padding: 1rem;
    margin-top: 1rem;
    display: none;
}

.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.achievement-item {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.achievement-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 5px rgba(255, 153, 0, 0.7), 0 0 10px rgba(255, 153, 0, 0.5);
}

.achievement-item h3 {
    color: var(--accent-color);
    margin-top: 0;
}

.achievement-notification {
    position: fixed;
    top: 20px;
    right: -300px;
    width: 250px;
    background-color: var(--panel-color);
    border: 2px solid var(--accent-color);
    border-radius: 5px;
    padding: 1rem;
    box-shadow: 0 0 10px rgba(255, 153, 0, 0.7);
    transition: right 0.5s ease;
    z-index: 1000;
}

.achievement-notification.show {
    right: 20px;
}

.achievement-notification h3 {
    color: var(--accent-color);
    margin-top: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    
    /* Add flexbox alignment to center content */
    display: none; /* Will be set to flex when shown */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--panel-color);
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--neon-glow);
    position: relative; /* Important for positioning within flexbox */
    margin: 0 auto; /* For older browsers */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    color: var(--primary-color);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal button {
    background-color: var(--panel-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    margin-right: 0.5rem;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    transition: all 0.3s ease;
}

.modal button:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
    box-shadow: var(--neon-glow);
}

/* Visual Effects */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.grid-line {
    position: absolute;
    background-color: rgba(0, 255, 255, 0.1);
}

.grid-line.horizontal {
    width: 100%;
    height: 1px;
}

.grid-line.vertical {
    height: 100%;
    width: 1px;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.03) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 100% 4px;
    z-index: -1;
    pointer-events: none;
}

.digital-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    pointer-events: none;
}

.neon-glow {
    text-shadow: var(--neon-glow);
}

.neon-button {
    position: relative;
    overflow: hidden;
}

.neon-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 0, 255, 0.2),
        transparent
    );
    transition: left 0.7s ease;
}

.neon-button:hover::before {
    left: 100%;
}

/* Animations */
.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 255, 0);
    }
}

.hover-animation {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-animation:hover {
    transform: translateY(-5px);
    box-shadow: var(--cyan-glow);
}

/* Particles */
.particle {
    position: absolute;
    font-weight: bold;
    pointer-events: none;
    z-index: 1000;
}

.credit-particle {
    color: #ffcc00;
}

.data-particle {
    color: #00ffff;
}

.energy-particle {
    color: #00ff00;
}

.reputation-particle {
    color: #ff00ff;
}

.click-explosion {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%);
    animation: explode 1s forwards;
    pointer-events: none;
    z-index: 1000;
}

.click-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1000;
}

@keyframes explode {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch-before, .glitch-after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch-before {
    color: #0ff;
    z-index: -1;
    animation: glitch-animation 0.3s infinite;
}

.glitch-after {
    color: #f0f;
    z-index: -2;
    animation: glitch-animation 0.3s infinite reverse;
}

@keyframes glitch-animation {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.glitch-text {
    animation: glitch-text 0.5s linear;
}

@keyframes glitch-text {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    10% {
        opacity: 0.8;
        transform: translateX(-2px);
    }
    20% {
        opacity: 1;
        transform: translateX(2px);
    }
    30% {
        opacity: 0.8;
        transform: translateX(-2px);
    }
    40% {
        opacity: 1;
        transform: translateX(2px);
    }
    50% {
        opacity: 0.8;
        transform: translateX(-2px);
    }
    60% {
        opacity: 1;
        transform: translateX(2px);
    }
    70% {
        opacity: 0.8;
        transform: translateX(-2px);
    }
    80% {
        opacity: 1;
        transform: translateX(2px);
    }
    90% {
        opacity: 0.8;
        transform: translateX(-2px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Terminal Effect */
.terminal {
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--secondary-color);
    font-family: 'Courier New', monospace;
    color: #0f0;
    padding: 0.5rem;
    position: relative;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background-color: #0f0;
    animation: blink 1s infinite;
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* Data Flow Effect */
.data-flow {
    position: fixed;
    width: 2px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--secondary-color), transparent);
    animation: data-flow 1s linear;
    pointer-events: none;
    z-index: -1;
}

@keyframes data-flow {
    0% {
        height: 0;
        opacity: 1;
    }
    100% {
        height: 100vh;
        opacity: 0;
    }
}

/* Cooldown display */
.cooldown {
    background-color: rgba(255, 0, 0, 0.2);
    color: var(--danger-color);
    padding: 0.3rem;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Responsive Design */
/* Tablet Breakpoint */
@media (max-width: 1024px) {
    .container {
        padding: 0.75rem;
        max-width: 100%;
    }
    
    .resources-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    .upgrades-list, .research-list, .districts-list, .operations-list, .achievements-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .tech-tree-container-layout {
        height: auto;
        min-height: 600px;
    }
    
    .tech-info-panel, .territory-info-panel {
        width: 280px;
    }
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
        max-width: 100%;
    }
    
    .resources-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .upgrades-list, .research-list, .districts-list, .operations-list, .achievements-list {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .tabs-header {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .tab {
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 44px;
        flex: 1 1 auto;
        min-width: 120px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .operation-button {
        min-width: 120px;
        min-height: 44px;
        font-size: 0.9rem;
        padding: 0.75rem;
    }
    
    /* Tech Tree Mobile Improvements */
    .tech-tree-container-layout {
        flex-direction: column;
        height: auto;
        min-height: 500px;
    }
    
    .tech-tree-container {
        height: 500px;
        width: 100%;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1.5rem;
    }
    
    .tech-info-panel {
        width: 100%;
        max-height: none;
        margin-top: 1rem;
    }
    
    /* Territory Mobile Improvements */
    .city-map-container {
        flex-direction: column;
        height: auto;
        min-height: 500px;
    }
    
    .city-map {
        height: 500px;
        width: 100%;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .territory-info-panel {
        width: 100%;
        max-height: none;
        margin-top: 1rem;
    }
    
    /* Tech nodes and territories responsive sizing */
    .tech-node {
        width: 110px;
        height: 110px;
        padding: 0.5rem;
    }
    
    .tech-node-icon {
        font-size: 1.5rem;
    }
    
    .tech-node-name {
        font-size: 0.85rem;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }
    
    .tech-node-desc {
        font-size: 0.7rem;
        line-height: 1.2;
        max-height: 32px;
    }
    
    .territory-location {
        width: 65px;
        height: 65px;
    }
    
    .territory-location:before {
        width: 80px;
        height: 80px;
    }
    
    .territory-location-icon {
        font-size: 22px;
    }
    
    .territory-location-name {
        font-size: 0.85rem;
        bottom: -28px;
        padding: 0.25rem 0.5rem;
        white-space: normal;
        text-align: center;
        max-width: 120px;
    }
    
    /* Dialogue system mobile adjustments */
    .dialogue-box {
        width: 95%;
        bottom: 10px;
        max-height: 90vh;
    }
    
    .dialogue-content {
        flex-direction: column;
    }
    
    .dialogue-portrait {
        margin-right: 0;
        margin-bottom: 10px;
        align-self: center;
        width: 180px;
        height: 180px;
    }
    
    .dialogue-text {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    /* iOS specific scrolling fixes */
    .tech-tree-container, .city-map, .tab-content {
        /* overflow-scrolling is not a standard property, using only -webkit prefix */
        -webkit-overflow-scrolling: touch;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
    
    /* Improved touch targets */
    button, 
    .operation-button,
    .territory-button,
    .tech-button,
    .choice-btn,
    .modal-close,
    .dialogue-close {
        min-height: 44px;
        padding: 0.75rem;
    }
    
    /* Improved form controls */
    input[type="text"],
    input[type="number"],
    select {
        min-height: 44px;
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    /* Improved spacing */
    .game-content {
        gap: 0.75rem;
    }
    
    .resources-panel {
        padding: 0.75rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
}

/* Small Screen Breakpoint */
@media (max-width: 480px) {
    /* Typography adjustments */
    h1 {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }
    
    h2 {
        font-size: 1.4rem;
        margin-bottom: 0.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    p {
        font-size: 0.95rem;
        line-height: 1.4;
    }
    
    /* Layout adjustments */
    .container {
        padding: 0.5rem;
    }
    
    .game-content {
        gap: 0.5rem;
    }
    
    /* Grid adjustments */
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .resource-container {
        padding: 0.5rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .resource-value {
        font-size: 1.2rem;
        margin: 0;
    }
    
    .resource-rate {
        font-size: 0.8rem;
    }
    
    /* Button and control adjustments */
    .operation-button {
        width: 100%;
        margin-bottom: 0.5rem;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .tab {
        padding: 0.5rem;
        font-size: 0.85rem;
        min-width: 90px;
    }
    
    /* Tech Tree & Territories compact layout */
    .tech-tree-container {
        height: 400px;
        padding: 0.75rem;
    }
    
    .city-map {
        height: 400px;
    }
    
    .tech-node {
        width: 90px;
        height: 90px;
        padding: 0.4rem;
    }
    
    .tech-node-icon {
        font-size: 1.2rem;
    }
    
    .tech-node-name {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    .tech-node-desc {
        font-size: 0.65rem;
        max-height: 24px;
    }
    
    .territory-location {
        width: 55px;
        height: 55px;
    }
    
    .territory-location:before {
        width: 65px;
        height: 65px;
    }
    
    .territory-location-icon {
        font-size: 18px;
    }
    
    .territory-location-name {
        font-size: 0.75rem;
        bottom: -24px;
        max-width: 100px;
    }
    
    /* Modal improvements */
    .modal-content {
        width: 95%;
        padding: 0.75rem;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 0.5rem;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    /* Dialogue system adjustments */
    .dialogue-box {
        width: 98%;
        bottom: 5px;
    }
    
    .dialogue-portrait {
        width: 140px;
        height: 140px;
    }
    
    .dialogue-text {
        font-size: 0.9rem;
    }
    
    .choice-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
    
    /* Stats and info panels */
    .attack-stats,
    .territory-status,
    .tech-status {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    /* Tab content adjustments */
    #techTree-tab, 
    #territories-tab,
    .tab-content {
        padding: 0.75rem 0.5rem;
    }
    
    /* Form controls */
    input[type="text"],
    input[type="number"],
    select {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Mission system adjustments */
    .mission-item {
        padding: 0.75rem;
    }
    
    .mission-header h4 {
        font-size: 1rem;
    }
    
    .mission-description {
        font-size: 0.85rem;
    }
    
    /* Achievement adjustments */
    .achievement-notification {
        width: 90%;
        right: 5%;
    }
}

/* Touch device improvements */
@media (hover: none) {
    /* Enhanced touch feedback */
    .tech-node, 
    .territory-location,
    .operation-button,
    .territory-button,
    .tech-button,
    .tab,
    .modal-close,
    .dialogue-close,
    .choice-btn {
        transition: transform 0.2s ease, background-color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .tech-node:active, 
    .territory-location:active {
        transform: scale(1.05);
        opacity: 0.8;
    }
    
    .operation-button:active,
    .territory-button:active,
    .tech-button:active,
    .tab:active,
    .choice-btn:active {
        transform: scale(0.98);
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Disable hover effects that might interfere with touch */
    .tech-node:hover,
    .territory-location:hover,
    .operation-button:hover,
    .territory-button:hover,
    .tech-button:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Improved touch scrolling */
    .tech-tree-container,
    .city-map,
    .tab-content,
    .modal-content,
    .dialogue-box {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        overscroll-behavior: contain;
    }
    
    /* Prevent text selection during touch interactions */
    .tech-node-name,
    .territory-location-name,
    .operation-button,
    .tab,
    .modal-title,
    .dialogue-text {
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Larger touch targets */
    .tab, 
    .operation-button, 
    .territory-button, 
    .tech-button,
    .modal-close,
    .dialogue-close,
    .choice-btn {
        min-height: 48px; /* Slightly larger than Apple's recommendation */
        padding: 0.75rem 1rem;
    }
    
    /* Improved form controls for touch */
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        min-height: 48px;
        padding: 0.75rem;
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: 8px; /* Larger radius for better touch feel */
    }
    
    /* Enhanced scrollbars for touch */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    ::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.3);
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-track {
        background-color: rgba(0, 0, 0, 0.2);
    }
    
    /* Improved touch feedback for resource containers */
    .resource-container:active {
        transform: scale(0.98);
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    /* Better touch area for close buttons */
    .modal-close,
    .dialogue-close {
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }
}

/* Help icon styling */
.help-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: var(--accent-color);
    color: var(--background-color);
    border-radius: 50%;
    text-align: center;
    font-size: 10px;
    line-height: 14px;
    margin-left: 3px;
    cursor: help;
    font-weight: bold;
}

/* Prestige Button - Attack styling */
.prestige-button.attack-ready {
    background-color: var(--panel-color);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prestige-button.attack-ready:hover {
    background-color: var(--danger-color);
    color: var(--background-color);
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.7), 0 0 10px rgba(255, 0, 0, 0.5);
    transform: scale(1.05);
}

/* Attack GigaCorp Button */
.attack-gigacorp-button {
    background-color: var(--danger-color);
    color: white;
    border: 2px solid #ff3333;
    border-radius: 5px;
    padding: 0.8rem 1.5rem;
    margin: 1rem 0;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    width: 100%;
    text-align: center;
    transition: all 0.3s ease;
    animation: pulse-danger 2s infinite;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.attack-gigacorp-button:hover {
    background-color: #ff3333;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 0 30px rgba(255, 0, 0, 0.4);
    transform: scale(1.05);
}

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

/* Attack info dialog styles */
.attack-info {
    text-align: left;
}

.attack-info h3 {
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 5px;
    margin-top: 15px;
}

.attack-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    border: 1px solid var(--danger-color);
}

.stat-label {
    color: var(--accent-color);
    font-weight: bold;
}

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

.attack-warning {
    color: var(--danger-color);
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
    font-size: 1.1em;
}

.attack-button {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    margin-right: 10px;
    font-size: 1.1em;
}

.cancel-button {
    background-color: var(--panel-color);
    color: var(--text-color);
    border: 1px solid var(--text-color);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

/* Dialogue System */
.dialogue-box {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 800px;
    background-color: var(--panel-color);
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    z-index: 1010; /* Higher than modal */
    overflow: hidden;
    animation: dialogue-appear 0.3s ease-out;
}

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

.dialogue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--secondary-color);
}

#dialogue-character-name {
    color: var(--secondary-color);
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.1rem;
}

.dialogue-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.dialogue-close:hover {
    color: var(--danger-color);
}

.dialogue-content {
    display: flex;
    padding: 15px;
}

.dialogue-portrait {
    flex: 0 0 150px;
    height: 150px;
    margin-right: 15px;
    border: 1px solid var(--accent-color);
    background-color: rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

#dialogue-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.dialogue-portrait img:hover {
    transform: scale(1.02);
}

.dialogue-text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#dialogue-text {
    flex: 1;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    line-height: 1.5;
    margin: 0 0 15px 0;
    color: var(--text-color);
    min-height: 80px;
}

.dialogue-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialogue-next-button, .dialogue-skip-button {
    padding: 5px 15px;
    border: 1px solid var(--secondary-color);
    background-color: var(--panel-color);
    color: var(--text-color);
    border-radius: 3px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dialogue-next-button:hover {
    background-color: var(--secondary-color);
    color: var(--background-color);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.dialogue-skip-button:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: var(--text-color);
}

.dialogue-typing {
    border-right: 2px solid var(--accent-color);
    animation: dialogue-cursor 0.8s infinite;
}

@keyframes dialogue-cursor {
    from {
        border-right-color: transparent;
    }
    to {
        border-right-color: var(--accent-color);
    }
}

/* City Map Styles */
.city-map-container {
    display: flex;
    height: 700px;
    margin-top: 1rem;
    gap: 1rem;
}

.city-map {
    flex: 1;
    height: 100%;
    background-color: var(--panel-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
    background-image: url('images/map.png');
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 50px rgba(0, 255, 255, 0.2);
    /* Enable pinch-to-zoom on touch devices */
    touch-action: pinch-zoom;
    -ms-touch-action: pinch-zoom;
}

/* Add overlay for better visibility of territory nodes */
.city-map::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 0;
    pointer-events: none;
}

/* Ensure territory elements appear above the overlay */
.territory-location, .territory-connection {
    position: absolute;
    z-index: 1;
}

.territory-location {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
    border: 3px solid;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.territory-location:before {
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid;
    opacity: 0.7;
    animation: pulse 2s infinite;
}

.territory-location.locked {
    border-color: #444;
    color: #888;
    box-shadow: 0 0 10px rgba(50, 50, 50, 0.5);
}

.territory-location.locked:before {
    border-color: #444;
}

.territory-location.unlockable {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 153, 0, 0.4);
}

.territory-location.unlockable:before {
    border-color: var(--accent-color);
}

.territory-location.unlocked {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.6);
}

.territory-location.unlocked:before {
    border-color: var(--primary-color);
}

.territory-location.active {
    border-color: var(--success-color);
    color: var(--success-color);
    box-shadow: 0 0 20px var(--success-color), 0 0 30px rgba(0, 255, 0, 0.4);
}

.territory-location.active:before {
    border-color: var(--success-color);
    animation: pulse 1.5s infinite;
}

.territory-location:hover, .territory-location.selected {
    transform: translate(-50%, -50%) scale(1.15);
    z-index: 3;
}

.territory-location-icon {
    font-size: 28px;
}

.territory-location-name {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--secondary-color);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
    text-shadow: 0 0 3px rgba(0, 255, 255, 0.8);
    letter-spacing: 0.5px;
    z-index: 5;
}

.territory-location.locked .territory-location-name {
    border-color: #444;
    box-shadow: none;
    text-shadow: none;
}

.territory-location.unlockable .territory-location-name {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(255, 153, 0, 0.4);
    text-shadow: 0 0 3px rgba(255, 153, 0, 0.8);
}

.territory-location.unlocked .territory-location-name {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
    text-shadow: 0 0 3px rgba(255, 0, 255, 0.8);
}

.territory-location.active .territory-location-name {
    border-color: var(--success-color);
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.8);
}

.territory-connection {
    position: absolute;
    background-color: rgba(0, 255, 255, 0.3);
    opacity: 0.5;
    transform-origin: 0 0;
    height: 3px;
    z-index: 0;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.territory-connection.unlocked {
    background-color: rgba(255, 0, 255, 0.5);
    opacity: 0.7;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.4);
}

.territory-connection.active {
    background-color: rgba(0, 255, 0, 0.6);
    opacity: 0.8;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.5);
}

/* Territory relationship styles */
.territory-location.player-controlled {
    border-color: #38b6ff;
}

.territory-location.ally-controlled {
    border-color: #4CAF50;
}

.territory-location.enemy-controlled {
    border-color: #f44336;
}

.territory-location.neutral-controlled {
    border-color: #ffffff;
}

.territory-location.player-controlled .territory-location-icon {
    background-color: rgba(56, 182, 255, 0.3);
}

.territory-location.ally-controlled .territory-location-icon {
    background-color: rgba(76, 175, 80, 0.3);
}

.territory-location.enemy-controlled .territory-location-icon {
    background-color: rgba(244, 67, 54, 0.3);
}

.territory-location.neutral-controlled .territory-location-icon {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Territory control text styles */
.territory-control {
    margin: 8px 0;
}

.player-controlled {
    color: #38b6ff;
    font-weight: bold;
}

.ally-controlled {
    color: #4CAF50;
    font-weight: bold;
}

.enemy-controlled {
    color: #f44336;
    font-weight: bold;
}

.neutral-controlled {
    color: #dddddd;
    font-weight: bold;
}

/* Territory Info Panel */
.territory-info-panel {
    width: 300px;
    padding: 1rem;
    background-color: var(--panel-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    max-height: 700px;
    overflow-y: auto;
}

.territory-info-panel h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.territory-status {
    margin: 0.5rem 0;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
}

#territory-status-value {
    font-weight: bold;
}

#territory-status-value.locked {
    color: #888;
}

#territory-status-value.unlockable {
    color: var(--accent-color);
}

#territory-status-value.unlocked {
    color: var(--primary-color);
}

#territory-status-value.active {
    color: var(--success-color);
}

.territory-button {
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    border: none;
    border-radius: 5px;
    background-color: var(--panel-color);
    color: var(--text-color);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.territory-button.unlock {
    border: 1px solid var(--accent-color);
}

.territory-button.unlock:hover:not(:disabled) {
    background-color: var(--accent-color);
    color: var(--background-color);
}

.territory-button.activate {
    border: 1px solid var(--success-color);
}

.territory-button.activate:hover:not(:disabled) {
    background-color: var(--success-color);
    color: var(--background-color);
}

.territory-button.deactivate {
    border: 1px solid var(--danger-color);
}

.territory-button.deactivate:hover:not(:disabled) {
    background-color: var(--danger-color);
    color: var(--background-color);
}

.formula {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 5px;
    font-family: 'Orbitron', monospace;
    color: var(--accent-color);
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
    margin: 15px 0;
}

/* Tech Tree Visualization */
.tech-tree-container-layout {
    display: flex;
    height: 1500px; /* Maximum height for extreme spacing */
    margin-top: 1rem;
    gap: 1rem;
}

.tech-tree-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 50px; /* Maximum padding to keep nodes away from edges */
    overflow: auto;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
        repeating-linear-gradient(0deg, rgba(0, 255, 255, 0.1), rgba(0, 255, 255, 0.1) 1px, transparent 1px, transparent 30px),
        repeating-linear-gradient(90deg, rgba(0, 255, 255, 0.1), rgba(0, 255, 255, 0.1) 1px, transparent 1px, transparent 30px);
    box-shadow: inset 0 0 50px rgba(0, 255, 255, 0.2);
    /* Enable pinch-to-zoom on touch devices */
    touch-action: pinch-zoom;
    -ms-touch-action: pinch-zoom;
}

.tech-info-panel {
    width: 300px;
    padding: 1rem;
    background-color: var(--panel-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    max-height: 700px;
    overflow-y: auto;
}

.tech-info-panel h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.tech-status {
    margin: 0.5rem 0;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
}

#tech-status-value {
    font-weight: bold;
}

#tech-status-value.locked {
    color: #888;
}

#tech-status-value.available {
    color: var(--accent-color);
}

#tech-status-value.completed {
    color: var(--success-color);
}

.tech-button {
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    border: none;
    border-radius: 5px;
    background-color: var(--panel-color);
    color: var(--text-color);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--secondary-color);
}

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

.tech-button:hover:not(:disabled) {
    background-color: var(--secondary-color);
    color: var(--background-color);
}

/* Old tech detail panel styles to be removed or modified */
.tech-detail-panel {
    display: none; /* Hide old panel */
}

/* Tech node styles updated to support connection points */
.tech-node {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 10px;
    background-color: var(--panel-color);
    border: 2px solid var(--secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    overflow: hidden;
    transform: translate(-50%, -50%); /* Ensures node is centered on its position coordinates */
}

.tech-node:hover {
    /* Remove transform that causes movement */
    /* transform: scale(1.1); */
    /* Instead just enhance the glow effect */
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.7);
    border-color: #00ffff;
    animation: pulse-tech-node 2s infinite;
}

@keyframes pulse-tech-node {
    0% {
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 255, 255, 0.7);
    }
    100% {
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    }
}

.tech-node.completed {
    border-color: var(--success-color);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

.tech-node.available {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 153, 0, 0.4);
}

.tech-node.locked {
    border-color: var(--panel-color);
    opacity: 0.7;
    filter: grayscale(70%);
}

.tech-node-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.tech-node.completed .tech-node-name {
    color: var(--success-color);
}

.tech-node-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.tech-node-desc {
    font-size: 0.7rem;
    margin-bottom: 5px;
    max-height: 40px;
    overflow: hidden;
}

/* Tech connection lines - updated for simplicity and visibility */
.tech-connection {
    position: absolute;
    background-color: var(--secondary-color);
    height: 8px; /* Much thicker line */
    transform-origin: 0 0;
    opacity: 0.7; /* Slightly transparent */
    z-index: 1; /* Behind nodes */
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
    pointer-events: none;
    /* Center the line on the start position */
    transform-origin: 0 50%;
    margin-top: -4px; /* Half the height to center it */
}

.tech-connection.completed {
    background-color: var(--success-color);
    opacity: 0.8;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.7);
    height: 10px; /* Even thicker for completed */
    margin-top: -5px; /* Half the height to center it */
}

/* Additional helper class for connection points */
.tech-node-connection-point {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: transparent;
    border-radius: 50%;
    z-index: 2;
    /* Enable these for easier debugging of connection points */
    /*
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid #fff;
    */
}

.tech-node-connection-point.input {
    top: 50%;
    left: -3px;
    transform: translateY(-50%);
}

.tech-node-connection-point.output {
    top: 50%;
    right: -3px;
    transform: translateY(-50%);
}

.tech-node-connection-point.top {
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
}

.tech-node-connection-point.bottom {
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    .container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile Floating Action Buttons */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    line-height: 60px;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 100;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-fab:active {
    transform: scale(0.95);
}

.mobile-fab.info {
    bottom: 90px;
    background-color: var(--secondary-color);
}

@media (max-width: 768px) {
    .mobile-fab {
        display: block;
    }
}

/* Debug Panel Styles */
.debug-panel {
    background-color: var(--panel-color);
    border: 1px solid #ff5500;
    border-radius: 5px;
    margin: 1rem 0;
    overflow: hidden;
    display: none; /* Hidden by default */
}

.debug-header {
    background-color: rgba(255, 85, 0, 0.2);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #ff5500;
}

.debug-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 0.9rem;
    color: #ff5500;
    background-color: rgba(0, 0, 0, 0.5);
}

.debug-refresh-button {
    background-color: #ff5500;
    color: #000;
    border: none;
    border-radius: 3px;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
}

.debug-refresh-button:hover {
    background-color: #ff7730;
}

.debug-toggle-button {
    background-color: var(--panel-color);
    color: #ff5500;
    border: 1px solid #ff5500;
    border-radius: 3px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    display: block;
    margin: 0.5rem 0;
    transition: all 0.3s ease;
}

.debug-toggle-button:hover {
    background-color: rgba(255, 85, 0, 0.2);
}

.debug-item {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 85, 0, 0.3);
}

.debug-item-key {
    font-weight: bold;
    color: #ff7730;
}

.debug-item-value {
    margin-left: 1rem;
    word-break: break-word;
}

.debug-object {
    margin-left: 1rem;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(255, 85, 0, 0.3);
}

/* Mission Dialogue System */
#mission-dialogue-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.mission-dialogue-box {
    width: 80%;
    max-width: 900px;
    background-color: #1a1a2e;
    border: 2px solid #4a4a69;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 255, 0.3);
    overflow: hidden;
    animation: dialogue-appear 0.3s ease-out;
}

.mission-dialogue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #2a2a3e;
    border-bottom: 1px solid #4a4a69;
}

.faction-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.faction-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #aaa;
    margin-bottom: 3px;
}

.npc-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 5px rgba(120, 120, 255, 0.5);
    margin-bottom: 3px;
}

.npc-title {
    font-size: 1rem;
    font-style: italic;
    color: #ccc;
}

.mission-dialogue-content {
    display: flex;
    padding: 25px;
    gap: 25px;
}

.npc-portrait {
    flex: 0 0 240px;
    height: 320px;
    border: 3px solid #5c5c8a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(92, 92, 138, 0.5);
    background-color: #000;
}

.npc-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.npc-portrait img:hover {
    transform: scale(1.02);
}

.dialogue-right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.npc-text {
    font-size: 1.1rem;
    line-height: 1.5;
    color: #eee;
    margin-bottom: 25px;
}

/* ShillZ faction specific styling */
.faction-shillz .mission-dialogue-box {
    border-color: #00c2cb;
    box-shadow: 0 0 25px rgba(0, 194, 203, 0.3);
}

.faction-shillz .npc-portrait {
    border-color: #00c2cb;
    box-shadow: 0 0 15px rgba(0, 194, 203, 0.5);
}

.faction-shillz .npc-name {
    color: #00e5ff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

.faction-shillz .faction-label {
    color: #00c2cb;
}

.faction-shillz .mission-dialogue-header,
.faction-shillz .choice-btn:hover {
    background-color: #183638;
}

@media (max-width: 768px) {
    .mission-dialogue-box {
        width: 95%;
        max-width: none;
    }
    
    .mission-dialogue-content {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }
    
    .npc-portrait {
        width: 180px;
        height: 240px;
        margin: 0 auto;
    }
    
    .npc-name {
        font-size: 1.2rem;
    }
    
    .npc-text,
    .npc-response {
        font-size: 0.9rem;
    }
    
    .choice-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* Faction Card Styles */
.faction-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.faction-card {
    background-color: #1a1a2e;
    border: 2px solid #4a4a69;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}

.faction-card:hover {
    transform: translateY(-5px);
}

.faction-card.ally {
    border-color: #2ecc71;
}

.faction-card.friendly {
    border-color: #27ae60;
}

.faction-card.neutral {
    border-color: #3498db;
}

.faction-card.unfriendly {
    border-color: #e67e22;
}

.faction-card.hostile {
    border-color: #e74c3c;
}

.faction-header {
    margin-bottom: 15px;
    border-bottom: 1px solid #4a4a69;
    padding-bottom: 10px;
}

.faction-header h3 {
    margin: 0 0 5px 0;
    color: #ffffff;
}

.faction-standing {
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.faction-standing.ally {
    background-color: rgba(46, 204, 113, 0.3);
    color: #2ecc71;
}

.faction-standing.friendly {
    background-color: rgba(39, 174, 96, 0.3);
    color: #27ae60;
}

.faction-standing.neutral {
    background-color: rgba(52, 152, 219, 0.3);
    color: #3498db;
}

.faction-standing.unfriendly {
    background-color: rgba(230, 126, 34, 0.3);
    color: #e67e22;
}

.faction-standing.hostile {
    background-color: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.faction-contact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.contact-name {
    font-size: 0.9rem;
    color: #cccccc;
}

.contact-button {
    background-color: #2a2a4a;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.contact-button:hover {
    background-color: #3a3a6a;
}

.faction-message {
    min-height: 60px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #dddddd;
}

/* Randomizer UI Styles */
.randomizer-ui {
    background-color: #1a1a2e;
    border: 2px solid #4a4a69;
    border-radius: 8px;
    padding: 20px;
    max-width: 800px;
    margin: 20px auto;
    box-shadow: 0 0 15px rgba(0, 0, 255, 0.2);
}

.randomizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #4a4a69;
    padding-bottom: 10px;
}

.randomizer-header h3 {
    margin: 0;
    color: #7f7fff;
}

.randomizer-seed {
    font-family: monospace;
    background-color: #2a2a4a;
    padding: 4px 8px;
    border-radius: 4px;
    color: #00ff66;
}

.randomizer-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.randomizer-section {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 12px;
}

.randomizer-section h4 {
    margin-top: 0;
    color: #5f5fff;
    border-bottom: 1px solid #3a3a59;
    padding-bottom: 5px;
}

.randomizer-item {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

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

.randomizer-button {
    background-color: #3a3a6a;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.randomizer-button:hover {
    background-color: #4a4a8a;
}

.randomizer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.randomizer-table th, 
.randomizer-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #3a3a59;
}

.randomizer-table th {
    color: #7f7fff;
    font-weight: 500;
}

.faction-ally {
    color: #4ade80;
}

.faction-rival {
    color: #f87171;
}

.mutator-item {
    background-color: rgba(40, 40, 80, 0.4);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
}

.mutator-name {
    font-weight: 500;
    color: #f59e0b;
}

.mutator-description {
    font-size: 0.85rem;
    color: #d1d5db;
    margin-top: 4px;
}

.close-dialogue-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    padding: 0 10px;
    transition: color 0.2s;
}

.close-dialogue-btn:hover {
    color: #fff;
}

.player-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    background-color: #2a2a4e;
    color: #fff;
    border: 1px solid #4a4a7a;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    transition: all 0.2s;
    position: relative;
}

.choice-btn:hover {
    background-color: #3a3a6e;
    transform: translateY(-2px);
}

.npc-response {
    margin-top: 25px;
    padding: 15px;
    background-color: #2a2a4e;
    border-radius: 8px;
    border-left: 4px solid #6a6a9a;
    color: #eee;
    font-size: 1.1rem;
    line-height: 1.5;
}

.continue-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #3a3a6e;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    float: right;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.continue-btn:hover {
    background-color: #4a4a8e;
}

.faction-shillz .continue-btn {
    background-color: #006064;
}

.faction-shillz .continue-btn:hover {
    background-color: #00838f;
}

.dialogue-portrait-animated {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/Turing_portrait.png');
    background-size: cover;
    animation: portrait-talk 0.5s steps(4) infinite;
}

@keyframes portrait-talk {
    from {
        background-position: 0 0;
    }
    to {
        background-position: -600px 0; /* Adjust based on spritesheet */
    }
}

/* Audio Controls */
.audio-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
}

.audio-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.audio-button:hover {
    background-color: rgba(0, 0, 255, 0.2);
    transform: scale(1.1);
}

.audio-button.muted {
    color: var(--danger-color);
}

/* Multiplier Button Styling */
.multiplier-button {
    background-color: rgba(255, 153, 0, 0.3) !important;
    border: 1px solid var(--accent-color) !important;
    position: relative;
    animation: pulse-multiplier 2s infinite;
    font-weight: bold;
}

.multiplier-button:hover {
    background-color: var(--accent-color) !important;
    box-shadow: 0 0 5px var(--accent-color), 0 0 10px var(--accent-color);
    border-color: white !important;
    color: black !important;
}

.multiplier-hint {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-left: 0.5rem;
    font-style: italic;
    animation: fade-in-out 2s infinite;
}

@keyframes pulse-multiplier {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 153, 0, 0.4);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(255, 153, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 153, 0, 0);
    }
}

@keyframes fade-in-out {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Mission System Styles */
.mission-section-header {
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 5px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.mission-item {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    transition: all 0.3s ease;
}

.mission-item:hover {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.mission-item.mission-in-progress {
    border-color: var(--primary-color);
    background-color: rgba(255, 0, 255, 0.1);
}

.mission-item.mission-queued {
    border-color: var(--accent-color);
    background-color: rgba(255, 153, 0, 0.1);
}

.mission-item.mission-complete {
    border-color: #00ff00;
    background-color: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

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

.mission-header h4 {
    margin: 0;
    color: var(--accent-color);
}

/* Mission Progress Styles */
.mission-progress {
    margin-top: 15px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.progress-label {
    color: var(--text-color);
}

.progress-time {
    color: var(--accent-color);
    font-weight: bold;
}

.progress-bar-container {
    width: 100%;
    height: 25px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--primary-color) 0%, 
        var(--accent-color) 50%, 
        var(--secondary-color) 100%);
    transition: width 0.5s ease;
    box-shadow: 0 0 10px var(--primary-color);
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 0 0 10px var(--primary-color);
    }
    50% {
        box-shadow: 0 0 20px var(--accent-color);
    }
}

.progress-percentage {
    text-align: center;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* Mission Completion Dialogue */
#mission-completion-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.mission-completion-dialogue {
    background-color: var(--panel-color);
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    animation: slideInUp 0.4s ease;
}

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

.completion-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid var(--accent-color);
}

.completion-header h3 {
    margin: 0 0 10px 0;
    color: var(--background-color);
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.completion-header h4 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.2rem;
}

.completion-content {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.completion-portrait {
    flex-shrink: 0;
}

.completion-portrait img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    box-shadow: 0 0 20px var(--primary-color);
    object-fit: cover;
}

.completion-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.completion-contact {
    border-bottom: 1px solid var(--secondary-color);
    padding-bottom: 10px;
}

.contact-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.contact-title {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.contact-faction {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 5px;
}

.completion-message {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-left: 3px solid var(--primary-color);
    border-radius: 5px;
}

.completion-message p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-color);
}

.completion-rewards h5 {
    color: var(--accent-color);
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.rewards-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reward-item {
    background-color: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-color);
    animation: rewardPop 0.5s ease;
}

@keyframes rewardPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.reward-icon {
    font-size: 1.5rem;
}

.completion-continue-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 100%);
    color: var(--background-color);
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
}

.completion-continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 153, 0, 0.5);
}

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

/* No missions message */
.no-missions-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-color);
    opacity: 0.7;
}

.no-missions-message p {
    margin: 10px 0;
    line-height: 1.6;
}

.no-missions-message strong {
    color: var(--accent-color);
}

.mission-faction {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--secondary-color);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.mission-description {
    margin-bottom: 10px;
    font-style: italic;
    color: #cccccc;
}

.mission-location {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #aaaaaa;
}

.mission-progress-container {
    height: 24px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    margin: 15px 0;
    border: 1px solid var(--secondary-color);
    position: relative;
    overflow: hidden;
}

.mission-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
    border-radius: 12px;
    transition: width 0.3s ease;
    position: relative;
    text-align: center;
    min-width: 40px;
}

.mission-timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-shadow: 0 0 3px black;
    font-weight: bold;
    width: 100%;
}

.mission-complete-notice {
    background-color: rgba(0, 255, 0, 0.2);
    border: 1px solid #00ff00;
    border-radius: 5px;
    padding: 8px;
    margin: 10px 0;
    text-align: center;
    color: #00ff00;
    font-weight: bold;
    animation: pulse-success 2s infinite;
}

.complete-icon {
    margin-right: 5px;
    font-size: 1.2em;
}

.mission-status {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mission-followers-committed {
    color: #aaddff;
    font-size: 0.9rem;
}

.followers-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: #aaddff;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.mission-rewards {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
}

.mission-rewards h5 {
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--accent-color);
}

.mission-rewards ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mission-rewards li {
    padding: 3px 0;
    display: flex;
    align-items: center;
}

.resource-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
}

.resource-icon.credits {
    background-color: #ffcc00;
    border-radius: 50%;
}

.resource-icon.followers {
    background-color: #aaddff;
    border-radius: 50%;
}

.resource-icon.techPoints, .resource-icon.techpoints {
    background-color: #00ffff;
    border-radius: 3px;
}

.resource-icon.influence {
    background-color: #ff00ff;
    border-radius: 3px;
}

.resource-icon.energy {
    background-color: #00ff00;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.reputation-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    background-color: #ff9900;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    vertical-align: middle;
}

.mission-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.mission-duration, .mission-cost {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 5px 10px;
}

.time-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid currentColor;
    border-radius: 50%;
    position: relative;
    margin-right: 5px;
    vertical-align: middle;
}

.time-icon::before, .time-icon::after {
    content: '';
    position: absolute;
    background-color: currentColor;
}

.time-icon::before {
    width: 1px;
    height: 5px;
    top: 2px;
    left: 6px;
}

.time-icon::after {
    width: 4px;
    height: 1px;
    top: 6px;
    left: 6px;
}

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

.mission-start-btn, .mission-complete-btn {
    background-color: var(--accent-color);
    color: black;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.mission-start-btn:hover:not(:disabled), .mission-complete-btn:hover:not(:disabled) {
    background-color: var(--highlight-color);
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--highlight-color);
}

.mission-start-btn:disabled {
    background-color: #555555;
    color: #888888;
    cursor: not-allowed;
}

.mission-complete-btn {
    background-color: #00cc00;
    color: black;
}

.mission-complete-btn:hover {
    background-color: #00ff00;
    box-shadow: 0 0 15px #00ff00;
}

.mission-help-text {
    text-align: center;
    padding: 30px;
    color: #888888;
}

.mission-extra {
    font-size: 0.9em;
    font-style: italic;
    margin-top: 10px;
    color: #aaaaaa;
}

/* Flashing tab */
@keyframes tab-flash {
    0% { background-color: rgba(0, 0, 0, 0.5); }
    50% { background-color: rgba(0, 255, 0, 0.3); }
    100% { background-color: rgba(0, 0, 0, 0.5); }
}

.tab-flashing {
    animation: tab-flash 1.5s infinite;
    position: relative;
}

.tab-flashing::after {
    content: '!';
    position: absolute;
    top: 2px;
    right: 5px;
    background-color: #00ff00;
    color: black;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
    animation: pulse-attention 1s infinite;
}

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

@keyframes pulse-success {
    0% { box-shadow: 0 0 5px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 15px rgba(0, 255, 0, 0.8); }
    100% { box-shadow: 0 0 5px rgba(0, 255, 0, 0.5); }
}

.glow-effect {
    position: relative;
    overflow: hidden;
}

.glow-effect::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(45deg);
    animation: glow-sweep 3s infinite;
    opacity: 0.5;
}

@keyframes glow-sweep {
    0% { transform: translate(-100%, -100%) rotate(45deg); }
    50% { transform: translate(100%, 100%) rotate(45deg); }
    100% { transform: translate(-100%, -100%) rotate(45deg); }
}
