/* ===== K8s Arena - Design System ===== */
:root {
    /* Colors */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-card-hover: #1e2a42;
    --bg-terminal: #0d1117;
    --bg-input: #161b22;
    --border: #30363d;
    --border-light: #3d4856;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #58a6ff;
    --accent-cyan: #3dd8e0;
    --accent-green: #3fb950;
    --accent-yellow: #d29922;
    --accent-orange: #db6d28;
    --accent-red: #f85149;
    --accent-purple: #bc8cff;
    --accent-pink: #f778ba;
    --glow-blue: rgba(88, 166, 255, 0.15);
    --glow-cyan: rgba(61, 216, 224, 0.15);
    --glow-green: rgba(63, 185, 80, 0.15);
    --glow-purple: rgba(188, 140, 255, 0.15);
    --glow-red: rgba(248, 81, 73, 0.15);
    /* Typography */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    /* Shadows */
    --shadow-card: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 30px rgba(88, 166, 255, 0.1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: var(--font-ui);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input { font-family: inherit; color: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

.hidden { display: none !important; }

/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed; inset: 0; z-index: 999;
    background: var(--bg-primary);
    display: flex; align-items: center; justify-content: center;
}
.loading-content { text-align: center; }
.loading-logo { margin-bottom: 2rem; }
.loading-logo .logo-icon {
    font-size: 4rem; display: block; margin-bottom: 0.5rem;
    animation: spin 3s linear infinite;
}
.loading-logo h1 {
    font-size: 2.5rem; font-weight: 800;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.loading-bar {
    width: 300px; height: 4px; background: var(--bg-card);
    border-radius: 2px; overflow: hidden; margin: 0 auto;
}
.loading-bar-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 2px;
    animation: loadingBar 2s ease-in-out forwards;
}
.loading-text { margin-top: 1rem; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.85rem; }

@keyframes loadingBar { 0%{width:0} 70%{width:85%} 100%{width:100%} }
@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

/* ===== Header ===== */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; height: 60px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.logo .logo-icon { font-size: 1.5rem; animation: spin 8s linear infinite; }
.logo .logo-text {
    font-size: 1.25rem; font-weight: 800;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.header-nav { display: flex; gap: 0.25rem; }
.nav-btn {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem; border-radius: var(--radius-md);
    font-size: 0.85rem; font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.nav-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-btn.active {
    background: linear-gradient(135deg, rgba(88,166,255,0.15), rgba(61,216,224,0.1));
    color: var(--accent-blue);
    box-shadow: 0 0 12px var(--glow-blue);
}
.nav-icon { font-size: 1.1rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.player-info { display: flex; align-items: center; gap: 0.6rem; }
.level-badge {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem;
    box-shadow: 0 0 12px rgba(88,166,255,0.3);
}
.xp-bar-mini { width: 60px; height: 4px; background: var(--bg-card); border-radius: 2px; overflow: hidden; }
.xp-bar-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 2px;
    transition: width 0.5s ease;
}
.xp-text { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }
.lang-toggle {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; transition: all 0.2s;
}
.lang-toggle:hover { background: var(--bg-card); border-color: var(--accent-blue); }

/* ===== Views ===== */
.view { display: none; min-height: calc(100vh - 60px); }
.view.active { display: block; }

/* ===== Dashboard ===== */
.dashboard { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.dashboard-hero {
    background: linear-gradient(135deg, rgba(88,166,255,0.08), rgba(61,216,224,0.05), rgba(188,140,255,0.05));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative; overflow: hidden;
}
.dashboard-hero::before {
    content: ''; position: absolute; top: -50%; right: -20%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(88,166,255,0.08), transparent 70%);
    border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; }
.hero-content h1 {
    font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-cyan));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-content p { color: var(--text-secondary); font-size: 1.05rem; }
.hero-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
    margin-top: 2rem; position: relative; z-index: 1;
}
.stat-card {
    background: rgba(26, 34, 53, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem; text-align: center;
}
.stat-value {
    font-size: 1.8rem; font-weight: 800;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-family: var(--font-mono);
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    cursor: pointer; position: relative; overflow: hidden;
    transition: all 0.3s ease;
}
.dashboard-card:hover { transform: translateY(-4px); border-color: var(--accent-blue); }
.card-glow {
    position: absolute; top: -50%; right: -50%; width: 200px; height: 200px;
    border-radius: 50%; opacity: 0; transition: opacity 0.4s;
}
.dashboard-card:hover .card-glow { opacity: 1; }
.card-campaign .card-glow { background: radial-gradient(circle, var(--glow-blue), transparent 70%); }
.card-troubleshoot .card-glow { background: radial-gradient(circle, var(--glow-red), transparent 70%); }
.card-sandbox .card-glow { background: radial-gradient(circle, var(--glow-green), transparent 70%); }
.card-achievements .card-glow { background: radial-gradient(circle, var(--glow-purple), transparent 70%); }
.card-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.dashboard-card h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.4rem; }
.dashboard-card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }
.card-progress { margin-top: 1rem; }
.card-progress-bar { height: 6px; background: var(--bg-primary); border-radius: 3px; overflow: hidden; }
.card-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 3px;
    transition: width 0.5s;
}
.card-progress-text { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); margin-top: 0.3rem; display: inline-block; }
.card-badge {
    display: inline-block; margin-top: 1rem;
    padding: 0.3rem 0.8rem;
    background: rgba(63,185,80,0.15); color: var(--accent-green);
    border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600;
}
.achievement-count {
    font-size: 2rem; font-weight: 800; margin-top: 0.5rem;
    font-family: var(--font-mono);
    color: var(--accent-purple);
}

