/* Study Quest — story.css (V7.2.4 "The full study release", lane C, builder v724-stats-story: scope A4 + R1/R2/R3)
 * The growing books' page edges (js/books.js edges), the Nauka's Professions and Writing tabs (js/ui-professions.js),
 * statistics and the story layer (js/ui-story.js: the hunt chip, the bounty board, the siege board), First steps
 * (js/first-steps.js). Flat and readable: no texture behind text; the books keep their own palettes. */

/* ======================================================================================== the growing books */
.bk-edges { position: absolute; z-index: 0; pointer-events: none; overflow: visible; }
.bk-ribbons { position: absolute; z-index: 4; pointer-events: none; overflow: visible; }
.nk-layer.is-small .nk-foot span:not(.nk-kc) { display: none; }   /* a small window: the keys alone (7 tabs) */
.nk-layer.is-small .nk-foot > div:first-child { gap: 3px; }
.nk-spread.has-bk-edges { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45); }
.nk-layer.is-small .nk-spread.has-bk-edges { box-shadow: none; }
.book-layer.lp-book .book-block.has-bk-edges { box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5); }
.az-block.has-bk-edges { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45); }
.nk-sub { max-width: 340px; }
.book-layer.lp-book.is-single .bk-pc { display: none; }   /* a small window: the head holds the chapter keys */

/* ======================================================================================== the Nauka: 7 tabs fit */
.nk-tabs { gap: 3px; }
.nk-tab { padding: 0 10px 0 11px; gap: 7px; font-size: 13.5px; }
@media (max-width: 1360px) { .nk-title { margin-right: 14px; } .nk-tab { padding: 0 8px 0 9px; gap: 6px; } .nk-tab .lbl { max-width: 104px; overflow: hidden; text-overflow: ellipsis; } }

