:root {
    --bg-color: #050505;
    --text-color: #e0e0e0;
    --primary-cyan: #00ffea;
    --primary-pink: #ff00ff;
    --primary-gold: #ffd700;
    --danger-red: #ff3333;
    --panel-bg: rgba(10, 10, 10, 0.9);
    --border-color: rgba(0, 255, 234, 0.3);
    --success-color: #00ff00;
    --font-main: 'Share Tech Mono', monospace;
    --font-header: 'Orbitron', sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%; /* Ensure html also takes full height */
    overflow-x: hidden; /* Prevent horizontal scrolling at html level */
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    /* overflow: hidden; Removed to allow scrolling on mobile */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    overflow-y: hidden; /* Prevent vertical scrolling of the entire body */
    height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
}

/* Scanline Effect */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.2));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
    opacity: 0.3;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 10px; /* Reduced padding */
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden; /* Added to clip overflowing content */
}

/* HUD */
.hud {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 10px var(--border-color);
    margin-bottom: 10px; /* Reduced margin */
    font-family: var(--font-header);
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    flex: 1;
    /* Distribute space equally */
    min-width: 0;
    /* Prevent overflow */
}

/* Specific alignment for HUD items to keep center item centered */
.hud-item:first-child {
    justify-content: flex-start;
}

.hud-item:nth-child(2) {
    justify-content: center;
}

.hud-item:last-child {
    justify-content: flex-end;
}

.glow-cyan {
    color: var(--primary-cyan);
    text-shadow: 0 0 5px var(--primary-cyan);
}

.glow-pink {
    color: var(--primary-pink);
    text-shadow: 0 0 5px var(--primary-pink);
}

.glow-gold {
    color: var(--primary-gold);
    text-shadow: 0 0 5px var(--primary-gold);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Shop Categories - Temporarily hidden as per user request */
.shop-categories {
    display: none;
}

.tab-btn {
    flex: 1;
    padding: 10px 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-header);
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    user-select: none;
}

.tab-btn:hover {
    background: rgba(0, 255, 234, 0.1);
    box-shadow: 0 0 10px var(--border-color);
}

.tab-btn.active {
    background: var(--primary-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--primary-cyan);
    font-weight: bold;
}

/* Main Interface */
.main-interface {
    /* flex: 1; Removed flex-grow to use fixed height */
    height: calc(100vh - 60px); /* Fixed height for desktop */
    position: relative;
    /* overflow: hidden; Removed to allow internal scrolling */
    /* border: 1px solid var(--border-color);  Removed border from main container */
    /* background: rgba(0, 0, 0, 0.8); Removed bg from main container */
    padding: 0;
    /* Remove padding to let children fill */
    display: flex;
}

.split-layout {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 20px;
    align-items: stretch; /* Ensure children stretch to fill height */
}

/* Left Panel: Terminal */
.terminal-section {
    flex: 0 0 50%; /* Increased width to 50% */
    /* Fixed 40% width */
    height: 100%; /* Ensure it stretches to full height of split-layout */
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    padding: 20px;
    align-items: center; /* Centers items horizontally */
    /* justify-content: space-between; Removed to allow more controlled vertical spacing */
    overflow-y: auto; /* Changed from hidden to auto */
    /* gap: 15px; Removed to control spacing with individual margins */
}

/* Right Panel: Auxiliary */
.auxiliary-section {
    flex: 1;
    /* Takes remaining space */
    height: 100%; /* Ensure it stretches to full height of split-layout */
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    padding: 20px;
    min-width: 0;
    /* Prevent flex overflow */
    overflow-y: auto; /* Added to allow internal scrolling */
}

.section-header {
    width: 100%;
    text-align: center;
    font-family: var(--font-header);
    color: var(--primary-cyan);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    /* margin-bottom: 20px; Removed to use gap in parent container */
    margin-bottom: 15px; /* Added for consistent spacing */
    font-size: 1.2em;
    letter-spacing: 2px;
}