/* ===== Campaign ===== */
.campaign-layout { display: flex; min-height: calc(100vh - 60px); }
.campaign-sidebar {
    width: 280px; padding: 1.5rem;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}
.campaign-sidebar h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-secondary); }
.chapter-item {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.8rem 1rem; border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.2s; margin-bottom: 0.3rem;
}
.chapter-item:hover { background: var(--bg-card); }
.chapter-item.active { background: var(--glow-blue); border: 1px solid rgba(88,166,255,0.3); }
.chapter-item.locked { opacity: 0.4; cursor: not-allowed; }
.chapter-icon { font-size: 1.3rem; }
.chapter-info { flex: 1; }
.chapter-name { font-size: 0.85rem; font-weight: 600; }
.chapter-progress-text { font-size: 0.7rem; color: var(--text-muted); }
.chapter-lock-icon { font-size: 0.9rem; }
.campaign-main { flex: 1; padding: 2rem; overflow-y: auto; }
.mission-select h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.mission-select > p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.mission-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    cursor: pointer; transition: all 0.25s;
    position: relative;
}
.mission-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.mission-card.completed { border-color: var(--accent-green); }
.mission-card.completed::after {
    content: '✓'; position: absolute; top: 0.8rem; right: 0.8rem;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent-green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
}
.mission-card.locked { opacity: 0.4; cursor: not-allowed; }
.mission-card.locked:hover { transform: none; border-color: var(--border); box-shadow: none; }
.mission-number { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 0.3rem; }
.mission-card h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.mission-card p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }
.mission-meta { display: flex; gap: 0.6rem; margin-top: 0.8rem; flex-wrap: wrap; }
.mission-tag {
    font-size: 0.7rem; padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.tag-easy { background: rgba(63,185,80,0.15); color: var(--accent-green); }
.tag-medium { background: rgba(210,153,34,0.15); color: var(--accent-yellow); }
.tag-hard { background: rgba(248,81,73,0.15); color: var(--accent-red); }
.tag-xp { background: rgba(188,140,255,0.15); color: var(--accent-purple); }

/* ===== Troubleshoot ===== */
.troubleshoot-layout { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.troubleshoot-layout h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem; }
.troubleshoot-subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.scenario-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer; transition: all 0.3s;
    position: relative; overflow: hidden;
}
.scenario-card:hover { border-color: var(--accent-orange); transform: translateY(-3px); }
.scenario-card.completed { border-color: var(--accent-green); }
.scenario-card.completed::before {
    content: '✓ RESOLVED'; position: absolute; top: 1rem; right: 1rem;
    background: rgba(63,185,80,0.15); color: var(--accent-green);
    padding: 0.2rem 0.6rem; border-radius: var(--radius-sm);
    font-size: 0.7rem; font-weight: 700;
}
.scenario-error-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem; border-radius: var(--radius-sm);
    background: rgba(248,81,73,0.15); color: var(--accent-red);
    font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600;
    margin-bottom: 0.8rem;
}
.scenario-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.4rem; }
.scenario-card p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; }
.scenario-meta { display: flex; gap: 0.6rem; margin-top: 1rem; }

