*{box-sizing:border-box}
:root{color-scheme:dark;--bg:#08111d;--panel:#0e2031;--line:#294a64;--cyan:#70e8ff;--green:#9ff1c9;--muted:#8ca3b6;--danger:#ff9b9b;--gold:#ffd27c}
body{margin:0;background:radial-gradient(circle at 80% 0,#102b43 0,#08111d 35%);color:#e9f4ff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;min-height:100vh}
button{font:inherit;cursor:pointer}
header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:14px 18px;background:#0d1b2bee;border-bottom:1px solid #24425d;position:sticky;top:0;z-index:5;backdrop-filter:blur(12px)}
h1{font-size:18px;margin:2px 0;color:#70e1ff;letter-spacing:.04em}small{color:#7c91a7}.edition{display:block;font-size:9px;color:#b9d8e8;letter-spacing:.12em}.stats{display:flex;gap:10px;align-items:center;font-size:12px;flex-wrap:wrap;justify-content:flex-end}.stats span,.stats button{background:#14283b;color:#dff7ff;border:1px solid #2e536f;border-radius:10px;padding:8px}
main{display:grid;grid-template-columns:280px 1fr;min-height:calc(100vh - 76px)}aside{padding:16px;border-right:1px solid #24425d;background:#0a1623}aside h2{font-size:14px}.chapter{padding:11px;margin:7px 0;border:1px solid #294761;border-radius:12px;cursor:pointer;transition:.2s}.chapter:hover{transform:translateX(2px)}.chapter.active{border-color:#5de1ff;background:#12334a}.chapter.lock{opacity:.38}.chapter b{display:block;font-size:13px}.chapter small{font-size:11px}
section{padding:20px;max-width:1040px;width:100%;margin:auto}.hero,.card,.thought,.buffer,.enemy{background:linear-gradient(145deg,#0e2031,#0b1a28);border:1px solid #294a64;border-radius:16px;padding:17px;margin-bottom:14px;box-shadow:0 12px 30px #0002}.hero h2{color:#79e4ff;margin-bottom:6px}.mission-grid,.enemy-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.mission,.enemy{cursor:pointer;transition:.2s}.mission:hover,.enemy:hover{border-color:#5bd4f1;transform:translateY(-2px)}.mission.done,.enemy.done{border-color:#51df9b}.tag{display:inline-block;border:1px solid #3f657e;border-radius:999px;padding:4px 8px;font-size:11px}.thought{border-left:4px solid #65e2ff}.thought strong{color:#7be7ff}
.scene-grid{display:grid;gap:10px;margin-top:13px}.speech{position:relative;padding:12px 14px;border:1px solid #294a64;border-radius:13px;background:#0a1825}.speech::before{content:"";position:absolute;left:-5px;top:18px;width:8px;height:8px;background:#0a1825;border-left:1px solid #294a64;border-bottom:1px solid #294a64;transform:rotate(45deg)}.speech .speaker-label{display:flex;align-items:center;gap:8px;color:var(--cyan);font-size:11px;font-weight:700;letter-spacing:.05em}.speech p{margin:7px 0 0;line-height:1.72}.speech.analogy{border-color:#806736;background:#211c12}.speech.analogy::before{background:#211c12;border-color:#806736}.speech.analogy .speaker-label{color:var(--gold)}.speech.nora{border-color:#3b7667;background:#0e211d}.speech.nora::before{background:#0e211d;border-color:#3b7667}.speech.nora .speaker-label{color:#8ff0cc}.speech.stakes{border-color:#72405d;background:#241521}.speech.stakes::before{background:#241521;border-color:#72405d}.speech.stakes .speaker-label{color:#f3a4cf}.thought-note{margin-top:10px;padding:10px 12px;background:#102b28;border:1px solid #2f766d;border-radius:10px;color:#bff5df;font-size:13px;line-height:1.6}
.tokens{display:flex;flex-wrap:wrap;gap:9px}.token{border:1px solid #41647e;background:#14293b;color:#cde5f4;border-radius:10px;padding:11px 13px;opacity:.24;transition:.15s}.token.ready{opacity:1;border-color:#70e8ff;box-shadow:0 0 16px #3ad9ff55;animation:pulse 1.2s infinite}.token.ready:hover{transform:translateY(-2px)}.token.used{opacity:.12}.buffer pre{white-space:pre-wrap;color:#9ff1c9;min-height:70px;line-height:1.7}.progress{height:8px;background:#172d3f;border-radius:8px;overflow:hidden;margin-top:12px}.progress i{display:block;height:100%;background:linear-gradient(90deg,#65e2ff,#73f5b3);transition:width .3s}.actions{display:flex;gap:8px;flex-wrap:wrap}.actions button,.primary,.ghost{background:#1d536e;color:white;border:1px solid #6ee5ff;border-radius:10px;padding:11px 15px}.ghost{background:#152332;border-color:#385369;color:#b9cddd}.feedback{padding:12px;border-radius:10px;background:#271827;border:1px solid #743a61;line-height:1.65}.success{background:#102d26;border-color:#36a678}.hp{color:#ff9b9b}.chapter-analogy{margin-top:12px;padding:12px;border-left:3px solid var(--gold);background:#201b12;border-radius:9px;color:#ffe5af;line-height:1.65}
.modal{position:fixed;inset:0;background:#000d;display:flex;align-items:center;justify-content:center;z-index:20;padding:16px}.modal.hidden{display:none}.dialog{width:min(640px,96vw);background:linear-gradient(145deg,#102538,#0b1a27);border:1px solid #67e4ff;border-radius:18px;padding:22px;box-shadow:0 25px 80px #0008}.dialog-head{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid #294a64;padding-bottom:12px}.dialog-head #speaker{color:#79e4ff;font-weight:800;font-size:17px}.dialog-head #dialogCounter{color:#93a9ba;font-size:12px}.dialog p{font-size:17px;line-height:1.9;white-space:pre-line;min-height:96px}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}
@keyframes pulse{50%{transform:translateY(-2px);box-shadow:0 0 25px #3ad9ff88}}
@media(max-width:760px){header{align-items:flex-start}.stats{max-width:190px}main{display:block}aside{border-right:0;border-bottom:1px solid #24425d;overflow-x:auto}#chapters{display:flex}.chapter{min-width:180px}section{padding:13px}.dialog p{font-size:16px}.scene-grid{gap:8px}.speech p{font-size:14px}}

.scene-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.scene-meta span,.scene-caption{font-size:12px;color:#b8d9e8;background:#102638;border:1px solid #31536a;border-radius:999px;padding:6px 10px}.scene-caption{display:inline-block;margin-top:12px;border-radius:9px}.mission small,.enemy small{display:block;margin-top:9px;color:#91acbd}

/* v1.3.0 Full Source Workshop */
.edition-note{margin-top:12px;padding:12px;border:1px solid #2e6b7d;background:#0d2732;border-radius:10px;color:#c6f4ff;line-height:1.65}
.source-volume{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px;padding:9px 10px;border:1px solid #31566d;border-radius:10px;background:#0b1d2b}.source-volume b{font-size:12px;color:#9ff1c9}.source-volume span{font-size:11px;color:#8fb1c5}.source-workshop{padding:0;overflow:hidden}.workshop-head{display:flex;justify-content:space-between;gap:16px;padding:17px}.workshop-head h3{margin:8px 0 5px}.workshop-head p{margin:0;color:#bfd1dc;line-height:1.6}.implementation-count{min-width:84px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #39728b;border-radius:13px;background:#0b2230;padding:9px}.implementation-count b{font-size:20px;color:#7fe8ff}.implementation-count span{font-size:10px;color:#9ab4c4}.file-tabs{display:flex;gap:6px;overflow-x:auto;padding:0 12px 10px}.file-tab{display:flex;align-items:center;gap:8px;white-space:nowrap;border:1px solid #31546b;background:#102536;color:#bed4e0;border-radius:9px 9px 0 0;padding:9px 11px}.file-tab small{background:#17374c;border-radius:999px;padding:2px 6px}.file-tab.active{border-color:#72e6ff;background:#12384c;color:white}.editor-toolbar{display:flex;justify-content:space-between;gap:12px;padding:8px 14px;background:#07101a;border-top:1px solid #203e52;border-bottom:1px solid #203e52;color:#7fa4ba;font-size:10px;letter-spacing:.08em}.code-editor{background:#050b11;overflow:auto;max-height:580px;padding:9px 0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;font-size:12px;line-height:1.65}.code-line{display:grid;grid-template-columns:48px minmax(max-content,1fr);min-height:23px;border-left:3px solid transparent}.code-line:hover{background:#0d1822}.code-line .line-no{user-select:none;text-align:right;padding:1px 12px 1px 4px;color:#446074;border-right:1px solid #172b3a}.code-line code{white-space:pre;padding:1px 14px;color:#d6e7f0}.code-line.static code{color:#9eb1bd}.code-line.completed{background:#0b211b;border-left-color:#45d69b}.code-line.completed code{color:#9ff1c9}.code-line.current{background:#102b38;border-left-color:#70e8ff;animation:sourcePulse 1.4s infinite}.code-line.current code{color:#70e8ff;font-weight:700}.code-line.future code{color:#49606e}.file-notice{padding:10px 14px;background:#241d11;border-top:1px solid #705a2e;color:#ffe1a0}.input-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}.input-panel-head h3{margin:8px 0}.mode-actions,.typing-actions{display:flex;gap:7px;flex-wrap:wrap}.line-candidates{display:grid;gap:9px}.line-choice{width:100%;text-align:left;border:1px solid #3b5c72;background:#0c1c29;color:#c9dce7;border-radius:10px;padding:12px;opacity:.68;transition:.15s;overflow:auto}.line-choice code{white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace}.line-choice:hover{opacity:1;border-color:#57b8d6}.line-choice.ready{opacity:1;border-color:#70e8ff;box-shadow:0 0 18px #3ad9ff44;background:#103046}.code-input{width:100%;resize:vertical;border:1px solid #4b728a;background:#050b11;color:#bff5df;border-radius:10px;padding:12px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;font-size:14px;line-height:1.6}.line-hint{margin-top:10px;padding:10px;border:1px solid #735c31;background:#211a0f;color:#ffe2a6;border-radius:9px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace}.hidden{display:none!important}
@keyframes sourcePulse{50%{background:#123849}}
@media(max-width:760px){.workshop-head,.input-panel-head{display:block}.implementation-count{margin-top:12px;flex-direction:row;gap:8px;width:max-content}.code-editor{font-size:11px;max-height:470px}.code-line{grid-template-columns:38px minmax(max-content,1fr)}.code-line .line-no{padding-right:8px}.code-line code{padding-left:10px}.mode-actions{margin-top:10px}.source-volume{align-items:flex-start;flex-direction:column}.line-choice{font-size:11px}}

/* v1.4.0 Per-Line Protagonist Thought Trace */
.speech.decision{border-color:#4c6fd1;background:#111c36}.speech.decision::before{background:#111c36;border-color:#4c6fd1}.speech.decision .speaker-label{color:#a9c0ff}
.speech.next-step{border-color:#8d6234;background:#241b12}.speech.next-step::before{background:#241b12;border-color:#8d6234}.speech.next-step .speaker-label{color:#ffd39b}
.line-reflection{margin-top:12px;padding:14px;border:1px solid #4d8fc0;border-radius:13px;background:linear-gradient(145deg,#102b42,#0b1e30);box-shadow:inset 0 0 20px #58cfff0d}
.line-reflection-head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:10px;color:#8fe9ff;font-size:12px;font-weight:800;letter-spacing:.04em}
.line-reflection-head b{border:1px solid #3a6d88;border-radius:999px;padding:3px 8px;color:#c7f6ff}
.line-reflection code,.thought-history-item code{display:block;overflow:auto;white-space:pre;padding:10px 11px;border:1px solid #294f66;border-radius:9px;background:#050c12;color:#a9f3cf;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;font-size:12px}
.line-reflection p{margin:10px 0 0;line-height:1.72}.line-reflection .trace-connection{color:#c1d9e8}.line-reflection .trace-next{color:#ffd49c;border-left:3px solid #9b6a32;padding-left:10px}
.thought-history{margin-top:12px;border:1px solid #31546b;border-radius:12px;background:#091722;overflow:hidden}
.thought-history summary{cursor:pointer;padding:12px 14px;color:#bcefff;font-weight:800;font-size:12px;list-style:none}.thought-history summary::-webkit-details-marker{display:none}.thought-history summary::before{content:"▸";display:inline-block;margin-right:8px;transition:.2s}.thought-history[open] summary::before{transform:rotate(90deg)}
.thought-history-list{display:grid;gap:9px;max-height:480px;overflow:auto;padding:0 12px 12px}.thought-history-item{border:1px solid #263f51;border-radius:10px;background:#0b1b28;padding:11px}.thought-history-item header{display:flex;justify-content:space-between;gap:10px;margin-bottom:8px;font-size:10px;color:#76dff6}.thought-history-item header b{color:#a9bfcc;font-weight:600}.thought-history-item p{margin:8px 0;line-height:1.6;font-size:12px}.thought-history-item small{display:block;color:#9db6c5;line-height:1.55}.trace-empty{margin-top:12px;padding:11px;border:1px dashed #39566a;border-radius:10px;color:#8ea9b9;font-size:12px;line-height:1.65}
.dialog #dialogRole{color:#9dc4d9}.dialog p{max-height:58vh;overflow:auto}
@media(max-width:760px){.line-reflection-head,.thought-history-item header{align-items:flex-start;flex-direction:column}.thought-history-list{max-height:380px}.mode-actions button{padding:9px 10px;font-size:11px}}
