/* Student Portal — readability first, phone-friendly. */
body.student { font-size: 16px; }
.s-top { position: sticky; top: 0; z-index: 20; background: #172b3a; color: #fff; }
.s-top-inner { max-width: 860px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.s-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.s-save { font-size: .8rem; color: #b9c3cc; white-space: nowrap; }
.s-save.warn { color: #ffd27a; }
.s-timer { font-variant-numeric: tabular-nums; font-weight: 700; background: rgba(255,255,255,.12); border-radius: 6px; padding: 4px 10px; }
.s-timer.low { background: #9a6400; }
.s-timer.critical { background: #b3261e; }
.s-main { max-width: 860px; margin: 0 auto; padding: 16px 16px 96px; outline: none; }

.s-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.s-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
.s-fact { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.s-fact .k { font-size: .78rem; color: var(--muted); }
.s-fact .v { font-weight: 650; }
.s-form label.field input, .s-form label.field select { font-size: 16px; padding: 10px 12px; } /* 16px avoids zoom on iPhone */
.s-big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 16px; }

.s-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; }
.s-nav button { min-width: 40px; min-height: 40px; padding: 4px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.s-nav button.answered { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-color: var(--accent); }
.s-nav button.current { outline: 2px solid var(--accent); outline-offset: 1px; font-weight: 700; }
.s-nav button.flagged::after { content: '⚑'; font-size: .7rem; margin-left: 2px; color: var(--warn); }
.s-progress { font-size: .85rem; color: var(--muted); }

.s-q { scroll-margin-top: 70px; }
.s-q-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.s-q-num { font-weight: 700; }
.s-q-pts { font-size: .85rem; color: var(--muted); }
.s-q-text { margin: 10px 0 14px; font-size: 1.02rem; line-height: 1.55; overflow-wrap: anywhere; }
.s-q-text table { max-width: 100%; display: block; overflow-x: auto; }
.s-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.s-choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; min-height: 48px; }
.s-choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.s-choice input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.s-choice .letter { font-weight: 650; }
.s-answer input { width: 100%; font-size: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); }
.s-flag { font-size: .85rem; }
.s-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.s-actions .spacer { flex: 1; }
.s-actions button { min-height: 44px; padding: 8px 18px; }
.s-assets img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); margin: 6px 0; }

.s-bottom { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 15; padding-bottom: env(safe-area-inset-bottom); }
.s-bottom-inner { max-width: 860px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 8px; align-items: center; }

.s-result-score { font-size: 2.2rem; font-weight: 750; }
.s-review li { margin-bottom: 14px; }
.s-review .mark { font-weight: 700; }
.s-review .ok { color: var(--ok); }
.s-review .bad { color: var(--bad); }
.s-review .ans { font-size: .92rem; margin-top: 4px; }
.s-review .ans p { display: inline; margin: 0; }

dialog.s-dialog { width: min(480px, calc(100vw - 32px)); }
.s-bottom-inner .spacer { flex: 1; }
@media (max-width: 480px) { .s-facts { grid-template-columns: 1fr 1fr; } }
.s-answer textarea.s-short { width: 100%; font-size: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); resize: vertical; min-height: 5.5em; font-family: inherit; }
.s-short-count { margin: 4px 0 0; }
.s-ideas { list-style: none; padding: 0; margin: 4px 0; }
.s-written { white-space: pre-wrap; word-break: break-word; }
.s-nopaste { margin: 4px 0 0; }
.s-formula-rule { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--surface-sunk, #f1f3f6); border-radius: 6px; font-size: .9rem; }
.s-formula-rule code { font-size: .85rem; }
.s-levels { width: 100%; border-collapse: collapse; }
.s-levels th, .s-levels td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.s-levels .num { text-align: right; }

/* Submit in the bottom bar: outlined, so it never looks like "Next" (one tap away on phones). */
.s-bottom-inner .s-submit-bar { min-height: 40px; padding: 6px 14px; background: transparent; border: 1.5px solid var(--border); color: var(--text); font-weight: 600; box-shadow: none; }
.s-bottom-inner .s-submit-bar:hover { border-color: var(--accent); }
/* Keep the question's own buttons well above the fixed bottom bar. */
body.student main { padding-bottom: 96px; }
.s-actions { margin-bottom: 24px; }
@media (max-width: 600px) {
  .s-actions .s-next { flex: 1 1 60%; min-height: 52px; font-size: 1.05rem; }
  .s-actions { margin-bottom: 40px; }
}

/* Result link / code (see this result on any device) and "Check my result" */
.s-access { border-color: var(--accent); }
.s-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.15rem; letter-spacing: .08em; }
.s-access-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0; }
.s-check > summary { cursor: pointer; font-weight: 600; }
.s-check[open] > summary { margin-bottom: 8px; }
.s-results-list { list-style: none; padding: 0; margin: 0; }
.s-results-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.s-results-list li:first-child { border-top: 0; }
.s-results-list .grow { flex: 1 1 200px; min-width: 0; }
.s-results-list .score { font-weight: 600; white-space: nowrap; }

/* Shareable result card (public quizzes) */
.s-share { border-color: var(--accent); }
.s-card-img { display: block; width: 100%; max-width: 420px; aspect-ratio: 1; margin: 6px auto 10px; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