.tab-content {
    flex: 1;
    /* overflow: hidden; Removed to allow internal content to scroll via tab-pane */
    position: relative;
}

.tab-pane {
    display: none;
    height: 100%;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-pane.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Terminal Specifics */
.hack-zone {
    /* margin-top: 20px; Removed to use gap in parent container */
    flex-grow: 0; /* Prevent it from growing */
    margin-bottom: 15px; /* Added for consistent spacing */
}

.cyber-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 234, 0.2) 0%, rgba(0, 0, 0, 0.8) 70%);
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-family: var(--font-header);
    font-size: 1.2em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.1s;
    box-shadow: 0 0 20px var(--primary-cyan);
}

.cyber-button:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px var(--primary-cyan);
}

/* Ripple Effect for Cyber Button */
.cyber-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 255, 234, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s, opacity 0.6s;
    opacity: 0;
}

.cyber-button:active::after {
    width: 200%;
    height: 200%;
    opacity: 0;
}

.log-container-wrapper {
    width: 100%;
    max-width: 800px;
    flex: 1;
    /* margin: 10px 0; Removed to use gap in parent container */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.log-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #333;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    font-weight: bold;
    text-shadow: 0 0 2px #0f0;
    color: #0f0;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    /* Newest at bottom, but we prepend so... actually let's keep it standard */
}

.log-entry {
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.1);
    padding-bottom: 2px;
}

/* Reboot Controls */
.reboot-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    /* margin: 10px 0; Removed to use gap in parent container */
    margin-bottom: 15px; /* Added for consistent spacing */
    padding: 12px;
    background: rgba(0, 20, 20, 0.6);
    border: 1px solid var(--primary-cyan);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(0, 255, 234, 0.2);
    flex-grow: 0; /* Prevent it from growing */
}

.cyber-button-reboot {
    width: 100%;
    max-width: 250px;
    height: 40px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-family: var(--font-header);
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(0, 255, 234, 0.3);
    text-shadow: 0 0 5px var(--primary-cyan);
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.cyber-button-reboot::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 234, 0.3), transparent);
    transition: left 0.5s;
}

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

.cyber-button-reboot:hover {
    background: rgba(0, 40, 40, 0.9);
    box-shadow: 0 0 25px rgba(0, 255, 234, 0.5);
    transform: translateY(-2px);
}

.cyber-button-reboot:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(0, 255, 234, 0.3);
}

@keyframes pulse-cyan {
    0% {
        box-shadow: 0 0 15px rgba(0, 255, 234, 0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(0, 255, 234, 0.6);
    }

    100% {
        box-shadow: 0 0 15px rgba(0, 255, 234, 0.3);
    }
}

.cyber-button-reboot:not(.disabled) {
    animation: pulse-cyan 2s infinite;
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}

.reboot-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.reboot-text {
    color: var(--primary-cyan);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85em;
    text-align: center;
    text-shadow: 0 0 3px rgba(0, 255, 234, 0.5);
}

/* Disabled state for reboot button */
.cyber-button-reboot.disabled {
    opacity: 0.5;
    background: rgba(40, 40, 40, 0.8);
    border-color: #555;
    color: #888;
    box-shadow: 0 0 5px rgba(100, 100, 100, 0.2);
    text-shadow: none;
    cursor: not-allowed;
    filter: grayscale(1);
}

.cyber-button-reboot.disabled:hover {
    background: rgba(40, 40, 40, 0.8);
    box-shadow: 0 0 5px rgba(100, 100, 100, 0.2);
    transform: none;
}

.cyber-button-reboot.disabled::before {
    display: none;
}

/* Statistics Tab */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.stat-card {
    background: rgba(0, 20, 20, 0.8);
    border: 2px solid var(--primary-cyan);
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(0, 255, 234, 0.2);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 25px rgba(0, 255, 234, 0.4);
    border-color: var(--primary-gold);
}

.stat-icon {
    font-size: 3em;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(0, 255, 234, 0.5));
}

