/* GATE-style mock test. Page parts use the site's theme variables; the exam screen is
   always light, like the real exam console, so question images read the same. */
.button{display:inline-flex;align-items:center;gap:.4rem;padding:.6rem 1rem;border:1px solid var(--accent);border-radius:8px;background:var(--panel);color:var(--accent);font:inherit;font-weight:650;text-decoration:none;cursor:pointer}
.button.primary{background:var(--accent);color:#fff}
.button:hover{filter:brightness(1.06)}
.linklike{background:none;border:0;color:var(--accent);font:inherit;text-decoration:underline;cursor:pointer;padding:0}
.hero-cta{margin-top:1.2rem;display:flex;flex-wrap:wrap;gap:.6rem 1rem;align-items:center}
.hero-cta span{color:var(--muted);font-size:.9rem}
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
.result-table{border-collapse:collapse;width:100%;font-size:.92rem}
.result-table th,.result-table td{border-bottom:1px solid var(--line);padding:.45rem .55rem;text-align:left;vertical-align:top}
.result-table thead th{font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.result-table small{color:var(--muted)}

#mock-app:not(.ready) #mock-form,#mock-app:not(.ready) details{opacity:.5;pointer-events:none}
.mock-form{border:1px solid var(--line);border-radius:12px;padding:1rem 1.2rem;background:var(--panel);margin:1rem 0}
.mock-form h2{margin-top:0}
.mock-pattern{padding-left:1.1rem;line-height:1.55}
.mock-form fieldset{border:1px solid var(--line);border-radius:8px;margin:1rem 0;padding:.6rem .9rem}
.mock-form legend{font-weight:650;padding:0 .3rem}
.mock-form .check{display:flex;gap:.55rem;align-items:flex-start;margin:.45rem 0;line-height:1.4}
.mock-form .check input{margin-top:.25rem;flex:none;width:1.05rem;height:1.05rem}
.mock-form .code{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;font-weight:650}
.mock-form .code span{font-weight:400;color:var(--muted)}
.mock-form .code input::placeholder{text-transform:none;letter-spacing:normal}
.mock-form .code input{font:inherit;font-family:ui-monospace,Menlo,monospace;letter-spacing:.08em;text-transform:uppercase;padding:.45rem .6rem;border:1px solid var(--line);border-radius:6px;width:11rem;background:var(--bg);color:var(--ink)}
.mock-resume{border:1px solid var(--accent);background:var(--soft);border-radius:10px;padding:.8rem 1rem;margin:1rem 0}
.mock-result .result-head{border:1px solid var(--line);border-radius:12px;padding:1rem 1.2rem;background:var(--panel);margin:1rem 0}
.mock-result h2 .score{font-size:2.6rem;color:var(--accent)}
.result-actions{display:flex;flex-wrap:wrap;gap:.5rem}
.weak{line-height:1.6}
.q-table tr.r-correct td:nth-child(5){color:#1a7f37;font-weight:650}
.q-table tr.r-wrong td:nth-child(5){color:#b42318;font-weight:650}

/* ---------------- exam console ---------------- */
body.exam-open{overflow:hidden}
.exam{--ex-bg:#fff;--ex-ink:#1b1f24;--ex-muted:#5b6470;--ex-line:#c9d1da;--ex-head:#1f3b57;--ex-tab:#e8eef5;--ex-blue:#2b6cb0;
  --st-a:#1e9e4a;--st-na:#d6452f;--st-nv:#eceff3;--st-mr:#6b3fa0;
  position:fixed;inset:0;z-index:1000;display:flex;flex-direction:column;background:var(--ex-bg);color:var(--ex-ink);
  font-family:Inter,ui-sans-serif,system-ui,sans-serif;color-scheme:light}
.exam button{font:inherit;cursor:pointer}
.exam-top{display:flex;align-items:center;gap:1rem;justify-content:space-between;background:var(--ex-head);color:#fff;padding:.5rem 1rem;flex-wrap:wrap}
.exam-title{display:flex;flex-direction:column;line-height:1.2}
.exam-title span{font-size:.75rem;opacity:.85;font-family:ui-monospace,Menlo,monospace}
.exam-tools{display:flex;gap:.5rem}
.exam-tools button{background:#fff;color:var(--ex-head);border:0;border-radius:4px;padding:.35rem .7rem;font-weight:650}
.exam-timer{font-size:1rem}
.exam-timer b{font-family:ui-monospace,Menlo,monospace;font-size:1.15rem;background:#fff;color:var(--ex-head);border-radius:4px;padding:.15rem .45rem;margin-left:.3rem}
.exam-timer.low b{background:#ffd7d0;color:#8a1c0e}
.exam-sections{display:flex;gap:2px;background:var(--ex-tab);padding:0 .5rem;border-bottom:1px solid var(--ex-line);overflow-x:auto}
.exam-sections button{border:0;background:transparent;padding:.55rem .9rem;color:var(--ex-ink);white-space:nowrap;border-bottom:3px solid transparent}
.exam-sections button.on{border-bottom-color:var(--ex-blue);font-weight:700;color:var(--ex-blue)}
.palette-toggle{margin-left:auto;display:none}
.exam-sections .short,.palette-close{display:none}
.palette-close{margin-left:auto;border:1px solid var(--ex-line);background:#fff;border-radius:4px;padding:.3rem .7rem;font-weight:650}
.exam-body{display:grid;grid-template-columns:1fr 300px;min-height:0;flex:1}
.exam-mtop,.exam-mbar,.exam-strip{display:none}
.exam-q{overflow:auto;padding:1rem 1.25rem 2rem;min-height:0}
.q-meta{display:flex;flex-wrap:wrap;justify-content:space-between;gap:.5rem;font-size:.85rem;color:var(--ex-muted);border-bottom:1px solid var(--ex-line);padding-bottom:.45rem}
.q-no{font-size:1.05rem;margin:.75rem 0}
.q-img img{display:block;width:100%;max-width:860px;height:auto;border:1px solid var(--ex-line);background:#fff;margin-bottom:.5rem}
.q-resp{margin-top:1rem;max-width:860px}
.choices-exam{border:1px solid var(--ex-line);border-radius:6px;padding:.5rem .9rem;display:flex;flex-wrap:wrap;gap:.4rem 1.6rem}
.choices-exam legend{font-size:.85rem;color:var(--ex-muted);padding:0 .3rem}
.choices-exam label{display:flex;align-items:center;gap:.4rem;font-weight:650;min-height:44px;padding-right:.4rem;cursor:pointer}
.choices-exam input{width:1.15rem;height:1.15rem}
.nat{display:flex;align-items:center;gap:.6rem;font-weight:650}
.nat input{font:inherit;font-family:ui-monospace,Menlo,monospace;font-size:1.1rem;width:14rem;max-width:60vw;padding:.45rem .6rem;border:1px solid var(--ex-line);border-radius:4px;background:#fff;color:var(--ex-ink)}
.nat-help{font-size:.8rem;color:var(--ex-muted)}
.keypad{display:grid;grid-template-columns:repeat(3,64px);gap:6px;margin-top:.5rem}
.keypad button{height:44px;border:1px solid var(--ex-line);border-radius:4px;background:#f6f8fa;font-weight:650}
.keypad button.wide{grid-column:span 3}
.keypad button:active{background:#e3e8ee}
.exam-palette{border-left:1px solid var(--ex-line);background:#f7f9fb;overflow:auto;padding:.75rem;display:flex;flex-direction:column;gap:.6rem;min-height:0}
.candidate{display:flex;align-items:center;gap:.6rem;font-weight:650;padding-bottom:.6rem;border-bottom:1px solid var(--ex-line)}
.avatar{display:inline-grid;place-items:center;width:44px;height:44px;border-radius:6px;background:#dde5ee;font-size:1.4rem}
.legend{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:1fr 1fr;gap:.35rem .5rem;font-size:.74rem;color:var(--ex-muted)}
.legend li{display:flex;align-items:center;gap:.4rem}
.legend li:last-child{grid-column:span 2}
.exam-palette h3{font-size:.85rem;margin:.2rem 0;background:var(--ex-head);color:#fff;padding:.35rem .5rem;border-radius:3px}
.pal-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}
/* status shapes: answered = green (rounded top), not answered = red (rounded bottom),
   not visited = grey square, marked = purple circle, answered + marked = purple circle with green dot */
.st{display:inline-grid;place-items:center;min-width:30px;height:30px;font-size:.8rem;font-weight:700;border:1px solid transparent;position:relative;color:#fff;padding:0 .2rem}
.st-a{background:var(--st-a);border-radius:12px 12px 3px 3px}
.st-na{background:var(--st-na);border-radius:3px 3px 12px 12px}
.st-nv{background:#fff;color:var(--ex-ink);border-color:#c5ccd6;border-radius:3px}
.st-mr,.st-amr{background:var(--st-mr);border-radius:50%}
.st-amr::after{content:"";position:absolute;right:-2px;bottom:-2px;width:11px;height:11px;border-radius:50%;background:var(--st-a);border:2px solid #f7f9fb}
.pal-grid .st{height:38px;cursor:pointer}
.pal-grid .st.cur{outline:3px solid var(--ex-blue);outline-offset:1px}
.exam-palette .submit{margin-top:auto;background:var(--ex-blue);color:#fff;border:0;border-radius:4px;padding:.6rem;font-weight:700}
.exam-actions{display:flex;justify-content:space-between;gap:.5rem;flex-wrap:wrap;padding:.55rem 1rem;border-top:1px solid var(--ex-line);background:#f3f6f9}
.exam-actions div{display:flex;gap:.5rem;flex-wrap:wrap}
.exam-actions button{border:1px solid var(--ex-line);background:#fff;border-radius:4px;padding:.55rem .9rem;font-weight:650;min-height:42px}
.exam-actions .save{background:#2fa84f;border-color:#2fa84f;color:#fff}
.exam-actions .submit-btn{background:#6fa8dc;border-color:#6fa8dc;color:#fff;min-width:7rem}
.exam-modal{position:fixed;inset:0;background:rgba(15,23,32,.55);display:grid;place-items:center;z-index:1100;padding:1rem}
.exam-modal[hidden]{display:none}
.modal-box{background:#fff;color:var(--ex-ink);border-radius:8px;max-width:720px;width:100%;max-height:90vh;overflow:auto;padding:1.1rem 1.3rem}
.modal-box h2{margin-top:0;font-size:1.15rem}
.modal-box ul{padding-left:1.1rem;line-height:1.5}
.modal-actions{display:flex;justify-content:flex-end;gap:.6rem;flex-wrap:wrap;margin-top:1rem}
.modal-actions button{border:1px solid var(--ex-line);background:#fff;border-radius:4px;padding:.55rem 1rem;font-weight:650}
.modal-actions .primary{background:var(--ex-blue);border-color:var(--ex-blue);color:#fff}
.submit-table{border-collapse:collapse;width:100%;font-size:.85rem}
.submit-table th,.submit-table td{border:1px solid var(--ex-line);padding:.35rem .5rem;text-align:center}
.submit-table tbody th{text-align:left}

/* calculator: floating, draggable */
.calc{position:fixed;top:70px;right:320px;z-index:1050;width:540px;max-width:96vw;background:#eef1f5;border:1px solid #9aa6b2;border-radius:6px;box-shadow:0 10px 30px rgba(0,0,0,.25);color:#1b1f24;font-size:.8rem;user-select:none}
.calc[hidden]{display:none}
.calc-bar{display:flex;justify-content:space-between;align-items:center;background:var(--ex-head);color:#fff;padding:.35rem .6rem;border-radius:6px 6px 0 0;cursor:move;touch-action:none}
.calc-bar button{background:none;border:0;color:#fff;font-size:1.2rem;line-height:1}
.calc-screen{margin:.45rem .5rem 0;background:#fff;border:1px solid #9aa6b2;border-radius:3px;padding:.3rem .5rem;font-family:ui-monospace,Menlo,monospace;text-align:right;min-height:1.9rem}
.calc-val{margin-bottom:.45rem}
.calc-expr{color:#5b6470;word-break:break-all;font-size:.85rem}
.calc-val{font-size:1.35rem;font-weight:700;min-height:1.4em;word-break:break-all}
.calc-modes{display:flex;align-items:center;gap:.75rem;padding:0 .5rem .4rem;flex-wrap:wrap}
.calc-mem{margin-left:auto;display:flex;gap:3px;align-items:center}
.calc-mem button{border:1px solid #9aa6b2;background:#fff;border-radius:3px;padding:.15rem .35rem;font-size:.75rem}
.mflag{font-weight:700;color:var(--ex-blue);margin-left:.25rem}
.calc-keys{display:grid;grid-template-columns:repeat(11,1fr);gap:3px;padding:0 .5rem .5rem}
.calc-keys button{min-height:30px;border:1px solid #9aa6b2;border-radius:3px;background:#fff;padding:0 .1rem;font-size:.78rem}
.calc-keys .num{background:#f9fafb;font-weight:700}
.calc-keys .op{background:#e3e9f0}
.calc-keys .ctl,.calc-keys [data-v=NEG]{background:#e2463a;border-color:#c93a2f;color:#fff;font-weight:700}
.calc-keys .wide,.calc-keys .num0{grid-column:span 2}
.calc-keys .eq{background:#2fbf5b;border-color:#25a04b;color:#fff;font-weight:700;grid-row:span 2}
.calc-keys button:active{filter:brightness(.92)}
.calc-bar>span{display:flex;gap:.5rem;align-items:center}
.calc-bar .calc-helpbtn{font-size:.78rem;font-weight:700;background:rgba(255,255,255,.22);border:1px solid rgba(255,255,255,.6);border-radius:3px;padding:.15rem .6rem}
.calc-mod{border:1px solid #9aa6b2;background:#e3e9f0;border-radius:3px;padding:.15rem .5rem;font-size:.78rem}
.calc-main[hidden],.calc-body[hidden]{display:none}
.calc.calc-minimised{width:280px;max-width:60vw}
.calc.calc-minimised:not([style*=left]){left:auto;right:12px;top:118px;bottom:auto}
.calc-minimised .calc-bar{border-radius:6px}
.calc-minimised .calc-helpbtn{display:none}
.calc-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.calc-bar>span{flex:none}
.restore-ico{display:inline-block;width:.8rem;height:.65rem;border:2px solid #fff;border-top-width:4px;vertical-align:middle}
.calc-help{margin:.5rem;padding:.5rem .7rem;background:#fff;border:1px solid #c5ccd6;border-radius:3px;font-size:.76rem;line-height:1.45;max-height:60vh;overflow:auto}
.calc-help h3{margin:.1rem 0 .4rem;font-size:.95rem;text-align:center}
.calc-help h4{margin:.5rem 0 .2rem;font-size:.8rem}
.calc-help ul{margin:0;padding-left:1.1rem}
.calc-help p{margin:.15rem 0}
.calc-help[hidden]{display:none}

@media (max-width:860px){
  .exam-body{grid-template-columns:1fr}
  .exam-top,.exam-sections{display:none}
  .exam-mtop{display:flex;align-items:center;justify-content:space-between;gap:.5rem;background:#1f2d55;color:#fff;padding:.5rem .6rem;font-size:.8rem}
  .m-crumb{display:flex;align-items:center;gap:.35rem;min-width:0}
  .m-paper{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42vw;color:#cfe0ff}
  .m-sep{opacity:.7}
  .m-crumb select{background:transparent;color:#fff;border:0;font:inherit;font-weight:650;max-width:48vw;padding:.2rem 0}
  .m-crumb select option{color:#111}
  .m-menu{background:none;border:0;color:#fff;font-size:1.3rem;line-height:1;padding:.1rem .35rem}
  .exam-mbar{display:flex;align-items:center;justify-content:space-between;background:#4285f4;color:#fff;padding:.25rem .5rem;font-size:.8rem}
  .m-calc{background:none;border:0;color:#fff;padding:.15rem;display:inline-grid;place-items:center}
  .m-time b{background:#1b1f24;color:#fff;border-radius:3px;padding:.1rem .45rem;margin-left:.3rem;font-family:ui-monospace,Menlo,monospace}
  .m-time.low b{background:#b42318}
  .exam-strip{display:flex;align-items:center;gap:.4rem;background:#dce8fb;padding:.35rem .4rem;border-bottom:1px solid var(--ex-line)}
  .m-strip{display:flex;gap:8px;overflow-x:auto;flex:1;scrollbar-width:none;padding:2px}
  .m-strip .st{min-width:44px;height:38px;flex:none}
  .m-strip .st.cur{outline:3px solid var(--ex-blue);outline-offset:1px}
  .m-info{flex:none;width:26px;height:26px;border-radius:50%;border:0;padding:0;display:inline-grid;place-items:center;line-height:1;background:#4285f4;color:#fff;font-weight:700;font-style:italic;font-family:Georgia,serif;font-size:.95rem}
  .exam-palette{position:fixed;top:0;right:0;bottom:0;width:min(320px,88vw);z-index:1040;transform:translateX(100%);transition:transform .2s;box-shadow:-8px 0 24px rgba(0,0,0,.2)}
  .exam-palette.open{transform:none}
  .exam-q{padding:.75rem .8rem 2rem}
  .exam-actions{padding:.45rem .6rem}
  .exam-actions{flex-wrap:nowrap}
  .exam-actions div{flex-wrap:nowrap;gap:.35rem}
  .exam-actions{gap:.35rem}
  .exam-actions button{padding:.4rem .4rem;font-size:.7rem;min-height:40px;line-height:1.15}
  .exam-actions div:first-child button{flex:0 1 auto}
  .exam-actions .submit-btn,.exam-actions .save{white-space:nowrap}
  .exam-actions .submit-btn{min-width:0}
  .exam-top{padding:.35rem .6rem;gap:.4rem .6rem}
  .exam-title strong{font-size:.85rem}
  .exam-title span{font-size:.68rem}
  .exam-tools{order:3;width:100%;gap:.4rem}
  .exam-tools button{padding:.25rem .55rem;font-size:.8rem}
  .exam-timer{font-size:.8rem}
  .exam-timer b{font-size:.95rem}
  .exam-sections button{padding:.45rem .6rem;font-size:.85rem}
  .exam-sections .long{display:none}
  .exam-sections .short{display:inline}
  .palette-close{display:inline-block}
  .q-meta{font-size:.78rem}
  /* opens over the lower half, as in the exam, so the question stays readable; drag it by its title bar */
  .calc{right:2vw;left:2vw;width:auto;top:auto;bottom:64px}
  .calc.calc-minimised:not([style*=left]){width:min(280px,60vw);top:132px}
  /* keep the exam's 11-column key layout on phones too, so key positions are the same everywhere */
  .calc-keys{gap:2px;padding:0 .3rem .4rem}
  .calc-keys button{min-height:34px;font-size:.62rem;padding:0}
  .calc-modes{padding:0 .3rem .35rem;gap:.4rem}
  .calc-mem button{padding:.12rem .25rem;font-size:.68rem}
}
@media (prefers-reduced-motion:reduce){.exam-palette{transition:none}}
.mock-random{margin:.8rem 0 .4rem}
.mock-code{margin:.4rem 0 1rem}
.mock-code summary{cursor:pointer;color:var(--accent);font-weight:600}
.mock-code .code{margin-top:.4rem}

/* answers and solutions after a mock */
.review{scroll-margin-top:1rem}
.rv-filter{display:flex;flex-wrap:wrap;gap:.4rem;margin:.6rem 0}
.rv-filter button{border:1px solid var(--line);background:var(--panel);color:inherit;border-radius:999px;padding:.3rem .75rem;font:inherit;font-size:.85rem;cursor:pointer}
.rv-filter button[aria-pressed=true]{background:var(--ink);color:var(--panel);border-color:var(--ink)}
.rv-filter button:disabled{opacity:.45;cursor:default}
.rv-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(2.4rem,1fr));gap:.3rem;margin:.4rem 0 1rem}
.rv-grid button{height:2.2rem;border-radius:4px;border:1px solid transparent;font:inherit;font-weight:700;font-size:.85rem;cursor:pointer;color:#fff}
.rv-grid button[hidden]{display:none}
.rv-grid .cur{outline:3px solid var(--accent);outline-offset:1px}
.rv-correct{background:#2fa84f}
.rv-wrong{background:#d64535}
.rv-unanswered{background:#8a94a3}
.rv-card{border:1px solid var(--line);border-radius:8px;padding:1rem;background:var(--panel)}
.rv-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem}
.rv-head h3{margin:0}
.rv-badge{color:#fff;border-radius:999px;padding:.2rem .7rem;font-weight:700;font-size:.85rem}
.rv-meta{color:var(--muted);font-size:.85rem;margin:.4rem 0 .8rem}
.rv-img{background:#fff;border:1px solid #d9dee5;border-radius:4px;padding:.4rem;margin-bottom:.8rem}
.rv-img img{display:block;max-width:100%;height:auto;margin:0 auto}
.rv-ans{display:grid;grid-template-columns:repeat(auto-fit,minmax(9rem,1fr));gap:.5rem;margin:0 0 .8rem}
.rv-ans div{border:1px solid var(--line);border-radius:6px;padding:.45rem .6rem}
.rv-ans dt{font-size:.75rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.rv-ans dd{margin:.15rem 0 0;font-weight:700}
.rv-sol{border-top:1px solid var(--line);padding-top:.6rem}
.rv-nav{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-top:1rem}
