:root{
  --ink:#1C2B48;
  --ink-soft:#33456B;
  --paper:#F6F3EA;
  --panel:#EFE8D6;
  --panel-border:#D9CFB2;
  --text:#28241C;
  --text-soft:#5B5647;
  --accent:#BD5B2C;
  --accent-soft:#F1DCC4;
  --good:#3B7358;
  --good-soft:#DCEAE1;
  --bad:#AE3B2E;
  --bad-soft:#F3DFD9;
  --line:#DAD3BE;
  --white:#FFFDF8;
}
*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:'Inter',system-ui,sans-serif;
  background:var(--paper);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}
.screen{display:none; min-height:100vh;}
.screen.active{display:flex; flex-direction:column;}

/* ---------- SETUP SCREEN ---------- */
#screen-setup{align-items:center; justify-content:center; padding:40px 20px;}
.setup-card{
  width:100%; max-width:640px;
  background:var(--white);
  border:1px solid var(--line);
  border-radius:4px;
  padding:44px 44px 36px;
}
.setup-eyebrow{font-size:13px; color:var(--accent); font-weight:600; letter-spacing:.02em;}
.setup-card h1{
  font-family:'Source Serif 4', Georgia, serif;
  font-size:32px; line-height:1.15; margin:8px 0 6px; font-weight:600;
}
.setup-card p.lede{color:var(--text-soft); font-size:15px; line-height:1.55; margin:0 0 30px; max-width:50ch;}
label.field-label{display:block; font-size:13px; font-weight:600; color:var(--ink); margin-bottom:8px;}
#studentName{
  width:100%; padding:13px 14px; font-size:16px; font-family:inherit;
  border:1px solid var(--panel-border); border-radius:3px; background:var(--paper);
  color:var(--text);
}
#studentName:focus{outline:2px solid var(--ink); outline-offset:1px;}
.field-block{margin-bottom:28px;}

.passage-choices{display:flex; flex-direction:column; gap:10px;}
.passage-card{
  border:1px solid var(--panel-border); border-radius:3px; padding:16px 18px;
  background:var(--paper); cursor:pointer; text-align:left; width:100%;
  display:flex; align-items:center; gap:14px; font-family:inherit;
}
.passage-card .radio-dot{
  width:16px; height:16px; border-radius:50%; border:2px solid var(--panel-border);
  flex:0 0 auto; position:relative;
}
.passage-card.selected{border-color:var(--ink); background:var(--white); box-shadow: 0 0 0 1px var(--ink);}
.passage-card.selected .radio-dot{border-color:var(--ink);}
.passage-card.selected .radio-dot::after{
  content:""; position:absolute; inset:3px; background:var(--ink); border-radius:50%;
}
.passage-card .pc-title{font-weight:600; font-size:15px; color:var(--text); margin-bottom:2px;}
.passage-card .pc-theme{font-size:13px; color:var(--text-soft);}

