/* ===== Velocity Internal Guide — v4 (modern) ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[data-theme="dark"] {
  --bg: #0a0c12; --bg2: #0e1118; --bg-s: rgba(12,15,22,.82); --bg-card: #12161f; --bg-code: #0d1019;
  --border: #1a2035; --border-h: #2a3550;
  --text: #97a1b5; --text-dim: #4e5e76; --text-bright: #e0e6f2;
  --ac1: #b196fc; --ac2: #34d399; --ac3: #6cb4fc; --ac4: #fb7185; --ac5: #fbbf24;
  --ac1-bg: rgba(177,150,252,.08); --ac2-bg: rgba(52,211,153,.06);
  --ac3-bg: rgba(108,180,252,.06); --ac4-bg: rgba(251,113,133,.06); --ac5-bg: rgba(251,191,36,.06);
  --ac1-glow: rgba(177,150,252,.14); --ac2-glow: rgba(52,211,153,.10);
  --sh: 0 1px 3px rgba(0,0,0,.28), 0 4px 16px rgba(0,0,0,.22);
  --sh-h: 0 8px 16px rgba(0,0,0,.35), 0 14px 36px rgba(0,0,0,.28);
  --c-cm: #3e5068; --c-kw: #f472b6; --c-str: #a5d6ff; --c-ty: #c4b5fd; --c-fn: #fbbf24; --c-dc: #93c5fd;
  --overlay: rgba(4,6,12,.8); --scrollbar: #1a2030;
  --grad-h: linear-gradient(135deg, #b196fc 0%, #34d399 50%, #6cb4fc 100%);
  --grad-card: linear-gradient(135deg, rgba(177,150,252,.06), rgba(52,211,153,.03), rgba(108,180,252,.06));
  --grad-glow: linear-gradient(135deg, rgba(177,150,252,.18), rgba(52,211,153,.08), rgba(108,180,252,.18));
}
[data-theme="light"] {
  --bg: #f8f9fc; --bg2: #eef0f5; --bg-s: rgba(245,246,250,.88); --bg-card: #fff; --bg-code: #f0f2f7;
  --border: #d4d9e4; --border-h: #b8bfd0;
  --text: #3a3f50; --text-dim: #6a7488; --text-bright: #161a26;
  --ac1: #7c3aed; --ac2: #059669; --ac3: #2563eb; --ac4: #e11d48; --ac5: #d97706;
  --ac1-bg: rgba(124,58,237,.05); --ac2-bg: rgba(5,150,105,.04);
  --ac3-bg: rgba(37,99,235,.04); --ac4-bg: rgba(225,29,72,.04); --ac5-bg: rgba(217,119,6,.04);
  --ac1-glow: rgba(124,58,237,.08); --ac2-glow: rgba(5,150,105,.06);
  --sh: 0 1px 2px rgba(0,0,0,.04), 0 3px 10px rgba(0,0,0,.05);
  --sh-h: 0 4px 8px rgba(0,0,0,.06), 0 10px 24px rgba(0,0,0,.07);
  --c-cm: #6a7488; --c-kw: #e11d48; --c-str: #2563eb; --c-ty: #7c3aed; --c-fn: #b45309; --c-dc: #2563eb;
  --overlay: rgba(248,249,252,.85); --scrollbar: #c0c6d4;
  --grad-h: linear-gradient(135deg, #7c3aed 0%, #059669 50%, #2563eb 100%);
  --grad-card: linear-gradient(135deg, rgba(124,58,237,.04), rgba(5,150,105,.02), rgba(37,99,235,.04));
  --grad-glow: linear-gradient(135deg, rgba(124,58,237,.10), rgba(5,150,105,.05), rgba(37,99,235,.10));
}
:root { --r: 12px; --mono: 'SF Mono','Fira Code','Cascadia Code','JetBrains Mono',Consolas,monospace; --sans: -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif; --toc-w: 230px; }
html { scroll-behavior: smooth; font-size: 15px; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.7; overflow-x: hidden; transition: background .4s, color .4s; }
a { color: var(--ac3); text-decoration: none; transition: color .2s; }
a:hover { color: var(--text-bright); }
::selection { background: rgba(177,150,252,.2); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* Ambient background decoration */
body::before, body::after { content: ''; position: fixed; border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(100px); }
body::before { width: 500px; height: 500px; top: -120px; right: -80px; background: radial-gradient(circle, rgba(177,150,252,.08), transparent 70%); animation: drift 20s ease-in-out infinite alternate; }
body::after { width: 400px; height: 400px; bottom: -100px; left: -60px; background: radial-gradient(circle, rgba(52,211,153,.06), transparent 70%); animation: drift 25s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translate(0,0); } to { transform: translate(30px, 20px); } }

