/* PRISM online sample test: the start page, the test screen and the result page. Colours come from portal.css.
   Phone: one column, Passage / Question tabs, bar of buttons at the foot.
   Laptop (900 px and wider): the screen does not scroll as a whole; the passage and the question sit side by side,
   each scrolling on its own, and from 1200 px the question grid is always open on the right. */

/* ---------------------------------------------------------------- start page */
.ss-wrap { display: grid; grid-template-columns: 1fr 1.1fr; gap: 28px; align-items: start; }
.ss-intro { background: var(--navy); color: #fff; border-radius: 18px; padding: 30px; }
.ss-intro h1 { font-size: 34px; margin: 2px 0 10px; }
.ss-intro p { color: rgba(255,255,255,.85); margin: 0 0 18px; }
.ss-kicker { color: var(--mint) !important; font-weight: 600; margin: 0 !important; }
.ss-facts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ss-facts li { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: rgba(255,255,255,.8); }
.ss-facts b { display: block; color: #fff; font-weight: 600; }
.ss-form { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.ss-form h2 { margin: 0 0 14px; }
.ss-classes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ss-cls { position: relative; margin: 0 !important; }
.ss-cls input { position: absolute; opacity: 0; inset: 0; }
.ss-cls span { display: flex; align-items: center; justify-content: center; height: 48px; border: 2px solid #C9D4DE; border-radius: 12px;
  font-weight: 600; font-size: 17px; cursor: pointer; background: #fff; }
.ss-cls input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.ss-cls input:focus-visible + span { outline: 3px solid var(--mint); outline-offset: 2px; }
.ss-form .hint { font-size: 13.5px; color: var(--muted); margin: 4px 0 16px; }
.btn.big { min-height: 52px; padding: 12px 28px; font-size: 16.5px; }
@media (max-width: 760px) {
  .ss-wrap { grid-template-columns: 1fr; gap: 16px; }
  .ss-form { order: -1; }                 /* phone: the login first, the facts below it */
  .ss-intro h1 { margin-top: 0; }
  .ss-intro { padding: 22px; } .ss-intro h1 { font-size: 27px; }
  .ss-form { padding: 18px; }
  .ss-classes { grid-template-columns: repeat(3, 1fr); }
}

/* ---------------------------------------------------------------- instructions page */
ul.plain { padding-left: 20px; margin: 0 0 8px; } ul.plain li { margin-bottom: 6px; }
.kinds .card p { margin: 0; }
form.start { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

/* ---------------------------------------------------------------- test screen */
body.exam { background: var(--bg); padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.xbar { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; border-bottom: 3px solid var(--mint);
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
.xq { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.xqn { font-size: 14px; color: rgba(255,255,255,.8); } .xqn b { color: #fff; font-size: 17px; font-weight: 600; } .xof { color: rgba(255,255,255,.6); }
.xsec { font-size: 12.5px; color: var(--mint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xtime { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 18px; background: rgba(255,255,255,.12);
  padding: 5px 12px; border-radius: 999px; letter-spacing: .5px; }
.xtime.amber { background: #F2C46D; color: var(--navy); }
.xtime.red { background: #E5484D; color: #fff; animation: xpulse 1s ease-in-out infinite alternate; }
@keyframes xpulse { to { opacity: .75; } }
@media (prefers-reduced-motion: reduce) { .xtime.red { animation: none; } }
.xpal-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 7px 11px; font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.xstatus { font-size: 12.5px; padding: 4px 12px; color: var(--muted); background: #fff; border-bottom: 1px solid var(--line); text-align: center; }
.xstatus.ok::before { content: "✓ "; color: var(--teal); }
.xstatus.bad { background: var(--err-bg); color: var(--error); }

/* phone: tabs and panes */
.xtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 12px 0; position: sticky; top: 58px; z-index: 5; background: var(--bg); }
.xtabs[hidden] { display: none; }
.xtabs button { font: inherit; font-size: 14.5px; font-weight: 500; padding: 10px; border-radius: 10px; border: 1.5px solid #C9D4DE; background: #fff; color: var(--navy); cursor: pointer; }
.xtabs button[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.xpane[hidden] { display: none; }
body.has-pass.tab-pass .xquestion, body.has-pass.tab-q .xpassage { display: none; }
.xinner { padding: 12px; }
.xpassage .xinner { padding-top: 10px; }
.xpass-head { font-size: 13px; color: var(--teal); font-weight: 500; margin: 0 0 6px; }
.xpassage img { display: block; width: 100%; max-width: 680px; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.xhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.xchip { background: var(--mint20); color: var(--teal); font-weight: 500; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; }
.xmarks { color: var(--muted); font-size: 12.5px; }
.xstem { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; max-width: 700px; }
.xstem img { display: block; width: 100%; max-width: 100%; height: auto; }

/* answers: the options are the buttons */
.xans { margin-top: 12px; max-width: 700px; }
.xlab { font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 500; }
.xans > .xlab:first-child { margin-top: 2px; }
.xcards { display: grid; gap: 8px; }
.xcard { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; min-height: 54px;
  border: 2px solid #D5DEE7; border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: var(--navy);
  transition: border-color .12s, background .12s; touch-action: manipulation; }
.xcard:hover { border-color: #9FB0C2; }
.xbadge { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #C9D4DE; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: 15px; color: var(--navy); background: #fff; }
.xcards.multi .xbadge { border-radius: 8px; }
.xpic { min-width: 0; flex: 1; }
.xpic img { display: block; max-width: 100%; height: auto; mix-blend-mode: multiply; }   /* the white of the picture takes the card colour */
.xcard[aria-pressed="true"] { border-color: var(--navy); background: #EEF3FA; }
.xcard[aria-pressed="true"] .xbadge { background: var(--navy); border-color: var(--navy); color: #fff; }
.xcards.multi .xcard[aria-pressed="true"] .xbadge::after { content: "✓"; position: absolute; }
.xcards.multi .xcard[aria-pressed="true"] .xbadge { position: relative; color: transparent; }
.xcards.multi .xcard[aria-pressed="true"] .xbadge::after { color: #fff; }
.xmrow { background: #fff; border: 1.5px solid #D5DEE7; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.xmtop { display: flex; gap: 12px; align-items: center; }
.xmchoices { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0 46px; }
.xmc { min-width: 56px; height: 42px; padding: 0 14px; border-radius: 10px; border: 2px solid #C9D4DE; background: #fff; font: inherit;
  font-weight: 600; font-size: 15px; color: var(--navy); cursor: pointer; touch-action: manipulation; }
.xmc[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.xnum { font: inherit; font-size: 26px; font-weight: 600; letter-spacing: 6px; width: 180px; padding: 8px 14px; border: 2px solid #C9D4DE;
  border-radius: 12px; font-variant-numeric: tabular-nums; color: var(--navy); background: #fff; }
.xnum:focus { border-color: var(--navy); outline: none; }
.xclear { margin-top: 10px; background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: 13.5px; cursor: pointer; padding: 6px 0; }
.xclear[hidden] { display: none; }
.xkeys { display: none; }

/* foot bar */
.xnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 8px; padding: 8px 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.xbtn { min-height: 48px; border-radius: 12px; border: 1px solid #C9D4DE; background: #fff; color: var(--navy); font: inherit; font-size: 15px;
  font-weight: 500; cursor: pointer; touch-action: manipulation; padding: 0 8px; }
.xbtn[disabled] { opacity: .4; cursor: default; }
.xnext { background: var(--navy); color: #fff; border-color: var(--navy); }
.xmark[aria-pressed="true"] { background: var(--warn-bg); border-color: #F2C46D; color: var(--warn); }

/* question grid: a sheet on phones */
.xpal { position: fixed; inset: 0; z-index: 40; background: #fff; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top));
  overflow-y: auto; transform: translateY(100%); visibility: hidden; transition: transform .2s ease, visibility .2s; display: flex; flex-direction: column; }
body.palopen .xpal { transform: none; visibility: visible; }
.xpal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 17px; }
.xclose { background: var(--cloud); border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 16px; cursor: pointer; color: var(--navy); }
.xlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.xlegend .k { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid #C9D4DE; vertical-align: -2px; margin-right: 5px; background: #fff; }
#grid { flex: 1; }
.xgsec { font-size: 12.5px; font-weight: 500; color: var(--teal); margin: 12px 0 6px; }
.xgnums { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 7px; }
.xg { position: relative; height: 42px; border-radius: 10px; border: 1.5px solid #C9D4DE; background: #fff; color: var(--navy); font: inherit;
  font-size: 14.5px; font-weight: 500; cursor: pointer; }
.xg.seen, .k.seen { border-color: #E5A3A0; background: #FDF1F0; }
.xg.ans, .k.ans { background: var(--navy); border-color: var(--navy); color: #fff; }
.xg.mark::after, .k.mark::after { content: ""; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: #F2C46D; border: 2px solid #fff; }
.k.mark { position: relative; }
.xg.cur { outline: 3px solid var(--mint); outline-offset: 1px; }
.xpal-foot { position: sticky; bottom: -16px; background: #fff; padding: 12px 0 4px; margin-top: 14px; border-top: 1px solid var(--line); }
.xcount { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; text-align: center; }
#finish { min-height: 50px; }

/* ---------------------------------------------------------------- laptop and wider */
@media (min-width: 900px) {
  body.exam { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding: 0; }
  .xbar { position: static; padding: 8px 20px; }
  .xq { flex-direction: row; align-items: baseline; gap: 14px; }
  .xqn { font-size: 15px; } .xsec { font-size: 14px; }
  .xbody { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
  body.has-pass .xbody { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .xtabs { display: none !important; }
  body.has-pass.tab-pass .xquestion, body.has-pass.tab-q .xpassage { display: block; }
  .xpane { overflow-y: auto; min-height: 0; }
  .xpassage { background: #EAF0F5; border-right: 1px solid var(--line); }
  .xinner { padding: 18px 22px 28px; }
  .xquestion .xinner { max-width: 760px; margin: 0 auto; }
  body.has-pass .xquestion .xinner { margin: 0; }
  .xpassage .xinner { max-width: 720px; margin-left: auto; }
  .xkeys { display: block; color: var(--muted); font-size: 12.5px; margin-top: 18px; }
  .xnav { position: static; grid-template-columns: 150px 190px 150px; justify-content: center; padding: 10px 20px; }
  .xpal { position: fixed; inset: 0 0 0 auto; width: 340px; box-shadow: -10px 0 30px rgba(0,0,0,.15); transform: translateX(100%); }
}
/* laptop, question without a passage: the question on the left, the options on the right */
@media (min-width: 1100px) {
  body:not(.has-pass) .xquestion .xinner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px;
    max-width: 1180px; align-items: start; grid-template-rows: auto auto auto auto 1fr; }
  body:not(.has-pass) .xhead { grid-column: 1 / -1; }
  body:not(.has-pass) .xstem { grid-column: 1; grid-row: 2 / span 4; position: sticky; top: 0; }   /* stays in view while long options scroll */
  body:not(.has-pass) .xans, body:not(.has-pass) .xclear, body:not(.has-pass) .xkeys { grid-column: 2; }
  body:not(.has-pass) .xans { margin-top: 0; }
  body:not(.has-pass) .xclear { justify-self: start; }
}
@media (min-width: 1200px) {
  .xbody { grid-template-columns: minmax(0, 1fr) 280px; }
  body.has-pass .xbody { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 280px; }
  .xpal { position: static; width: auto; transform: none; visibility: visible; box-shadow: none; border-left: 1px solid var(--line);
    padding: 16px; transition: none; }
  .xclose, .xpal-btn { display: none; }
  .xpal-foot { bottom: -16px; }
}

/* ---------------------------------------------------------------- dialogs */
.xmodal { position: fixed; inset: 0; z-index: 60; background: rgba(30,42,74,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.xmodal[hidden] { display: none; }
.xdialog { background: #fff; border-radius: 16px; padding: 22px; max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.xdialog h2 { margin: 0 0 8px; font-size: 20px; }
.xdialog p { margin: 0 0 10px; color: var(--slate); }
.xwarn { font-size: 14px; color: var(--warn) !important; }
.xrow { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.xtoast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 50; background: var(--navy); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); text-align: center; }
.xtoast[hidden] { display: none; }

/* ---------------------------------------------------------------- result page */
.sr-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: stretch; }
.sr-score { background: var(--navy); color: #fff; border-radius: 16px; padding: 18px 26px; display: flex; flex-direction: column; justify-content: center; min-width: 150px; }
.sr-score span { color: var(--mint); font-size: 13px; } .sr-score b { font-size: 42px; line-height: 1.1; font-weight: 600; } .sr-score small { color: rgba(255,255,255,.7); }
.sr-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sr-counts .c { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--muted); }
.sr-counts .c b { display: block; font-size: 24px; color: var(--navy); font-weight: 600; }
.sr-counts .right { border-left: 4px solid var(--deep-mint); } .sr-counts .part { border-left: 4px solid #F2C46D; }
.sr-counts .wrong { border-left: 4px solid #E5484D; } .sr-counts .blank { border-left: 4px solid #C9D4DE; }
.sr-sec { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--teal); }
.sr-list { display: grid; gap: 6px; }
.sr-q { background: #fff; border: 1px solid var(--line); border-left: 4px solid #C9D4DE; border-radius: 10px; }
.sr-q.right { border-left-color: var(--deep-mint); } .sr-q.part { border-left-color: #F2C46D; } .sr-q.wrong { border-left-color: #E5484D; }
.sr-q > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 34px 1fr 1fr 46px; gap: 10px; align-items: center; padding: 10px 12px; }
.sr-q > summary::-webkit-details-marker { display: none; }
.sr-q .n { font-weight: 600; } .sr-q .ans { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.sr-q .lab { display: block; font-size: 11.5px; color: var(--muted); }
.sr-q .mk { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.sr-q.wrong .mk { color: var(--error); } .sr-q.right .mk { color: var(--teal); }
.sr-body { padding: 4px 12px 14px; max-width: 720px; }
.sr-body img.stem { display: block; width: 100%; height: auto; }
.sr-pass { margin-bottom: 8px; } .sr-pass summary { cursor: pointer; color: var(--teal); font-size: 14px; padding: 4px 0; }
.sr-pass img { display: block; width: 100%; height: auto; }
.sr-opts { display: grid; gap: 6px; margin-top: 8px; }
.sr-opt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.sr-opt img { max-width: 100%; height: auto; }
.sr-opt .badge { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #C9D4DE; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.sr-opt.ok { border-color: var(--deep-mint); background: #F0FAF5; } .sr-opt.ok .badge { background: var(--deep-mint); border-color: var(--deep-mint); color: #fff; }
.sr-opt.mine:not(.ok), .sr-opt.bad { border-color: #E5484D; background: #FDF1F0; }
.sr-opt .tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: auto; }
.sr-opt .tag + .tag { margin-left: 6px; }
.tag.ok { background: var(--mint20); color: var(--teal); } .tag.no { background: var(--err-bg); color: var(--error); } .tag.me { background: var(--cloud); color: var(--navy); }
@media (max-width: 600px) {
  .sr-top { grid-template-columns: 1fr; } .sr-counts { grid-template-columns: repeat(2, 1fr); }
}
