/* Old-exam page (paper.html): the mode chooser, and practice mode's right / wrong feedback.
   Colours come from the page's theme variables (--brand = right, --alert = wrong, --fill / --on-fill = solid), so dark mode follows. */

/* ---- the chooser: shown first, the paper is hidden until a mode is picked ---- */
.nk-modes{max-width:940px;margin:0 auto;padding:46px 32px 72px;display:flex;flex-direction:column;gap:28px;box-sizing:border-box;width:100%}
.nk-modes-head{display:flex;flex-direction:column;gap:6px}
.nk-modes-eyebrow{font-size:13px;letter-spacing:.14em;color:var(--brand)}
.nk-modes-title{margin:0;font-size:32px;line-height:1.2;font-weight:700}
.nk-modes-sub{margin:0;font-size:14px;color:var(--ink-2)}
.nk-modes-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.nk-mode{display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:26px 26px 24px;border:2px solid var(--line);border-radius:20px;background:var(--paper);color:var(--ink);text-align:left;font-family:inherit;cursor:pointer;
  transition:transform .22s ease,box-shadow .22s ease;animation:nk-card-in .6s cubic-bezier(.2,.8,.2,1) both}
.nk-mode:nth-child(2){animation-delay:.09s}
.nk-mode:hover{transform:translateY(-4px);box-shadow:var(--shadow-2)}
.nk-mode:focus-visible{outline:3px solid var(--brand);outline-offset:3px}
.nk-mode-ic{width:52px;height:52px;border-radius:50%;display:grid;place-items:center;border:2px solid var(--line);color:var(--brand)}
.nk-mode-exam .nk-mode-ic{background:var(--fill);color:var(--on-fill);border-color:var(--fill)}
.nk-mode-name{font-size:21px;font-weight:700;line-height:1.3}
.nk-mode-time{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.nk-mode-time b{font-size:34px;line-height:1.1;font-weight:700;letter-spacing:-.01em;color:var(--brand);font-variant-numeric:tabular-nums}
.nk-mode-time small{font-size:12.5px;color:var(--ink-2)}
.nk-mode-list{margin:2px 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px;font-size:13.5px;line-height:1.55}
.nk-mode-list li{position:relative;padding-left:20px}
.nk-mode-list li::before{content:"";position:absolute;left:3px;top:.62em;width:7px;height:7px;border-radius:50%;background:var(--brand)}
.nk-mode-note{min-height:1em;font-size:11.5px;color:var(--ink-2)}
.nk-mode-go{margin-top:auto;align-self:stretch;display:flex;align-items:center;justify-content:center;height:46px;border-radius:999px;border:2px solid var(--fill);font-size:15px;font-weight:700;background:var(--paper);color:var(--fill);transition:background .18s ease,color .18s ease}
.nk-mode-exam .nk-mode-go,.nk-mode:hover .nk-mode-go{background:var(--fill);color:var(--on-fill)}
@keyframes nk-card-in{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}
@media (max-width:820px){.nk-modes{padding:26px 16px 56px}.nk-modes-title{font-size:26px}.nk-modes-grid{grid-template-columns:minmax(0,1fr)}.nk-mode{padding:20px 18px 18px}.nk-mode-time b{font-size:28px}}

/* ---- practice mode: the moment a choice is pressed ---- */
.choice,.cell{position:relative}
/* right: the choice pops, a small burst of navy and pink specks leaves it, the question box flashes */
.choice.nk-right{animation:nk-pop .5s cubic-bezier(.2,.9,.3,1.5)}
.choice.nk-right::before{content:"";position:absolute;inset:-2px;border-radius:12px;border:2.5px solid var(--brand);pointer-events:none;animation:nk-ring .75s ease-out both}
.choice.nk-right::after{content:"";position:absolute;inset:-8px;border-radius:16px;pointer-events:none;animation:nk-burst .85s ease-out both;
  background:radial-gradient(circle at 7% 20%,var(--brand) 0 3.6px,transparent 4.6px),radial-gradient(circle at 93% 16%,var(--alert) 0 3.6px,transparent 4.6px),radial-gradient(circle at 50% -3%,var(--brand) 0 3px,transparent 4px),
    radial-gradient(circle at 97% 82%,var(--brand) 0 3.6px,transparent 4.6px),radial-gradient(circle at 3% 86%,var(--alert) 0 3.6px,transparent 4.6px),radial-gradient(circle at 50% 103%,var(--alert) 0 3px,transparent 4px),
    radial-gradient(circle at 25% 2%,var(--alert) 0 2.8px,transparent 3.8px),radial-gradient(circle at 76% 99%,var(--brand) 0 2.8px,transparent 3.8px)}
.cell.nk-right{animation:nk-pop .5s cubic-bezier(.2,.9,.3,1.5)}
.q.nk-q-right{animation:nk-q-right .9s ease-out}
/* wrong: the choice shakes, the box flashes pink, then the right choice lights up (a beat later) */
.choice.nk-wrong,.cell.nk-wrong{animation:nk-shake .55s cubic-bezier(.36,.07,.19,.97)}
.q.nk-q-wrong{animation:nk-q-wrong .9s ease-out}
.choice.nk-reveal,.cell.nk-reveal{animation:nk-reveal .75s .5s ease-out backwards}
@keyframes nk-pop{0%{transform:scale(1)}38%{transform:scale(1.05)}100%{transform:scale(1)}}
@keyframes nk-burst{0%{opacity:1;transform:scale(.7)}100%{opacity:0;transform:scale(1.5)}}
@keyframes nk-ring{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(1.12,1.5)}}
@keyframes nk-shake{10%,90%{transform:translateX(-2px)}20%,80%{transform:translateX(4px)}30%,50%,70%{transform:translateX(-7px)}40%,60%{transform:translateX(7px)}}
@keyframes nk-reveal{0%{box-shadow:0 0 0 0 rgba(10,64,136,.6);transform:scale(.96)}55%{box-shadow:0 0 0 10px rgba(10,64,136,0);transform:scale(1.04)}100%{box-shadow:0 0 0 0 rgba(10,64,136,0);transform:scale(1)}}
@keyframes nk-q-right{0%{background-color:rgba(10,64,136,.16)}100%{background-color:transparent}}
@keyframes nk-q-wrong{0%{background-color:rgba(252,148,175,.5)}100%{background-color:transparent}}