/* ===== Sandbox ===== */
.sandbox-layout { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; }
.sandbox-info { margin-bottom: 1.5rem; }
.sandbox-info h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem; }
.sandbox-info > p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.sandbox-quick-ref {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.5rem;
}
.sandbox-quick-ref h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 1rem; color: var(--accent-cyan); }
.quick-ref-list { display: flex; flex-direction: column; gap: 0.5rem; }
.quick-ref-list code {
    font-family: var(--font-mono); font-size: 0.82rem;
    padding: 0.5rem 0.8rem; background: var(--bg-terminal);
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    cursor: pointer; transition: all 0.2s;
}
.quick-ref-list code:hover { border-color: var(--accent-cyan); background: rgba(61,216,224,0.05); }

/* ===== Game Layout ===== */
.game-layout { display: flex; height: calc(100vh - 60px); }
.game-panel {
    width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow-y: auto;
}
.mission-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.8rem;
}
.back-btn {
    font-size: 0.85rem; color: var(--text-secondary);
    padding: 0.3rem 0.6rem; border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.back-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.mission-header h3 { flex: 1; font-size: 1rem; font-weight: 700; }
.mission-difficulty .mission-tag { font-size: 0.75rem; }
.mission-body { padding: 1.5rem; flex: 1; }
.mission-description { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; margin-bottom: 1.5rem; }
.objectives-panel h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.8rem; color: var(--accent-cyan); }
.objective-list { list-style: none; }
.objective-list li {
    padding: 0.5rem 0; font-size: 0.85rem;
    display: flex; align-items: flex-start; gap: 0.5rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(48,54,61,0.4);
}
.objective-list li::before { content: '○'; color: var(--text-muted); font-weight: 700; }
.objective-list li.completed { color: var(--accent-green); text-decoration: line-through; opacity: 0.7; }
.objective-list li.completed::before { content: '●'; color: var(--accent-green); }
.hints-panel { margin-top: 1.5rem; }
.hint-btn {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(210,153,34,0.1); color: var(--accent-yellow);
    border: 1px solid rgba(210,153,34,0.3);
    border-radius: var(--radius-md);
    font-size: 0.85rem; font-weight: 500;
    transition: all 0.2s;
}
.hint-btn:hover { background: rgba(210,153,34,0.2); }
.hint-content {
    margin-top: 0.8rem; padding: 1rem;
    background: rgba(210,153,34,0.05);
    border: 1px solid rgba(210,153,34,0.2);
    border-radius: var(--radius-md);
    color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5;
}

/* Next Mission Panel */
.next-mission-panel {
    margin-top: 1.5rem; padding: 1.2rem;
    background: rgba(63,185,80,0.08);
    border: 1px solid rgba(63,185,80,0.3);
    border-radius: var(--radius-lg);
    animation: fadeIn 0.5s ease;
}
.mission-complete-banner {
    display: flex; align-items: center; gap: 0.6rem;
    margin-bottom: 1rem; padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(63,185,80,0.2);
}
.complete-icon { font-size: 1.5rem; animation: bounce 0.6s ease; }
.mission-complete-banner strong {
    font-size: 1rem;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.next-mission-buttons { display: flex; gap: 0.6rem; }
.btn-secondary {
    flex: 1; padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary); font-weight: 600; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.btn-next-mission {
    flex: 1.5; display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    font-size: 0.9rem;
    animation: pulseGlow 2s ease-in-out infinite;
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(88,166,255,0.2); }
    50% { box-shadow: 0 0 20px rgba(88,166,255,0.4); }
}