.begin-btn{
  margin-top:32px; width:100%; padding:15px; font-size:15px; font-weight:600;
  background:var(--ink); color:var(--white); border:none; border-radius:3px; cursor:pointer;
  font-family:inherit; letter-spacing:.01em;
}
.begin-btn:disabled{background:#B7B2A2; cursor:not-allowed;}
.begin-btn:not(:disabled):hover{background:var(--ink-soft);}
.setup-foot{margin-top:16px; font-size:12.5px; color:var(--text-soft); text-align:center;}

/* ---------- TEST SCREEN ---------- */
#screen-test{height:100vh;}
.test-header{
  background:var(--ink); color:var(--white);
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 26px; flex:0 0 auto; gap:20px; flex-wrap:wrap;
}
.test-header .th-left{display:flex; flex-direction:column; gap:2px;}
.test-header .th-title{font-family:'Source Serif 4',serif; font-size:19px; font-weight:600;}
.test-header .th-sub{font-size:12.5px; color:#B9C3D8;}
.test-header .th-right{display:flex; align-items:center; gap:22px;}
.name-badge{font-size:13px; color:#CBD4E5;}
.name-badge strong{color:var(--white); font-weight:600;}
.timer-wrap{display:flex; flex-direction:column; align-items:flex-end; gap:5px;}
.timer{
  font-family:'IBM Plex Mono', monospace; font-size:22px; font-weight:600; letter-spacing:.02em;
}
.timer.urgent{color:#F2A98E;}
.timer-bar{width:130px; height:4px; background:#3A4D74; border-radius:2px; overflow:hidden;}
.timer-bar-fill{height:100%; background:var(--accent); width:100%; transition:width 1s linear;}

.req-strip{
  background:var(--accent-soft); color:#6B3A17; font-size:13px; padding:9px 26px;
  border-bottom:1px solid var(--panel-border); flex:0 0 auto;
}

.test-body{
  flex:1 1 auto; display:grid; grid-template-columns:1fr 1fr; gap:0; min-height:0;
}
.passage-pane{
  border-right:1px solid var(--line); display:flex; flex-direction:column; min-height:0; background:var(--paper);
}
.pane-heading{
  padding:16px 30px 10px; font-size:12.5px; font-weight:600; color:var(--text-soft);
  flex:0 0 auto; text-transform:none;
}
.passage-scroll{
  flex:1 1 auto; overflow-y:auto; padding:6px 30px 30px;
}
.passage-scroll h2{
  font-family:'Source Serif 4', Georgia, serif; font-size:24px; margin:0 0 16px; font-weight:600;
}
.passage-scroll p{
  font-family:'Source Serif 4', Georgia, serif; font-size:17px; line-height:1.7; color:var(--text);
  margin:0 0 18px; max-width:62ch;
}

.writing-pane{display:flex; flex-direction:column; min-height:0;}
.jump-nav{
  display:flex; gap:8px; padding:14px 30px 0; flex:0 0 auto; background:var(--paper);
}
.jump-btn{
  font-family:inherit; font-size:13px; font-weight:600; padding:8px 16px; border-radius:20px;
  border:1px solid var(--panel-border); background:var(--white); color:var(--text-soft); cursor:pointer;
}
.jump-btn.active{background:var(--ink); border-color:var(--ink); color:var(--white);}

.writing-scroll{flex:1 1 auto; overflow-y:auto; padding:18px 30px 30px; min-height:0;}
.task-block{margin-bottom:26px;}
.task-prompt{font-size:14px; color:var(--text); margin:0 0 4px; font-weight:500;}
.task-req{font-size:12.5px; color:var(--text-soft); margin:0 0 10px;}
.box-wrap{border:1px solid var(--panel-border); border-radius:3px; overflow:hidden; background:var(--white);}
.box-header{
  background:var(--ink); color:var(--white); font-size:12.5px; font-weight:600;
  padding:8px 14px; display:flex; justify-content:space-between; align-items:center;
}
.box-header .wc-badge{
  padding:2px 9px; border-radius:20px; background:rgba(255,255,255,.14); font-family:'IBM Plex Mono',monospace;
}
.box-header .wc-badge.good{background:var(--good); color:var(--white);}
.box-header .wc-badge.bad{background:var(--bad); color:var(--white);}
textarea{
  width:100%; border:none; resize:vertical; font-family:inherit; font-size:15px; line-height:1.55;
  padding:14px; color:var(--text); background:var(--white); display:block;
}
textarea:focus{outline:none; background:#FFFEF9;}
#summaryBox{height:110px;}
#opinionBox{height:190px;}
.hint-line{font-size:12px; margin-top:6px;}
.hint-line.bad{color:var(--bad);}
.hint-line.good{color:var(--good);}
.hint-line.neutral{color:var(--text-soft);}

.test-footer{
  flex:0 0 auto; border-top:1px solid var(--line); padding:14px 30px; display:flex;
  justify-content:flex-end; align-items:center; gap:12px; background:var(--white); flex-wrap:wrap;
}
.submit-warning{
  display:none; align-items:center; gap:10px; font-size:13px; color:#6B3A17;
  background:var(--accent-soft); border:1px solid #E0B78D; border-radius:3px;
  padding:9px 12px; flex:1 1 260px;
}
.submit-warning.show{display:flex;}
.btn-secondary{
  font-family:inherit; font-size:14px; font-weight:600; padding:11px 18px; border-radius:3px;
  border:1px solid var(--panel-border); background:var(--white); color:var(--text); cursor:pointer;
}
.btn-primary{
  font-family:inherit; font-size:14px; font-weight:600; padding:11px 22px; border-radius:3px;
  border:none; background:var(--ink); color:var(--white); cursor:pointer;
}
.btn-primary:hover{background:var(--ink-soft);}

/* ---------- RESULTS SCREEN ---------- */
#screen-results{align-items:center; padding:50px 20px; justify-content:flex-start;}
.results-card{width:100%; max-width:720px; background:var(--white); border:1px solid var(--line); border-radius:4px; padding:40px 44px 34px;}
.results-card h1{font-family:'Source Serif 4',serif; font-size:27px; margin:6px 0 4px;}
.results-meta{font-size:13px; color:var(--text-soft); margin-bottom:26px;}
.results-section{margin-bottom:22px;}
.results-section h3{font-size:13px; text-transform:none; color:var(--ink); margin:0 0 6px; font-weight:600;}
.results-section .rs-wc{font-family:'IBM Plex Mono',monospace; font-size:12px; color:var(--text-soft); margin-left:8px;}
.results-body{
  background:var(--paper); border:1px solid var(--panel-border); border-radius:3px; padding:14px 16px;
  font-size:14.5px; line-height:1.6; white-space:pre-wrap;
}
.results-actions{display:flex; gap:10px; flex-wrap:wrap; margin-top:28px;}
.note-box{
  margin-top:26px; font-size:12.5px; color:var(--text-soft); background:var(--panel);
  border:1px solid var(--panel-border); border-radius:3px; padding:12px 14px; line-height:1.55;
}

@media (max-width:840px){
  .test-body{grid-template-columns:1fr; grid-template-rows:1fr 1fr;}
  .passage-pane{border-right:none; border-bottom:1px solid var(--line);}
}
@media print{
  .test-header, .req-strip, .results-actions, .note-box{display:none !important;}
}

:root{--ink:#dce6ee;--ink-soft:#b9d7ec;--paper:#051326;--panel:#0b2744;--panel-border:#28516b;--text:#e4e7e5;--text-soft:#c2ccd3;--accent:#71d6ef;--accent-soft:#123f54;--good:#9fe3bd;--good-soft:#15392e;--bad:#ffb4a9;--bad-soft:#492827;--line:#28516b;--white:#06182e}
.setup-card,.results-card{border-radius:20px}.practice-note{font-size:13px;line-height:1.6;color:var(--text-soft)}.erc-return{display:inline-block;color:#71d6ef;margin-bottom:20px;font-size:14px}.begin-btn,.btn-primary{background:#075bd8;color:#fff}.begin-btn:disabled{background:#24445e;color:#abbac6}.btn-secondary{color:var(--text)}[hidden]{display:none!important}#draftPrompt{margin-bottom:20px}a:focus-visible,button:focus-visible{outline:3px solid #71d6ef;outline-offset:4px}
.test-header,.box-header{background:#0b2744;color:#e4e7e5}.name-badge strong{color:#fff}.req-strip,.submit-warning{color:#dce6ee}.submit-warning{border-color:#71d6ef}.jump-btn.active{background:#123f54;color:#e4e7e5;border-color:#71d6ef}textarea:focus{background:#0b2744;outline:2px solid #71d6ef;outline-offset:-2px}.begin-btn:not(:disabled):hover,.btn-primary:hover{background:#086de8}.box-header .wc-badge{color:#e4e7e5}.box-header .wc-badge.good,.box-header .wc-badge.bad{color:#051326}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
@media print{:root{--ink:#111;--text:#111;--text-soft:#333;--white:#fff;--paper:#fff;--line:#ccc}.practice-note,.erc-return{display:none}}

