:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18212f;
  background: #f4f6f8;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }

.shell { max-width: 1080px; margin: 0 auto; padding: 28px 18px 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
h1 { margin: 2px 0 4px; font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { line-height: 1.35; }
h3 { margin: 8px 0; font-size: 1.35rem; }
.eyebrow { margin: 0; font-size: .76rem; letter-spacing: .12em; font-weight: 700; }
.subtle { color: #687385; margin: 4px 0; }
.small { font-size: .86rem; }
.hidden { display: none !important; }

.notice { border: 1px solid #d8dde5; background: #fff8e7; padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.card { background: white; border: 1px solid #e1e5eb; border-radius: 16px; box-shadow: 0 5px 18px rgba(20, 30, 45, .05); }
.auth-card, .question-card, .mastery-card, .mode-card { padding: 22px; }
.auth-card { max-width: 560px; }
label { display: grid; gap: 6px; margin: 14px 0; font-weight: 600; }
input { width: 100%; border: 1px solid #cbd2dc; border-radius: 10px; padding: 11px 12px; background: white; }
input:focus { outline: 2px solid #9ab3d6; outline-offset: 1px; }

button { border: 0; border-radius: 10px; padding: 10px 15px; background: #1f4f8a; color: white; font-weight: 700; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: #e9eef5; color: #20324a; }
button.ghost { background: transparent; color: #274a75; border: 1px solid #ccd7e4; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.message { min-height: 1.4em; color: #8a3342; }

.section-heading { margin: 10px 0 16px; }
.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dashboard-loading { padding: 24px; color: #687385; }
.dashboard-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.recommendation-card { padding: 22px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.recommendation-card > div { min-width: 0; }
.skill-map-card { padding: 22px; margin-bottom: 14px; }
.skill-map-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 14px; }
.legend { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; color: #687385; font-size: .82rem; }
.band-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.band-dot.strong { background: #3d8a5c; }
.band-dot.developing { background: #c58a27; }
.band-dot.support { background: #b64a55; }
.skill-map { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.skill-tile { border: 1px solid #e1e5eb; border-radius: 13px; padding: 14px; display: grid; gap: 10px; background: #fbfcfe; }
.skill-tile.recommended { border-color: #8caed7; box-shadow: inset 0 0 0 1px #b9cee6; background: #f7fbff; }
.skill-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.skill-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; color: #6f7c8d; }
.skill-title { font-weight: 700; line-height: 1.35; }
.skill-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.band-badge { padding: 4px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.band-badge.strong { background: #e9f6ee; color: #2f7149; }
.band-badge.developing { background: #fff5df; color: #8a641f; }
.band-badge.needs_support { background: #fff0f1; color: #9a3944; }
.band-badge.not_assessed { background: #eef2f7; color: #687385; }
.mastery-chip { font-size: .78rem; color: #596779; }
.check-chip { font-size: .75rem; color: #2f7149; font-weight: 700; text-align: right; line-height: 1.3; }
.check-chip.recent-recovery { color: #8a641f; }
.check-chip.completion-neutral { color: #596779; }
.mini-progress { height: 7px; margin-top: 8px; border-radius: 999px; overflow: hidden; background: #e8edf2; }
.mini-progress-bar { height: 100%; background: #355f91; transition: width .25s ease; }

.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.actions-grid { margin-top: 14px; }
.mode-card { display: flex; flex-direction: column; gap: 8px; }
.mode-card button { align-self: flex-start; margin-top: auto; }
.mode-kicker { display: inline-flex; align-self: flex-start; border-radius: 999px; background: #eef3f9; color: #2d527e; padding: 5px 9px; font-size: .78rem; font-weight: 700; }
.session-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }

.dashboard-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.compact { padding: 14px 16px; }
.stat { display: grid; gap: 4px; }
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #718096; }
.question-heading, .mastery-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.question-actions { display: flex; align-items: center; gap: 10px; }
.skill-name { margin: 0; font-weight: 700; }
.item-code { margin: 4px 0 0; font-size: .8rem; color: #8791a0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.question-card h2 { margin: 22px 0 18px; font-size: clamp(1.2rem, 3vw, 1.55rem); }
#answerArea { margin: 0 0 18px; }
.option { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid #d9dee6; border-radius: 10px; margin: 8px 0; font-weight: 500; }
.option:hover { background: #f7f9fc; }
.option input { width: auto; margin-top: 3px; }
.quantity-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 10px; }

.feedback { margin-top: 18px; border-radius: 12px; padding: 14px; }
.feedback.good { background: #edf8f1; border: 1px solid #b8dfc6; }
.feedback.bad { background: #fff0f0; border: 1px solid #efc1c1; }
.feedback.neutral { background: #eef4fb; border: 1px solid #c8d8ec; }
.mastery-card { margin-top: 12px; }
.pill { border-radius: 999px; background: #eef2f7; padding: 5px 9px; font-size: .8rem; }
.progress-track, .session-progress-track { height: 11px; background: #e8edf2; border-radius: 999px; overflow: hidden; margin: 14px 0 10px; }
.progress-bar, .session-progress-bar { height: 100%; background: #355f91; transition: width .25s ease; }
.session-progress-bar { background: #244d7e; }

.stimulus { margin: 18px 0; padding: 16px; border-radius: 12px; background: #f8fafc; border: 1px solid #e1e6ed; }
.scale-wrap { overflow-x: auto; padding: 10px; }
.scale-svg { width: 100%; min-width: 420px; height: 120px; }
.cylinders { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 18px; max-width: 520px; margin: 0 auto; }
.cylinder { position: relative; height: 180px; border: 3px solid #77869a; border-top: 0; border-radius: 0 0 18px 18px; overflow: hidden; background: #fff; }
.water { position: absolute; left: 0; right: 0; bottom: 0; background: #c9e5f6; border-top: 2px solid #7eb8db; }
.cylinder-label { text-align: center; margin-top: 7px; font-size: .9rem; }
.stack { display: flex; flex-direction: column-reverse; align-items: stretch; gap: 2px; max-width: 240px; margin: 12px auto; }
.stack > div { height: 7px; border-radius: 3px; background: #d7b980; border: 1px solid #b7975c; }
.conversion { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 1.2rem; font-weight: 700; padding: 16px; }

@media (max-width: 760px) {
  .dashboard-row, .dashboard-summary, .mode-grid, .skill-map { grid-template-columns: 1fr; }
  .question-heading, .mastery-head, .topbar, .dashboard-heading, .recommendation-card, .skill-map-heading { align-items: stretch; flex-direction: column; }
  .question-actions { justify-content: space-between; }
  .quantity-row { grid-template-columns: 1fr; }
}