:root{
    --cb-blue:      #324DC7;
    --cb-blue-dark: #2538A8;
    --cb-blue-bg:   #3B4FC0;
    --cb-navy:      #232C63;
    --cb-lightband: #E3EAF8;
    --cb-yellow:    #FFCE31;
    --cb-red:       #B72C3D;
    --ink:          #1E1E1E;
    --ink-soft:     #4F5560;
    --line:         #D9D9D9;
    --serif: Georgia, "Times New Roman", Times, serif;
    --sans: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --hl-yellow: #FBF3B6;
    --hl-blue:   #CDE4FB;
    --hl-pink:   #F8D2E2;
  }
  *{ box-sizing:border-box; }
  html,body{ height:100%; }
  body{ margin:0; font-family:var(--sans); color:var(--ink); background:#fff; -webkit-font-smoothing:antialiased; }
  button{ font-family:inherit; cursor:pointer; }
  .hidden{ display:none !important; }
  :focus-visible{ outline:2px solid var(--cb-blue); outline-offset:2px; }

  .pill{
    border:none; border-radius:24px; padding:12px 30px; font-size:15px; font-weight:700;
    background:var(--cb-blue); color:#fff;
  }
  .pill:hover{ background:var(--cb-blue-dark); }
  .pill.ghost{ background:#fff; color:var(--cb-navy); border:1.5px solid var(--cb-navy); }
  .pill.ghost:hover{ background:#F2F4FB; }
  .pill.yellow{ background:var(--cb-yellow); color:var(--ink); }
  .pill.yellow:hover{ background:#F5C112; }

  /* ================= SIGN IN ================= */
  #screen-signin{
    min-height:100vh; background:var(--cb-blue-bg);
    display:flex; flex-direction:column; align-items:center; padding:60px 20px;
  }
  .bb-logo{ color:#fff; font-size:34px; font-weight:800; letter-spacing:-0.5px; display:flex; align-items:center; gap:8px; }
  .bb-logo .star{ font-size:30px; transform:rotate(-12deg); display:inline-block; }
  .bb-logo sup{ font-size:11px; font-weight:400; }
  .signin-card{
    background:#fff; border-radius:16px; padding:38px 44px; width:100%; max-width:520px;
    margin-top:48px; box-shadow:0 6px 24px rgba(0,0,0,.18); text-align:center;
  }
  .signin-card h1{ margin:0 0 26px; font-size:28px; }
  .signin-card label{ display:block; text-align:left; font-size:13px; font-weight:700; margin:0 0 6px; }
  .signin-card input{
    width:100%; padding:12px 14px; font-size:16px; border:1.5px solid #9AA0AE; border-radius:8px;
  }
  .signin-card .pill{ width:100%; margin-top:22px; }
  .signin-note{ margin-top:22px; font-size:13px; color:var(--ink-soft); }
  .signin-footer{ margin-top:auto; color:#C9D2F2; font-size:12px; padding-top:40px; }

  /* ================= HOME ================= */
  #screen-home{ min-height:100vh; }
  .home-top{
    display:flex; align-items:center; justify-content:space-between; padding:18px 42px;
  }
  .home-top .bb-logo-sm{ color:var(--cb-blue); font-size:22px; font-weight:800; display:flex; align-items:center; gap:6px; }
  .home-user{ display:flex; align-items:center; gap:10px; font-weight:700; }
  .home-user .avatar{
    width:36px; height:36px; border-radius:50%; background:var(--cb-blue); color:#fff;
    display:flex; align-items:center; justify-content:center; font-size:15px;
  }
  .welcome-band{
    background:var(--cb-lightband); padding:44px 0;
  }
  .welcome-band h1{
    max-width:1100px; margin:0 auto; padding:0 42px; font-weight:400;
    color:var(--cb-blue); font-size:38px;
  }
  .home-main{ max-width:1100px; margin:0 auto; padding:36px 42px 80px; }
  .home-sectionrow{ display:flex; align-items:center; gap:20px; margin:34px 0 20px; flex-wrap:wrap; }
  .home-sectionrow h2{ margin:0; font-size:28px; }
  .seg{
    display:flex; border:1.5px solid #9AA0AE; border-radius:22px; overflow:hidden; font-size:14px; font-weight:700;
  }
  .seg span{ padding:8px 18px; }
  .seg .on{ background:var(--cb-navy); color:#fff; }
  .no-tests-card{
    border:1px solid var(--line); border-radius:12px; max-width:560px; padding:28px 34px; text-align:center;
    box-shadow:0 2px 8px rgba(0,0,0,.06);
  }
  .no-tests-card h3{ margin:0 0 10px; font-size:20px; }
  .no-tests-card p{ margin:0; font-size:15px; line-height:1.6; }
  .practice-cards{ display:flex; gap:22px; flex-wrap:wrap; }
  .pcard{
    border:1px solid var(--line); border-radius:12px; width:250px; padding:30px 20px 26px; text-align:center;
    box-shadow:0 2px 8px rgba(0,0,0,.06); transition:box-shadow .15s, transform .15s;
  }
  .pcard:hover{ box-shadow:0 6px 18px rgba(50,77,199,.18); transform:translateY(-2px); cursor:pointer; }
  .pcard .icn{ font-size:40px; margin-bottom:16px; }
  .pcard h3{ margin:0; font-size:19px; line-height:1.35; }
  .pcard .sub{ font-size:12.5px; color:var(--ink-soft); margin-top:8px; }
  .bigfuture{
    display:flex; border:1px solid var(--line); border-radius:12px; overflow:hidden; margin-top:16px;
    box-shadow:0 2px 8px rgba(0,0,0,.06); max-width:900px;
  }
  .bigfuture .bf-img{
    width:280px; min-height:180px; background:linear-gradient(135deg,#E5387A 0%, #324DC7 100%); flex-shrink:0;
    display:flex; align-items:center; justify-content:center; color:#fff; font-size:44px;
  }
  .bigfuture .bf-body{ padding:26px 30px; }
  .bigfuture h3{ margin:0 0 10px; font-size:21px; }
  .bigfuture p{ margin:0 0 18px; font-size:15px; line-height:1.55; max-width:560px; }

  /* ================= LOADING ================= */
  #screen-loading{ min-height:100vh; display:flex; flex-direction:column; align-items:center; padding-top:90px; }
  #screen-loading h1{ font-weight:400; font-size:34px; margin:0 0 46px; }
  .loading-card{
    border:1px solid var(--line); border-radius:12px; padding:50px 70px; text-align:center; max-width:580px;
    box-shadow:0 2px 10px rgba(0,0,0,.07);
  }
  .hourglass{ font-size:64px; animation:hgspin 2.4s ease-in-out infinite; display:inline-block; }
  @keyframes hgspin{ 0%,70%{ transform:rotate(0);} 85%,100%{ transform:rotate(180deg);} }
  .loading-card p{ font-size:18px; line-height:1.6; margin:30px 0 0; }

  /* ================= GET READY / INTERSTITIAL ================= */
  #screen-ready{ min-height:100vh; display:flex; flex-direction:column; }
  #screen-ready .ready-body{ flex:1; display:flex; flex-direction:column; align-items:center; padding:60px 20px 20px; }
  #screen-ready h1{ font-weight:400; font-size:34px; margin:0 0 40px; }
  .ready-card{
    border:1px solid var(--line); border-radius:12px; padding:38px 44px; max-width:620px; width:100%;
    box-shadow:0 2px 10px rgba(0,0,0,.07);
  }
  .ready-item{ display:flex; gap:18px; margin-bottom:30px; }
  .ready-item:last-child{ margin-bottom:0; }
  .ready-item .ricon{
    width:40px; height:40px; border-radius:50%; background:#EBEBEB; flex-shrink:0;
    display:flex; align-items:center; justify-content:center; font-size:19px;
  }
  .ready-item h3{ margin:0 0 6px; font-size:19px; }
  .ready-item p{ margin:0; font-size:15px; line-height:1.55; }
  .ready-footer{
    display:flex; justify-content:flex-end; gap:14px; padding:20px 40px 34px;
  }

  /* ================= TEST SCREEN ================= */
  #screen-test{ display:flex; flex-direction:column; height:100vh; overflow:hidden; }
  .t-header{
    position:relative; padding:14px 24px 10px; flex-shrink:0;
    border-bottom:2px dashed var(--ink);
    display:grid; grid-template-columns:1fr auto 1fr; align-items:start;
  }
  .t-header .th-left h1{ margin:0; font-size:20px; font-weight:700; }
  .dir-toggle{
    background:none; border:none; font-size:15px; font-weight:600; padding:6px 0 0; display:flex; align-items:center; gap:6px;
  }
  .dir-toggle .chev{ transition:transform .15s; font-size:12px; }
  .dir-toggle.open .chev{ transform:rotate(180deg); }
  .th-center{ text-align:center; justify-self:center; }
  .t-timer{ font-size:26px; font-weight:700; letter-spacing:.5px; min-height:32px; }
  .t-timer.warn{ color:var(--cb-red); }
  .t-timer .clock-ico{ font-size:22px; }
  .timer-btn{
    margin-top:2px; background:#fff; border:1.5px solid var(--ink); border-radius:16px;
    font-size:13px; font-weight:700; padding:3px 16px;
  }
  .th-right{ justify-self:end; text-align:right; }
  .battery{ font-size:11.5px; color:var(--ink-soft); margin-bottom:4px; }
  .th-tools{ display:flex; gap:22px; justify-content:flex-end; }
  .th-tool{ background:none; border:none; font-size:12.5px; font-weight:600; color:var(--ink); text-align:center; }
  .th-tool .ticon{ font-size:17px; display:block; margin-bottom:2px; }

  .t-body{ flex:1; display:flex; overflow:hidden; position:relative; margin-top:6px; }
  .pane{ overflow-y:auto; padding:26px 40px 60px; }
  .pane-left{ width:50%; }
  .pane-right{ flex:1; }
  .t-body.single .pane-left, .t-body.single #divider{ display:none; }
  .t-body.single .pane-right{ max-width:860px; margin:0 auto; }
  #divider{
    width:3px; background:#8b8b8b; position:relative; flex-shrink:0; cursor:col-resize;
  }
  #divider .grip{
    position:absolute; top:200px; left:50%; transform:translateX(-50%);
    width:22px; height:34px; background:#f2f2f2; border:1px solid #8b8b8b; border-radius:4px;
    display:flex; align-items:center; justify-content:center; font-size:11px; color:#555; user-select:none;
  }

  .passage-text{
    font-family:var(--serif); font-size:17.5px; line-height:1.75; max-width:660px; white-space:pre-wrap;
  }
  .passage-text ::selection, .passage-text::selection{ background:#BBD3F5; }
  .hl{ cursor:pointer; }
  .hl.c-yellow{ background:var(--hl-yellow); }
  .hl.c-blue{ background:var(--hl-blue); }
  .hl.c-pink{ background:var(--hl-pink); }
  .hl.c-none{ background:transparent; }
  .hl.u-solid{ text-decoration:underline; text-decoration-style:solid; text-decoration-thickness:2px; }
  .hl.u-dashed{ text-decoration:underline; text-decoration-style:dashed; text-decoration-thickness:2px; }
  .hl.u-dotted{ text-decoration:underline; text-decoration-style:dotted; text-decoration-thickness:2px; }

  .q-head{
    display:flex; align-items:stretch; margin-bottom:18px; border-bottom:2px solid var(--ink); position:relative;
  }
  .q-num{
    background:var(--ink); color:#fff; font-weight:700; font-size:16px; min-width:34px;
    display:flex; align-items:center; justify-content:center; padding:8px 10px;
  }
  .q-flag{
    flex:1; background:#F3F3F3; border:none; display:flex; align-items:center; gap:8px;
    font-size:14.5px; font-weight:600; padding:0 14px; text-align:left;
  }
  .q-flag .bkm{ font-size:16px; color:#555; }
  .q-flag.on{ text-decoration:underline; }
  .q-flag.on .bkm{ color:var(--cb-red); }
  .abc-toggle{
    background:#F3F3F3; border:none; border-left:1px solid #d5d5d5; padding:0 14px;
    font-size:11px; font-weight:800; letter-spacing:.5px; position:relative;
  }
  .abc-toggle .abctxt{ text-decoration:line-through; }
  .abc-toggle.on{ background:var(--cb-navy); color:#fff; }

  .q-text{
    font-family:var(--serif); font-size:17.5px; line-height:1.6; margin-bottom:22px; white-space:pre-wrap; max-width:760px;
  }
  .choices{ display:flex; flex-direction:column; gap:14px; max-width:760px; }
  .choice-row{ display:flex; align-items:center; gap:12px; }
  .choice{
    flex:1; display:flex; align-items:center; gap:14px; border:1.5px solid var(--ink);
    border-radius:8px; padding:12px 16px; font-family:var(--serif); font-size:16.5px; line-height:1.45;
    background:#fff; cursor:pointer;
  }
  .choice:hover{ background:#FAFAFA; }
  .choice .clabel{
    width:27px; height:27px; border-radius:50%; border:1.5px solid var(--ink); flex-shrink:0;
    display:flex; align-items:center; justify-content:center;
    font-family:var(--sans); font-size:13px; font-weight:700;
  }
  .choice.selected{ border-color:var(--cb-blue); border-width:2px; }
  .choice.selected .clabel{ background:var(--cb-blue); border-color:var(--cb-blue); color:#fff; }
  .choice.eliminated{ color:#999; }
  .choice.eliminated .ctext{ text-decoration:line-through; }
  .choice.eliminated .clabel{ border-color:#999; color:#999; }
  .elim-btn{
    width:30px; height:30px; border-radius:50%; border:1.5px solid var(--ink); background:#fff;
    font-size:12px; font-weight:700; position:relative; flex-shrink:0; display:none;
    align-items:center; justify-content:center;
  }
  .elim-btn::after{
    content:""; position:absolute; left:-3px; right:-3px; top:50%; height:1.5px; background:var(--ink);
    transform:rotate(-18deg);
  }
  .elim-mode .elim-btn{ display:flex; }
  .elim-undo{
    display:none; background:none; border:none; font-size:13px; font-weight:700;
    text-decoration:underline; flex-shrink:0; padding:4px;
  }
  .elim-mode .choice-row.is-elim .elim-undo{ display:inline; }
  .elim-mode .choice-row.is-elim .elim-btn{ display:none; }

  /* SPR (student-produced response) */
  .spr-dir{ font-family:var(--serif); max-width:700px; }
  .spr-dir h2{ font-size:22px; margin:0 0 18px; }
  .spr-dir ul{ padding-left:22px; margin:0 0 26px; }
  .spr-dir li{ font-size:16px; line-height:1.6; margin-bottom:12px; }
  .spr-extitle{ text-align:center; font-size:16.5px; margin-bottom:8px; }
  .spr-table{ border-collapse:collapse; margin:0 auto; font-size:15px; font-family:var(--serif); }
  .spr-table th, .spr-table td{ border:1px solid #444; padding:10px 16px; text-align:center; vertical-align:middle; }
  .spr-table code{ background:#eee; padding:2px 7px; display:inline-block; margin:2px 0; font-size:13.5px; font-family:var(--mono, monospace); }
  .spr-input{
    width:150px; font-size:22px; font-family:var(--sans); padding:12px 14px;
    border:1.5px solid var(--ink); border-radius:10px;
  }
  .spr-input:focus{ border-color:var(--cb-blue); }
  .ap-label{ font-family:var(--serif); font-weight:700; font-size:22px; margin:32px 0 14px; }
  .ap-val{ font-family:var(--serif); font-size:24px; }
  .frac{ font-family:var(--serif); font-size:22px; display:inline-flex; align-items:center; gap:4px; }
  .fstack{ display:inline-flex; flex-direction:column; align-items:center; line-height:1.15; }
  .fbar{ width:100%; height:1.5px; background:#111; margin:2px 0; }
  .keypad-toggle{
    background:#1E1E1E; color:#fff; border:none; border-radius:22px; padding:10px 20px;
    font-size:14.5px; font-weight:700; margin-top:28px; display:inline-flex; gap:8px; align-items:center;
  }
  .keypad{
    position:fixed; z-index:90; background:#fff; border-radius:12px;
    box-shadow:0 10px 30px rgba(0,0,0,.35); width:276px;
  }
  .keypad-head{
    background:#1E1E1E; color:#fff; border-radius:12px 12px 0 0; display:flex; align-items:center;
    padding:10px 14px; font-weight:700; cursor:move; user-select:none;
  }
  .kp-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; padding:14px 14px 0; }
  .kp-row5{ display:grid; grid-template-columns:repeat(5,1fr); gap:8px; padding:10px 14px 14px; }
  .keypad button[data-k]{
    font-size:19px; font-weight:600; padding:11px 0; border:1px solid #cfcfcf; border-radius:10px;
    background:#fff; box-shadow:0 2px 0 #d8d8d8;
  }
  .keypad button[data-k]:active{ transform:translateY(1px); box-shadow:none; }

  .t-footer{
    flex-shrink:0; border-top:2px dashed var(--ink); padding:14px 30px;
    display:grid; grid-template-columns:1fr auto 1fr; align-items:center;
  }
  .tf-name{ font-size:17px; font-weight:700; }
  .qnav-btn{
    justify-self:center; background:var(--ink); color:#fff; border:none; border-radius:8px;
    font-size:15px; font-weight:700; padding:11px 20px; display:flex; align-items:center; gap:10px;
  }
  .qnav-btn .chev{ font-size:11px; }
  .tf-right{ justify-self:end; display:flex; gap:12px; }

  /* Directions popup */
  .dir-overlay{
    position:absolute; inset:0; background:rgba(60,60,60,.45); z-index:40;
  }
  .dir-panel{
    position:absolute; top:0; left:26px; width:min(880px, 78%); background:#fff;
    border-radius:0 0 10px 10px; padding:30px 36px 24px; box-shadow:0 10px 30px rgba(0,0,0,.3);
    max-height:75vh; overflow-y:auto;
  }
  .dir-panel::before{
    content:""; position:absolute; top:-12px; left:34px; border:12px solid transparent; border-bottom-color:#fff; border-top:none;
  }
  .dir-panel p{ font-family:var(--serif); font-size:16.5px; line-height:1.65; margin:0 0 16px; }
  .dir-panel .close-row{ display:flex; justify-content:flex-end; }

  /* Highlight popup */
  .hl-popup{
    position:absolute; z-index:60; background:#fff; border-radius:26px; padding:8px 14px;
    box-shadow:0 4px 18px rgba(0,0,0,.3); display:flex; align-items:center; gap:10px;
  }
  .hl-dot{ width:26px; height:26px; border-radius:50%; border:1.5px solid #bbb; cursor:pointer; }
  .hl-dot.y{ background:var(--hl-yellow); }
  .hl-dot.b{ background:var(--hl-blue); }
  .hl-dot.p{ background:var(--hl-pink); }
  .hl-sep{ width:1px; height:26px; background:#ddd; }
  .hl-tool{ background:none; border:none; font-size:16px; padding:2px 4px; position:relative; }
  .hl-u{ font-weight:700; text-decoration:underline; font-size:15px; }
  .u-menu{
    position:absolute; top:34px; left:50%; transform:translateX(-50%); background:#fff; border-radius:10px;
    box-shadow:0 4px 16px rgba(0,0,0,.28); padding:6px 0; display:flex; flex-direction:column; min-width:74px; z-index:70;
  }
  .u-menu button{ background:none; border:none; padding:9px 12px; font-size:15px; font-weight:700; }
  .u-menu button:hover{ background:#F1F3FA; }
  .u-menu .u-solid{ text-decoration:underline; }
  .u-menu .u-dashed{ text-decoration:underline; text-decoration-style:dashed; }
  .u-menu .u-dotted{ text-decoration:underline; text-decoration-style:dotted; }

  /* Question navigator popup */
  .qnav-overlay{ position:fixed; inset:0; z-index:50; }
  .qnav-popup{
    position:fixed; bottom:84px; left:50%; transform:translateX(-50%); z-index:55;
    background:#fff; border-radius:12px; box-shadow:0 8px 34px rgba(0,0,0,.32);
    padding:22px 30px 24px; width:min(640px, 92vw);
  }
  .qnav-popup::after{
    content:""; position:absolute; bottom:-11px; left:50%; transform:translateX(-50%);
    border:11px solid transparent; border-top-color:#fff; border-bottom:none;
  }
  .qnav-title{ text-align:center; font-size:18px; font-weight:700; margin:0 34px 16px; }
  .qnav-close{
    position:absolute; top:14px; right:14px; background:none; border:none; font-size:20px; line-height:1;
  }
  .qnav-legend{
    display:flex; justify-content:center; gap:26px; font-size:13.5px; font-weight:600;
    border-top:1px solid var(--line); border-bottom:1px solid var(--line); padding:10px 0; margin-bottom:20px;
  }
  .qnav-legend span{ display:flex; align-items:center; gap:7px; }
  .lg-pin{ font-size:15px; }
  .lg-dash{ width:15px; height:15px; border:1.5px dashed var(--cb-blue); display:inline-block; }
  .lg-flag{ color:var(--cb-red); font-size:15px; }
  .qnav-grid{
    display:grid; grid-template-columns:repeat(10, 1fr); gap:14px 10px; padding:14px 4px 6px; justify-items:center;
  }
  .qcell{
    position:relative; width:38px; height:34px; font-size:15px; font-weight:700; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    border:1.5px dashed var(--cb-blue); color:var(--cb-blue); background:#fff;
  }
  .qcell.answered{ background:var(--cb-blue); border:1.5px solid var(--cb-blue); color:#fff; }
  .qcell .cellpin{
    position:absolute; top:-19px; left:50%; transform:translateX(-50%); font-size:14px; color:var(--ink);
  }
  .qcell .cellflag{
    position:absolute; top:-8px; right:-7px; font-size:13px; color:var(--cb-red);
  }
  .qnav-gotoreview{ display:flex; justify-content:center; margin-top:18px; }

  /* Check your work (review view) */
  .review-wrap{ max-width:760px; margin:0 auto; padding:40px 24px 60px; text-align:center; }
  .review-wrap h1{ font-weight:400; font-size:32px; margin:0 0 14px; }
  .review-wrap .rv-sub{ font-size:15.5px; line-height:1.6; margin:0 auto 30px; max-width:620px; }
  .review-box{
    border:1px solid var(--line); border-radius:12px; padding:22px 26px; box-shadow:0 2px 10px rgba(0,0,0,.07);
  }
  .review-box .qnav-title{ margin-bottom:14px; }

  /* ================= RESULTS ================= */
  #screen-results{ max-width:820px; margin:0 auto; padding:52px 24px 90px; }
  #screen-results h1{ font-size:30px; font-weight:400; margin:0 0 4px; }
  #screen-results p.sub{ color:var(--ink-soft); margin:0 0 30px; font-size:15px; }
  .score-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:36px; }
  .score-card{ border:1px solid var(--line); border-radius:12px; padding:20px; }
  .score-card .sc-lbl{ font-size:12px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.4px; margin-bottom:8px; font-weight:700; }
  .score-card .sc-val{ font-size:30px; font-weight:700; }
  .score-card.total{ background:var(--cb-navy); color:#fff; }
  .score-card.total .sc-lbl{ color:#B9C3EA; }
  .mb-row{ display:flex; align-items:center; justify-content:space-between; padding:12px 0; border-bottom:1px solid var(--line); font-size:14.5px; }
  .mb-row:last-child{ border-bottom:none; }
  .mb-bar{ flex:1; height:6px; background:#EEF1F9; border-radius:3px; margin:0 16px; overflow:hidden; }
  .mb-bar-fill{ height:100%; background:var(--cb-blue); }
  .qreview-item{ border:1px solid var(--line); border-radius:12px; padding:18px 20px; margin-bottom:12px; }
  .qri-head{ display:flex; align-items:center; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
  .qri-badge{ font-size:11px; font-weight:800; padding:3px 10px; border-radius:20px; text-transform:uppercase; letter-spacing:.3px; }
  .qri-badge.correct{ background:#E3F3E8; color:#1E7A43; }
  .qri-badge.wrong{ background:#FBE9EB; color:var(--cb-red); }
  .qri-badge.skipped{ background:#F0F0F0; color:var(--ink-soft); }
  .qri-skill{ font-size:12.5px; color:var(--ink-soft); }
  .qri-qtext{ font-family:var(--serif); font-size:14.5px; margin-bottom:10px; color:#3d3d3d; }
  .results-actions{ display:flex; gap:12px; margin-top:24px; }

  /* ================= MODULE OVER / BREAK ================= */
  #screen-moduleover{
    min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center;
    text-align:center; padding:20px;
  }
  #screen-moduleover h1{ color:#4B5AD1; font-weight:400; font-size:36px; margin:0 0 34px; }
  #screen-moduleover p{ font-size:19px; margin:0 0 18px; }
  .dotspin{ margin-top:44px; display:flex; gap:9px; }
  .dotspin span{ width:9px; height:9px; border-radius:50%; background:#1E1E1E; animation:dsp 1.1s infinite ease-in-out; }
  .dotspin span:nth-child(2){ animation-delay:.12s; }
  .dotspin span:nth-child(3){ animation-delay:.24s; }
  .dotspin span:nth-child(4){ animation-delay:.36s; }
  .dotspin span:nth-child(5){ animation-delay:.48s; }
  @keyframes dsp{ 0%,60%,100%{ opacity:.22; transform:translateY(0); } 30%{ opacity:1; transform:translateY(-6px); } }

  #screen-break{
    min-height:100vh; background:#1C1C1C; color:#fff; position:relative;
    display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:20px;
  }
  #screen-break .brk-batt{
    position:absolute; top:22px; right:26px; background:#3A3A3A; border-radius:6px;
    padding:8px 14px; font-size:13px; font-weight:700;
  }
  #screen-break .brk-timer{ font-size:58px; font-weight:700; margin-bottom:26px; letter-spacing:1px; }
  #screen-break h1{ font-size:38px; margin:0 0 22px; font-weight:700; }
  #screen-break p{ font-size:19px; margin:0 0 40px; color:#E8E8E8; }
  #screen-break .brk-name{ position:absolute; bottom:26px; left:30px; font-size:19px; font-weight:700; }

  /* ================= CALCULATOR PANEL (Desmos) ================= */
  .calc-panel{
    position:fixed; top:92px; left:14px; width:480px; height:560px; min-width:330px; min-height:380px;
    background:#fff; border-radius:8px; box-shadow:0 10px 34px rgba(0,0,0,.35); z-index:80;
    display:flex; flex-direction:column; resize:both; overflow:hidden;
  }
  .calc-head{
    background:#2A2A2A; color:#fff; display:flex; align-items:center; padding:8px 10px; gap:10px;
    cursor:move; flex-shrink:0; user-select:none;
  }
  .calc-tabs{ display:flex; background:#4a4a4a; border-radius:6px; overflow:hidden; }
  .calc-tabs button{ background:transparent; color:#ddd; border:none; padding:6px 14px; font-size:13px; font-weight:700; }
  .calc-tabs button.on{ background:#fff; color:#111; }
  .calc-drag{ margin-left:auto; letter-spacing:2px; color:#bbb; }
  .panel-x{ background:none; border:none; color:#fff; font-size:17px; line-height:1; }
  .calc-body{ flex:1; position:relative; }
  .calc-body > div{ position:absolute; inset:0; }
  .calc-msg{
    display:flex; align-items:center; justify-content:center; text-align:center;
    padding:24px; font-size:14.5px; color:var(--ink-soft); background:#fff;
  }

  /* ================= REFERENCE PANEL ================= */
  .ref-panel{
    position:absolute; top:0; right:0; bottom:0; width:560px; max-width:92%;
    background:#fff; box-shadow:-8px 0 26px rgba(0,0,0,.22); z-index:70; display:flex; flex-direction:column;
  }
  .ref-panel.expanded{ width:min(980px, 94%); }
  .ref-head{ display:flex; align-items:center; padding:16px 20px; border-bottom:1px solid var(--line); }
  .ref-head h2{ margin:0; font-size:20px; }
  .ref-head .rh-btns{ margin-left:auto; display:flex; gap:16px; }
  .ref-head button{ background:none; border:none; font-size:18px; color:#111; }
  .ref-body{ flex:1; overflow-y:auto; padding:26px 30px 50px; }
  .ref-grid{ display:grid; grid-template-columns:1fr 1fr; gap:36px 26px; align-items:end; }
  .ref-fig{ text-align:center; font-family:var(--serif); }
  .ref-fig svg{ max-width:100%; height:auto; }
  .ref-fig .rf-f{ margin-top:10px; font-size:16.5px; }
  .ref-span{ grid-column:1/-1; text-align:center; font-family:var(--serif); font-weight:700; font-size:17px; margin-top:-14px; }
  .ref-facts{
    font-family:var(--serif); font-size:15.5px; margin-top:36px; border-top:1px solid var(--line);
    padding-top:22px; line-height:1.9;
  }

  /* ================= FIGURE FRAME / ZOOM ================= */
  .fig-frame{ border:1px solid #9a9a9a; border-radius:6px; max-width:520px; margin:0 auto 26px; background:#fff; }
  .fig-toolbar{
    display:flex; align-items:center; justify-content:flex-end; gap:12px; padding:7px 12px;
    border-bottom:1px solid #e2e2e2; font-size:13.5px; font-weight:600;
  }
  .fig-toolbar button{ background:none; border:none; font-size:14px; font-weight:700; }
  .fig-toolbar .sep{ width:1px; height:16px; background:#ccc; }
  .fig-imgwrap{ overflow:auto; max-height:380px; padding:14px; text-align:center; }
  .fig-imgwrap img{ width:100%; }
  .fig-caption{ font-family:var(--serif); text-align:center; padding:0 12px 14px; font-size:15.5px; }
  .fig-overlay{
    position:fixed; inset:0; background:rgba(40,40,40,.55); z-index:120;
    display:flex; align-items:center; justify-content:center;
  }
  .fig-overlay .fo-card{
    background:#fff; padding:34px 22px 22px; border-radius:8px; max-width:82vw; max-height:84vh;
    overflow:auto; position:relative;
  }
  .fig-overlay img{ max-width:74vw; }
  .fig-overlay .panel-x{ position:absolute; top:8px; right:10px; color:#111; }

  @media (max-width:860px){
    .t-body{ flex-direction:column; }
    .pane-left{ width:100% !important; max-height:45vh; border-bottom:1px solid var(--line); }
    #divider{ display:none; }
    .qnav-grid{ grid-template-columns:repeat(6,1fr); }
    .score-grid{ grid-template-columns:1fr; }
    .welcome-band h1{ font-size:28px; }
  }
  /* ---- schema v1.1 rich content ---- */
  .fmt-table{ border-collapse:collapse; margin:10px 0; background:#fff; }
  .fmt-table th, .fmt-table td{
    border:1.5px solid #333; padding:6px 16px; text-align:center;
    white-space:normal; font-size:inherit;
  }
  .fmt-table th{ font-weight:700; }
  .katex{ font-size:1.08em; }
  .katex-display{ margin:10px 0; }
  .ctext .katex-display{ margin:2px 0; text-align:left; }
  .katex-fallback{ font-family:ui-monospace,Menlo,Consolas,monospace; background:#f4f4f6;
    border:1px dashed #bbb; border-radius:4px; padding:0 4px; }
  .qri-badge.nokey{ background:#e8e8ee; color:#555; }
