:root {
    --bg-color: #0d1117;
    --sidebar-bg: #161b22;
    --terminal-bg: #010409;
    --accent-primary: #00ff9f;
    --accent-secondary: #00d1ff;
    --text-main: #c9d1d9;
    --text-dim: #8b949e;
    --border-color: #30363d;
    --error-red: #ff7b72;
    --warning-yellow: #d29922;
    --glass-bg: rgba(22, 27, 34, 0.7);
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: #e6edf3;
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(13, 17, 23, 0.8) 0%, var(--bg-color) 100%), url('hero.png');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loader-content {
    text-align: center;
    width: 400px;
    background: rgba(13, 17, 23, 0.85);
    padding: 3rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 159, 0.2);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.terminal-text {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    transition: width 0.1s linear;
}

/* Header */
.main-header {
    height: 60px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

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

.logo .icon {
    font-family: var(--font-mono);
    background: var(--accent-primary);
    color: var(--bg-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 800;
}

.logo h1 {
    font-size: 1.2rem;
    letter-spacing: 2px;
    font-weight: 800;
}

.logo h1 span {
    color: var(--accent-secondary);
}

.user-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
}

.stat-item {
    color: var(--text-dim);
}

.stat-item .value {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Dashboard Layout */
.dashboard {
    flex: 1;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 0;
    overflow: hidden;
}

/* Sidebar Refined */
.sidebar {
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0d1117 100%);
    border-right: 1px solid var(--border-color);
    padding: 2.5rem 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    color: var(--accent-secondary);
    margin: 2rem 0 1.25rem 0;
    font-weight: 800;
    opacity: 0.9;
}

.mission-card {
    background: rgba(33, 38, 45, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.mission-card h3 {
    color: #ffffff;
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
    font-weight: 700;
}

.mission-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.objectives h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

.objectives ul {
    list-style: none;
}

.objectives li {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    padding-left: 28px;
    position: relative;
    color: var(--text-main);
}

.objectives li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

.objectives li.completed {
    color: var(--accent-primary);
    opacity: 0.8;
}

.objectives li.completed::before {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 255, 159, 0.5);
}

/* Tabs System Premium */
.tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 2.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 10px 5px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: var(--bg-color);
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 255, 159, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Dictionary Refined */
#dict-search {
    width: 100%;
    background: rgba(1, 4, 9, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s ease;
}

#dict-search:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 255, 159, 0.1);
}

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

.dict-card {
    background: rgba(33, 38, 45, 0.4);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.dict-card:hover {
    border-color: rgba(0, 255, 159, 0.3);
    transform: translateX(4px);
}

.dict-card h3 {
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.dict-card p {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.dict-card .example {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    color: var(--accent-secondary);
    font-family: var(--font-mono);
}

/* Guides Refined */
.guides-container h2 {
    color: var(--accent-secondary);
}

.guide-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.guide-item h3 {
    font-size: 1.1rem;
    color: #f0f6fc;
    margin-bottom: 8px;
}

.guide-item p {
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.guide-item code {
     background: rgba(56, 139, 253, 0.15);
     padding: 3px 6px;
     border-radius: 4px;
     color: var(--accent-secondary);
     font-family: var(--font-mono);
}

/* Terminal Container */
.terminal-container {
    padding: 1.5rem 2rem;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: #21262d;
    height: 40px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: relative;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.controls {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }

.terminal-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.system-time {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.terminal-body {
    flex: 1;
    background: radial-gradient(circle at center, #02060d 0%, #000000 100%);
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 1.5;
    overflow-y: auto;
    color: #e6edf3;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    text-shadow: 0 0 2px rgba(0, 255, 159, 0.4);
}

/* CRT Effect */
.terminal-body::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* Scanline Effect */
.terminal-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 255, 159, 0.03);
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

.output-line {
    margin-bottom: 4px;
    word-break: break-all;
    animation: fadeIn 0.2s ease-out;
}

.input-line {
    display: flex;
    gap: 10px;
    align-items: center;
}

.prompt {
    color: var(--accent-primary);
    white-space: nowrap;
}

#cli-input {
    background: transparent;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    flex: 1;
    outline: none;
    caret-color: var(--accent-primary);
}

/* Footer */
.main-footer {
    height: 48px;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
    color: #8b949e;
    font-weight: 500;
}

/* Nano Editor */
.nano-editor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #010409;
    display: none;
    flex-direction: column;
    font-family: var(--font-mono);
    z-index: 100;
}

.nano-header {
    background: #ffffff;
    color: #000000;
    padding: 2px 10px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.nano-content {
    flex: 1;
    background: transparent;
    color: #ffffff;
    border: none;
    resize: none;
    padding: 1rem;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.nano-footer {
    background: #21262d;
    color: #ffffff;
    padding: 5px 10px;
    font-size: 0.8rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.nano-footer span {
    color: var(--accent-primary);
    font-weight: bold;
}

/* Utilities */
.accent-primary { color: var(--accent-primary); }
.accent-secondary { color: var(--accent-secondary); }
.error-text { color: var(--error-red); }

/* Responsive adjustments */
.mobile-alert {
    display: none;
    background: rgba(255, 123, 114, 0.1);
    border: 1px solid var(--error-red);
    padding: 1.5rem;
    margin: 1.5rem;
    border-radius: 12px;
    text-align: center;
    color: #e6edf3;
    animation: fadeIn 0.5s ease-out;
}

.mobile-alert strong {
    color: var(--accent-primary);
}

.mobile-alert em {
    color: var(--text-dim);
    font-size: 0.85rem;
    display: block;
    margin-top: 10px;
}

@media (max-width: 1000px) {
    .dashboard {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    .sidebar {
        display: flex;
        flex: 1;
        border-right: none;
        padding: 1rem;
    }
    .terminal-container {
        display: none;
    }
    .mobile-alert {
        display: block;
    }
}