.stat-value {
    font-size: 2.5em;
    font-family: var(--font-header);
    color: var(--primary-cyan);
    font-weight: bold;
    margin: 10px 0;
    text-shadow: 0 0 10px var(--primary-cyan);
}

.stat-label {
    font-size: 0.85em;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    word-wrap: break-word;
    /* Allow long words to break */
    overflow-wrap: break-word;
    line-height: 1.2;
}



/* Grid Layouts for Shop/Market/Achievements */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    padding: 8px;
}

/* Upgrade Items */
.upgrade-item {
    background: rgba(0, 20, 20, 0.8);
    border: 1px solid var(--primary-cyan);
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upgrade-item:hover {
    background: rgba(0, 40, 40, 0.9);
    box-shadow: 0 0 10px var(--primary-cyan);
}

.upgrade-item.disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: default;
    border-color: #555;
    pointer-events: auto;
}

.upgrade-item.disabled:hover {
    background: rgba(0, 20, 20, 0.8);
    box-shadow: none;
}

/* Purchase Success Animation */
@keyframes purchaseSuccess {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px var(--primary-cyan);
    }

    100% {
        transform: scale(1);
    }
}

.upgrade-item.purchased {
    animation: purchaseSuccess 0.5s ease;
}

.upgrade-info h3 {
    margin: 0 0 5px 0;
    color: var(--primary-cyan);
    font-family: var(--font-header);
    font-size: 0.95em;
}

.upgrade-info p {
    margin: 4px 0;
    font-size: 0.85em;
    line-height: 1.2;
}

.upgrade-cost {
    margin-top: 6px;
    font-weight: bold;
    color: var(--primary-gold);
    text-align: right;
}

/* Black Market Items */
.market-header {
    text-align: center;
    color: var(--primary-pink);
    margin-bottom: 20px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

.market-item {
    background: rgba(20, 0, 20, 0.8);
    border: 1px solid var(--primary-pink);
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.market-item:hover {
    background: rgba(40, 0, 40, 0.9);
    box-shadow: 0 0 10px var(--primary-pink);
}

.market-item.purchased {
    animation: purchaseSuccess 0.5s ease;
}

.market-item h3 {
    color: var(--primary-pink);
}

/* Achievements */
.achievement-item {
    background: rgba(0, 20, 20, 0.8);
    border: 1px solid #333;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.5;
    transition: all 0.3s;
}

.achievement-item.unlocked {
    opacity: 1;
    border-color: var(--primary-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.ach-info {
    display: flex;
    flex-direction: column;
}

.achievement-item .icon {
    font-size: 2em;
}

/* --- Particles --- */
.particle {
    position: absolute;
    pointer-events: none;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.2rem;
    animation: floatUp 1s ease-out forwards;
    z-index: 1000;
    text-shadow: 0 0 5px currentColor;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px) scale(1.5);
        opacity: 0;
    }
}

/* Number Counter Glow Animation */
@keyframes numberGlow {
    0% {
        text-shadow: 0 0 5px currentColor;
    }

    50% {
        text-shadow: 0 0 20px currentColor, 0 0 30px currentColor;
    }

    100% {
        text-shadow: 0 0 5px currentColor;
    }
}

.value.updated {
    animation: numberGlow 0.6s ease;
}

.hud .value {
    user-select: none;
    cursor: default;
}

/* --- Data Breach Mini-game --- */
.breach-container {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid var(--primary-cyan);
    padding: 20px;
    border-radius: 5px;
    text-align: center;
    box-shadow: 0 0 30px var(--primary-cyan);
    max-width: 90vw;
}

.breach-info {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-cyan);
}

.breach-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin: 20px 0;
    background: #001111;
    padding: 10px;
    border: 1px solid #004444;
}

.breach-node {
    width: 50px;
    height: 50px;
    background: #002222;
    border: 1px solid #004444;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.breach-node:hover {
    background: #003333;
}

.breach-node.data {
    background: #002222;
    /* Hidden initially */
}