/* ===== Terminal ===== */
.terminal-container { flex: 1; display: flex; flex-direction: column; background: var(--bg-terminal); }
.terminal-header {
    display: flex; align-items: center;
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.terminal-dots { display: flex; gap: 6px; margin-right: 1rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }
.terminal-title { flex: 1; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); text-align: center; }
.terminal-clear-btn {
    font-size: 1rem; padding: 0.2rem 0.4rem; border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.terminal-clear-btn:hover { background: var(--bg-card); }
.terminal-body {
    flex: 1; padding: 1rem;
    overflow-y: auto; position: relative;
    font-family: var(--font-mono); font-size: 0.85rem;
    line-height: 1.6;
}
.terminal-output { white-space: pre-wrap; word-break: break-word; }
.terminal-output .cmd-line { color: var(--accent-cyan); }
.terminal-output .cmd-output { color: var(--text-secondary); }
.terminal-output .cmd-error { color: var(--accent-red); }
.terminal-output .cmd-success { color: var(--accent-green); }
.terminal-output .cmd-info { color: var(--accent-blue); }
.terminal-output .cmd-warn { color: var(--accent-yellow); }
.terminal-output .cmd-header { color: var(--accent-purple); font-weight: 700; }
.terminal-input-line {
    display: flex; align-items: center;
    margin-top: 0.3rem;
}
.terminal-prompt { color: var(--accent-green); font-weight: 700; margin-right: 0.5rem; }
.terminal-input {
    flex: 1; background: transparent; border: none; outline: none;
    font-family: var(--font-mono); font-size: 0.85rem;
    color: var(--text-primary); caret-color: var(--accent-cyan);
}
.terminal-suggestions {
    position: absolute; bottom: 2.5rem; left: 1rem; right: 1rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 0.3rem;
    max-height: 180px; overflow-y: auto;
    box-shadow: var(--shadow-card);
}
.suggestion-item {
    padding: 0.4rem 0.6rem; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.82rem; display: flex; gap: 0.5rem;
}
.suggestion-item:hover, .suggestion-item.active { background: var(--glow-blue); color: var(--accent-blue); }
.suggestion-cmd { font-weight: 600; }
.suggestion-desc { color: var(--text-muted); font-size: 0.75rem; }

/* ===== Modals ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
}
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    max-width: 700px; width: 100%;
    max-height: 80vh; overflow-y: auto;
    padding: 2rem; position: relative;
}
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.modal-close:hover { background: var(--bg-card); color: var(--text-primary); }
.modal h2 { font-size: 1.3rem; margin-bottom: 1.5rem; }
.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.8rem; }
.achievement-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem; text-align: center;
    transition: all 0.2s;
}
.achievement-item.unlocked { border-color: var(--accent-purple); }
.achievement-item.locked { opacity: 0.4; }
.achievement-item .ach-icon { font-size: 2rem; margin-bottom: 0.5rem; display: block; }
.achievement-item .ach-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.2rem; }
.achievement-item .ach-desc { font-size: 0.75rem; color: var(--text-muted); }

/* ===== Toasts ===== */
.toast {
    position: fixed; bottom: 2rem; right: 2rem;
    z-index: 300;
    animation: slideInRight 0.4s ease;
}
.toast-content {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.toast-achievement .toast-content { border-color: var(--accent-purple); }
.toast-icon { font-size: 1.5rem; }
.toast-text strong { display: block; font-size: 0.9rem; }
.toast-text span { font-size: 0.8rem; color: var(--text-secondary); }

@keyframes slideInRight {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Level Up Overlay ===== */
.level-up-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.3s;
}
.level-up-content { text-align: center; animation: scaleIn 0.5s ease; }
.level-up-icon { font-size: 4rem; margin-bottom: 0.5rem; animation: bounce 0.6s ease; }
.level-up-content h2 {
    font-size: 2rem; font-weight: 800;
    background: linear-gradient(135deg, var(--accent-yellow), var(--accent-orange));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}
.level-up-number {
    font-size: 5rem; font-weight: 800;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}
.btn-primary {
    padding: 0.6rem 2rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff; border-radius: var(--radius-md);
    font-weight: 600; font-size: 0.95rem;
    transition: all 0.2s;
}
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 0 20px rgba(88,166,255,0.3); }

@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes scaleIn { from{transform:scale(0.5);opacity:0} to{transform:scale(1);opacity:1} }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-20px)} }

/* ===== Dashboard 5-col ===== */
.dashboard-grid-5 { grid-template-columns: repeat(3, 1fr); }
.card-builder .card-glow { background: radial-gradient(circle, rgba(61,216,224,0.15), transparent 70%); }

