/* Abhidhamma Visual Learning System — thearthistory.org
   Swiss modernist: grid, type, white space, flat solid color. No gradients, no shadows, no pastels.
   Color semantics (consistent across this piece):
     purple  = interaction / selection / javana
     lime    = bhavanga / completed / foundation
     orange  = tadalambana / test / TODO flags
     blue    = sense-cognition phase of citta-vithi ONLY
     ink     = structure, text, lines                                                     */

:root {
  --purple: #753BFF;
  --lime: #C5F500;
  --orange: #FF8A00;
  --blue: #1F5EFF;
  --ink: #111111;
  --paper: #FFFFFF;
  --grey: #6B6B6B;
  --rule: #DADADA;
  --soft: #F3F3F3;
  --font: "Inter", "Noto Sans Thai", "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gap: 24px;
  --r: 4px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
.pali { font-style: italic; color: var(--grey); }
.muted { color: var(--grey); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- site bar + section nav ---------- */
.sitebar { border-bottom: 1px solid var(--ink); }
.sitebar .in, .secnav .in, main, .foot .in { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.sitebar .in { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -0.02em; }
.sitebar nav { display: flex; gap: 20px; font-size: 14px; }
.sitebar nav a { text-decoration: none; color: var(--grey); }
.sitebar nav a.on { color: var(--ink); font-weight: 600; }
.secnav { border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--paper); z-index: 20; }
.secnav .in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.secnav .in::-webkit-scrollbar { display: none; }
.secnav a {
  flex: none; text-decoration: none; padding: 12px 12px; font-size: 14px; font-weight: 500;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.secnav a:hover { border-bottom-color: var(--rule); }
.secnav a.on { border-bottom-color: var(--purple); color: var(--purple); font-weight: 700; }

main { padding-top: 40px; padding-bottom: 80px; min-height: 60vh; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--ink); padding: 24px 0 40px; font-size: 13px; }
.foot .in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.foot a { text-decoration: underline; }

/* ---------- type scale ---------- */
.display { font-size: clamp(40px, 7vw, 84px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
.h3 { font-size: 20px; font-weight: 700; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.lead { font-size: clamp(18px, 2vw, 22px); color: var(--grey); font-weight: 500; }

/* ---------- grid + panels ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.panel { border: 1px solid var(--ink); border-radius: var(--r); padding: 24px; background: var(--paper); min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.panel-head h2 { font-size: 22px; font-weight: 800; padding-left: 14px; border-left: 6px solid var(--purple); }
.panel-head .sub { font-size: 14px; color: var(--grey); margin-top: 4px; padding-left: 20px; }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 5fr 7fr; gap: 40px; align-items: end; margin-bottom: 40px; }
.hero .lead { margin-top: 12px; }
.hero p.desc { margin-top: 16px; max-width: 560px; }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.fcard {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 190px;
  padding: 20px; border-radius: var(--r); text-decoration: none; border: 1px solid var(--ink);
}
.fcard .t { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; display: flex; justify-content: space-between; align-items: center; }
.fcard .d { font-size: 15px; font-weight: 500; }
.fcard .ix { font-size: 13px; font-weight: 700; }
.fcard:hover .t span:last-child { transform: translateX(4px); }
.fcard .t span:last-child { transition: transform .15s; }
.bg-purple { background: var(--purple); color: #fff; border-color: var(--purple); }
.bg-lime { background: var(--lime); color: var(--ink); }
.bg-orange { background: var(--orange); color: var(--ink); }
.bg-ink { background: var(--ink); color: #fff; }

/* ---------- buttons, chips, tabs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--paper);
  padding: 8px 14px; border-radius: var(--r); cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn.primary:hover { background: #5f22f0; }
.btn.ghost { border-color: var(--rule); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--paper); padding: 7px 14px; cursor: pointer; font-size: 14px; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button.on { background: var(--purple); color: #fff; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { border: 1px solid var(--rule); background: var(--paper); padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 500; }
.tab.on { background: var(--purple); color: #fff; border-color: var(--purple); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--ink); line-height: 1.6; white-space: nowrap; }
.chip.akusala { background: var(--orange); border-color: var(--orange); }
.chip.kusala { border-color: var(--purple); color: var(--purple); }
.chip.vipaka { border-color: var(--ink); }
.chip.kiriya { background: var(--ink); color: #fff; }
.chip.no { border-color: var(--rule); color: #A8A8A8; text-decoration: line-through; }
.chip.yes { background: var(--lime); border-color: var(--lime); }
.tag-prov { font-family: ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 2px; letter-spacing: .02em; }
.tag-prov.CANON { background: var(--ink); color: #fff; }
.tag-prov.COMMENTARY { background: var(--lime); }
.tag-prov.ABHIDHAMMATTHASANGAHA { background: var(--lime); }
.tag-prov.EDUCATIONAL { border: 1px dashed var(--purple); color: var(--purple); }
.tag-prov.SYSTEM { background: var(--orange); }
.todo { display: inline-block; background: var(--orange); font-family: ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 2px; }
.note { border-left: 4px solid var(--orange); padding: 10px 14px; background: var(--soft); font-size: 14px; }
input[type=search], select {
  font: inherit; font-size: 15px; border: 1px solid var(--ink); border-radius: var(--r); padding: 8px 12px; background: var(--paper); min-width: 0;
}
input[type=search] { width: 100%; }
select { cursor: pointer; }

/* ---------- citta-vithi ---------- */
.vithi-ctrl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.vithi-ctrl .sp { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.vithi-wrap { overflow-x: auto; padding: 14px 8px 12px; scroll-snap-type: x proximity; }
.vithi-track { display: flex; align-items: flex-start; gap: 0; min-width: max-content; }
.vnode { display: flex; flex-direction: column; align-items: center; width: 84px; scroll-snap-align: center; cursor: pointer; background: none; border: 0; padding: 0; text-align: center; }
.vnode .c {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px;
  border: 2px solid var(--ink); background: var(--paper); transition: transform .15s;
}
.vnode .lbl { margin-top: 10px; font-weight: 700; font-size: 13px; line-height: 1.3; }
.vnode .sub { font-size: 12px; color: var(--grey); line-height: 1.35; margin-top: 2px; }
.ph-bhavanga .c { border-color: var(--ink); background: var(--lime); }
.ph-sense .c { border-color: var(--blue); color: var(--blue); }
.ph-sense.lit .c { background: var(--blue); color: #fff; }
.ph-javana .c { border-color: var(--purple); color: var(--purple); }
.ph-javana.lit .c { background: var(--purple); color: #fff; }
.ph-tadalambana .c { border-color: var(--orange); }
.ph-tadalambana.lit .c { background: var(--orange); }
.vnode.cur .c { transform: scale(1.18); outline: 3px solid var(--ink); outline-offset: 3px; }
.vnode.sel .lbl { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.varrow { align-self: flex-start; margin-top: 18px; color: var(--grey); font-size: 15px; width: 12px; text-align: center; flex: none; }
.vgroup { display: flex; flex-direction: column; align-items: center; padding: 6px 8px 0; border: 1.5px dashed var(--purple); border-radius: var(--r); cursor: pointer; background: none; }
.vgroup.tad { border-color: var(--orange); }
.vgroup .dots { display: flex; gap: 4px; height: 56px; align-items: center; }
.vgroup .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--purple); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--purple); background: var(--paper); }
.vgroup.tad .dot { border-color: var(--orange); color: var(--ink); width: 34px; height: 34px; }
.vgroup .dot.lit { background: var(--purple); color: #fff; }
.vgroup.tad .dot.lit { background: var(--orange); color: var(--ink); }
.vgroup .dot.cur { outline: 3px solid var(--ink); outline-offset: 2px; }
.vgroup .lbl { margin-top: 10px; font-weight: 700; font-size: 14px; }
.vgroup .sub { font-size: 12px; color: var(--grey); padding-bottom: 6px; }
.vlegend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; }
.vlegend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid var(--ink); }
.vlegend .l-bh::before { background: var(--lime); }
.vlegend .l-se::before { border-color: var(--blue); background: var(--blue); }
.vlegend .l-ja::before { border-color: var(--purple); background: var(--purple); }
.vlegend .l-ta::before { border-color: var(--orange); background: var(--orange); }
.vinfo { margin-top: 16px; border-top: 1px solid var(--ink); padding-top: 16px; display: grid; grid-template-columns: 1.1fr 2fr; gap: 24px; }
.vinfo dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.vinfo dt { font-weight: 700; }
.vinfo dd { margin: 0; }

/* ---------- memory map ---------- */
.mm-root { display: flex; flex-direction: column; align-items: center; }
.mm-top { width: 104px; height: 104px; border-radius: 50%; background: var(--purple); color: #fff; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 30px; line-height: 1; }
.mm-top small { display: block; font-size: 15px; font-weight: 600; margin-top: 4px; }
.mm-stem { width: 2px; height: 20px; background: var(--ink); }
.mm-branches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; border-top: 2px solid var(--ink); padding-top: 20px; position: relative; }
.mm-b { border: 1px solid var(--ink); border-radius: var(--r); padding: 12px; background: var(--paper); cursor: pointer; text-align: left; position: relative; }
.mm-b::before { content: ""; position: absolute; top: -21px; left: 50%; width: 2px; height: 20px; background: var(--ink); }
.mm-b .n { font-size: 28px; font-weight: 800; line-height: 1; }
.mm-b .t { font-weight: 700; font-size: 14px; margin-top: 4px; }
.mm-b.on { background: var(--purple); color: #fff; border-color: var(--purple); }
.mm-detail { margin-top: 16px; }
.mm-group { border-top: 1px solid var(--ink); padding: 12px 0; }
.mm-group > button { background: none; border: 0; padding: 0; cursor: pointer; display: flex; justify-content: space-between; width: 100%; font-weight: 700; text-align: left; }
.mm-subs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mm-sub { border: 1px solid var(--rule); border-radius: var(--r); padding: 6px 10px; font-size: 13px; cursor: pointer; background: var(--paper); text-align: left; }
.mm-sub b { font-size: 16px; }
.mm-sub.on { border-color: var(--purple); outline: 2px solid var(--purple); }
.mm-items { margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.mm-item { font-size: 13px; border-left: 3px solid var(--ink); padding: 4px 8px; cursor: pointer; background: none; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; }
.mm-item:hover { background: var(--soft); }
.mm-formula { font-weight: 700; font-size: 15px; margin-top: 12px; font-variant-numeric: tabular-nums; }

/* ---------- matrix ---------- */
.mx { display: grid; grid-template-columns: 96px repeat(4, 1fr); border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.mx > div.small { font-size: 11px; white-space: nowrap; padding: 6px 2px; }
.mx > div { border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 8px; text-align: center; font-size: 13px; display: flex; align-items: center; justify-content: center; min-height: 40px; }
.mx .h { font-weight: 700; }
.mx .h.span2 { grid-column: span 2; }
.mx .rh { font-weight: 700; flex-direction: column; }
.mx .cell button {
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); font-size: 18px; font-weight: 800; cursor: pointer;
}
.mx .cell button.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.mx .cell button.right { background: var(--lime); }
.mx .cell button.wrong { background: var(--orange); }
.mx-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.mx-toggles .lab { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.mx-toggles .seg { display: flex; }
.mx-toggles .seg button { flex: 1; padding: 7px 6px; font-size: 13px; white-space: nowrap; }
.mx-out { border-top: 1px solid var(--ink); padding-top: 14px; }
.mx-out .num { font-size: 40px; font-weight: 800; line-height: 1; color: var(--purple); }

/* ---------- cards / lists ---------- */
.side-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--rule); padding: 12px 0; text-decoration: none; }
.side-list a:last-child { border-bottom: 1px solid var(--rule); }
.side-list .t { font-weight: 700; font-size: 15px; }
.side-list .d { font-size: 13px; color: var(--grey); }
.prog-bar { height: 10px; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.prog-bar > i { display: block; height: 100%; background: var(--lime); border-right: 1px solid var(--ink); }
.prog-bar > i[style*="width: 0"] { border-right: 0; }
.mods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.mod-pip { border: 1px solid var(--ink); border-radius: var(--r); padding: 6px; font-size: 11px; text-align: center; text-decoration: none; }
.mod-pip b { display: block; font-size: 16px; }
.mod-pip .ls { display: flex; gap: 2px; justify-content: center; margin-top: 4px; }
.mod-pip .ls i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink); }
.ls i.done { background: var(--lime); } .ls i.prog { background: var(--purple); border-color: var(--purple); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; font-size: 12px; }
.stats3 b { display: block; font-size: 22px; }

.ccards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ccard { border: 1px solid var(--ink); border-radius: var(--r); padding: 14px; background: var(--paper); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.ccard:hover { border-color: var(--purple); }
.ccard .no { font-size: 12px; font-weight: 700; color: var(--grey); }
.ccard .t { font-weight: 700; }
.ccard .meta { display: flex; flex-wrap: wrap; gap: 4px; }

.flash { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.fc { border: 1px solid var(--ink); border-radius: var(--r); min-height: 110px; padding: 14px; cursor: pointer; background: var(--paper); text-align: left; display: flex; flex-direction: column; justify-content: space-between; }
.fc .f { font-weight: 800; font-size: 18px; }
.fc .b { font-size: 14px; color: var(--grey); }
.fc.open { background: var(--lime); }
.fc.open .b { color: var(--ink); }
.fc .hint { font-size: 11px; color: var(--grey); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--rule); padding: 8px 10px; text-align: left; vertical-align: top; }
.tbl th { border-bottom: 2px solid var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tbl-wrap { overflow-x: auto; }

/* ---------- composer ---------- */
.cp-sum { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; font-size: 14px; }
.cp-sum b { font-size: 26px; display: block; line-height: 1.1; }
.cp-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cp-g { border: 1px solid var(--ink); border-radius: var(--r); padding: 14px; }
.cp-g h4 { font-size: 15px; display: flex; justify-content: space-between; margin-bottom: 10px; }
.cp-g.g-universal h4 { border-left: 6px solid var(--ink); padding-left: 8px; }
.cp-g.g-pakinnaka h4 { border-left: 6px solid var(--lime); padding-left: 8px; }
.cp-g.g-akusala h4 { border-left: 6px solid var(--orange); padding-left: 8px; }
.cp-g.g-sobhana h4 { border-left: 6px solid var(--purple); padding-left: 8px; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cs { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--ink); }
.cs.fixed { background: var(--ink); color: #fff; }
.cs.may { border-style: dashed; border-width: 2px; border-color: var(--purple); color: var(--purple); font-weight: 600; }
.cs.none { border-color: var(--rule); color: #A0A0A0; text-decoration: line-through; }
.cp-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }

/* ---------- lessons ---------- */
.modlist { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.modcard { border: 1px solid var(--ink); border-radius: var(--r); padding: 20px; }
.modcard .mno { font-size: 48px; font-weight: 800; line-height: 1; }
.modcard h3 { margin: 8px 0 2px; font-size: 18px; }
.lrow { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--rule); padding: 10px 0; text-decoration: none; }
.lrow .ln { font-weight: 800; font-variant-numeric: tabular-nums; width: 28px; }
.lrow .lt { flex: 1; font-weight: 500; }
.st { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); flex: none; }
.st.done { background: var(--lime); } .st.prog { background: var(--purple); border-color: var(--purple); }
.lesson-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; border-bottom: 1px solid var(--ink); padding-bottom: 20px; margin-bottom: 24px; }
.stepper { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 32px; }
.stepper button { border: 0; border-top: 4px solid var(--rule); background: none; text-align: left; padding: 8px 0 0; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--grey); }
.stepper button.seen { border-top-color: var(--ink); color: var(--ink); }
.stepper button.on { border-top-color: var(--purple); color: var(--purple); }
.stepper button span { display: block; font-size: 11px; }
.step-body { min-height: 300px; }
.hook { font-size: clamp(24px, 3.4vw, 40px); font-weight: 800; line-height: 1.25; max-width: 900px; letter-spacing: -0.02em; }
.explain-list { max-width: 760px; font-size: 18px; }
.explain-list p { padding-left: 18px; border-left: 3px solid var(--ink); margin-bottom: 16px; }
.remember-box { background: var(--lime); border-radius: var(--r); padding: 32px; }
.remember-box .pat { font-size: clamp(22px, 3vw, 36px); font-weight: 800; letter-spacing: -0.01em; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; border-top: 1px solid var(--ink); padding-top: 16px; flex-wrap: wrap; }
.prov-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--grey); margin-top: 16px; }

/* ---------- quiz ---------- */
.quiz { max-width: 820px; }
.qhead { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.qq { font-size: 22px; font-weight: 700; margin-bottom: 16px; line-height: 1.35; }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; border: 1px solid var(--ink); border-radius: var(--r); padding: 12px 16px; background: var(--paper); cursor: pointer; font-size: 16px; }
.opt:hover:not([disabled]) { background: var(--soft); }
.opt.picked { border-color: var(--purple); outline: 2px solid var(--purple); }
.opt.right { background: var(--lime); }
.opt.wrong { background: var(--orange); }
.fb { margin-top: 14px; padding: 12px 16px; border-left: 4px solid var(--ink); background: var(--soft); font-size: 15px; }
.fb.ok { border-left-color: var(--lime); }
.fb.no { border-left-color: var(--orange); }
.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; border-top: 1px solid var(--rule); padding: 8px 0; }
.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.order-list li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--ink); border-radius: var(--r); padding: 8px 10px; background: var(--paper); cursor: grab; }
.order-list li.drag { opacity: .4; }
.order-list li.over { border-color: var(--purple); outline: 2px solid var(--purple); }
.order-list li .ix { font-weight: 800; width: 22px; }
.order-list li .tx { flex: 1; }
.order-list li .mv { border: 1px solid var(--rule); background: var(--paper); border-radius: var(--r); width: 32px; height: 32px; cursor: pointer; }
.order-list li.right { background: var(--lime); } .order-list li.wrong { background: var(--orange); }
.seq-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.seq-line .blank { min-width: 90px; border-bottom: 3px solid var(--purple); text-align: center; padding: 2px 8px; color: var(--purple); }
.qnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.score-big { font-size: 72px; font-weight: 800; line-height: 1; }
.review-item { border-top: 1px solid var(--rule); padding: 10px 0; font-size: 14px; }

