/* Attested at Home - India paper and blue cloth: index-card word slips, then a two-column dictionary page with guide
 * words, small-caps headwords and a gilt thumb index cut into the page edge. */
:root {
  --bg: #e9edf1; --panel: #fbfbf9; --ink: #1c1f25; --muted: #5a6170; --line: #d3d8df; --soft: #f1f3f6;
  --accent: #1f3a5f; --accent-ink: #ffffff; --link: #1f4f8a; --heading: #172b47;
  --paper: #fffdf7; --rule: #d9d2c0; --cite: #3d4350; --gilt: #7f6119; --tab: #1f2a3a; --tab-ink: #e9cf86; --tab-off: #e4e1d8; --tab-off-ink: #9a948a;
  --slip: #fffef9; --slip-rule: #e3e8ee; --slip-top: #c0563f;
  --st-att-bg: #dcefdc; --st-att-ink: #1f5a2a; --st-des-bg: #dde6f3; --st-des-ink: #1f3a5f; --st-rec-bg: #ece1f0; --st-rec-ink: #5b2d6e;
  --v-thin-bg: #f6e7c4; --v-thin-ink: #6b4805; --v-uncited-bg: #f7dfd6; --v-uncited-ink: #84301a; --v-ready-bg: #d9eeda; --v-ready-ink: #1d5527;
  --warn-bg: #fbe5df; --warn-ink: #8a2416; --info-bg: #e6edf5; --info-ink: #2b4560; --note-bg: #f6efd9;
  --chip-on: #dbe5f2; --shadow: 0 1px 2px rgba(28,31,37,.06), 0 8px 20px rgba(28,31,37,.07);
}
:root[data-theme="dark"] {
  --bg: #0e1319; --panel: #151c25; --ink: #e7ebf1; --muted: #a8b2c1; --line: #2c3746; --soft: #1b2430;
  --accent: #a9c3e6; --accent-ink: #0d1726; --link: #a9c8f0; --heading: #cfdcf0;
  --paper: #1b222c; --rule: #3a4554; --cite: #c6ceda; --gilt: #d8b964; --tab: #d8b964; --tab-ink: #1a1408; --tab-off: #27303c; --tab-off-ink: #7d8899;
  --slip: #1d2530; --slip-rule: #283240; --slip-top: #d9785f;
  --st-att-bg: #1d3a22; --st-att-ink: #b9e6bf; --st-des-bg: #1d2d45; --st-des-ink: #c3d6f2; --st-rec-bg: #33223b; --st-rec-ink: #e5c7f0;
  --v-thin-bg: #43330c; --v-thin-ink: #ffe0a0; --v-uncited-bg: #4a2015; --v-uncited-ink: #ffcbbb; --v-ready-bg: #1d3a20; --v-ready-ink: #c2edc4;
  --warn-bg: #4b1e16; --warn-ink: #ffcabd; --info-bg: #1b2a3a; --info-ink: #c9dcec; --note-bg: #2f2a1c;
  --chip-on: #233a5a; --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif; overflow-x: hidden; }
a { color: var(--link); }
.hidden { display: none !important; }
.small { font-size: .88rem; } .muted { color: var(--muted); } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.serif, h1, h2, h3, h4, .brand strong { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; }
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.back { text-decoration: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: .45rem; flex: 1; min-width: 0; }
.brand strong { font-size: 1.1rem; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 28px; height: 28px; flex: none; }
.lg-book { fill: var(--accent); }
.lg-spine { fill: var(--tab); opacity: .85; }
.lg-tab { fill: var(--gilt); }
.lg-a { fill: var(--gilt); font: italic 700 13px Georgia, serif; }
:root[data-theme="dark"] .lg-spine { fill: #2a3546; opacity: 1; }
:root[data-theme="dark"] .lg-a { fill: #1a2433; }
.session { display: flex; gap: .4rem; align-items: center; flex-wrap: nowrap; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: .38rem .9rem; font: inherit; font-size: .88rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.pill:hover:not(:disabled) { border-color: var(--accent); }
.pill.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pill.solid:hover:not(:disabled) { filter: brightness(1.08); color: var(--accent-ink); }
.pill.ghost { background: transparent; cursor: default; }
.pill.big { font-size: 1rem; padding: .6rem 1.3rem; }
.pill.tiny { font-size: .8rem; padding: .22rem .7rem; }
.pill:disabled { opacity: .5; cursor: not-allowed; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.hero { padding: 1.3rem 0 .5rem; }
.kicker { margin: 0 0 .9rem; padding: .55rem .85rem; border-left: 4px solid var(--gilt); background: var(--panel); border-radius: 0 10px 10px 0; font-size: .9rem; color: var(--muted); }
h1, h2, h3, h4 { color: var(--heading); overflow-wrap: anywhere; }
h1 { margin: 0 0 .5rem; font-size: clamp(2.1rem, 6.5vw, 3.3rem); line-height: 1.05; font-variant: small-caps; letter-spacing: .02em; }
.h1b { display: block; font-size: .42em; font-variant: normal; letter-spacing: 0; color: var(--ink); margin-top: .5rem; line-height: 1.3; font-style: italic; }
.lede { max-width: 46rem; margin: 0 0 .9rem; }
.samples { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip { border: 1px dashed var(--muted); background: var(--panel); color: var(--ink); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .86rem; cursor: pointer; }
.chip.on { border-style: solid; border-color: var(--accent); background: var(--chip-on); font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow); }
.ph { display: flex; align-items: center; gap: .55rem; margin: 0 0 .6rem; font-size: 1.3rem; line-height: 1.2; }
.step-no { display: inline-flex; width: 1.7rem; height: 1.7rem; border-radius: 50%; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); font-size: .95rem; font-family: "Avenir Next", system-ui, sans-serif; flex: none; }
.lbl { display: block; font-size: .85rem; font-weight: 600; margin: 0 0 .25rem; color: var(--muted); }
.fieldrow { margin-bottom: .7rem; max-width: 26rem; }
textarea, input[type="text"] { width: 100%; font: inherit; font-size: .95rem; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; }
textarea { resize: vertical; min-height: 9rem; line-height: 1.55; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; }
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.drag { outline: 2px dashed var(--accent); }
.note { background: var(--note-bg); border-radius: 8px; padding: .45rem .65rem; }
.cardrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .6rem 0 0; }
.tallyline { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-style: italic; margin: .5rem 0; }
.none { color: var(--muted); font-style: italic; }
/* --- The word slips --- */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-top: .6rem; }
.slips-empty { grid-column: 1 / -1; }
.slip { position: relative; background-color: var(--slip); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 1.45rem, var(--slip-rule) 1.45rem, var(--slip-rule) calc(1.45rem + 1px)); background-position: 0 2.3rem;
  border: 1px solid var(--line); border-top: 3px solid var(--slip-top); border-radius: 2px 2px 4px 4px; padding: .5rem .75rem 1.5rem; box-shadow: 0 1px 0 var(--line), 0 4px 10px rgba(28,31,37,.06); min-width: 0; }
.slip:nth-child(3n+2) { transform: rotate(.4deg); } .slip:nth-child(3n) { transform: rotate(-.35deg); }
.slip-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .3rem .5rem; margin-bottom: .35rem; }
.slip-hw { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; font-variant: small-caps; font-size: 1.12rem; letter-spacing: .02em; overflow-wrap: break-word; min-width: 0; }
.slip-stamp { display: inline-block; flex: none; font: 700 .64rem/1 "Avenir Next", system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; padding: .28rem .42rem; border-radius: 3px; border: 1.5px solid currentColor; transform: rotate(-3deg); }
.st-attested { background: var(--st-att-bg); color: var(--st-att-ink); }
.st-described { background: var(--st-des-bg); color: var(--st-des-ink); }
.st-reconstructed { background: var(--st-rec-bg); color: var(--st-rec-ink); }
.slip-q { margin: .1rem 0 0; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-style: italic; overflow-wrap: anywhere; }
.slip-src { margin: 0 0 .2rem; font-size: .82rem; color: var(--muted); text-align: right; }
.slip-m { margin: .2rem 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.slip-no { position: absolute; right: .55rem; bottom: .3rem; font: .7rem ui-monospace, Menlo, monospace; color: var(--muted); }
.slip-edit { position: absolute; left: .45rem; bottom: .15rem; background: none; border: 0; padding: .15rem .3rem; font: inherit; font-size: .78rem; color: var(--link); text-decoration: underline; cursor: pointer; }
.slip-edit:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
/* --- The verdict --- */
.verdict-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .7rem; }
.verdict-row p { margin: 0; flex: 1; min-width: 14rem; }
.badge { display: inline-block; padding: .25rem .7rem; border-radius: 6px; font-weight: 700; font-size: .85rem; background: var(--soft); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.badge.v-thin, .pstamp.v-thin { background: var(--v-thin-bg); color: var(--v-thin-ink); }
.badge.v-uncited, .pstamp.v-uncited { background: var(--v-uncited-bg); color: var(--v-uncited-ink); }
.badge.v-ready, .pstamp.v-ready { background: var(--v-ready-bg); color: var(--v-ready-ink); }
/* --- The dictionary page --- */
.page-host { padding: .9rem 0 .2rem; }
.dpage { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 3px 12px 12px 3px; padding: 1rem 0 .7rem 1.4rem; box-shadow: -6px 0 0 -3px var(--rule), var(--shadow);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; color: var(--ink); }
.runhead { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; border-bottom: 1.5px solid var(--ink); padding: 0 3.4rem .3rem 0; font-variant: small-caps; font-weight: 700; letter-spacing: .04em; }
.runhead .guide { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runhead .guide.right { text-align: right; }
.runhead .rtitle { flex: 2; text-align: center; font-weight: 400; font-style: italic; font-variant: normal; font-size: .85rem; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.pbody { display: flex; align-items: stretch; }
.cols { flex: 1; min-width: 0; column-count: 2; column-gap: 1.7rem; column-rule: 1px solid var(--rule); padding: .7rem 1.1rem .4rem 0; min-height: 27rem; }
.lhead { margin: .1rem 0 .3rem; font-size: 1.7rem; line-height: 1; color: var(--gilt); break-after: avoid; }
.entry { margin: 0 0 .6rem; padding-left: 1.1em; text-indent: -1.1em; break-inside: avoid; font-size: .96rem; line-height: 1.45; overflow-wrap: anywhere; }
.hw { font-weight: 700; font-variant: small-caps; font-size: 1.08em; letter-spacing: .02em; color: var(--heading); }
.star { font-weight: 700; color: var(--st-rec-ink); margin-right: .05em; }
.say { color: var(--muted); }
.pos { color: var(--link); }
.sn { font-family: "Avenir Next", system-ui, sans-serif; font-size: .78em; }
.unk, .nocite { font-style: italic; color: var(--muted); }
.ety { color: var(--muted); }
.cite { display: block; text-indent: 0; margin: .2rem 0 0; padding-left: .6rem; border-left: 2px solid var(--gilt); font-size: .87em; color: var(--cite); font-style: italic; }
.cit-l { font-style: normal; font-variant: small-caps; font-weight: 700; color: var(--muted); }
.cit-src { font-style: normal; color: var(--muted); }
.thumbs { flex: none; width: 2.7rem; display: flex; flex-direction: column; gap: 3px; padding-top: .55rem; }
.thumb { display: block; height: 2.05rem; border-radius: 1.1rem 0 0 1.1rem; background: var(--tab-off); color: var(--tab-off-ink); font: 700 .66rem/2.05rem "Avenir Next", system-ui, sans-serif; letter-spacing: .05em; text-align: center; text-decoration: none; }
.thumb.on { background: var(--tab); color: var(--tab-ink); }
a.thumb.on:hover { filter: brightness(1.15); }
.pfoot { display: flex; justify-content: space-between; border-top: 1px solid var(--rule); margin-top: .3rem; padding: .35rem 3.4rem 0 0; font-size: .8rem; color: var(--muted); font-style: italic; }
.folio { font-style: normal; font-weight: 700; }
.pstamp { position: absolute; top: -.75rem; right: 3.6rem; padding: .25rem .6rem; border: 2px solid currentColor; border-radius: 4px; font: 700 .72rem/1.1 "Avenir Next", system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; transform: rotate(-4deg); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.dpage.proof .runhead { border-bottom-style: dashed; }
/* --- Ask, progress, result --- */
.runrow { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; }
.runrow #price { flex: 1; min-width: 12rem; }
.gate { background: var(--note-bg); border-radius: 8px; padding: .5rem .7rem; margin: .7rem 0 0; }
.gate a { margin-left: .3rem; }
.steps { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .25rem; }
.step { color: var(--muted); font-size: .92rem; }
.step.active { color: var(--ink); font-weight: 600; } .step.done { color: var(--st-att-ink); }
.step-ic { display: inline-block; width: 1.1rem; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--soft); border-radius: 8px; padding: .7rem; font-size: .82rem; max-height: 24rem; overflow: auto; }
.res-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.res-head h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; font-variant: small-caps; }
.preface { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-style: italic; font-size: 1.05rem; border-left: 3px solid var(--gilt); padding-left: .8rem; margin: .8rem 0; }
.reason { margin: .4rem 0; font-weight: 600; }
.result h3 { margin: 1.2rem 0 .5rem; font-size: 1.12rem; }
.habits { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.habit { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; background: var(--soft); }
.habit b { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 1.02rem; }
.habit p { margin: .25rem 0 0; font-size: .92rem; }
.habit-ex { display: flex; flex-wrap: wrap; gap: .3rem; }
.hw-chip { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-variant: small-caps; font-weight: 700; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .45rem; font-size: .9rem; }
.questions { margin: 0; padding-left: 1.4rem; }
.questions li { margin: .25rem 0; }
.recon { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.recon li { padding: .4rem .6rem; border-radius: 8px; font-size: .9rem; background: var(--soft); }
.recon li.warn { background: var(--warn-bg); color: var(--warn-ink); }
.recon li.info { background: var(--info-bg); color: var(--info-ink); }
.exports { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .9rem; }
/* --- Saved, marks, about --- */
.saved { list-style: none; padding: 0; margin: .7rem 0 0; display: grid; gap: .5rem; }
.hrow { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; }
.hinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hinfo b { overflow-wrap: anywhere; }
.hbtns { display: flex; gap: .35rem; flex-wrap: wrap; }
.mini { width: 26px; height: 30px; flex: none; }
.mb-cover { fill: var(--accent); } .mb-line { stroke: var(--gilt); stroke-width: 1.4; fill: none; }
.mb-spine { fill: var(--muted); }
.mini.v-thin .mb-spine { fill: #c9962f; } .mini.v-uncited .mb-spine { fill: #c0563f; } .mini.v-ready .mb-spine { fill: #3f8a4f; }
.marks { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mark-card { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; background: var(--soft); }
.mark-card p { margin: .5rem 0 0; }
.foot { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 2.5rem; color: var(--muted); font-size: .88rem; }
.toasts { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 30; display: grid; gap: .4rem; width: min(92vw, 30rem); }
.toast { background: var(--ink); color: var(--panel); border-radius: 10px; padding: .55rem .8rem; font-size: .9rem; box-shadow: var(--shadow); transition: opacity .5s; }
.toast.err { background: var(--warn-ink); color: #fff; }
:root[data-theme="dark"] .toast.err { background: var(--warn-bg); color: var(--warn-ink); }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }
/* --- Phones --- */
@media (max-width: 640px) {
  .bar { padding: .5rem .7rem; gap: .4rem; }
  .back-t { display: none; }
  .brand strong { font-size: .98rem; }
  .pill { padding: .34rem .7rem; }
  main { padding: .6rem .75rem 1.5rem; }
  .panel { padding: .85rem .8rem 1rem; border-radius: 12px; }
  .dpage { padding-left: .8rem; }
  .cols { column-count: 1; min-height: 0; padding-right: .7rem; }
  .thumbs { width: 2.15rem; }
  .thumb { font-size: .58rem; height: 1.8rem; line-height: 1.8rem; }
  .runhead { padding-right: 2.6rem; font-size: .85rem; }
  .runhead .rtitle { display: none; }
  .pfoot { padding-right: 2.6rem; }
  .pstamp { right: 2.6rem; font-size: .64rem; }
  .slips { grid-template-columns: 1fr; }
}
@media (max-width: 380px) { .session #theme { padding: .3rem .55rem; } }
/* --- Print: the page, the habits and the questions only --- */
@media print {
  body { background: #fff; color: #000; }
  .bar, .hero, .notebox, .askbox, .progress, #how, #rawResult, .histbox, .marksbox, .aboutbox, .foot, .toasts, .verdict-row, #sourceNote, .exports, .slip-edit, #rRecon, #rMeta, .result h3:nth-of-type(3) { display: none !important; }
  .panel { border: none; box-shadow: none; padding: 0; }
  .dpage { box-shadow: none; border-color: #999; }
  .slip, .entry { break-inside: avoid; }
}