/* ===== Builder Mission List ===== */
.builder-list-layout { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.builder-list-layout h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem; }
.builder-subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
.builder-mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.builder-mission-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.5rem;
    cursor: pointer; transition: all 0.3s; position: relative; overflow: hidden;
}
.builder-mission-card:hover { border-color: var(--accent-cyan); transform: translateY(-3px); box-shadow: 0 0 20px var(--glow-cyan); }
.builder-mission-card.completed { border-color: var(--accent-green); }
.builder-mission-card.completed::after {
    content: '✓'; position: absolute; top: 0.8rem; right: 0.8rem;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent-green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
}
.builder-mission-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.4rem; }
.builder-mission-card p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; }
.builder-mission-card .mission-meta { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.builder-mission-preview {
    margin-top: 0.8rem; padding: 0.6rem;
    background: var(--bg-terminal); border-radius: var(--radius-sm);
    display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.preview-resource {
    font-size: 0.7rem; padding: 0.15rem 0.4rem;
    background: rgba(88,166,255,0.1); border: 1px solid rgba(88,166,255,0.2);
    border-radius: var(--radius-sm); color: var(--accent-blue);
}

/* ===== Build Game Layout ===== */
.build-game-layout { display: flex; height: calc(100vh - 60px); }

/* Palette */
.build-palette {
    width: 200px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.palette-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
}
.palette-header h4 { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.palette-items { flex: 1; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.4rem; }
.palette-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: grab; transition: all 0.2s;
    user-select: none;
}
.palette-item:hover { border-color: var(--accent-cyan); background: var(--bg-card-hover); }
.palette-item:active { cursor: grabbing; }
.palette-item .p-icon { font-size: 1.2rem; }
.palette-item .p-name { font-size: 0.78rem; font-weight: 600; }
.palette-item.type-pod { border-left: 3px solid var(--accent-blue); }
.palette-item.type-deployment { border-left: 3px solid var(--accent-cyan); }
.palette-item.type-service { border-left: 3px solid var(--accent-green); }
.palette-item.type-configmap { border-left: 3px solid var(--accent-yellow); }
.palette-item.type-secret { border-left: 3px solid var(--accent-red); }
.palette-item.type-ingress { border-left: 3px solid var(--accent-purple); }
.palette-item.type-pvc { border-left: 3px solid var(--accent-orange); }
.palette-item.type-namespace { border-left: 3px solid var(--text-muted); }

/* Canvas Area */
.build-canvas-area { flex: 1; display: flex; flex-direction: column; }
.build-canvas-toolbar {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.build-canvas-toolbar h3 { flex: 1; font-size: 0.95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-toolbar-actions { display: flex; gap: 0.4rem; }
.build-toolbar-btn {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem; font-weight: 600;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); transition: all 0.2s;
}
.build-toolbar-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.btn-validate {
    background: linear-gradient(135deg, rgba(63,185,80,0.15), rgba(61,216,224,0.1));
    border-color: rgba(63,185,80,0.4); color: var(--accent-green);
}
.btn-validate:hover { border-color: var(--accent-green); box-shadow: 0 0 12px var(--glow-green); }

/* Canvas */
.build-canvas {
    flex: 1; position: relative; overflow: hidden;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(circle, rgba(48,54,61,0.4) 1px, transparent 1px);
    background-size: 24px 24px;
}
.build-svg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    z-index: 1; pointer-events: none;
}
.build-svg path {
    fill: none; stroke-width: 2.5; stroke-linecap: round;
}
.build-svg path.conn-line { stroke: var(--accent-blue); opacity: 0.6; }
.build-svg path.conn-line:hover { opacity: 1; stroke-width: 3; }
.build-svg path.conn-temp { stroke: var(--accent-cyan); opacity: 0.5; stroke-dasharray: 6 4; }
.build-nodes { position: absolute; inset: 0; z-index: 2; }
.build-canvas-hint {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.1rem;
    pointer-events: none; z-index: 0;
}

/* Canvas Nodes */
.build-node {
    position: absolute;
    min-width: 140px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: move;
    user-select: none;
    transition: box-shadow 0.2s, border-color 0.2s;
    z-index: 3;
}
.build-node:hover { border-color: var(--accent-blue); box-shadow: 0 0 15px var(--glow-blue); }
.build-node.selected { border-color: var(--accent-cyan); box-shadow: 0 0 20px var(--glow-cyan); }
.build-node.valid { border-color: var(--accent-green); }
.build-node.invalid { border-color: var(--accent-red); animation: shake 0.3s; }
.node-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-weight: 600; font-size: 0.78rem;
}
.node-header .node-icon { font-size: 1rem; }
.node-header .node-delete {
    margin-left: auto; font-size: 0.7rem;
    opacity: 0; transition: opacity 0.2s;
    padding: 0.15rem 0.3rem; border-radius: 3px;
}
.build-node:hover .node-delete { opacity: 0.6; }
.node-delete:hover { opacity: 1 !important; background: rgba(248,81,73,0.2); color: var(--accent-red); }
.node-body {
    padding: 0.4rem 0.7rem 0.5rem;
    font-size: 0.72rem; color: var(--text-secondary);
}
.node-body .node-name { font-weight: 600; color: var(--text-primary); font-size: 0.8rem; }
.node-body .node-detail { margin-top: 0.15rem; }

/* Node type colors */
.build-node.type-pod .node-header { background: rgba(88,166,255,0.12); }
.build-node.type-deployment .node-header { background: rgba(61,216,224,0.12); }
.build-node.type-statefulset .node-header { background: rgba(0,188,175,0.12); }
.build-node.type-daemonset .node-header { background: rgba(130,112,255,0.12); }
.build-node.type-job .node-header { background: rgba(255,183,0,0.12); }
.build-node.type-cronjob .node-header { background: rgba(178,215,0,0.12); }
.build-node.type-service .node-header { background: rgba(63,185,80,0.12); }
.build-node.type-endpoints .node-header { background: rgba(63,185,80,0.08); }
.build-node.type-configmap .node-header { background: rgba(210,153,34,0.12); }
.build-node.type-secret .node-header { background: rgba(248,81,73,0.12); }
.build-node.type-ingress .node-header { background: rgba(188,140,255,0.12); }
.build-node.type-pvc .node-header { background: rgba(219,109,40,0.12); }
.build-node.type-namespace .node-header { background: rgba(110,118,129,0.12); }

/* Connection Ports */
.node-port {
    position: absolute;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--accent-blue);
    cursor: crosshair; z-index: 5;
    transition: all 0.2s;
}
.node-port:hover { transform: scale(1.4); background: var(--accent-blue); }
.node-port.port-out { right: -6px; top: 50%; transform: translateY(-50%); }
.node-port.port-in { left: -6px; top: 50%; transform: translateY(-50%); }
.node-port.port-out:hover { right: -6px; transform: translateY(-50%) scale(1.4); }
.node-port.port-in:hover { left: -6px; transform: translateY(-50%) scale(1.4); }

