/* ADMIRE University — ADMIRE corporate identity (admire.co.th)
   Colour rule 60-30-10: 60% light surfaces · 30% ADMIRE navy · 10% orange accent.
   Orange is used for ONE thing per screen: the main action (Von Restorff).
   Green / red are reserved for right / wrong feedback only. */
:root {
  --navy: #002E6C;
  --navy-2: #112E5F;
  --navy-3: #0B1A33;
  --tint: #E2E9F4;
  --accent: #E65100;
  --accent-ink: #B33F00;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --line: #DFE3E8;
  --text: #292D32;
  --muted: #5F6670;
  --faint: #8A93A0;
  --ok: #1F8A4C;
  --ok-soft: #E3F3E9;
  --ok-ink: #13563A;
  --bad: #C8102E;
  --bad-soft: #FCEBEE;
  --bad-ink: #8E0B21;
  --q1: #FDE9DF;
  --q2: #E3F0EA;
  --q3: #FFF4D9;
  --q4: #ECEFF3;
  --radius: 14px;
  --pill: 22px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--navy); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1.02rem; font-weight: 600; }
img, video, iframe { max-width: 100%; }
[hidden] { display: none !important; }

.container { max-width: 960px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 640px; margin: 0 auto; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.section-title { font-size: .8rem; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 22px 0 8px; }

/* ---------- header / nav ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; background: var(--navy); color: #fff; padding: 10px 16px; }
.brand { display: flex; align-items: baseline; gap: 8px; color: #fff; text-decoration: none; }
.brand-word { font-weight: 700; letter-spacing: .22em; font-size: 1.05rem; }
.brand-sub { font-size: .8rem; opacity: .8; letter-spacing: .04em; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a, .nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h); color: var(--faint); text-decoration: none; font: inherit; font-size: .75rem; background: none; border: 0; cursor: pointer; }
.nav .ico { font-size: 1.2rem; line-height: 1; }
.nav a.active { color: var(--navy); font-weight: 600; }
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .nav { position: static; margin-left: auto; background: none; border: 0; gap: 4px; padding: 0; }
  .nav a, .nav button { flex: none; flex-direction: row; height: auto; padding: 6px 14px; border-radius: var(--pill); color: #C9D3E3; font-size: .9rem; }
  .nav a.active { color: var(--navy); background: #fff; }
  .nav .ico { font-size: 1rem; }
}
body.focus { padding-bottom: 0; }
body.focus .topbar, body.focus .nav { display: none !important; }

/* ---------- cards / buttons / forms ---------- */
.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 16px; }
.card + .card { margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 22px; border-radius: var(--pill); border: 1.5px solid transparent;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { background: var(--line); color: var(--faint); cursor: not-allowed; }
.btn.secondary, .btn.navy { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.secondary:disabled { border-color: var(--line); }
.btn.danger { background: #fff; color: var(--bad); border-color: #EBB5BE; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn.ghost { background: none; color: var(--navy); border-color: transparent; }
label.field { display: block; font-size: .875rem; color: var(--muted); }
label.field > span { display: block; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); padding: 10px 12px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
textarea { min-height: 96px; resize: vertical; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; min-height: 160px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--tint); border-color: var(--navy); }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--navy); }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.grid-form { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-form { grid-template-columns: 1fr 1fr; } .grid-form .full { grid-column: 1 / -1; } }
.error { color: var(--bad); font-size: .9rem; min-height: 1.2em; }