.breach-node.data.revealed {
    background: var(--primary-cyan);
    box-shadow: 0 0 10px var(--primary-cyan);
}

.breach-node.ice {
    background: #002222;
    /* Hidden initially */
}

.breach-node.ice.revealed {
    background: var(--primary-pink);
    box-shadow: 0 0 10px var(--primary-pink);
}

.breach-node.hacked {
    opacity: 0.3;
    pointer-events: none;
}

.breach-instruction {
    color: #888;
    font-size: 0.9rem;
}

/* Glitch Entity */
.glitch-entity {
    position: fixed;
    font-size: 3em;
    cursor: pointer;
    animation: glitch-anim 0.5s infinite;
    z-index: 2000;
}

@keyframes glitch-anim {
    0% {
        transform: translate(0, 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, 0);
    }
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    bottom: 20px;
    right: -300px;
    width: 280px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--primary-gold);
    padding: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
    transition: right 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3000;
    box-shadow: 0 0 20px var(--primary-gold);
}

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

/* Enhanced Achievement Unlock Animation */
@keyframes achievementShine {
    0% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(2);
    }

    100% {
        filter: brightness(1);
    }
}

.achievement-popup.show {
    animation: achievementShine 1s ease;
}

.ach-icon {
    font-size: 2em;
}

.ach-title {
    font-weight: bold;
    color: var(--primary-gold);
    margin-bottom: 5px;
}

.ach-desc {
    font-size: 0.8em;
    color: #ccc;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #111;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Debug Console */
#debug-console-container {
    position: fixed;
    top: 0;
    right: -400px;
    /* Hidden by default */
    width: 400px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    border-left: 2px solid var(--danger-red);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease-in-out;
    box-shadow: -5px 0 20px rgba(255, 51, 51, 0.2);
}

#debug-console-container.visible {
    right: 0;
}

.debug-header {
    padding: 15px;
    background: #111;
    border-bottom: 1px solid var(--danger-red);
    color: var(--danger-red);
    font-family: var(--font-header);
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#debug-log {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    color: #aaa;
}

.debug-entry {
    margin-bottom: 4px;
    border-bottom: 1px solid #222;
    word-wrap: break-word;
}

#debug-toggle-btn {
    position: fixed;
    top: 80px;
    right: 10px;
    background: rgba(255, 51, 51, 0.2);
    border: 1px solid var(--danger-red);
    color: var(--danger-red);
    padding: 8px 12px;
    cursor: pointer;
    font-family: var(--font-header);
    font-size: 0.7em;
    z-index: 4999;
    transition: all 0.3s;
}

#debug-toggle-btn:hover {
    background: rgba(255, 51, 51, 0.4);
    box-shadow: 0 0 10px var(--danger-red);
}

/* Firewall Overlay */
#firewall-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 4000;
}

#firewall-overlay.active {
    display: flex;
}

.firewall-box {
    background: rgba(20, 0, 0, 0.9);
    border: 3px solid var(--danger-red);
    padding: 30px;
    text-align: center;
    box-shadow: 0 0 30px var(--danger-red);
    animation: pulse-red 2s infinite;
    max-width: 90vw;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 20px var(--danger-red);
    }

    50% {
        box-shadow: 0 0 40px var(--danger-red);
    }

    100% {
        box-shadow: 0 0 20px var(--danger-red);
    }
}

.firewall-title {
    font-size: 2em;
    color: var(--danger-red);
    font-family: var(--font-header);
    margin-bottom: 20px;
    text-shadow: 0 0 10px var(--danger-red);
}

.firewall-warning {
    color: #fff;
    margin-bottom: 20px;
    line-height: 1.6;
}

.firewall-code-display {
    font-size: 2em;
    font-family: 'Courier New', monospace;
    color: var(--primary-cyan);
    margin: 20px 0;
    letter-spacing: 10px;
    text-shadow: 0 0 10px var(--primary-cyan);
}

.firewall-input {
    width: 200px;
    padding: 10px;
    font-size: 1.5em;
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-family: 'Courier New', monospace;
    letter-spacing: 5px;
    margin-bottom: 20px;
}