/* Progress */
.progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--grad-h); z-index: 200; width: 0; box-shadow: 0 0 10px rgba(177,150,252,.3); }

/* Layout */
.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* TOC — glass sidebar */
.toc { position: fixed; top: 0; left: 0; width: var(--toc-w); height: 100vh; background: var(--bg-s); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-right: 1px solid var(--border); overflow-y: auto; padding: 16px 0; z-index: 50; transition: background .4s, transform .3s; }
.toc-head { padding: 0 14px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.toc-brand { display: flex; flex-direction: column; gap: 2px; }
.toc-title { font-family: var(--mono); font-size: .8rem; font-weight: 700; background: var(--grad-h); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.toc-sub { font-size: .56rem; color: var(--text-dim); font-family: var(--mono); letter-spacing: .5px; }
.toc-grp { padding: 0 8px; margin-bottom: 2px; }
.toc-grp-t { font-size: .56rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-dim); padding: 6px 6px 2px; }
.toc-link { display: block; padding: 4px 10px; font-size: .74rem; color: var(--text-dim); border-radius: 7px; transition: all .2s; cursor: pointer; position: relative; }
.toc-link:hover { color: var(--text-bright); background: var(--ac1-bg); }
.toc-link.on { color: var(--ac1); background: var(--ac1-glow); font-weight: 600; }
.toc-link.on::before { content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%); width: 3px; height: 16px; border-radius: 2px; background: var(--ac1); box-shadow: 0 0 8px var(--ac1-glow); }
.tb { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-dim); font-size: .82rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .25s; }
.tb:hover { border-color: var(--ac1); color: var(--ac1); background: var(--ac1-bg); box-shadow: 0 0 12px var(--ac1-glow); }

/* Mobile */
.mob-toggle { display: none; position: fixed; top: 8px; left: 8px; z-index: 100; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font-size: .95rem; cursor: pointer; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
@media (max-width:820px) {
  .toc { transform: translateX(-100%); z-index: 100; }
  .toc.open { transform: translateX(0); box-shadow: 3px 0 28px rgba(0,0,0,.4); }
  .mob-toggle { display: flex; }
  .content { margin-left: 0 !important; padding: 0 14px 40px !important; }
}

/* Content */
.content { margin-left: var(--toc-w); flex: 1; max-width: 760px; padding: 0 34px 52px; position: relative; }
@media (min-width:1200px) { .content { padding-left: 48px; } }

/* Header */
.page-header { position: relative; padding: 40px 0 32px; border-bottom: 1px solid var(--border); margin-bottom: 30px; overflow: hidden; }
.page-header::before { content: ''; position: absolute; top: -60px; right: -80px; width: 240px; height: 240px; border-radius: 50%; background: var(--ac1); opacity: .06; filter: blur(70px); pointer-events: none; animation: pulse 6s ease-in-out infinite; }
.page-header::after { content: ''; position: absolute; bottom: -40px; left: 15%; width: 180px; height: 180px; border-radius: 50%; background: var(--ac2); opacity: .04; filter: blur(60px); pointer-events: none; }
@keyframes pulse { 0%, 100% { opacity: .06; transform: scale(1); } 50% { opacity: .09; transform: scale(1.1); } }
.page-header h1 { font-family: var(--mono); font-size: 1.6rem; font-weight: 800; background: var(--grad-h); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -1px; margin-bottom: 8px; }
.page-header p { font-size: .86rem; color: var(--text-dim); max-width: 480px; position: relative; }

/* Sections */
.sec { padding: 26px 0; border-bottom: 1px solid var(--border); transition: border-color .4s; }
.sec:last-of-type { border-bottom: none; }
.sec-label { display: inline-block; font-family: var(--mono); font-size: .56rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--ac1); padding: 2px 10px; border-radius: 20px; background: var(--ac1-bg); border: 1px solid rgba(177,150,252,.12); margin-bottom: 6px; }
.sec h2 { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; color: var(--text-bright); letter-spacing: -.5px; margin-bottom: 8px; transition: color .4s; }
.sec h3 { font-family: var(--mono); font-size: .88rem; font-weight: 600; color: var(--text-bright); margin: 18px 0 6px; transition: color .4s; }
.sec p, .sec li { font-size: .84rem; }
.sec ul, .sec ol { margin: 4px 0 10px 16px; }
.sec li { margin-bottom: 3px; }

