:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface2: #242424;
    --text: #e0e0e0;
    --text2: #a0a0a0;
    --accent: #7c3aed;
    --accent2: #a78bfa;
    --border: #333;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text); line-height:1.6;
    min-height: 100vh;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
}
header h1 { font-size: 1.2rem; font-weight: 600; color: var(--accent2); }
header h1 a { color: var(--accent2); }
header nav { display: flex; gap: 16px; align-items: center; }
header nav a {
    color: var(--text2); font-size: 0.9rem; padding: 4px 8px; border-radius: 6px;
    transition: all 0.2s;
}
header nav a:hover, header nav a.active { color: var(--text); background: var(--surface2); text-decoration: none; }

/* HQ nav highlight */
header nav a[href="/hq"] {
    background: linear-gradient(135deg, #7c3aed22, #2563eb22);
    border: 1px solid #7c3aed44;
    font-weight: 600;
}
header nav a[href="/hq"]:hover, header nav a[href="/hq"].active {
    background: linear-gradient(135deg, #7c3aed44, #2563eb44);
    border-color: #7c3aed88;
    box-shadow: 0 0 12px #7c3aed33;
}

/* Mobile menu */
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* Main */
main { max-width: 960px; margin: 0 auto; padding: 20px; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; margin-bottom: 12px; color: var(--accent2); }

/* Stats grid */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; text-align: center;
}
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--accent2); }
.stat .label { font-size: 0.8rem; color: var(--text2); }

/* Checklist */
.checklist .item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; cursor: pointer;
    transition: background 0.2s;
}
.checklist .item:hover { background: var(--surface2); }
.checklist .item input[type="checkbox"] {
    width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer;
}
.checklist .item.done label { text-decoration: line-through; color: var(--text2); }
.checklist .item label { cursor: pointer; flex:1; }

/* File list */
.file-list { list-style: none; }
.file-list li {
    padding: 10px 12px; border-radius: 8px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.file-list li:last-child { border-bottom: none; }
.file-list li a { flex: 1; }
.file-list .icon { font-size: 1.2rem; }
.file-list .size { color: var(--text2); font-size: 0.8rem; }
.file-list li:hover { background: var(--surface2); }

/* Note view */
.note-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    line-height: 1.8;
}
.note-content h1 { font-size: 1.5rem; margin: 20px 0 12px; }
.note-content h2 { font-size: 1.3rem; margin: 16px 0 10px; color: var(--accent2); }
.note-content h3 { font-size: 1.1rem; margin: 14px 0 8px; }
.note-content p { margin-bottom: 12px; }
.note-content code {
    background: var(--surface2); padding: 2px 6px; border-radius: 4px;
    font-size: 0.9rem;
}
.note-content pre {
    background: var(--surface2); padding: 16px; border-radius: 8px;
    overflow-x: auto; margin: 12px 0; border: 1px solid var(--border);
}
.note-content pre code { background: none; padding: 0; }
.note-content blockquote {
    border-left: 3px solid var(--accent); padding-left: 16px;
    margin: 12px 0; color: var(--text2);
}
.note-content ul, .note-content ol { padding-left: 24px; margin: 8px 0; }
.note-content table {
    width: 100%; border-collapse: collapse; margin: 12px 0;
}
.note-content th, .note-content td {
    border: 1px solid var(--border); padding: 8px 12px; text-align: left;
}
.note-content th { background: var(--surface2); }
.note-content img { max-width: 100%; border-radius: 8px; }
.note-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Share banner */
.share-banner {
    background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem;
}
.share-banner input { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: 6px; font-size: 0.85rem; }
.share-banner button { background: var(--accent); color: white; border: none; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; }

/* Buttons */
.btn {
    display: inline-block; padding: 8px 20px; border-radius: 8px;
    font-size: 0.9rem; cursor: pointer; border: none; transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent2); }

/* Search */
.search-box { width: 100%; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); font-size: 1rem; margin-bottom: 16px; }
.search-box:focus { outline: none; border-color: var(--accent); }

/* Footer */
footer {
    text-align: center; padding: 30px 20px; color: var(--text2); font-size: 0.8rem;
    border-top: 1px solid var(--border); margin-top: 40px;
}

/* Share-specific */
.share-only { display: none; }

/* Responsive */
@media (max-width: 600px) {
    header nav { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px; }
    header nav.open { display: flex; }
    .menu-toggle { display: block; }
    main { padding: 12px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}