.keypad-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.keypad-btn {
    padding: 15px;
    font-size: 1.2em;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    cursor: pointer;
    font-family: var(--font-header);
    transition: all 0.2s;
}

.keypad-btn:hover {
    background: rgba(0, 255, 234, 0.2);
    box-shadow: 0 0 10px var(--primary-cyan);
}

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

.keypad-btn.control-clr {
    grid-column: span 2;
    background: rgba(255, 51, 51, 0.2);
    border-color: var(--danger-red);
    color: var(--danger-red);
}

.keypad-btn.control-ok {
    grid-column: span 2;
    background: rgba(0, 255, 0, 0.2);
    border-color: #0f0;
    color: #0f0;
}

/* Offline Progress Overlay */
#offline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 4000;
}

#offline-overlay.visible {
    display: flex;
}

.offline-box {
    background: rgba(0, 20, 20, 0.9);
    border: 3px solid var(--primary-cyan);
    padding: 40px;
    text-align: center;
    box-shadow: 0 0 30px var(--primary-cyan);
    max-width: 90vw;
}

.offline-title {
    font-size: 2em;
    color: var(--primary-cyan);
    font-family: var(--font-header);
    margin-bottom: 20px;
    text-shadow: 0 0 10px var(--primary-cyan);
}

.offline-amount {
    font-size: 3em;
    color: var(--primary-gold);
    font-family: var(--font-header);
    margin: 20px 0;
    text-shadow: 0 0 15px var(--primary-gold);
}

/* Settings Button */
.settings-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 1.5em;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: rgba(0, 255, 234, 0.2);
    box-shadow: 0 0 15px var(--primary-cyan);
    transform: rotate(90deg);
}

/* Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.modal-overlay.visible {
    display: flex;
}

.modal-box {
    background: rgba(0, 20, 20, 0.95);
    border: 2px solid var(--primary-cyan);
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px var(--primary-cyan);
}

.modal-header {
    font-size: 1.5em;
    color: var(--primary-cyan);
    font-family: var(--font-header);
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.setting-item {
    margin: 20px 0;
}

.setting-label {
    color: var(--text-color);
    margin-bottom: 10px;
    font-weight: bold;
}

.cyber-slider {
    width: 100%;
    height: 5px;
    background: #333;
    outline: none;
    border-radius: 5px;
}

.cyber-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-cyan);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-cyan);
}

.setting-value {
    text-align: center;
    color: var(--primary-cyan);
    margin-top: 10px;
}

.export-import-controls {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.save-data-area {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: 'Courier New', monospace;
    padding: 10px;
    resize: vertical;
}

.modal-footer {
    margin-top: 20px;
    text-align: center;
}

/* Modal Buttons - Rectangular style */
.modal-button {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    padding: 12px 24px;
    font-family: var(--font-header);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    user-select: none;
    min-width: 120px;
}

.modal-button:hover {
    background: rgba(0, 255, 234, 0.2);
    box-shadow: 0 0 15px var(--primary-cyan);
    transform: translateY(-2px);
}

.modal-button:active {
    transform: translateY(0);
}

.export-import-controls {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.export-import-controls .modal-button {
    flex: 1;
    min-width: 140px;
}

/* Save Indicator */
#save-indicator {
    position: fixed;
    top: 110px; /* Adjusted to prevent overlap with debug button */
    right: 10px;
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid #0f0;
    color: #0f0;
    padding: 8px 12px;
    font-family: var(--font-header);
    font-size: 0.8em;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.save-indicator.show {
    opacity: 1;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 6000;
}

.tutorial-overlay.visible {
    display: flex;
}

.tutorial-box {
    background: rgba(0, 20, 20, 0.95);
    border: 2px solid var(--primary-cyan);
    padding: 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 30px var(--primary-cyan);
}

.tutorial-box h2 {
    color: var(--primary-cyan);
    font-family: var(--font-header);
    margin-bottom: 20px;
}

.tutorial-box p {
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 10px;
    z-index: 3000;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 5px;
}

.mobile-nav-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px 5px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-header);
    font-size: 0.7em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.mobile-nav-btn .icon {
    font-size: 1.5em;
}

