/* Candidate assessment site — calm, mobile-first, no portal chrome. One base colour (charcoal) + the brand red. */
:root {
    --ink: #23262B;
    --ink-soft: #5b5f68;
    --muted: #8a8e97;
    --line: #e4e2dd;
    --paper: #ffffff;
    --ground: #f5f4f1;
    --red: #D2232A;
    --red-soft: #fbe9ea;
    --ok: #1f8a4c;
    --ok-soft: #e6f4ec;
    --warn: #b9770e;
    --warn-soft: #fdf3e0;
    --radius: 14px;
    --font: "IBM Plex Sans", "Noto Sans SC", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-head: "Jost", "Noto Sans SC", var(--font);
    --font-size: 15px;
}
* { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--font-size); line-height: 1.55; color: var(--ink); background: var(--ground); min-height: 100vh; }
a { color: var(--red); }
button { font-family: inherit; font-size: inherit; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .875em; }
.hidden { display: none !important; }

/* ---- Layout ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 860px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { display: inline-flex; color: var(--ink); }
.brand-name { font-family: var(--font-head); font-weight: 700; letter-spacing: .04em; font-size: .95rem; }
.brand-cn { font-family: "Noto Sans SC", var(--font); font-weight: 500; color: var(--muted); font-size: .9rem; }
.spacer { flex: 1; }
.wrap { max-width: 860px; margin: 0 auto; padding: 22px 16px 120px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card + .card { margin-top: 16px; }
@media (max-width: 600px) { .card { padding: 16px; } .wrap { padding: 14px 12px 120px; } }

/* ---- Language switch ---- */
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--paper); }
.lang button { border: 0; background: transparent; padding: 5px 12px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .85rem; }
.lang button.on { background: var(--ink); color: #fff; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 10px; padding: 11px 18px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s; }
.btn:hover { background: #f3f2ef; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: #b81d23; border-color: #b81d23; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #111; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .875rem; border-radius: 8px; }
.btn-link { border: 0; background: none; color: var(--red); padding: 0; font-weight: 600; cursor: pointer; }

/* ---- Landing ---- */
.hero-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.eyebrow { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--red); font-weight: 700; margin-bottom: 6px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 6px; }
.fact { background: var(--ground); border-radius: 10px; padding: 12px 14px; }
.fact .k { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.fact .v { font-weight: 600; font-size: 1.05rem; margin-top: 2px; }
.rules { margin: 0; padding-left: 1.2rem; }
.rules li { margin-bottom: 8px; }
.instructions { border-left: 3px solid var(--red); padding: 4px 0 4px 14px; margin: 14px 0; color: var(--ink-soft); }
.instructions p:last-child { margin-bottom: 0; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.checks li:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--red); }
.consent { display: flex; gap: 12px; align-items: flex-start; background: var(--ground); border-radius: 10px; padding: 14px; margin: 16px 0; cursor: pointer; }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--red); }
.state { text-align: center; padding: 40px 12px; }
.state .icon { font-size: 44px; margin-bottom: 8px; }
.state h2 { margin-bottom: 6px; }
.note { font-size: .875rem; color: var(--muted); }

