:root {
    --bg-main: #0f1117;
    --bg-card: #171a21;
    --bg-editor: #1e1e1e;
    --bg-input: #252526;
    --border: #2a2d35;
    --green: #23c552;
    --red: #f14c4c;
    --blue: #2f80ed;
    --yellow: #ffbd44;
    --purple: #a855f7;
    --text: #f5f5f5;
    --text-dim: #a0a0a0;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-main);
    color: var(--text);
    margin: 0;
}

.code-font {
    font-family: 'Fira Code', monospace;
}

.msv-editor {
    background: var(--bg-editor);
    overflow-x: auto;
    overflow-y: auto;
    height: 100%;
}

#screen-editor.active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    padding-bottom: 0;
    max-width: 100vw;
}

#screen-editor.active ~ bottom-nav {
    display: none;
}

.msv-line {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    min-height: 26px;
}

.msv-line.active {
    background: #2a2d2e;
}

.msv-gutter {
    color: #555;
    text-align: right;
    padding-right: 12px;
    user-select: none;
    font-size: 11px;
}

.msv-content {
    padding-right: 16px;
    white-space: pre;
    tab-size: 4;
    font-size: 13px;
    line-height: 1.7;
}

.tok-keyword { color: #569cd6; }
.tok-type { color: #4ec9b0; }
.tok-fn { color: #dcdcaa; }
.tok-str { color: #ce9178; }
.tok-num { color: #b5cea8; }
.tok-comment { color: #6a9955; }
.tok-punct { color: #d4d4d4; }
.tok-ident { color: #9cdcfe; }
.tok-macro { color: #c586c0; }

.msv-input {
    background: var(--bg-input);
    color: #fff;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    outline: none;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    padding: 1px 4px;
    height: 24px;
    text-align: center;
    vertical-align: middle;
    margin: 0 1px;
}

.msv-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 1px var(--blue);
}

.msv-input.correct {
    border-color: var(--green);
    background: rgba(35, 197, 82, .15);
}

.msv-input.wrong {
    border-color: var(--red);
    background: rgba(241, 76, 76, .15);
    animation: shake .3s;
}

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

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

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) }
    100% { opacity: 0; transform: translateY(-30px) }
}

@keyframes glow {
    0% { box-shadow: 0 0 0 0 rgba(35, 197, 82, .4) }
    100% { box-shadow: 0 0 0 8px rgba(35, 197, 82, 0) }
}

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

.animate-slide-up { animation: slideUp .3s ease; }
.animate-glow { animation: glow .6s ease; }
.animate-pop { animation: popIn .3s ease; }

.xp-float {
    position: absolute;
    animation: floatUp 1s ease forwards;
    font-weight: 700;
    font-size: 14px;
    color: var(--yellow);
    pointer-events: none;
}

.screen {
    display: none;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    color: var(--text-dim);
    cursor: pointer;
    transition: color .15s;
    border: none;
    background: none;
    font-size: 10px;
    font-family: 'DM Sans', sans-serif;
}

.nav-tab.active {
    color: var(--blue);
}

.node-line {
    width: 3px;
    height: 32px;
    margin: 0 auto;
}

.progress-ring {
    position: relative;
    width: 56px;
    height: 56px;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all .15s;
}

.card:hover {
    border-color: #3a3d45;
}

.streak-flame {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #ff6b35, #ffbd44);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.map-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .15s;
}

.map-node:hover {
    background: rgba(47, 128, 237, .08);
}

.map-node.locked {
    opacity: .4;
    pointer-events: none;
}

.map-node.completed .node-icon {
    background: var(--green);
}

.map-node.current .node-icon {
    background: var(--blue);
    animation: glow 2s infinite;
}

.node-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #333;
    flex-shrink: 0;
}

.achievement-badge {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: var(--bg-card);
    border: 2px solid var(--border);
}

.achievement-badge.unlocked {
    border-color: var(--yellow);
    background: rgba(255, 189, 68, .1);
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    z-index: 1000;
    animation: popIn .3s ease;
    pointer-events: none;
}