/* Terminal / code blocks */
.term { font-family: var(--mono); font-size: .72rem; line-height: 1.85; color: var(--text-dim); background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 18px; margin: 8px 0 14px; overflow-x: auto; white-space: pre; transition: all .35s; position: relative; }
.term::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--grad-h); opacity: .2; }
.term .h1 { color: var(--ac1); font-weight: 600; }
.term .h2 { color: var(--ac2); }
.term .h3 { color: var(--ac3); }
.term .dm { color: var(--c-cm); }
.ln { font-family: var(--mono); font-size: .72rem; color: var(--ac3); font-weight: 500; }
code { font-family: var(--mono); font-size: .82em; background: var(--ac1-bg); color: var(--ac1); padding: 2px 6px; border-radius: 5px; transition: background .4s; border: 1px solid rgba(177,150,252,.08); }

/* "View source" button */
.src-btn { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; margin-left: 4px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-dim); font-family: var(--mono); font-size: .62rem; cursor: pointer; transition: all .25s; vertical-align: middle; }
.src-btn:hover { border-color: var(--ac1); color: var(--ac1); background: var(--ac1-bg); box-shadow: 0 0 10px var(--ac1-glow); }

/* Callout boxes */
.box { border-radius: var(--r); padding: 12px 14px 12px 18px; margin: 8px 0; font-size: .82rem; line-height: 1.55; position: relative; overflow: hidden; backdrop-filter: blur(4px); }
.box::before { content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 3px; border-radius: 0 2px 2px 0; }
.box b { display: block; margin-bottom: 3px; font-size: .76rem; font-family: var(--mono); letter-spacing: .3px; }
.box-warn { background: var(--ac4-bg); border: 1px solid rgba(251,113,133,.1); }
.box-warn::before { background: var(--ac4); } .box-warn b { color: var(--ac4); }
.box-info { background: var(--ac3-bg); border: 1px solid rgba(108,180,252,.08); }
.box-info::before { background: var(--ac3); } .box-info b { color: var(--ac3); }
.box-tip { background: var(--ac2-bg); border: 1px solid rgba(52,211,153,.08); }
.box-tip::before { background: var(--ac2); } .box-tip b { color: var(--ac2); }

/* Steps */
.steps { counter-reset: st; list-style: none; padding: 0; margin: 8px 0 14px; }
.steps li { counter-increment: st; padding: 8px 0 8px 36px; position: relative; font-size: .84rem; border-left: 2px solid var(--border); margin-left: 12px; transition: border-color .3s; }
.steps li:hover { border-left-color: var(--ac1); }
.steps li::before { content: counter(st); position: absolute; left: -13px; top: 7px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ac1); color: var(--ac1); font-size: .64rem; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: var(--mono); transition: all .3s; }
.steps li:hover::before { background: var(--ac1-bg); box-shadow: 0 0 10px var(--ac1-glow); }
.steps li strong { color: var(--text-bright); }

/* File cards */
.fcard { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; margin: 5px 0; box-shadow: var(--sh); transition: all .3s cubic-bezier(.22,1,.36,1); position: relative; overflow: hidden; }
.fcard:hover { border-color: var(--ac1); transform: translateY(-2px) scale(1.005); box-shadow: var(--sh-h); }
.fcard::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--grad-h); opacity: 0; transition: opacity .3s; }
.fcard:hover::after { opacity: 1; }
.fcard-path { font-family: var(--mono); font-size: .76rem; color: var(--ac1); font-weight: 600; }
.fcard-role { font-size: .76rem; color: var(--text-dim); margin-top: 3px; }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 8px 0; }
.checklist li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; margin: 3px 0; border-radius: var(--r); background: var(--bg-card); border: 1px solid var(--border); font-size: .82rem; transition: all .3s; }
.checklist li:hover { border-color: var(--border-h); box-shadow: var(--sh); }
.checklist input[type="checkbox"] { margin-top: 3px; accent-color: var(--ac2); flex-shrink: 0; cursor: pointer; width: 15px; height: 15px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: .6rem; font-weight: 600; font-family: var(--mono); margin-left: 4px; letter-spacing: .3px; }
.t-sig { background: var(--ac4-bg); color: var(--ac4); border: 1px solid rgba(251,113,133,.1); }
.t-med { background: var(--ac3-bg); color: var(--ac3); border: 1px solid rgba(108,180,252,.08); }
.t-low { background: var(--ac1-bg); color: var(--ac1); border: 1px solid rgba(177,150,252,.1); }
.t-bug { background: rgba(251,113,133,.06); color: var(--ac4); border: 1px solid rgba(251,113,133,.08); }
.t-feat { background: var(--ac2-bg); color: var(--ac2); border: 1px solid rgba(52,211,153,.08); }
.t-perf { background: var(--ac3-bg); color: var(--ac3); border: 1px solid rgba(108,180,252,.08); }
.checklist .desc { color: var(--text); } .checklist .det { color: var(--text-dim); font-size: .74rem; margin-top: 3px; }