/* ---------- badges / bars / chips ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge.not_started { background: var(--q4); color: var(--muted); }
.badge.passed { background: var(--tint); color: var(--navy); }
.badge.failed { background: var(--bad-soft); color: var(--bad-ink); }
.badge.retest_due { background: #fff; color: var(--navy); border: 1.5px dashed var(--navy); }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--navy); border-radius: 99px; transition: width .4s; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); color: var(--navy); border-radius: 99px; padding: 4px 12px; font-size: .85rem; font-weight: 600; }
.chip .big { font-size: 1rem; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.login .card { width: 100%; max-width: 380px; padding: 28px 22px; border: 0; }
.login .wordmark { text-align: center; color: var(--navy); font-weight: 700; letter-spacing: .3em; font-size: 1.6rem; margin-top: 4px; }
.login .sub { text-align: center; color: var(--muted); font-size: .9rem; margin: 0 0 8px; letter-spacing: .04em; }
.pin-input { letter-spacing: .6em; text-align: center; font-size: 1.4rem; }

/* ---------- home ---------- */
.hello { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.hello h1 { margin: 0; font-size: 1.25rem; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.next-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.next-card .kicker { font-size: .8rem; color: var(--muted); }
.next-card h2 { font-size: 1.25rem; margin: 2px 0 6px; }
.next-card .meta { font-size: .85rem; color: var(--muted); margin-bottom: 14px; white-space: pre-line; }
.due { display: flex; align-items: center; gap: 12px; background: #fff; border: 1.5px dashed var(--navy); border-radius: var(--radius); padding: 12px 14px; margin-top: 10px; color: var(--navy); text-decoration: none; }
.due .ico { font-size: 1.3rem; }
.goal { display: inline-flex; align-items: center; gap: 6px; }
.goal-ring { --p: 0; width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(var(--navy) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; }
.goal-ring::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #fff; }

/* mascot greeting */
.buddy { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.buddy .face { font-size: 2.6rem; line-height: 1; animation: bob 2.4s ease-in-out infinite; }
.buddy .say { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 14px; color: var(--navy); }
.buddy .say b { display: block; font-size: 1.15rem; }
.buddy .say span { font-size: .9rem; color: var(--muted); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* unit banner (common region: one unit = one block) */
.unit { background: var(--navy); color: #fff; border-radius: 18px; padding: 14px 16px; margin: 22px 0 8px; }
.unit .k { font-size: .8rem; opacity: .8; }
.unit b { font-size: 1.1rem; }
.unit .row { margin-top: 8px; }
.unit .bar { flex: 1; background: rgba(255,255,255,.22); height: 8px; }
.unit .bar > i { background: #fff; }

/* learning path — continuity: one trail joins every lesson and fills as you pass */
.path { position: relative; padding: 6px 0; }
.path::before { content: ""; position: absolute; left: 36px; top: 30px; bottom: 30px; width: 6px; margin-left: -3px; border-radius: 6px;
  background: linear-gradient(var(--navy) 0 var(--fill, 0%), var(--line) var(--fill, 0%) 100%); }
.node-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 9px 0; text-decoration: none; color: inherit; }
.node { position: relative; z-index: 1; flex: none; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; line-height: 1;
  background: #fff; border: 4px solid var(--line); border-bottom-width: 7px; transition: transform .15s; }
.node-row:hover .node { transform: translateY(-2px); }
.node.passed { background: var(--tint); border-color: var(--navy); }
.node.failed { background: #fff; border-color: var(--navy); }
.node.retest_due { background: #fff; border: 4px dashed var(--navy); }
.node.not_started .emo { filter: grayscale(1); opacity: .45; }
.node.current { background: var(--accent); border-color: #B33F00; box-shadow: 0 0 0 7px #FBD9C4; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 7px #FBD9C4; } 50% { box-shadow: 0 0 0 12px #FDEADF; } }
.node .corner { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; border: 2px solid #fff; }
.node .corner.ok { background: var(--navy); color: #fff; }
.node .corner.due { background: #fff; color: var(--navy); border: 2px dashed var(--navy); }
.start-bubble { position: absolute; left: 6px; top: -14px; z-index: 2; background: var(--navy); color: #fff; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 10px; animation: bob 1.6s ease-in-out infinite; }
.start-bubble::after { content: ""; position: absolute; left: 22px; bottom: -6px; border: 6px solid transparent; border-top-color: var(--navy); border-bottom: 0; }
.lcard { flex: 1; min-width: 0; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.node-row.is-current { margin-top: 18px; }
.node-row.is-current .lcard { border-color: var(--navy); }
.lcard .lk { font-size: .78rem; color: var(--muted); font-weight: 600; }
.lcard .lt { display: block; font-size: 1.02rem; font-weight: 700; color: var(--navy); line-height: 1.35; margin: 1px 0 6px; }
.lcard .ls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.starline { letter-spacing: 1px; font-size: .9rem; }
.starline .off { filter: grayscale(1); opacity: .35; }
.board .team { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.board .team:last-child { border-bottom: 0; }
.board .rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--q4); color: var(--muted); font-weight: 700; font-size: .8rem; flex: none; }
.board .team.me { font-weight: 700; color: var(--navy); }
.board .team.me .rank { background: var(--navy); color: #fff; }

/* ---------- lesson flow ---------- */
.steps { display: flex; gap: 4px; margin: 4px 0 16px; }
.steps span { flex: 1; text-align: center; font-size: .72rem; color: var(--faint); padding-top: 6px; border-top: 4px solid var(--line); }
.steps span.done { border-color: var(--navy); color: var(--muted); }
.steps span.now { border-color: var(--navy); color: var(--navy); font-weight: 700; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (min-width: 768px) { .sticky-actions { bottom: 0; } }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin-bottom: 12px; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.lesson .lead { font-size: 1.05rem; }
.lesson .hl { background: var(--tint); color: var(--navy); padding: 0 4px; border-radius: 4px; font-weight: 600; }
.lesson ol li, .lesson ul li { margin-bottom: 8px; }
.lesson .table-wrap { margin: 8px 0 12px; }
.callout { background: var(--navy); color: #fff; padding: 14px 16px; border-radius: 12px; margin: 16px 0; }
.callout b { color: #fff; }
/* story-first lesson: story → bridge → 3 keys → case → memo */
.story { background: var(--tint); border-radius: 16px; padding: 14px 16px; margin: 4px 0 10px; }
.story .story-tag { font-size: .8rem; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.story p { margin: 0; font-size: 1.05rem; line-height: 1.75; color: var(--navy-3); }
.lesson .bridge { font-weight: 600; color: var(--navy); margin: 0 0 14px; }
.lesson ol.keys { padding-left: 0; list-style: none; counter-reset: k; }
.lesson ol.keys li { counter-increment: k; position: relative; padding: 10px 12px 10px 48px; margin-bottom: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; }
.lesson ol.keys li::before { content: counter(k); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
details.more { margin-top: 14px; border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.meta-box { background: var(--tint); color: var(--navy); border-radius: 10px; padding: 8px 12px; font-size: .88rem; margin-bottom: 12px; }
.placeholder { border: 1.5px dashed var(--faint); border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: .9rem; margin: 12px 0; }
.eis-grid { display: grid; grid-template-columns: 22px 1fr 1fr; grid-template-rows: auto 1fr 1fr; gap: 6px; margin: 16px 0; }
.eis-axis { display: flex; font-size: .75rem; font-weight: 600; color: var(--muted); }
.eis-axis-top { grid-column: 2 / 4; grid-row: 1; }
.eis-axis-top span { flex: 1; text-align: center; }
.eis-axis-side { grid-column: 1; grid-row: 2 / 4; flex-direction: column; }
.eis-axis-side span { flex: 1; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.eis-q { border-radius: 10px; padding: 10px; font-size: .82rem; }
.eis-q b { display: block; font-size: .9rem; color: var(--navy); }
.eis-q small { color: var(--muted); }
.eis-q p { margin: 4px 0 0; }
.eis-q.q1 { background: var(--q1); grid-area: 2 / 2; } .eis-q.q2 { background: var(--q2); grid-area: 2 / 3; }
.eis-q.q3 { background: var(--q3); grid-area: 3 / 2; } .eis-q.q4 { background: var(--q4); grid-area: 3 / 3; }
.loop { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 12px 0; }
@media (min-width: 560px) { .loop { grid-template-columns: 1fr 1fr; } }
.loop-col { border-radius: 12px; padding: 12px; }
.loop-col.back { background: var(--q4); }
.loop-col.fwd { background: var(--tint); }
.loop-col ol { margin: 8px 0 0; padding-left: 20px; }
.loop-col small { color: var(--muted); }
details.reveal { border: 1.5px dashed var(--navy); border-radius: 12px; padding: 10px 14px; margin: -4px 0 16px; }
details.reveal summary { cursor: pointer; font-weight: 600; color: var(--navy); }

/* ---------- quiz (one question per screen) ---------- */
.quiz { max-width: 640px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.quiz-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.quiz-top .x { background: none; border: 0; font-size: 1.4rem; color: var(--faint); cursor: pointer; padding: 4px; line-height: 1; }
.quiz-top .bar { flex: 1; height: 12px; }
.quiz-top .combo { font-weight: 700; color: var(--navy); min-width: 44px; text-align: right; font-size: .9rem; }
.quiz-body { flex: 1; padding: 10px 16px 16px; }
.quiz-kicker { font-size: .8rem; color: var(--muted); }
.quiz-q { font-size: 1.2rem; font-weight: 600; color: var(--navy); margin: 6px 0 14px; line-height: 1.5; }
.choice { display: block; width: 100%; text-align: left; margin-top: 10px; padding: 13px 15px; min-height: 52px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; background: #fff; font: inherit; color: inherit; cursor: pointer; line-height: 1.45; }
.choice:hover { border-color: #C5CEDB; }
.choice.sel { border-color: var(--navy); background: var(--tint); color: var(--navy); font-weight: 500; }
.choice.right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); }
.choice:disabled { cursor: default; }
.conf { margin-top: 18px; }
.conf .lbl { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.conf .opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.conf button { border: 2px solid var(--line); border-bottom-width: 4px; background: #fff; border-radius: 14px; padding: 8px 4px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.conf button .e { font-size: 1.5rem; line-height: 1.1; }
.conf .lbl small { color: var(--faint); }
.conf button.sel { border-color: var(--navy); background: var(--tint); color: var(--navy); font-weight: 600; }
.quiz-foot { position: sticky; bottom: 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.quiz-foot.ok { background: var(--ok-soft); border-top: 3px solid var(--ok); }
.quiz-foot.bad { background: var(--bad-soft); border-top: 3px solid var(--bad); }
.quiz-foot .fb-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 2px; }
.quiz-foot.ok .fb-title { color: var(--ok-ink); }
.quiz-foot.bad .fb-title { color: var(--bad-ink); }
.quiz-foot .fb-text { font-size: .9rem; margin-bottom: 10px; }
.quiz-foot.ok .fb-text { color: var(--ok-ink); }
.quiz-foot.bad .fb-text { color: var(--bad-ink); }
.review-tag { display: inline-block; font-size: .75rem; font-weight: 600; color: var(--navy); background: var(--tint); border-radius: 99px; padding: 2px 10px; }

/* ---------- result ---------- */
.result-hero { text-align: center; padding: 22px 16px; }
.score-ring { --p: 0; --c: var(--navy); width: 148px; height: 148px; border-radius: 50%; margin: 6px auto 12px; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.score-ring > div { width: 120px; height: 120px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: var(--navy); }
.xp-pop { display: inline-block; font-weight: 700; color: var(--navy); background: var(--tint); border-radius: 99px; padding: 6px 16px; animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.medal { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; font-size: 1.7rem; background: var(--navy); box-shadow: 0 0 0 5px var(--tint); }
.medal.off { background: var(--q4); box-shadow: none; filter: grayscale(1); opacity: .55; }
.badge-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; text-align: center; font-size: .8rem; }
.q-item { margin-bottom: 12px; }
.q-item .q-no { font-size: .8rem; color: var(--muted); font-weight: 600; }
.q-item .q-text { font-weight: 600; margin: 2px 0 10px; color: var(--navy); }
.q-item .choice { cursor: default; border-bottom-width: 2px; padding: 10px 12px; min-height: 0; margin-top: 6px; }
.q-item.flag { border: 2px solid var(--bad); }
.flag-note.guess { color: var(--navy); background: var(--tint); }
.flag-note { font-size: .8rem; font-weight: 700; color: var(--bad-ink); background: var(--bad-soft); border-radius: 8px; padding: 4px 10px; display: inline-block; margin-bottom: 6px; }
.explain { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--tint); color: var(--navy); font-size: .9rem; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .8; } }

/* ---------- matrix_drag exercise ---------- */
.mx-board { position: sticky; top: var(--topbar-h, 50px); z-index: 5; background: var(--card); padding: 6px 0; box-shadow: 0 6px 8px -8px rgba(0,0,0,.25); }
/* Mobile: keep the board short so it can stay pinned while the cards scroll underneath */
@media (max-width: 640px) {
  .mx-q { min-height: 62px; padding: 6px 8px; }
  .mx-q .mx-chips { display: none; }
  .mx-q .mx-action { font-size: .7rem; line-height: 1.3; }
  .mx-feedback { min-height: 0; margin-top: 6px; padding: 6px 10px; font-size: .82rem; }
}
.mx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mx-grid > .mx-q:last-child:nth-child(odd) { grid-column: 1 / -1; }
.mx-q { background: var(--bg); min-height: 92px; border-radius: 12px; padding: 8px; border: 2px dashed transparent; transition: border-color .15s; cursor: pointer; }
.mx-q.Q1 { background: var(--q1); } .mx-q.Q2 { background: var(--q2); }
.mx-q.Q3 { background: var(--q3); } .mx-q.Q4 { background: var(--q4); }
.mx-q.hover, .mx-q.target { border-color: var(--navy); }
.mx-q .mx-title { font-weight: 700; font-size: .85rem; color: var(--navy); }
.mx-q .mx-action { font-size: .75rem; color: var(--muted); }
.mx-q .mx-count { float: right; font-size: .75rem; background: #fff; border-radius: 99px; padding: 0 8px; }
.mx-q .mx-chip { display: block; font-size: .72rem; line-height: 1.3; margin-top: 4px; padding: 4px 6px; background: rgba(255,255,255,.8); border-radius: 6px; }
.mx-pool { display: grid; gap: 8px; margin-top: 12px; }
.mx-card { padding: 12px 14px; background: #fff; border-radius: 12px; border: 2px solid var(--line); border-bottom-width: 4px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.mx-card.sel { border-color: var(--navy); background: var(--tint); }
.mx-card.shake { animation: shake .4s; border-color: var(--bad); }
.mx-ghost { position: fixed; z-index: 100; pointer-events: none; opacity: .92; transform: rotate(2deg); max-width: 300px; }
.mx-feedback { min-height: 3.2em; margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; background: var(--bg); }
.mx-feedback.ok { background: var(--ok-soft); color: var(--ok-ink); }
.mx-feedback.bad { background: var(--bad-soft); color: var(--bad-ink); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.rf-list { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.rf-list p { margin: 6px 0 0; }
.rf-list.ok { background: var(--ok-soft); color: var(--ok-ink); }
.rf-list.bad { background: var(--bad-soft); color: var(--bad-ink); }

/* ---------- tables / admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs a { white-space: nowrap; padding: 8px 16px; border-radius: var(--pill); background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; }
.tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #F8F9FB; font-weight: 600; white-space: nowrap; color: var(--navy); }
tr:last-child td { border-bottom: 0; }
.matrix th.sticky, .matrix td.sticky { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 140px; box-shadow: 1px 0 0 var(--line); }
.matrix th.sticky { background: #F8F9FB; }
.cell { display: inline-block; min-width: 54px; text-align: center; padding: 3px 6px; border-radius: 6px; font-weight: 600; }
.cell.passed { background: var(--tint); color: var(--navy); }
.cell.failed { background: var(--bad-soft); color: var(--bad-ink); }
.cell.retest_due { background: #fff; color: var(--navy); border: 1.5px dashed var(--navy); }
.cell.not_started { background: var(--q4); color: var(--muted); font-weight: 400; }
/* compact skill matrix: short headers, stacked best/latest, so ~13 topics fit without sideways scrolling */
.matrix { font-size: .82rem; }
.matrix th, .matrix td { padding: 6px 3px; }
.matrix th.sticky, .matrix td.sticky { padding-left: 8px; min-width: 100px; max-width: 140px; }
.matrix .tc { text-align: center; white-space: nowrap; }
.matrix th.tc { font-size: .72rem; font-weight: 600; cursor: help; white-space: normal; max-width: 50px; line-height: 1.2; vertical-align: bottom; word-break: normal; overflow-wrap: normal; }
.matrix .cell { min-width: 34px; padding: 2px 3px; line-height: 1.15; }
.container.wide { max-width: 1200px; }
.matrix .cell b { display: block; font-size: .9rem; }
.matrix .cell small { display: block; font-size: .7rem; font-weight: 500; opacity: .8; }
.legend-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.legend-chip.passed { background: var(--tint); color: var(--navy); }
.legend-chip.failed { background: var(--bad-soft); color: var(--bad-ink); }
.legend-chip.retest_due { background: #fff; color: var(--navy); border: 1.5px dashed var(--navy); }
.legend-chip.not_started { background: var(--q4); color: var(--muted); }
.col-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; margin-top: 8px; }
.col-key b { display: inline-block; min-width: 72px; color: var(--navy); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: .8rem; margin: 8px 0; }
details.q-edit { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
details.q-edit + details.q-edit { margin-top: 8px; }
details.q-edit summary { cursor: pointer; font-weight: 500; }
.stars { display: flex; gap: 6px; }
.stars label { flex: 1; }
.stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.stars span { display: block; text-align: center; padding: 10px 0; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; }
.stars input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%) translateY(20px); background: var(--navy-3); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