/* ---------- simulator ---------- */
.sim-flow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 16px 0; }
.sim-step { border: 1px solid var(--ink); border-radius: var(--r); padding: 12px; min-height: 140px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; background: var(--paper); }
.sim-step .k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sim-step .v { font-weight: 600; font-size: 14px; flex: 1; }
.sim-step.on { border-color: var(--purple); outline: 2px solid var(--purple); }
.sim-step.ja { background: var(--purple); color: #fff; border-color: var(--purple); }
.sim-choice { display: grid; gap: 8px; }

/* ---------- misc ---------- */
.empty { padding: 40px; text-align: center; border: 1px dashed var(--ink); border-radius: var(--r); }
.hub { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.hub a { border: 1px solid var(--ink); border-radius: var(--r); padding: 20px; text-decoration: none; display: flex; flex-direction: column; gap: 6px; min-height: 140px; }
.hub a:hover { border-color: var(--purple); }
.hub a .t { font-weight: 800; font-size: 20px; }
.hub a .d { color: var(--grey); font-size: 14px; }
.hub a .k { font-size: 12px; font-weight: 700; color: var(--purple); }
.modal-bg { position: fixed; inset: 0; background: rgba(17,17,17,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--paper); border: 1px solid var(--ink); border-radius: var(--r); max-width: 720px; width: 100%; max-height: 88vh; overflow: auto; padding: 24px; }
.modal dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.modal dt { font-weight: 700; } .modal dd { margin: 0; }
.bhumi-g { border-top: 1px solid var(--ink); padding: 10px 0; }
.bhumi-g button { background: none; border: 0; padding: 0; width: 100%; display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; cursor: pointer; text-align: left; }
.bhumi-g .items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.par-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.par { border: 1px solid var(--ink); border-radius: var(--r); padding: 20px; aspect-ratio: 1; display: flex; flex-direction: column; justify-content: space-between; }
.par .n { font-size: 48px; font-weight: 800; line-height: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .span-8, .span-7, .span-6, .span-5 { grid-column: span 12; }
  .span-4, .span-3 { grid-column: span 6; }
  .modlist, .hub { grid-template-columns: repeat(2, 1fr); }
  .sim-flow { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .sitebar .in, .secnav .in, main, .foot .in { padding: 0 16px; }
  .sitebar nav { display: none; }
  main { padding-top: 24px; }
  .grid { gap: 16px; }
  .span-4, .span-3 { grid-column: span 12; }
  .panel { padding: 16px; }
  .cards3 { grid-template-columns: 1fr; }
  .fcard { min-height: 0; flex-direction: row; align-items: center; gap: 12px; }
  .fcard .ix { display: none; }
  .fcard .t { font-size: 22px; flex: none; }
  .fcard .d { flex: 1; text-align: right; }
  .modlist, .hub, .cp-groups, .par-grid { grid-template-columns: 1fr; }
  .par-grid { grid-template-columns: repeat(2, 1fr); }
  .mm-branches { grid-template-columns: repeat(2, 1fr); border-top: 0; padding-top: 0; }
  .mm-b::before { display: none; }
  .mm-stem { height: 12px; }
  .vinfo { grid-template-columns: 1fr; }
  .vithi-ctrl .sp { margin-left: 0; }
  .mx { grid-template-columns: 64px repeat(4, 1fr); }
  .mx .cell button { width: 38px; height: 38px; font-size: 15px; }
  .mx > div { padding: 4px; font-size: 11px; }
  .mx-toggles { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(3, 1fr); row-gap: 8px; }
  .sim-flow { grid-template-columns: 1fr; }
  .sim-step { min-height: 0; }
  .match-row { grid-template-columns: 1fr; gap: 4px; }
  .qq { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .secnav, .sitebar nav, .vithi-ctrl, .step-nav { display: none; } }
.stepper { scroll-margin-top: 64px; }

/* ---------- v2: Vault integration ---------- */
.vnode.opt .c, .vgroup.opt { border-style: dashed; }
.cs.unresolved { border-style: dotted; border-color: var(--grey); color: var(--grey); }
.cs.conflict { background: var(--orange); border-color: var(--orange); }
.cs.ref-fixed { box-shadow: none; text-decoration: underline; text-decoration-color: var(--purple); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cs.ref-may { text-decoration: underline dotted var(--purple); text-underline-offset: 3px; }
.vrow { display: grid; grid-template-columns: 70px 1fr; gap: 12px; border-top: 1px solid var(--rule); padding: 10px 0; font-size: 14px; }
.vrow .st-pass { background: var(--lime); } .vrow .st-fail { background: var(--orange); } .vrow .st-warn { border: 2px dashed var(--orange); }
.vrow .badge { font-family: ui-monospace, Menlo, monospace; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 2px; text-align: center; align-self: start; }
.fs-vault { color: var(--ink); }
.fs-todo { color: var(--grey); }
.je-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.je-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.je-grid input[type=range] { width: 100%; accent-color: var(--purple); }
.vrow > div { min-width: 0; overflow-wrap: anywhere; } .modal, .sim-step, .prov-line { overflow-wrap: anywhere; }