/* Ideas form */
.idea-form { display: flex; gap: 8px; margin: 10px 0; }
.idea-form input { flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-code); color: var(--text-bright); font-family: var(--sans); font-size: .83rem; outline: none; transition: all .25s; }
.idea-form input:focus { border-color: var(--ac1); box-shadow: 0 0 0 3px var(--ac1-bg), 0 0 16px var(--ac1-glow); }
.idea-form button { padding: 10px 18px; border-radius: 10px; border: 1px solid var(--ac1); background: var(--ac1-bg); color: var(--ac1); font-weight: 600; font-size: .78rem; cursor: pointer; transition: all .25s; white-space: nowrap; }
.idea-form button:hover { background: var(--ac1-glow); box-shadow: 0 0 14px var(--ac1-glow); }
.idea-items { list-style: none; padding: 0; margin: 6px 0; }
.idea-items li { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; margin: 3px 0; border-radius: var(--r); background: var(--bg-card); border: 1px solid var(--border); font-size: .82rem; color: var(--text); transition: all .25s; }
.idea-items li:hover { border-color: var(--border-h); }
.idea-rm { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: .85rem; padding: 2px 6px; border-radius: 5px; transition: all .2s; }
.idea-rm:hover { color: var(--ac4); background: var(--ac4-bg); }
.idea-empty { color: var(--text-dim); font-size: .78rem; font-style: italic; padding: 8px 0; }

/* Starter idea cards */
.starter { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.starter li { padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); font-size: .8rem; cursor: pointer; transition: all .3s cubic-bezier(.22,1,.36,1); position: relative; overflow: hidden; box-shadow: var(--sh); }
.starter li:hover { border-color: var(--ac2); transform: translateY(-3px) scale(1.01); box-shadow: var(--sh-h), 0 0 20px var(--ac2-glow); }
.starter li::before { content: ''; position: absolute; inset: 0; background: var(--grad-card); opacity: 0; transition: opacity .3s; pointer-events: none; }
.starter li:hover::before { opacity: 1; }
.starter li::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--ac2); opacity: 0; transition: opacity .3s; }
.starter li:hover::after { opacity: 1; }
.starter li strong { color: var(--ac2); font-family: var(--mono); font-size: .76rem; display: block; margin-bottom: 4px; position: relative; }
.starter li span { color: var(--text-dim); font-size: .72rem; position: relative; line-height: 1.4; }
.starter li .idea-badge { display: inline-block; font-size: .52rem; font-family: var(--mono); padding: 1px 6px; border-radius: 10px; margin-left: 6px; font-weight: 600; letter-spacing: .4px; vertical-align: middle; }
.badge-code { background: var(--ac1-bg); color: var(--ac1); border: 1px solid rgba(177,150,252,.12); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 300; opacity: 0; pointer-events: none; transition: opacity .3s; display: flex; align-items: center; justify-content: center; }
.modal-bg.show { opacity: 1; pointer-events: auto; }
.modal-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; max-width: 600px; width: 92%; max-height: 82vh; overflow-y: auto; box-shadow: 0 16px 48px rgba(0,0,0,.35), 0 0 0 1px var(--border); transform: translateY(16px) scale(.96); transition: transform .35s cubic-bezier(.22,1,.36,1), background .4s; padding: 0; position: relative; }
.modal-bg.show .modal-box { transform: translateY(0) scale(1); }
.modal-box::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad-h); border-radius: 16px 16px 0 0; }
.modal-inner { padding: 26px 26px 22px; }
.modal-box h3 { font-family: var(--mono); font-size: 1rem; font-weight: 700; color: var(--text-bright); margin-bottom: 10px; padding-right: 30px; }
.modal-box p { font-size: .83rem; color: var(--text); margin-bottom: 10px; line-height: 1.6; }
.modal-box .term { margin: 10px 0; font-size: .72rem; }
.modal-box .hint-label { font-family: var(--mono); font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ac1); margin: 16px 0 6px; padding: 2px 8px; background: var(--ac1-bg); border-radius: 10px; display: inline-block; }
.modal-box .touch-label { font-family: var(--mono); font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ac5); margin: 16px 0 6px; padding: 2px 8px; background: var(--ac5-bg); border-radius: 10px; display: inline-block; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text-dim); font-size: .85rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .25s; z-index: 1; }
.modal-close:hover { border-color: var(--ac4); color: var(--ac4); background: var(--ac4-bg); }

/* Divider & Footer */
.divider { height: 1px; background: var(--grad-h); margin: 8px 0; opacity: .12; }
.page-footer { padding: 20px 0; text-align: center; font-size: .72rem; color: var(--text-dim); margin-top: 18px; border-top: 1px solid var(--border); }

/* Reveal */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.rv.vis { opacity: 1; transform: translateY(0); }

@media (max-width:600px) { .starter { grid-template-columns: 1fr; } }