.mobile-nav-btn.active {
    background: var(--primary-cyan);
    color: #000;
    box-shadow: 0 0 10px var(--primary-cyan);
}

/* Active Effects Display */
.active-effects {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 40, 40, 0.6);
    border: 1px solid var(--primary-cyan);
    border-radius: 3px;
}

.active-effect {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin: 5px 0;
    background: rgba(0, 0, 0, 0.5);
    border-left: 3px solid var(--primary-pink);
}

.effect-name {
    color: var(--primary-pink);
    font-weight: bold;
}

.effect-timer {
    color: var(--primary-cyan);
    font-family: 'Courier New', monospace;
}

/* Skill Tree Styles */
.skill-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 20, 20, 0.6);
    border: 1px solid var(--primary-cyan);
}

.skill-points-display {
    font-size: 1.5em;
    color: var(--primary-gold);
    font-family: var(--font-header);
    text-shadow: 0 0 10px var(--primary-gold);
}

.skill-tree-info {
    color: #aaa;
    font-size: 0.9em;
}

.skill-tree-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 10px;
}

.skill-node {
    background: rgba(0, 20, 20, 0.8);
    border: 2px solid #333;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.skill-node:hover:not(.locked) {
    background: rgba(0, 40, 40, 0.9);
    transform: translateY(-3px);
}

.skill-node.locked {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
}

.skill-node.unlocked {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 10px var(--primary-cyan);
}

.skill-node.maxed {
    border-color: var(--primary-gold);
    box-shadow: 0 0 10px var(--primary-gold);
}

/* Skill Levelup Animation */
@keyframes skillLevelup {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px var(--primary-gold);
        filter: brightness(1.5);
    }

    100% {
        transform: scale(1);
    }
}

.skill-node.levelup {
    animation: skillLevelup 0.6s ease;
}

.skill-node.affordable:not(.locked):not(.maxed) {
    border-color: #fff;
    animation: pulse-border 2s infinite;
}

.skill-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.skill-name {
    font-weight: bold;
    color: var(--primary-cyan);
    margin-bottom: 5px;
}

.skill-desc {
    font-size: 0.8em;
    color: #ccc;
    margin-bottom: 10px;
    flex-grow: 1;
}

.skill-cost {
    font-size: 0.9em;
    color: var(--primary-gold);
    font-weight: bold;
}

