:root{--bg:#0f1115;--panel:#151922;--border:#262c3d;--text:#e6e9ef;--muted:#9aa0b3;--accent:#3b82f6;--accent-soft:rgba(59,130,246,.13);--ok:#22c55e;--shadow:0 18px 55px rgba(0,0,0,.28)}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}button,input,select,textarea{font:inherit}.topbar{height:64px;display:flex;align-items:center;justify-content:space-between;padding:0 22px;background:#111827;border-bottom:1px solid var(--border);position:sticky;top:0;z-index:20}.brand{display:flex;align-items:center;gap:11px;color:var(--text);font-weight:750;text-decoration:none}.logo-mark{display:grid;place-items:center;width:52px;height:52px;border-radius:15px;background:linear-gradient(145deg,#60a5fa,#2563eb);color:white;font-size:.9rem;font-weight:900;letter-spacing:.04em;box-shadow:0 10px 30px rgba(37,99,235,.3)}.logo-mark.small{width:35px;height:35px;border-radius:9px;font-size:.72rem}.top-actions{display:flex;align-items:center;gap:16px}.top-actions form{margin:0}.welcome{font-size:.9rem;color:var(--muted)}.ghost-button{border:1px solid #334155;border-radius:7px;background:#1f2937;color:var(--text);padding:8px 12px;cursor:pointer}.ghost-button:hover{border-color:var(--accent)}
.app-layout{display:grid;grid-template-columns:280px minmax(0,1fr);min-height:calc(100vh - 64px)}.sidebar{background:var(--panel);border-right:1px solid var(--border);padding:22px 14px;display:flex;flex-direction:column}.sidebar-head{display:flex;align-items:center;justify-content:space-between;padding:0 10px 12px}.sidebar-head span,.section-title>span{color:var(--muted);font-size:.78rem;border:1px solid var(--border);border-radius:999px;padding:4px 8px}.eyebrow{margin:0 0 7px;color:#60a5fa;font-size:.72rem;font-weight:850;letter-spacing:.14em}.subject-list{display:flex;flex-direction:column;gap:5px}.subject-item{display:grid;grid-template-columns:34px 1fr auto;align-items:center;gap:10px;padding:10px;border:1px solid transparent;border-radius:9px;color:var(--muted);font-size:.9rem;font-weight:650;text-decoration:none}.subject-item:hover{background:rgba(255,255,255,.035);color:var(--text)}.subject-item.active{border-color:rgba(59,130,246,.36);background:var(--accent-soft);color:white}.subject-icon{display:grid;place-items:center;width:32px;height:32px;border-radius:8px;background:#0f172a;color:#93c5fd;font-size:.68rem;font-weight:900}.subject-item.active .subject-icon{background:var(--accent);color:#fff}.chevron{font-size:1.3rem}.sidebar-tip{margin-top:auto;display:flex;flex-direction:column;gap:4px;padding:14px;border:1px solid var(--border);border-radius:10px;background:#111827;font-size:.8rem}.sidebar-tip span{color:var(--muted)}
.content{padding:34px clamp(20px,4vw,58px) 70px;overflow:hidden}.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:30px;margin-bottom:28px}.page-head h1{margin:0;font-size:clamp(2rem,4vw,3.2rem);letter-spacing:-.04em}.page-head p:not(.eyebrow){margin:10px 0 0;color:var(--muted)}.exam-control{width:min(320px,100%);padding:14px;border:1px solid var(--border);border-radius:10px;background:var(--panel)}.exam-control>label{display:block;margin-bottom:7px;color:var(--muted);font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}.exam-control select,.new-exam input{width:100%;border:1px solid #334155;border-radius:7px;background:#0f172a;color:var(--text);padding:10px}.new-exam{margin-top:9px}.new-exam summary{cursor:pointer;color:#93c5fd;font-size:.8rem;font-weight:700}.new-exam form{display:flex;gap:7px;margin-top:9px}
.setup-card{display:grid;grid-template-columns:auto minmax(190px,.75fr) minmax(320px,1.25fr);gap:20px;align-items:start;padding:24px;border:1px solid var(--border);border-radius:12px;background:linear-gradient(135deg,#151922,#121722);box-shadow:var(--shadow)}.step-number{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:var(--accent);font-weight:900}.setup-copy h2,.section-title h2{margin:0}.setup-copy>p:not(.eyebrow){color:var(--muted);line-height:1.55}.topic-form{display:flex;flex-direction:column;gap:12px}.topic-form textarea{width:100%;resize:vertical;min-height:128px;border:1px solid #334155;border-radius:8px;background:#0b1220;color:var(--text);padding:12px;line-height:1.5}.topic-form textarea:focus,.new-exam input:focus,.exam-control select:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(59,130,246,.16)}.confirm-check{display:flex;align-items:flex-start;gap:10px;padding:10px;border:1px solid var(--border);border-radius:8px;background:#111827;cursor:pointer}.confirm-check input{margin-top:3px;accent-color:var(--accent)}.confirm-check span{display:flex;flex-direction:column;gap:2px;font-size:.8rem}.confirm-check small{color:var(--muted)}.button{border:1px solid #3b82f6;border-radius:7px;background:#1d4ed8;color:#fff;padding:10px 14px;font-weight:800;cursor:pointer;text-decoration:none;text-align:center}.button:hover{background:#2563eb}.button.primary{box-shadow:0 9px 25px rgba(37,99,235,.22)}.button.compact{padding:8px 10px;font-size:.78rem}.button.full{display:block;width:100%}
.topics-section{margin-top:32px}.section-title{display:flex;align-items:end;justify-content:space-between;margin-bottom:14px}.topic-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.topic-card{padding:18px;border:1px solid var(--border);border-radius:11px;background:var(--panel)}.topic-head{display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:9px;padding-bottom:14px;border-bottom:1px solid var(--border)}.topic-head>span{display:grid;place-items:center;width:27px;height:27px;border-radius:7px;background:var(--accent-soft);color:#93c5fd;font-size:.72rem;font-weight:900}.topic-head h3{margin:0;font-size:.95rem}.topic-average{min-width:40px;border-radius:999px;background:#0b1220;color:#93c5fd;padding:5px 8px;text-align:center;font-size:.76rem;font-weight:800}.score-row{display:grid;grid-template-columns:minmax(155px,1fr) minmax(90px,1fr) 28px;align-items:center;gap:10px;margin-top:14px;color:var(--muted);font-size:.78rem}.score-row input{width:100%;accent-color:var(--accent)}.score-row output{color:var(--text);font-weight:850;text-align:right}.save-state{min-height:17px;margin-top:12px;color:var(--muted);font-size:.7rem;text-align:right;opacity:0;transition:opacity .2s}.save-state.visible{opacity:1}.save-state.error{color:#fca5a5}.empty-state{text-align:center;padding:44px 20px;border:1px dashed #334155;border-radius:11px;color:var(--muted)}.empty-state>div{display:grid;place-items:center;width:42px;height:42px;margin:0 auto 12px;border-radius:50%;background:rgba(34,197,94,.12);color:#4ade80}.empty-state h3{margin:0;color:var(--text)}.empty-state p{margin:8px auto 0;max-width:470px}
.flash{margin-bottom:16px;padding:11px 13px;border:1px solid var(--border);border-radius:8px;background:var(--panel);font-size:.85rem}.flash.error{border-color:rgba(239,68,68,.45);color:#fecaca}.flash.success{border-color:rgba(34,197,94,.4);color:#bbf7d0}.auth-page{min-height:100vh;background:radial-gradient(circle at 20% 20%,rgba(59,130,246,.16),transparent 33%),var(--bg)}.auth-shell{min-height:100vh;display:grid;grid-template-columns:minmax(320px,1.15fr) minmax(320px,.85fr);align-items:center;gap:8vw;max-width:1100px;margin:auto;padding:50px}.auth-brand h1{margin:18px 0;font-size:clamp(2.5rem,6vw,5.6rem);line-height:.96;letter-spacing:-.06em}.auth-brand>p:last-child{max-width:540px;color:var(--muted);font-size:1.05rem;line-height:1.65}.auth-card{width:100%;max-width:430px;justify-self:end;padding:32px;border:1px solid var(--border);border-radius:14px;background:rgba(21,25,34,.94);box-shadow:var(--shadow)}.auth-card h2{margin:0 0 22px}.stack{display:flex;flex-direction:column;gap:16px}.stack label{display:flex;flex-direction:column;gap:7px;color:var(--muted);font-size:.78rem;font-weight:750}.stack input{border:1px solid #334155;border-radius:8px;background:#0b1220;color:var(--text);padding:12px}.code-input{font-size:1.35rem;letter-spacing:.3em;text-align:center}.text-link{display:block;margin-top:18px;color:#93c5fd;font-size:.82rem;text-align:center;text-decoration:none}.issued-code{margin:18px 0;padding:20px;border:1px solid rgba(59,130,246,.35);border-radius:10px;background:#0b1220;color:#bfdbfe;font-size:2rem;font-weight:900;letter-spacing:.25em;text-align:center}.muted{color:var(--muted);font-size:.84rem;line-height:1.5}


.topic-card{scroll-margin-top:140px}.topic-notes{display:flex;flex-direction:column;gap:8px;margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.topic-notes label{color:var(--muted);font-size:.8rem;font-weight:650}.topic-notes textarea{width:100%;min-height:85px;resize:vertical;border:1px solid #334155;border-radius:8px;background:#0b1220;color:var(--text);padding:10px;line-height:1.5}.topic-notes textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(59,130,246,.16)}.topic-notes button{align-self:flex-start}

/* Responsive layout and touch controls. */
.content,.page-head>div,.setup-copy,.topic-form,.topic-card,.topic-head h3,.auth-card,.stack{min-width:0}
.topic-head h3,.page-head h1,.auth-brand h1,.welcome{overflow-wrap:anywhere}
.new-exam input{min-width:0}
button,a,input,select,textarea,summary{-webkit-tap-highlight-color:transparent}
button,a,summary{touch-action:manipulation}
a:focus-visible,button:focus-visible,summary:focus-visible,input:focus-visible{outline:2px solid #93c5fd;outline-offset:3px}
@media(max-width:1200px){
  .setup-card{grid-template-columns:auto minmax(0,1fr)}
  .topic-form{grid-column:1/-1}
  .topic-grid{grid-template-columns:minmax(0,1fr)}
}
@media(max-width:900px){
  .app-layout{grid-template-columns:90px minmax(0,1fr)}
  .sidebar{padding:18px 10px}
  .sidebar-head,.sidebar-tip,.subject-item>span:nth-child(2),.chevron{display:none}
  .subject-item{display:flex;justify-content:center}
  .page-head{display:grid;grid-template-columns:minmax(0,1fr);gap:18px}
  .exam-control{width:100%}
  .auth-shell{grid-template-columns:minmax(0,1fr);gap:28px}
  .auth-card{justify-self:center}
  .auth-brand h1{font-size:3.5rem}
}
@media(max-width:760px){
  .app-layout{display:block}
  .topbar{padding:0 14px}
  .brand>span:last-child{font-size:.9rem}
  .welcome{display:none}
  .sidebar{position:sticky;top:64px;z-index:15;display:block;padding:8px 12px;border-right:0;border-bottom:1px solid var(--border);overflow-x:auto;overscroll-behavior-x:contain}
  .subject-list{flex-direction:row;width:max-content;gap:8px}
  .subject-item{flex:0 0 auto;gap:8px;min-height:44px;padding:6px 10px;border-color:var(--border)}
  .subject-item>span:nth-child(2){display:block;font-size:.85rem}
  .subject-icon{width:28px;height:28px;flex-shrink:0}
  .content{padding:24px 14px 40px;padding-bottom:max(40px,env(safe-area-inset-bottom));overflow:visible}
  .page-head h1{font-size:2rem}
  .page-head p:not(.eyebrow){line-height:1.5}
  .setup-card{padding:18px;gap:12px}
  .setup-copy h2,.section-title h2{font-size:1.2rem}
  .setup-copy>p:not(.eyebrow){margin-bottom:0}
  .topic-card{padding:16px;scroll-margin-top:150px}
  .topic-head{grid-template-columns:28px minmax(0,1fr) auto}
  .score-row{grid-template-columns:minmax(0,1fr) 36px;gap:4px 12px;font-size:.9rem;margin-top:18px}
  .score-row>span{grid-column:1/-1;line-height:1.45}
  .score-row input{min-width:0;min-height:44px;margin:0}
  .score-row output{font-size:1rem}
  .button,.button.compact,.ghost-button{min-height:44px;font-size:.9rem;white-space:normal}
  .topic-notes button{width:100%}
  .topic-notes label,.confirm-check span{font-size:.9rem;line-height:1.45}
  .topic-form textarea,.topic-notes textarea,.new-exam input,.exam-control select,.stack input{font-size:16px;min-height:44px}
  .confirm-check{min-height:48px;padding:12px}
  .confirm-check input{width:22px;height:22px;flex-shrink:0}
  .new-exam summary{min-height:44px;padding:12px 0;font-size:.9rem}
  .new-exam form{flex-direction:column}
  .section-title{gap:10px;flex-wrap:wrap}
  .section-title>span{white-space:nowrap}
  .auth-shell{min-height:100svh;padding:28px 18px;align-content:center;gap:24px}
  .auth-brand h1{font-size:clamp(2rem,8vw,3rem);line-height:1.08}
  .auth-brand>p:last-child{font-size:.95rem;line-height:1.5}
  .auth-card{max-width:100%;padding:22px}
  .stack .code-input{font-size:1.35rem}
  .text-link{display:flex;align-items:center;justify-content:center;min-height:44px;line-height:1.5}
}
@media(max-width:380px){
  .brand>span:last-child{font-size:.8rem}
  .topbar{padding:0 10px}
  .brand{gap:7px}
  .auth-card{padding:18px}
  .issued-code{font-size:1.6rem;letter-spacing:.15em}
}

/* Preparation overview. */
.overview-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.overview-stats>div{display:flex;flex-direction:column;gap:8px;padding:18px;border:1px solid var(--border);border-radius:11px;background:var(--panel)}.overview-stats strong{font-size:2rem;color:#93c5fd}.overview-stats span{color:var(--muted);font-size:.85rem}.overview-stats .attention-stat strong{color:#fbbf24}.overview-explanation{color:var(--muted);font-size:.82rem;line-height:1.6;margin:16px 0 28px}.overview-subjects{display:grid;gap:20px}.overview-subject{padding:22px;border:1px solid var(--border);border-radius:12px;background:var(--panel);min-width:0}.overview-link{display:inline-flex;align-items:center;min-height:44px;color:#93c5fd;text-decoration:none;font-size:.85rem;font-weight:700}.overview-link:hover{text-decoration:underline}.overview-topic-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.overview-topic{padding:16px;background:#0b1220;border:1px solid var(--border);border-radius:10px;min-width:0}.overview-topic.needs-attention{border-color:#755c28}.overview-topic.on-track{border-color:#235f43}.overview-topic-head{display:flex;gap:12px;flex-wrap:wrap;align-items:start;justify-content:space-between}.overview-topic h3{margin:0;font-size:1rem;overflow-wrap:anywhere}.overview-topic h3 a{color:var(--text);text-decoration:none}.overview-topic h3 a:hover{text-decoration:underline}.status-chip{display:inline-block;border-radius:999px;background:var(--accent-soft);color:#93c5fd;padding:5px 9px;font-size:.72rem;white-space:nowrap}.needs-attention .status-chip{background:#3d321c;color:#fcd34d}.on-track .status-chip{background:#153b2b;color:#86efac}.next-steps{display:grid;gap:8px;list-style:none;padding:0;margin:16px 0}.next-steps li{display:flex;justify-content:space-between;gap:10px;color:var(--muted);font-size:.85rem;line-height:1.5}.next-steps strong{flex-shrink:0;color:var(--text)}.attention-note{padding:12px;border-radius:8px;background:#27251d;color:#fde68a;font-size:.85rem;line-height:1.5}.attention-note p{white-space:pre-wrap;overflow-wrap:anywhere;margin:7px 0 0}.empty-state .button{display:inline-block;margin-top:18px}
@media(max-width:1100px){.overview-topic-list{grid-template-columns:minmax(0,1fr)}}
@media(max-width:760px){.overview-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.overview-stats>div{padding:14px}.overview-stats span{font-size:.8rem}.overview-subject{padding:16px}.overview-explanation{font-size:.85rem}.overview-topic{padding:14px}.next-steps li,.attention-note{font-size:.9rem}}

/* Compact RAG cards. */
.overview-stats>div{padding:12px 16px;gap:3px}.overview-stats strong{font-size:1.6rem}.overview-subjects{gap:14px}.overview-subject{padding:16px}.overview-subject .section-title{margin-bottom:4px}.overview-subject>.muted{margin:0 0 12px}.overview-topic{padding:12px;scroll-margin-top:150px}.overview-topic-list{align-items:start}.overview-topic h3{font-size:.92rem}.overview-topic-head{gap:7px}.overview-topic>.overview-link{font-size:.78rem;min-height:32px}
.rag-legend{display:flex;flex-wrap:wrap;gap:8px 16px;margin:14px 0 6px;color:var(--muted);font-size:.78rem}.rag-legend span{display:flex;align-items:center;gap:7px}.rag-legend i{display:inline-block;width:12px;height:12px;border-radius:3px}.rag-red{background:#dc4848}.rag-amber{background:#e6a52b}.rag-green{background:#2bb36f}.overview-help{color:var(--muted);font-size:.78rem;line-height:1.5;margin-bottom:18px}.overview-help summary{cursor:pointer;padding:6px 0}.overview-help p{margin:6px 0}
.rag-strip{position:relative;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;margin:12px 0}.rag-cell{min-width:0;width:100%;height:32px;border:1px solid rgba(255,255,255,.18);border-radius:5px;cursor:help;padding:0}.rag-cell:hover,.rag-cell:focus{outline:2px solid var(--text);outline-offset:2px}.rag-tooltip{position:absolute;top:calc(100% + 8px);left:0;width:100%;display:none;z-index:25;background:#1f2937;color:var(--text);padding:10px;border:1px solid #475569;border-radius:7px;font-size:.8rem;line-height:1.5;text-align:left;box-shadow:var(--shadow);overflow-wrap:anywhere;pointer-events:none}.rag-cell:focus .rag-tooltip{display:block}
@media(hover:hover){.rag-cell:hover .rag-tooltip{display:block}}
.overview-notes{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 8px}.overview-notes label{grid-column:1/-1;font-size:.76rem;color:var(--muted)}.overview-notes textarea{width:100%;min-width:0;resize:vertical;min-height:62px;border:1px solid #334155;border-radius:7px;background:#101827;color:var(--text);padding:8px;font-size:.85rem;line-height:1.5}.overview-notes textarea:focus{outline:2px solid #93c5fd;outline-offset:2px}.overview-notes button{align-self:end;min-height:36px}
@media(max-width:760px){.rag-cell{height:44px}.overview-notes textarea{font-size:16px}.overview-notes button{min-height:44px}.overview-topic>.overview-link{min-height:44px}.overview-help summary{min-height:44px;display:flex;align-items:center}.overview-stats>div{padding:12px}.overview-topic-list{gap:10px}}