/* Status Bar */
.build-status-bar {
    padding: 0.4rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 0.75rem; color: var(--text-muted);
    font-family: var(--font-mono);
    display: flex; gap: 1.5rem;
}

/* Properties Panel */
.build-properties {
    width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.properties-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
}
.properties-header h4 { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.properties-content { flex: 1; overflow-y: auto; padding: 1rem; }
.properties-empty { color: var(--text-muted); font-size: 0.85rem; text-align: center; padding: 2rem 0; }
.prop-group { margin-bottom: 1rem; }
.prop-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; text-transform: uppercase; }
.prop-input {
    width: 100%; padding: 0.45rem 0.6rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 0.82rem;
    font-family: var(--font-mono);
    outline: none; transition: border-color 0.2s;
}
.prop-input:focus { border-color: var(--accent-cyan); }
.prop-input::placeholder { color: var(--text-muted); }

/* Build Objectives */
.build-objectives {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    overflow-y: auto;
}
.build-objectives h4 { font-size: 0.85rem; font-weight: 600; color: var(--accent-cyan); margin-bottom: 0.6rem; }

/* Build Result Modal */
.build-result-content { text-align: center; max-width: 500px; }
.build-result-icon { font-size: 4rem; margin-bottom: 0.5rem; }
.build-result-content h2 { margin-bottom: 0.5rem; }
.build-result-content p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.build-result-details {
    text-align: left; padding: 1rem; margin-bottom: 1rem;
    background: var(--bg-card); border-radius: var(--radius-md);
    font-size: 0.82rem;
}
.build-result-details .result-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0;
}
.result-item.pass { color: var(--accent-green); }
.result-item.fail { color: var(--accent-red); }
.build-result-actions { display: flex; gap: 0.6rem; justify-content: center; }

@keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Auto-generated nodes (ReplicaSet, Pods from Deployment) */
.build-node.auto-generated {
    opacity: 0.75;
    border-style: dashed;
    min-width: 120px;
    transform: scale(0.9);
}
.build-node.auto-generated .node-header { font-size: 0.72rem; padding: 0.35rem 0.6rem; }
.build-node.auto-generated .node-body { font-size: 0.68rem; padding: 0.3rem 0.6rem; }
.build-node.type-replicaset .node-header { background: rgba(61,216,224,0.08); }
.build-svg path.conn-auto {
    stroke: var(--accent-cyan); opacity: 0.35;
    stroke-dasharray: 4 3; stroke-width: 1.8;
}
.status-auto { color: var(--accent-cyan); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header { padding: 0 0.8rem; }
    .nav-label { display: none; }
    .nav-btn { padding: 0.5rem; }
    .hero-stats { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .game-layout { flex-direction: column; }
    .game-panel { width: 100%; max-height: 40vh; }
    .terminal-container { min-height: 50vh; }
    .campaign-layout { flex-direction: column; }
    .campaign-sidebar { width: 100%; max-height: 30vh; border-right: none; border-bottom: 1px solid var(--border); }
    .player-info { display: none; }
}