/* the line under the question */
.nk-fb{display:flex;align-items:center;gap:10px;margin:10px 0 0 40px;padding:8px 12px;border-radius:12px;font-size:12.5px;font-weight:700;line-height:1.4;animation:nk-fb-in .42s cubic-bezier(.2,.9,.3,1) both}
.nk-fb-right{background:var(--fill);color:var(--on-fill)}
.nk-fb-wrong{background:var(--alert);color:#000}
.nk-fb-none{border:1px dashed var(--line-2);color:var(--ink-2);font-weight:500}
.nk-fb-ic{flex:none;width:22px;height:22px;border-radius:50%;display:grid;place-items:center}
.nk-fb-right .nk-fb-ic{background:var(--on-fill);color:var(--fill);animation:nk-tick .55s .12s cubic-bezier(.2,1.6,.4,1) both}
.nk-fb-wrong .nk-fb-ic{background:#000;color:#fff;animation:nk-wob .55s .12s both}
.nk-fb-none .nk-fb-ic{display:none}
.nk-fb-retry{margin-left:auto;flex:none;height:26px;padding:0 12px;border-radius:999px;border:1px solid currentColor;background:transparent;color:inherit;font:inherit;font-size:11px;font-weight:700;cursor:pointer}
.nk-fb-retry:hover{background:rgba(255,255,255,.22)}
@keyframes nk-fb-in{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}
@keyframes nk-tick{from{transform:scale(0) rotate(-45deg)}to{transform:none}}
@keyframes nk-wob{0%{transform:scale(0)}40%{transform:scale(1.25) rotate(14deg)}70%{transform:rotate(-10deg)}100%{transform:none}}
@media (max-width:820px){.nk-fb{margin-left:0;flex-wrap:wrap}}

/* the head's tally in practice mode: a small bump each time it changes (two names so it can play again) */
.nk-tally.nk-bump-a{animation:nk-bump-a .4s ease-out}
.nk-tally.nk-bump-b{animation:nk-bump-b .4s ease-out}
@keyframes nk-bump-a{0%{transform:scale(1)}40%{transform:scale(1.1)}100%{transform:scale(1)}}
@keyframes nk-bump-b{0%{transform:scale(1)}40%{transform:scale(1.1)}100%{transform:scale(1)}}

/* dark mode: pink with dark type, white specks stay readable */
html.nk-dark .nk-fb-wrong{color:#101A25}
html.nk-dark .nk-fb-wrong .nk-fb-ic{background:#101A25}

@media (prefers-reduced-motion:reduce){
  .nk-mode,.choice.nk-right,.cell.nk-right,.choice.nk-wrong,.cell.nk-wrong,.choice.nk-reveal,.cell.nk-reveal,.q.nk-q-right,.q.nk-q-wrong,.nk-fb,.nk-fb-ic,.nk-tally{animation:none!important}
  .choice.nk-right::after,.choice.nk-right::before{display:none}
  .nk-mode{transition:none}
}

/* ---- the real exam in parts (2026-11-10): the clock lives on the answer sheet, a part is handed in before the next opens ---- */
/* the clock where the word มาร์กชีต was: a solid pill that is easy to see counting down; pink + a slow pulse in the last fifth of the part */
.nk-sheet-clock{display:inline-flex;align-items:center;gap:7px;padding:3px 12px 3px 10px;border-radius:999px;background:var(--fill);color:var(--on-fill);font-size:17px;font-weight:800;line-height:1.25;letter-spacing:.05em;font-variant-numeric:tabular-nums;transition:background .3s ease,color .3s ease}
.nk-sheet-clock::before{content:"";flex:none;width:8px;height:8px;border-radius:50%;background:currentColor;animation:nk-run 1s ease-in-out infinite}
.nk-sheet-clock.nk-low{background:var(--alert);color:#000;animation:nk-low 1s ease-in-out infinite}
html.nk-dark .nk-sheet-clock.nk-low{color:#101A25}
@keyframes nk-run{0%,100%{opacity:1}50%{opacity:.22}}
@keyframes nk-low{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}
/* on a wide screen the head's clock and hand-in button are on the sheet instead (on a phone the sheet is under the paper, so the head keeps them) */
@media (min-width:821px){.nk-moved{display:none!important}}

/* the strip of parts (widths follow the minutes), the name of the open part, the bar that drains with the clock */
.nk-sess{display:flex;flex-direction:column;gap:6px}
.nk-segs{display:flex;gap:4px}
.nk-seg{min-width:0;display:flex;flex-direction:column;gap:1px;padding:4px 7px;border:1px solid var(--line);border-radius:9px;background:var(--paper);color:var(--ink-2);font-size:9px;line-height:1.35}
.nk-seg b{font-size:10px;font-weight:700;color:var(--ink);white-space:nowrap}
.nk-seg i{font-style:normal;white-space:nowrap}
/* the part that is open (or the one waiting behind the card) is the solid one; a part already handed in is faded and says ส่งแล้ว */
.nk-seg.cur{background:var(--fill);border-color:var(--fill);color:var(--on-fill)}
.nk-seg.cur b{color:var(--on-fill)}
.nk-seg.done{background:var(--bg);color:var(--ink-2);opacity:.7}
.nk-seg.done b{color:var(--ink-2)}
.nk-sess-row{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
.nk-sess-name{min-width:0;font-size:10.5px;font-weight:700;line-height:1.45}
.nk-sess-min{flex:none;font-size:9.5px;font-weight:700;color:var(--ink-2)}
.nk-sess-bar{height:9px;border-radius:999px;background:var(--bg);border:1px solid var(--line);overflow:hidden}

/* the two buttons at the foot of the sheet */
.nk-sheet-btns{display:flex;flex-direction:column;gap:7px;flex-shrink:0}
.nk-btn-submit,.nk-btn-restart{width:100%;border-radius:999px;font-family:inherit;font-weight:700;cursor:pointer;transition:transform .15s ease,background .15s ease,color .15s ease}
.nk-btn-submit{height:42px;border:0;background:var(--ink);color:var(--paper);font-size:13px}
.nk-btn-submit:hover{transform:translateY(-1px)}
.nk-btn-restart{height:34px;border:1px solid var(--line);background:var(--paper);color:var(--ink);font-size:11.5px}
.nk-btn-restart:hover{background:var(--bg)}
.nk-btn-submit:focus-visible,.nk-btn-restart:focus-visible{outline:3px solid var(--brand);outline-offset:2px}

@media (prefers-reduced-motion:reduce){.nk-sheet-clock,.nk-sheet-clock::before,.nk-sheet-clock.nk-low,.nk-gap{animation:none!important}.nk-sess-bar span,.nk-btn-submit,.nk-btn-restart,.nk-gap-go{transition:none!important}}

/* results box on the sheet: it must not be squeezed by the long list of rows (it clips its own content, so a flex column would shrink it) */
aside[aria-label="解答用紙"] .rise{flex-shrink:0}
/* a phone: the paper on top, the sheet under it (the page's own phone rule only reached the blocks inside <main>, so the two columns stayed side by side) */
@media (max-width:820px){main{grid-template-columns:minmax(0,1fr)!important}aside[aria-label="解答用紙"]{position:static!important;max-height:none!important}}

/* the bar over the paper while a handed-in part is open to read: it stays in view, with the way back and the way on */
.nk-rev-bar{position:sticky;top:66px;z-index:4;width:100%;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 14px;padding:10px 14px;border-radius:14px;background:var(--fill);color:var(--on-fill);font-size:12.5px;font-weight:700;box-shadow:var(--shadow-2)}
.nk-rev-btns{display:flex;flex-wrap:wrap;gap:8px}
.nk-rev-btns button{height:32px;padding:0 14px;border-radius:999px;border:1px solid var(--on-fill);background:transparent;color:var(--on-fill);font-family:inherit;font-size:12px;font-weight:700;cursor:pointer}
.nk-rev-btns button.go{background:var(--on-fill);color:var(--fill)}
.nk-rev-btns button:focus-visible{outline:3px solid var(--alert);outline-offset:2px}

/* ---- the card between two parts, as a quiet dashboard: the score, three small numbers, a map of the questions (2026-11-10) ---- */
.nk-gap{width:100%;max-width:700px;margin:30px auto 0;padding:32px 34px 30px;border:1px solid var(--line);border-radius:24px;background:var(--paper);display:flex;flex-direction:column;gap:22px;box-sizing:border-box;animation:nk-card-in .55s cubic-bezier(.2,.8,.2,1) both}
.nk-gap-head{display:flex;flex-direction:column;gap:6px}
.nk-gap-eyebrow{font-size:12px;font-weight:700;letter-spacing:.08em;color:var(--brand)}
.nk-gap-title{margin:0;font-size:26px;line-height:1.25;font-weight:700}
.nk-dash{display:grid;grid-template-columns:auto 1px minmax(0,1fr);align-items:center;gap:0 26px;padding:20px 24px;border-radius:18px;background:var(--bg)}
.nk-dash-main{display:flex;flex-direction:column;gap:2px;font-variant-numeric:tabular-nums}
.nk-dash-main b{font-size:52px;line-height:1;font-weight:800;letter-spacing:-.02em;color:var(--brand)}
.nk-dash-main b i{font-style:normal;font-size:20px;font-weight:700;color:var(--ink-2);margin-left:6px}
.nk-dash-main small{margin-top:8px;font-size:11px;font-weight:700;letter-spacing:.08em;color:var(--ink-2)}
.nk-dash-rule{align-self:stretch;background:var(--line);opacity:.5}
.nk-dash-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.nk-dash-stat{display:flex;flex-direction:column;gap:3px;font-variant-numeric:tabular-nums}
.nk-dash-stat b{font-size:24px;line-height:1.1;font-weight:700}
.nk-dash-stat small{font-size:11.5px;color:var(--ink-2)}
/* the map: one small square per question, coloured by how it went; a press opens the part at that question */
.nk-map{display:flex;flex-direction:column;gap:10px}
.nk-map-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;font-size:11.5px;color:var(--ink-2)}
.nk-map-head b{font-size:12px;font-weight:700;color:var(--ink)}
.nk-map-legend{display:flex;gap:12px}
.nk-map-legend span{display:inline-flex;align-items:center;gap:5px}
.nk-map-legend i{width:9px;height:9px;border-radius:3px;display:inline-block}
.nk-map-legend .ok{background:var(--fill)}
.nk-map-legend .bad{background:var(--alert)}
.nk-map-legend .blank{border:1.5px dashed var(--ink-2)}
.nk-map-cells{display:flex;flex-wrap:wrap;gap:5px}
.nk-sq{width:28px;height:28px;padding:0;border-radius:8px;border:1.5px solid transparent;font-family:inherit;font-size:10.5px;font-weight:700;font-variant-numeric:tabular-nums;cursor:pointer;transition:transform .15s ease,box-shadow .15s ease}
.nk-sq.ok{background:var(--fill);color:var(--on-fill);border-color:var(--fill)}
.nk-sq.bad{background:var(--alert);color:#000;border-color:var(--alert)}
.nk-sq.blank{background:transparent;color:var(--ink-2);border:1.5px dashed var(--ink-2)}
.nk-sq.none{background:transparent;color:var(--ink-2);border-color:var(--line);opacity:.45}
.nk-sq:hover{transform:translateY(-2px);box-shadow:var(--shadow-2)}
.nk-sq:focus-visible{outline:3px solid var(--brand);outline-offset:2px}
html.nk-dark .nk-sq.bad{color:#101A25}
.nk-gap-foot{display:flex;flex-direction:column;gap:12px}
.nk-gap-next{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 16px;font-size:13px;color:var(--ink-2)}
.nk-gap-next b{font-size:15px;font-weight:700;color:var(--ink)}
.nk-gap-next em{font-style:normal;font-weight:700;color:var(--brand);font-variant-numeric:tabular-nums}
.nk-gap-actions{display:flex;flex-direction:column;gap:8px}
.nk-gap-go{height:52px;border-radius:999px;border:0;background:var(--fill);color:var(--on-fill);font-family:inherit;font-size:16px;font-weight:700;cursor:pointer;transition:transform .2s ease,box-shadow .2s ease}
.nk-gap-go:hover{transform:translateY(-2px);box-shadow:var(--shadow-2)}
.nk-gap-review{align-self:center;height:34px;padding:0 6px;border:0;background:transparent;color:var(--ink-2);font-family:inherit;font-size:13px;font-weight:700;text-decoration:underline;text-underline-offset:4px;cursor:pointer}
.nk-gap-review:hover{color:var(--ink)}
.nk-gap-go:focus-visible,.nk-gap-review:focus-visible{outline:3px solid var(--brand);outline-offset:3px}
@media (max-width:820px){.nk-gap{margin-top:14px;padding:22px 16px 20px;gap:18px}.nk-gap-title{font-size:22px}.nk-dash{grid-template-columns:minmax(0,1fr);gap:14px;padding:16px}.nk-dash-rule{display:none}.nk-dash-main b{font-size:44px}.nk-sq{width:26px;height:26px}}
@media (prefers-reduced-motion:reduce){.nk-sq,.nk-gap-go{transition:none!important}}

/* the underlined words of the old papers (the data writes them <u>…</u>); the colour follows the text so it also reads on a selected (dark) choice */
.nk-u{text-decoration:underline;text-decoration-color:currentColor;text-decoration-thickness:2px;text-underline-offset:4px;text-decoration-skip-ink:none}