.skill-level {
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .split-layout {
        flex-direction: column;
        gap: 10px; /* Reduce gap on mobile */
    }

    .terminal-section {
        flex: 0 0 auto;
        min-height: 300px;
        padding: 10px; /* Reduce padding on mobile */
    }

    .auxiliary-section {
        flex: 1;
        padding: 10px; /* Reduce padding on mobile */
    }

    .mobile-nav {
        display: flex;
    }

    .terminal-section.mobile-hidden,
    .auxiliary-section.mobile-hidden {
        display: none;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hud {
        flex-direction: column;
        gap: 10px;
        padding: 10px; /* Reduce overall padding */
    }

    .hud-item {
        justify-content: center !important;
        font-size: 1em; /* Reduce font size */
        gap: 5px; /* Reduce gap between items */
    }

    .hud {
        display: none; /* Hide top navigation on mobile */
    }

    .app-container {
        padding-bottom: 80px; /* Increased space for the fixed mobile nav */
    }
    .main-interface {
        flex: 1; /* Allow main interface to grow and shrink dynamically */
        min-height: 0; /* Allow main interface to shrink below content size */
        /* Removed fixed height calculation as it will now flex */
    }
}

@keyframes pulse-border {
    0% {
        border-color: #fff;
        box-shadow: 0 0 5px #fff;
    }

    50% {
        border-color: var(--primary-gold);
        box-shadow: 0 0 15px var(--primary-gold);
    }

    100% {
        border-color: #fff;
        box-shadow: 0 0 5px #fff;
    }
}

.danger {
    background: rgba(255, 51, 51, 0.2) !important;
    border-color: var(--danger-red) !important;
    color: var(--danger-red) !important;
}

.danger:hover {
    background: rgba(255, 51, 51, 0.4) !important;
    box-shadow: 0 0 15px var(--danger-red) !important;
}

.btn-content {
    position: relative;
    z-index: 1;
}

.btn-glitch {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    opacity: 0;
}
@media (max-width: 768px) {
    /* Hack Button Sizing */
    .cyber-button {
        width: 150px; /* Smaller size for mobile */
        height: 150px;
        font-size: 1em;
    }

    /* Tab Button Touch Targets */
    .tab-btn {
        padding: 15px 10px; /* Increase padding for better touch targets */
        font-size: 0.9em; /* Adjust font size slightly */
    }

    /* General Grid Item Spacing/Padding */
    .upgrade-item,
    .market-item,
    .skill-node {
        padding: 10px; /* Reduce padding for compactness */
    }

    /* Adjust overall font size for better mobile readability */
    body {
        font-size: 0.9em;
    }

    /* Adjust skill tree header font size */
    .skill-tree-header {
        font-size: 0.9em;
        padding: 10px;
    }

    /* Adjust font sizes in skill nodes */
    .skill-node .skill-name {
        font-size: 0.9em;
    }
    .skill-node .skill-desc,
    .skill-node .skill-cost,
    .skill-node .skill-level {
        font-size: 0.75em;
    }

    /* Adjust achievement item padding */
    .achievement-item {
        padding: 8px;
    }
    .achievement-item .icon {
        font-size: 1.8em;
    }
    .ach-info .ach-name {
        font-size: 0.9em;
    }
    .ach-info .ach-reward {
        font-size: 0.75em;
    }

    /* Firewall Input and Keypad */
    .firewall-input {
        width: 150px;
        font-size: 1.2em;
        padding: 8px;
    }
    .keypad-btn {
        padding: 12px;
        font-size: 1em;
    }
    .firewall-code-display {
        font-size: 1.8em;
        letter-spacing: 5px;
    }

    /* Settings Modal Adjustments */
    .modal-box {
        padding: 20px;
        width: 95%; /* Use more width on small screens */
    }
    .modal-header {
        font-size: 1.2em;
    }
    .modal-button {
        padding: 10px 15px;
        font-size: 0.8em;
        min-width: 100px;
    }
    .export-import-controls .modal-button {
        min-width: 120px;
    }
}

.pagination-controls-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.pagination-controls-container span {
    font-size: 1em;
    color: var(--primary-cyan);
    font-family: var(--font-header);
}

.pagination-controls-container .modal-button {
    padding: 8px 15px;
    font-size: 0.8em;
    min-width: auto;
}

/* ── elcherlab 통합 로그인 (설정 모달) ─────────────────── */
/* 로그인하면 저장본이 서버에도 올라간다. 로그인하지 않으면 지금까지와 같다. */

.cc-account-status {
    font-size: 0.8em;
    color: #aaa;
    margin-bottom: 10px;
    line-height: 1.5;
}

.cc-auth-input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--primary-cyan, #0ff);
    border-radius: 4px;
    color: #fff;
    font-family: inherit;
    font-size: 0.85em;
}

.cc-auth-input:focus {
    outline: none;
    box-shadow: 0 0 6px var(--primary-cyan, #0ff);
}

.cc-auth-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
    font-size: 0.72em;
    line-height: 1.5;
    color: #aaa;
    cursor: pointer;
}

.cc-auth-check input {
    margin: 2px 0 0;
    flex: none;
    cursor: pointer;
}

.cc-auth-check a {
    color: var(--primary-cyan, #0ff);
}

.cc-auth-error {
    margin: 6px 0;
    font-size: 0.78em;
    color: #ff6b6b;
}