/* ======================================================================================== the Professions tab */
.pf-page { --tm-read: var(--nk-read); --tm-ui: var(--nk-ui); padding: 0; background: none; box-shadow: none; border-radius: 0; }
.pf-ribbons { display: flex; gap: 6px; margin: -6px 0 14px; }
.pf-ribbon { position: relative; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 12px; border: 0; cursor: pointer;
  font: 600 13.5px/1 var(--nk-ui); color: #f4ecdb; border-radius: 0 0 4px 4px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%); padding-bottom: 4px; opacity: 0.78; transition: opacity 0.15s ease, height 0.15s ease; }
.pf-ribbon b { font: 700 12px/1 var(--nk-ui); padding: 2px 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.22); }
.pf-ribbon:hover, .pf-ribbon.is-on { opacity: 1; }
.pf-ribbon.is-on { height: 40px; }
.pf-ribbon:focus-visible { outline: 2px solid var(--nk-lapis); outline-offset: 2px; }
.pf-ribbon--tomeforging { background: #8a3a12; } .pf-ribbon--zapis { background: #2f5a9a; } .pf-ribbon--konspekt { background: #2f7a68; }
.pf-page .tome-emblem-wrap { background: #fbf6ea; }
.pf-master { margin-top: 8px; }
.pf-tool { margin: 6px 0 4px; }
.pf-shelf { min-height: 150px; }
.pf-shelf--boxes { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 2px; }
.pf-item { position: relative; width: 104px; height: 72px; border-radius: 3px; padding: 8px; display: flex; align-items: flex-end;
  font: 600 12px/1.25 var(--nk-ui); color: #f8f0dc; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.3); overflow: hidden; }
.pf-item span { position: relative; z-index: 1; }
.pf-item--deck::before { content: ''; position: absolute; right: 8px; top: 8px; width: 22px; height: 28px; border-radius: 2px; background: rgba(255, 255, 255, 0.82); box-shadow: -3px 3px 0 rgba(255, 255, 255, 0.45); }
.pf-item--notebook::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 3px; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0 3px, transparent 3px 7px); }
.pf-item.tome-spine--unbound { color: #3b2f22; }
.pf-other { margin-top: 6px; }
.pf-masters { list-style: none; margin: 0; padding: 0; }
.pf-masters li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dotted var(--nk-rule); font: 500 14px/1.35 var(--nk-ui); }
.pf-masters li.is-here { font-weight: 700; }
.pf-wbtns { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.pf-essays { list-style: none; margin: 0; padding: 0; }
.pf-essays li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 8px; border-bottom: 1px dotted var(--nk-rule); cursor: pointer; border-radius: 3px; }
.pf-essays li .t { flex: 1 1 auto; min-width: 0; font: 600 15px/1.3 var(--nk-read); color: var(--nk-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-essays li .nk-meta { flex: none; white-space: nowrap; }
.pf-essays li:hover { background: rgba(47, 90, 154, 0.07); }
.pf-essays li.is-sel { background: var(--nk-sel); box-shadow: inset 3px 0 0 var(--nk-lapis); }
.pf-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 10px; }
.pf-chip { min-width: 34px; height: 30px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--nk-rule); background: #fffaf0; cursor: pointer; font: 600 13px/1 var(--nk-ui); color: var(--nk-ink-2); }
.pf-chip:hover { border-color: #b9a681; }
.pf-chip.is-on { background: var(--nk-lapis); color: #f4ecdb; border-color: #24487e; }
.pf-linkline { font: 500 14px/1.5 var(--nk-ui); color: var(--nk-ink-2); }
.pf-etitle { margin-bottom: 2px; }
.pf-reclink { color: #7a1d10; border-bottom: 1px dotted currentColor; cursor: pointer; }
/* the master's window */
.prof-dlg .pf-learnlist { list-style: none; margin: 8px 0 10px; padding: 0; }
.prof-dlg .pf-learnlist li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--tm-rule, #d2c19f); }
.prof-dlg .pf-lname { display: flex; flex-direction: column; gap: 2px; font: 600 16px/1.3 var(--tm-read, Georgia, serif); }
.prof-dlg .pf-lname small { font: 400 13px/1.35 var(--tm-ui, sans-serif); color: var(--tm-meta, #625240); }
.prof-dlg .pf-lstate { font: 600 13px/1 var(--tm-ui, sans-serif); color: #3e5d4f; }
.prof-dlg .pf-dlg-who { font: 400 15px/1.5 var(--tm-read, Georgia, serif); }

/* ======================================================================================== statistics */
.sy-switch { display: inline-flex; margin: 2px 0 10px; border: 1px solid var(--nk-rule); border-radius: 5px; overflow: hidden; }
.sy-switch button { height: 28px; padding: 0 14px; border: 0; background: #fffaf0; cursor: pointer; font: 600 13px/1 var(--nk-ui); color: var(--nk-ink-2); }
.sy-switch button + button { border-left: 1px solid var(--nk-rule); }
.sy-switch button.is-on { background: var(--nk-lapis); color: #f4ecdb; }
.sy-figs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 4px; }
.sy-figs div { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--nk-rule); border-radius: 4px; background: #fbf6ea; }
.sy-figs b { font: 700 20px/1 var(--nk-read); color: var(--nk-ink); }
.sy-figs span { font: 500 12px/1.2 var(--nk-ui); color: var(--nk-meta); }
.sy-legend { display: flex; gap: 12px; align-items: center; font: 500 12px/1 var(--nk-ui); color: var(--nk-meta); margin: 0 0 6px; }
.sy-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: -6px; }
.sy-legend i.k { background: #2f6a58; } .sy-legend i.l { background: #b06a12; } .sy-legend i.f { background: #e2d5b8; box-shadow: inset 0 0 0 1px #c9b48c; }
.sy-mastery { list-style: none; margin: 0; padding: 0; }
.sy-mastery li { display: grid; grid-template-columns: minmax(0, 1fr) 46% 44px; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 3px; font: 500 13.5px/1.25 var(--nk-ui); color: var(--nk-ink-2); }
.sy-mastery li[data-act] { cursor: pointer; }
.sy-mastery li[data-act]:hover { background: rgba(47, 90, 154, 0.07); }
.sy-mastery li.is-sel { background: var(--nk-sel); color: var(--nk-ink); font-weight: 700; }
.sy-mn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sy-mb { position: relative; display: flex; height: 9px; border-radius: 5px; background: #e2d5b8; box-shadow: inset 0 0 0 1px #c9b48c; overflow: hidden; }
.sy-mb i { display: block; height: 100%; }
.sy-mb i.k { background: #2f6a58; } .sy-mb i.l { background: #b06a12; }
.sy-mp { text-align: right; color: var(--nk-ink); white-space: nowrap; }
.sy-mastery li { break-inside: avoid; }
.sy-heat, .sy-fc { display: block; width: 100%; max-width: 440px; height: auto; margin: 4px 0 2px; }
.sy-ax { font: 600 8.5px var(--nk-ui, sans-serif); fill: #6b5a44; }
.sy-axl { stroke: #b9a681; stroke-width: 1; }
.sy-bar { fill: #4f907a; } .sy-bar--today { fill: #b06a12; }
.sy-heat rect:hover, .sy-fc rect:hover { stroke: #211a12; stroke-width: 1; }
.sy-recall { margin: 6px 0 0; }
.sy-rrow { display: grid; grid-template-columns: 112px minmax(0, 1fr) 50px; gap: 10px; align-items: center; margin: 3px 0; font: 500 13.5px/1.2 var(--nk-ui); color: var(--nk-ink-2); }
.sy-rb { height: 10px; border-radius: 5px; background: #e9dfc8; box-shadow: inset 0 0 0 1px #d2c19f; overflow: hidden; }
.sy-rb i { display: block; height: 100%; border-radius: 5px; }
.sy-rrow.is-true .sy-rb i { background: #2f6a58; } .sy-rrow.is-target .sy-rb i { background: #2f5a9a; } .sy-rrow.is-exp .sy-rb i { background: #8aa3c9; }
.sy-rrow b { text-align: right; color: var(--nk-ink); }
.sy-note { font: 500 13px/1.45 var(--nk-ui); color: var(--nk-meta); margin: 6px 0 0; }
.sy-rt { width: 100%; border-collapse: collapse; font: 500 13.5px/1.3 var(--nk-ui); color: var(--nk-ink-2); }
.sy-rt th { font: 700 11px/1.2 var(--nk-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--nk-meta); text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--nk-rule); }
.sy-rt td { padding: 4px; border-bottom: 1px dotted var(--nk-rule); }
.sy-rt .r { text-align: right; }
.sy-rt small { color: var(--nk-meta); }
.sy-rk { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; font: 700 11px/1 var(--nk-ui); color: #fff; margin-right: 4px; }
.sy-rk1 { background: #9a2f08; } .sy-rk2 { background: #b06a12; } .sy-rk3 { background: #2f7a68; } .sy-rk4 { background: #2f5a9a; }
.sy-leeches { list-style: none; margin: 0; padding: 0; }
.sy-leeches li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 6px 0; border-bottom: 1px dotted var(--nk-rule); }
.sy-elite { font: 700 13.5px/1.3 var(--nk-ui); color: #7a1d10; border-bottom: 1px dotted currentColor; cursor: help; justify-self: start; }
.sy-lt { grid-column: 1 / 2; font: 400 14px/1.35 var(--nk-read); color: var(--nk-ink); }
.sy-leeches .nk-meta { grid-column: 1 / 2; }
.sy-lact { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.sy-scope { margin-bottom: 4px; }
/* in the Letopis (its own ink) */
.sy-lp .sy-heat, .sy-lp .sy-fc { max-width: 100%; }
.sy-lp .sy-ax { fill: #4f3f2c; }
.sy-lp .sy-mastery li, .sy-lp .sy-rrow, .sy-lp .sy-rt, .sy-lp .sy-note { font-family: 'Avenir Next', 'Alegreya Sans', 'Helvetica Neue', sans-serif; color: #4a3520; }
.sy-lp .sy-mastery li { grid-template-columns: minmax(0, 1fr) 38% 54px; padding: 3px 0; font-size: 14px; }
.sy-lp .sy-rrow { grid-template-columns: 136px minmax(0, 1fr) 54px; }
.sy-lp .sy-rrow span:first-child { white-space: nowrap; }
.pf-empty { display: flex; align-items: center; justify-content: center; padding: 18px 26px; min-height: 120px; }
.pf-empty p { margin: 0; text-align: center; color: #e9dcc0; font: 500 13.5px/1.5 var(--nk-ui); }
.sy-lp .sy-lt { font-family: 'Iowan Old Style', Charter, Georgia, serif; color: #22170d; }
.sy-lp .nk-btn { display: none; }   /* rewriting happens in the Nauka and at the bounty board */
.sy-lp .nk-meta { font: 500 12.5px/1.3 'Avenir Next', sans-serif; color: #4f3f2c; }

/* ======================================================================================== the siege board */
.sy-siege { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--nk-rule); }
.sy-towers { display: flex; align-items: flex-end; gap: 6px; min-height: 96px; padding: 6px 2px 0; overflow-x: auto; }
.sy-tower { position: relative; flex: none; width: 26px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: default; }
.sy-tower i { display: block; width: 18px; border-radius: 2px 2px 0 0; background: #8aa3c9;
  -webkit-mask: linear-gradient(#000, #000) bottom / 100% calc(100% - 4px) no-repeat, linear-gradient(90deg, #000 0 4px, transparent 4px 7px, #000 7px 11px, transparent 11px 14px, #000 14px) top / 100% 4px no-repeat;
  mask: linear-gradient(#000, #000) bottom / 100% calc(100% - 4px) no-repeat, linear-gradient(90deg, #000 0 4px, transparent 4px 7px, #000 7px 11px, transparent 11px 14px, #000 14px) top / 100% 4px no-repeat; }
.sy-tower--holds i { background: #2f6a58; } .sy-tower--shaky i { background: #b06a12; } .sy-tower--breached i { background: #8a7a5c; }
.sy-tower span { font: 600 11px/1 var(--nk-ui); color: var(--nk-meta); }

/* ======================================================================================== the hunt chip (HUD) */
.sy-hunt { position: absolute; left: 50%; top: 36px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 8px; height: 24px; padding: 0 12px;
  border-radius: 12px; border: 1px solid rgba(217, 176, 95, 0.45); background: rgba(14, 11, 8, 0.72); color: #e8dcc0; cursor: pointer; white-space: nowrap;
  font: 600 12.5px/1 'Avenir Next', 'Alegreya Sans', 'Helvetica Neue', sans-serif; letter-spacing: 0.02em; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); pointer-events: auto; }
.sy-hunt.hidden { display: none; }
.sy-hunt:hover { border-color: rgba(244, 213, 140, 0.8); color: #fff3d6; }
.sy-hunt .sy-h { color: #f4d58c; }
.sy-hunt .sy-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(232, 220, 192, 0.5); }
.sy-hunt--safe .sy-s { color: #b5dcc6; } .sy-hunt--watchful .sy-s { color: #f0d08c; } .sy-hunt--uneasy .sy-s { color: #e8b98c; } .sy-hunt--settling .sy-s { color: #cfc4ad; }
.sy-hunt .sy-e { color: #e8c39a; }
.sy-hunt.is-done .sy-h::after { content: ' ✓'; color: #b5dcc6; }
body.sq-compact .sy-hunt { display: none; }
/* (V7.4 v74-finish, LATE-REQUESTS R5) in the HUD's top-centre column (ui-story.js puts it under the zone's name): it stacks, never on top */
.hud-top > .sy-hunt { position: relative; left: auto; top: auto; transform: none; flex: none; }

/* ======================================================================================== the inn and the bounty board */
.sy-inn { margin-top: 6px; }
.sy-board .sy-blead { font: 400 15px/1.5 var(--tm-read, Georgia, serif); color: var(--tm-ink-2, #4e4031); }
.sy-bounty { list-style: none; margin: 0 0 8px; padding: 0; }
.sy-bounty li { padding: 8px 0; border-bottom: 1px dotted var(--tm-rule, #d2c19f); }
.sy-bt { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.sy-bq { font: 400 15px/1.4 var(--tm-read, Georgia, serif); color: var(--tm-ink, #211a12); margin: 4px 0 6px; }
.sy-ba { display: flex; gap: 8px; flex-wrap: wrap; }
.sy-comfort { display: flex; gap: 8px; align-items: flex-start; font: 500 13.5px/1.45 var(--tm-ui, sans-serif); color: var(--tm-ink-2, #4e4031); cursor: pointer; }
.sy-comfort input { margin-top: 3px; }

/* ======================================================================================== First steps (the Azbuka) */
.fs-lead { margin-bottom: 6px; }
.fs-list { list-style: none; margin: 0 0 8px; padding: 0; counter-reset: fs; }
.fs-list li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; border-bottom: 1px dotted rgba(29, 24, 19, 0.25); break-inside: avoid; }
.fs-box { flex: none; width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid #1d1813; border-radius: 3px; display: grid; place-items: center; font: 700 13px/1 sans-serif; color: #f7f1e3; }
.fs-list li.is-done .fs-box { background: #36553f; border-color: #36553f; }
.fs-t { display: flex; flex-direction: column; gap: 2px; }
.fs-t b { font-weight: 600; }
.fs-list li.is-done .fs-t b { color: #4b5a4f; }
.fs-t small { font-size: 0.86em; opacity: 0.8; }
.fs-note { font-size: 0.92em; }

/* V7.8 fixer (play critic #6): "Face all N today" is Borna's own choice, so it looks unlike Practise all: ember leather, light ink */
.pr-b.pr-warden-all { background: #6a3420; border-color: #46200f; color: #f4ecdb; font-weight: 700; }
.pr-b.pr-warden-all:hover:not([disabled]) { border-color: #c8a050; }
