*{margin:0;padding:0;box-sizing:border-box}
:root{--bg:#1a1a2e;--surface:#16213e;--surface2:#1a2540;--border:#2a3a5c;--text:#e2e8f0;--textd:#94a3b8;--accent:#818cf8;--accent2:#6366f1;--green:#34d399;--red:#f87171;--yellow:#fbbf24}
html,body{height:100%;overflow:hidden}
body{font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:var(--bg);color:var(--text)}

/* Top bar */
.topbar{
    height:48px;display:flex;align-items:center;padding:0 16px;gap:12px;
    background:var(--surface);border-bottom:1px solid var(--border);
    position:fixed;top:0;left:0;right:0;z-index:100;
}
.topbar .slug{
    font-size:14px;font-weight:600;color:var(--accent);
    display:flex;align-items:center;gap:6px;
    min-width:0;flex:1;
}
.topbar .slug i{font-size:12px;opacity:.6}
.topbar .slug span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topbar .status{
    font-size:12px;font-weight:500;white-space:nowrap;
    display:flex;align-items:center;gap:5px;
}
.topbar .status .dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}
.topbar .status.saved .dot{background:var(--green)}
.topbar .status.saving .dot{background:var(--yellow);animation:pulse .8s infinite}
.topbar .status.error .dot{background:var(--red)}
.topbar .status.saved{color:var(--green)}
.topbar .status.saving{color:var(--yellow)}
.topbar .status.error{color:var(--red)}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.3}}

/* Toolbar */
.toolbar{
    height:40px;display:flex;align-items:center;padding:0 8px;gap:2px;
    background:var(--surface2);border-bottom:1px solid var(--border);
    position:fixed;top:48px;left:0;right:0;z-index:99;
    overflow-x:auto;-webkit-overflow-scrolling:touch;
}
.toolbar::-webkit-scrollbar{display:none}
.toolbar button{
    background:none;border:none;color:var(--textd);
    width:32px;height:32px;border-radius:6px;cursor:pointer;
    display:flex;align-items:center;justify-content:center;
    font-size:13px;flex-shrink:0;transition:all .15s;
}
.toolbar button:hover{background:var(--border);color:var(--text)}
.toolbar button:active{transform:scale(.92)}
.toolbar button.active{background:var(--accent2);color:#fff}
.toolbar .sep{width:1px;height:20px;background:var(--border);margin:0 4px;flex-shrink:0}

/* Editor */
.editor-wrap{
    position:fixed;top:88px;left:0;right:0;bottom:0;
    overflow-y:auto;padding:24px 16px 80px;
}
.editor{
    max-width:800px;margin:0 auto;min-height:calc(100vh - 168px);
    outline:none;font-size:16px;line-height:1.75;color:var(--text);
    word-wrap:break-word;overflow-wrap:break-word;
}
.editor:empty::before{
    content:attr(data-placeholder);color:var(--textd);opacity:.5;
    pointer-events:none;
}

/* Editor typography */
.editor h1{font-size:28px;font-weight:700;margin:20px 0 8px;color:#fff}
.editor h2{font-size:22px;font-weight:600;margin:16px 0 6px;color:#f1f5f9}
.editor h3{font-size:18px;font-weight:600;margin:12px 0 4px;color:#e2e8f0}
.editor p{margin-bottom:4px}
.editor blockquote{
    border-left:3px solid var(--accent);padding:8px 16px;margin:8px 0;
    background:rgba(99,102,241,.08);border-radius:0 6px 6px 0;
    color:var(--textd);font-style:italic;
}
.editor pre{
    background:var(--surface);border:1px solid var(--border);
    border-radius:8px;padding:12px 16px;margin:8px 0;
    font-family:'Fira Code','Consolas',monospace;font-size:14px;
    overflow-x:auto;
}
.editor code{
    background:rgba(99,102,241,.15);padding:2px 6px;border-radius:4px;
    font-family:'Fira Code','Consolas',monospace;font-size:14px;
}
.editor pre code{background:none;padding:0}
.editor hr{border:none;height:1px;background:var(--border);margin:16px 0}
.editor ul,
.editor ol{padding-left:24px;margin:4px 0}
.editor li{margin-bottom:2px}
.editor a{color:var(--accent);text-decoration:underline}
.editor img{max-width:100%;border-radius:8px;margin:8px 0}
.editor table{border-collapse:collapse;width:100%;margin:8px 0}
.editor th,
.editor td{border:1px solid var(--border);padding:6px 10px;text-align:left}
.editor th{background:var(--surface2)}

/* Info bar */
.info-bar{
    position:fixed;bottom:0;left:0;right:0;height:28px;
    background:var(--surface);border-top:1px solid var(--border);
    display:flex;align-items:center;justify-content:space-between;
    padding:0 16px;font-size:11px;color:var(--textd);z-index:100;
}

/* Share btn */
.share-btn{
    background:none;border:1px solid var(--border);color:var(--textd);
    padding:4px 10px;border-radius:6px;font-size:12px;cursor:pointer;
    display:flex;align-items:center;gap:4px;transition:all .15s;
}
.share-btn:hover{border-color:var(--accent);color:var(--accent)}

/* Toast */
.toast{
    position:fixed;bottom:40px;left:50%;transform:translateX(-50%) translateY(20px);
    background:var(--surface2);border:1px solid var(--border);
    padding:10px 20px;border-radius:10px;font-size:13px;color:var(--text);
    opacity:0;transition:all .3s;z-index:200;pointer-events:none;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* Responsive */
@media(max-width:640px){
    .topbar{padding:0 10px;height:44px}
    .topbar .slug{font-size:13px}
    .toolbar{height:38px}
    .editor-wrap{top:82px;padding:16px 12px 60px}
    .editor{font-size:15px;line-height:1.7}
    .editor h1{font-size:24px}
    .editor h2{font-size:19px}
    .info-bar{height:24px;font-size:10px;padding:0 10px}
}