/* ---- Assessment ---- */
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-txt { font-weight: 600; white-space: nowrap; }
.progress-bar { width: 140px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--red); width: 0; transition: width .3s; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--ground); border: 1px solid var(--line); white-space: nowrap; }
.timer.warn { background: var(--warn-soft); border-color: #f0d9a8; color: var(--warn); }
.timer.danger { background: var(--red-soft); border-color: #f3c3c5; color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.saved { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.saved.ok { color: var(--ok); } .saved.bad { color: var(--red); } .saved.busy { color: var(--warn); }
.q-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.q-section { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.q-type { font-size: .78rem; color: var(--ink-soft); background: var(--ground); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.q-timer { font-size: .85rem; font-weight: 700; color: var(--warn); }
.q-title { font-size: 1.15rem; margin: 6px 0 8px; }
.q-prompt { color: var(--ink-soft); margin-bottom: 14px; }
.q-prompt img { max-width: 100%; height: auto; }
.q-prompt pre { background: #f4f4f5; border-radius: 8px; padding: 10px 12px; overflow: auto; }
.hint { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--paper); transition: border-color .15s, background .15s; }
.opt:hover { border-color: #cfcbc3; }
.opt input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--red); }
.opt.on { border-color: var(--red); background: #fff8f8; }
.opt .txt { flex: 1; }
.answer-field, textarea.answer-field, input.answer-field { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-family: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); outline: none; transition: border-color .15s, box-shadow .15s; }
.answer-field:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(35,38,43,.08); }
textarea.answer-field { min-height: 140px; resize: vertical; }
textarea.answer-field.essay { min-height: 220px; }
textarea.answer-field.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; min-height: 260px; background: #14161c; color: #e9ebf2; border-color: #262a33; tab-size: 4; white-space: pre; line-height: 1.5; }
textarea.answer-field.code:focus { border-color: #4a4f5c; box-shadow: none; }
.codebar { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.codebar .chip { background: #14161c; color: #cdd1dc; border-radius: 6px; padding: 2px 8px; font-family: ui-monospace, Menlo, monospace; }
input.answer-field.numeric { max-width: 260px; font-variant-numeric: tabular-nums; }
.counter { text-align: right; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.file-box { border: 1.5px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; background: var(--ground); }
.file-box.has { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.file-box input { display: none; }
.file-name { font-weight: 600; word-break: break-all; }
.upload-progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 10px; }
.upload-progress > span { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
.locked { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }

.navbar-bottom { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; }
.navbar-bottom .in { max-width: 860px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.navbar-bottom .grow { flex: 1; }

/* ---- Review ---- */
.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.review-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: var(--paper); }
.review-item:hover { border-color: #cfcbc3; }
.review-item .n { font-weight: 700; }
.review-item .s { font-size: .78rem; margin-top: 2px; }
.review-item.done .s { color: var(--ok); }
.review-item.todo { border-color: #f3c3c5; background: #fffafa; }
.review-item.todo .s { color: var(--red); }
.summary { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 4px; }
.summary .pill { border-radius: 999px; padding: 6px 14px; font-weight: 600; background: var(--ground); }
.summary .pill.ok { background: var(--ok-soft); color: var(--ok); }
.summary .pill.todo { background: var(--red-soft); color: var(--red); }

/* ---- Banners / overlays ---- */
.banner { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: calc(100% - 24px); font-size: .9rem; }
.banner .btn { padding: 6px 12px; font-size: .85rem; }
.banner.warn { background: var(--warn); }
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(35,38,43,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.overlay .box { background: var(--paper); border-radius: 16px; padding: 26px; max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.overlay .box .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.result { text-align: center; padding: 18px 0 6px; }
.result .big { font-family: var(--font-head); font-size: 3rem; font-weight: 700; line-height: 1; }
.result .tag { display: inline-block; margin-top: 8px; border-radius: 999px; padding: 6px 16px; font-weight: 700; }
.result .tag.ok { background: var(--ok-soft); color: var(--ok); } .result .tag.bad { background: var(--red-soft); color: var(--red); }
.foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 26px; }

/* ---- Spreadsheet (Excel-style) answer (js/grid.js) ---- */
.grid-answer { margin-top: 4px; }
.sg-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.sg { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: .95rem; min-width: 100%; }
.sg th, .sg td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; }
.sg thead th { background: var(--ground); text-align: left; padding: 6px 10px; font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.sg tbody th { background: var(--ground); text-align: center; padding: 0 8px; font-weight: 600; color: var(--muted); min-width: 38px; }
.sg th.sg-corner { min-width: 38px; }
.sg .sg-letter { display: inline-block; font-size: .72rem; color: var(--muted); font-weight: 700; margin-right: 8px; }
.sg .sg-nummark { margin-left: 8px; color: var(--muted); font-size: .75rem; }
.sg .sg-added { background: #fbfbe6; }
.sg td.sg-td { padding: 0; background: var(--paper); position: relative; }
.sg td.sg-td.sg-focus { box-shadow: inset 0 0 0 2px var(--ink); z-index: 2; }
.sg td.sg-locked { background: #eceef1; color: var(--ink-soft); }
.sg .sg-ro { padding: 8px 10px; white-space: nowrap; font-weight: 600; }
.sg td.sg-num .sg-ro { text-align: right; }
.sg .sg-in { display: block; width: 100%; min-width: 110px; border: 0; background: transparent; padding: 8px 10px; font: inherit; color: var(--ink); outline: none; }
.sg .sg-in.sg-num { text-align: right; }
.sg td.sg-formula { background: #f4f8ff; }
.sg td.sg-formula::after { content: "ƒ"; position: absolute; top: 2px; right: 5px; font-family: Georgia, serif; font-style: italic; font-size: .7rem; color: #2563eb; pointer-events: none; }
.sg td.sg-err { background: var(--red-soft); }
.sg td.sg-err .sg-in { color: var(--red); font-weight: 600; }
.sg td.sg-invalid { box-shadow: inset 0 0 0 1.5px var(--warn); }
.sg td.sg-invalid .sg-in { color: var(--warn); }
.sg-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.sg-note { font-size: .85rem; color: var(--warn); }
@media (max-width: 600px) { .sg .sg-in { min-width: 90px; padding: 8px 8px; } }
