/* Study Quest — wear.css · V7.4 "Towns and home", lane K (builder v74-books, K1): THE FIVE STAGES OF BOOK WEAR
 * (Notes/30 Design/BOOK-WEAR.md; js/engine-wear.js counts the wear, js/ui-wear.js sets body[data-wear-<book>="0..4"]).
 * Written by work/v9/v74/v74-books/tools/make-wear-css.py (the textures are SVG made there; edit the script, not this file).
 *   0 Fresh · 1 Thumbed (softened corners, a faint crease on the cover, the fore-edges greyed by thumbs, the ribbon frayed)
 *   2 Worn (a scuffed cover, faded tooling, a dog-ear, a ring stain, grubby edges, the spine creased; a note on the book)
 *   3 Battered (a cracked spine, loose pages peeking out, stains and wrinkles, the ink fading to ~6:1 (>= 4.5 on a stain); a warning)
 *   4 Falling apart (crumpled loose pages, ink blots in the margins, the ink faded and blotched at its floor ~4:1 (>= 3:1 on the
 *     darkest stain), a torn corner, the binding sagging, the cloth worn through at the corners; a strong warning, also on the button)
 * The page edges, the ribbons, the loose pages and the sag are js/books.js edges().
 * THE GUARDS: every word stays legible. The ink only changes colour (never opacity), to floors measured on the darkest stain:
 * @stain-max: 0.11 = the most the layers under the text darken the paper (the crumple's shadows <= 0.055, a ring line <= 0.04,
 * a blotch <= 0.015; edge grime and ink blots only in the outer 30 px, where no text runs); tests/wear.test.js W13 measures every
 * ink. Stains, wrinkles and creases are BACKGROUND layers of the pages (--bw-pl / --bw-pr in books.css): always under the text.
 * Nothing here reaches the practice window (#st-layer), the writer, the Opsada (.nk-layer[data-tab="exams"]) or anything you
 * type into: they keep the book's full ink. Nothing is hidden or locked.
 */

/* ---------------------------------------------------------------------------------------------- the textures and tones (book roots) */
.nk-layer, .book-layer.lp-book, .az-layer {
  --bw-crumple: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='340'%3E%3Cfilter id='a' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.011' numOctaves='4' seed='9' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='3' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='38'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 0.32 0 0 0 0 0.21 0 0 0 0 0.08 -1 0 0 0 0.6'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.045 0.045 0.045 0.045'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.011' numOctaves='4' seed='9' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='3' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='38'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.99 0 0 0 0 0.95 1 0 0 0 -0.68'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.05 0.05 0.05 0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='340' height='340' filter='url(%23a)'/%3E%3Crect width='340' height='340' filter='url(%23b)'/%3E%3C/svg%3E");
  --bw-crumple2: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='a' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.009 0.016' numOctaves='4' seed='4' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='4.5' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='38'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 0.32 0 0 0 0 0.21 0 0 0 0 0.08 -1 0 0 0 0.6'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.055 0.055 0.055 0.055'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.009 0.016' numOctaves='4' seed='4' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='4.5' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='38'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.99 0 0 0 0 0.95 1 0 0 0 -0.68'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.06 0.06 0.06 0.06'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23a)'/%3E%3Crect width='300' height='300' filter='url(%23b)'/%3E%3C/svg%3E");
  --bw-scuff: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='s' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8 0.05' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.96 0 0 0 0 0.88 0 0 0 0.8 -0.4'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23s)'/%3E%3C/svg%3E");
  --bw-scuff2: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='s' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.45 0.035' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.95 0 0 0 0 0.86 0 0 0 1.3 -0.6'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23s)'/%3E%3C/svg%3E");
  --bw-crack: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 600' preserveAspectRatio='none'%3E%3Cpath d='M20 0L18.6 40L21.3 92L19 150L21.8 214L18.8 268L20.9 330L18.4 391L21.6 452L19.2 520L20.6 600' fill='none' stroke='rgba(255,246,226,0.6)' stroke-width='1.8'/%3E%3Cpath d='M20.6 0L19.2 40L21.9 92L19.6 150L22.4 214L19.4 268L21.5 330L19 391L22.2 452L19.8 520L21.2 600' fill='none' stroke='rgba(48,30,12,0.7)' stroke-width='1.3'/%3E%3Cpath d='M19.6 150l-5 4M21.5 330l6 3M19.2 520l-5 -2' stroke='rgba(60,40,18,0.5)' stroke-width='0.8'/%3E%3C/svg%3E");
  --bw-crack2: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 600' preserveAspectRatio='none'%3E%3Cpath d='M20 0L17.4 36L22.8 88L17.8 146L23.4 210L17.2 266L22.2 330L17 392L23 450L18 522L21 600' fill='none' stroke='rgba(255,246,226,0.55)' stroke-width='3.4'/%3E%3Cpath d='M20.8 0L18.2 36L23.6 88L18.6 146L24.2 210L18 266L23 330L17.8 392L23.8 450L18.8 522L21.8 600' fill='none' stroke='rgba(36,20,6,0.8)' stroke-width='2.4'/%3E%3Cpath d='M18.6 146l-7 5M23 330l8 4M18.8 522l-7 -3M23.8 450l6 -4M17.2 266l-6 2' stroke='rgba(60,40,18,0.55)' stroke-width='0.9'/%3E%3Cpath d='M14 60q6 3 12 0M13 240q7 4 14 0M14 420q6 3 12 0' fill='none' stroke='rgba(230,215,180,0.7)' stroke-width='0.7'/%3E%3C/svg%3E");
  --bw-st: 125, 82, 32; --bw-grime: 95, 72, 40; --bw-blot: 52, 34, 16; --bw-dog: #d6c8a8; --bw-flap: #efe4cb; --bw-wornc: 225, 215, 190; --bw-board: 118, 90, 58; }
.book-layer.lp-book { --bw-st: 120, 75, 25; --bw-grime: 95, 70, 35; --bw-dog: #ccb98e; --bw-flap: #e9dab7; --bw-wornc: 230, 190, 160; --bw-board: 150, 110, 75; }
.az-layer { --bw-dog: #dbd0b5; --bw-flap: #f2eada; --bw-wornc: 225, 225, 200; --bw-board: 135, 110, 72; }

/* ---------------------------------------------------------------------------------------------- stage 1: Thumbed */
body[data-wear-nauka="1"] .nk-layer, body[data-wear-letopis="1"] .book-layer.lp-book, body[data-wear-azbuka="1"] .az-layer {
  --bw-cover: linear-gradient(118deg, rgba(0, 0, 0, 0) 0 61%, rgba(255, 255, 255, 0.048) 61% 61.18%, rgba(0, 0, 0, 0.12) 61.18% 61.45%, rgba(0, 0, 0, 0) 61.45%);
  --bw-pl: linear-gradient(90deg, rgba(var(--bw-grime), 0.05), rgba(var(--bw-grime), 0) 30px);
  --bw-pr: linear-gradient(270deg, rgba(var(--bw-grime), 0.05), rgba(var(--bw-grime), 0) 30px); }
body[data-wear-nauka="1"] .nk-layer .nk { border-radius: 9px 9px 11px 11px; }
body[data-wear-letopis="1"] .book-layer.lp-book .book-cover.codex-frame { border-radius: 13px; }
body[data-wear-azbuka="1"] .az-layer .az { border-radius: 9px 11px 11px 9px; }

/* ---------------------------------------------------------------------------------------------- stage 2: Worn */
body[data-wear-nauka="2"] .nk-layer, body[data-wear-letopis="2"] .book-layer.lp-book, body[data-wear-azbuka="2"] .az-layer {
  --bw-cover: var(--bw-scuff) 0 0 / 180px 180px,
    linear-gradient(118deg, rgba(0, 0, 0, 0) 0 61%, rgba(255, 255, 255, 0.064) 61% 61.18%, rgba(0, 0, 0, 0.16) 61.18% 61.45%, rgba(0, 0, 0, 0) 61.45%),
    radial-gradient(ellipse 130px 80px at 0 100%, rgba(var(--bw-wornc), 0.16), rgba(var(--bw-wornc), 0) 70%),
    radial-gradient(ellipse 120px 70px at 100% 0, rgba(var(--bw-wornc), 0.13), rgba(var(--bw-wornc), 0) 70%);
  --bw-pl: linear-gradient(90deg, rgba(var(--bw-grime), 0.07), rgba(var(--bw-grime), 0) 30px),
    linear-gradient(0deg, rgba(var(--bw-grime), 0.04), rgba(var(--bw-grime), 0) 22px);
  --bw-pr: linear-gradient(225deg, var(--bw-dog) 0 14px, rgba(60, 40, 15, 0.32) 14px 15px, var(--bw-flap) 15px 25px, rgba(60, 40, 15, 0.14) 25px 26px, rgba(0, 0, 0, 0) 26px) right top / 33px 33px no-repeat,
    radial-gradient(circle at 74% 70%, rgba(0, 0, 0, 0) 0 42px, rgba(var(--bw-st), 0.04) 43.5px, rgba(var(--bw-st), 0.018) 47px, rgba(0, 0, 0, 0) 49px),
    linear-gradient(270deg, rgba(var(--bw-grime), 0.07), rgba(var(--bw-grime), 0) 30px),
    linear-gradient(0deg, rgba(var(--bw-grime), 0.04), rgba(var(--bw-grime), 0) 22px);
  --bw-gut: linear-gradient(90deg, rgba(0, 0, 0, 0) 46%, rgba(255, 250, 235, 0.3) 48.5%, rgba(60, 40, 15, 0.22) 51%, rgba(0, 0, 0, 0) 54%); }
body[data-wear-nauka="2"] .nk-layer .nk { border-radius: 11px 11px 13px 13px; }
body[data-wear-letopis="2"] .book-layer.lp-book .book-cover.codex-frame { border-radius: 15px; }
body[data-wear-azbuka="2"] .az-layer .az { border-radius: 11px 13px 13px 11px; }
body[data-wear-nauka="2"] .nk-layer .nk-corner, body[data-wear-nauka="2"] .nk-layer .nk-seal, body[data-wear-nauka="2"] .nk-layer .nk-hb, body[data-wear-letopis="2"] .book-layer.lp-book .lp-fl, body[data-wear-letopis="2"] .book-layer.lp-book .lp-rule, body[data-wear-letopis="2"] .book-layer.lp-book .lp-hb, body[data-wear-azbuka="2"] .az-layer .az-hb, body[data-wear-azbuka="2"] .az-layer .az-thumb { filter: saturate(0.68) brightness(0.86); }

/* ---------------------------------------------------------------------------------------------- stage 3: Battered */
body[data-wear-nauka="3"] .nk-layer, body[data-wear-letopis="3"] .book-layer.lp-book, body[data-wear-azbuka="3"] .az-layer {
  --bw-cover: var(--bw-scuff2) 0 0 / 220px 220px,
    var(--bw-scuff) 40px 20px / 180px 180px,
    linear-gradient(118deg, rgba(0, 0, 0, 0) 0 61%, rgba(255, 255, 255, 0.08) 61% 61.18%, rgba(0, 0, 0, 0.2) 61.18% 61.45%, rgba(0, 0, 0, 0) 61.45%),
    linear-gradient(62deg, rgba(0, 0, 0, 0) 0 23%, rgba(255, 255, 255, 0.064) 23% 23.18%, rgba(0, 0, 0, 0.16) 23.18% 23.45%, rgba(0, 0, 0, 0) 23.45%),
    radial-gradient(ellipse 160px 100px at 0 100%, rgba(var(--bw-wornc), 0.22), rgba(var(--bw-wornc), 0) 70%),
    radial-gradient(ellipse 150px 90px at 100% 0, rgba(var(--bw-wornc), 0.19), rgba(var(--bw-wornc), 0) 70%),
    radial-gradient(ellipse 40px 30px at 0 100%, rgba(var(--bw-board), 0.35), rgba(var(--bw-board), 0) 75%);
  --bw-pl: var(--bw-crumple) 0 0 / 340px 340px,
    radial-gradient(ellipse 140px 95px at 24% 78%, rgba(var(--bw-st), 0.015), rgba(var(--bw-st), 0) 72%),
    linear-gradient(45deg, var(--bw-dog) 0 12px, rgba(60, 40, 15, 0.32) 12px 13px, var(--bw-flap) 13px 22px, rgba(60, 40, 15, 0.14) 22px 23px, rgba(0, 0, 0, 0) 23px) left bottom / 30px 30px no-repeat,
    linear-gradient(90deg, rgba(var(--bw-grime), 0.09), rgba(var(--bw-grime), 0) 30px),
    linear-gradient(180deg, rgba(var(--bw-grime), 0.05), rgba(var(--bw-grime), 0) 26px),
    linear-gradient(0deg, rgba(var(--bw-grime), 0.05), rgba(var(--bw-grime), 0) 22px);
  --bw-pr: var(--bw-crumple) 160px 60px / 340px 340px,
    linear-gradient(225deg, var(--bw-dog) 0 17px, rgba(60, 40, 15, 0.32) 17px 18px, var(--bw-flap) 18px 31px, rgba(60, 40, 15, 0.14) 31px 32px, rgba(0, 0, 0, 0) 32px) right top / 39px 39px no-repeat,
    radial-gradient(circle at 74% 70%, rgba(0, 0, 0, 0) 0 42px, rgba(var(--bw-st), 0.04) 43.5px, rgba(var(--bw-st), 0.018) 47px, rgba(0, 0, 0, 0) 49px),
    radial-gradient(circle at 30% 106%, rgba(0, 0, 0, 0) 0 70px, rgba(var(--bw-st), 0.035) 71.5px, rgba(var(--bw-st), 0.016) 75px, rgba(0, 0, 0, 0) 77px),
    radial-gradient(ellipse 120px 80px at 30% 22%, rgba(var(--bw-st), 0.015), rgba(var(--bw-st), 0) 72%),
    linear-gradient(270deg, rgba(var(--bw-grime), 0.09), rgba(var(--bw-grime), 0) 30px),
    linear-gradient(180deg, rgba(var(--bw-grime), 0.05), rgba(var(--bw-grime), 0) 26px),
    linear-gradient(0deg, rgba(var(--bw-grime), 0.05), rgba(var(--bw-grime), 0) 22px);
  --bw-gut: var(--bw-crack) center / 40px 100% no-repeat; }
body[data-wear-nauka="3"] .nk-layer .nk { border-radius: 13px 14px 16px 15px; }
body[data-wear-letopis="3"] .book-layer.lp-book .book-cover.codex-frame { border-radius: 17px 18px 20px 18px; }
body[data-wear-azbuka="3"] .az-layer .az { border-radius: 13px 15px 16px 13px; }
body[data-wear-nauka="3"] .nk-layer .nk-corner, body[data-wear-nauka="3"] .nk-layer .nk-seal, body[data-wear-nauka="3"] .nk-layer .nk-hb, body[data-wear-letopis="3"] .book-layer.lp-book .lp-fl, body[data-wear-letopis="3"] .book-layer.lp-book .lp-rule, body[data-wear-letopis="3"] .book-layer.lp-book .lp-hb, body[data-wear-azbuka="3"] .az-layer .az-hb, body[data-wear-azbuka="3"] .az-layer .az-thumb { filter: saturate(0.5) brightness(0.76); }
body[data-wear-nauka="3"] .nk-layer:not([data-tab="exams"]) .nk-page { --nk-ink: #645646; --nk-ink-2: #6a5843; --nk-meta: #6c573f; }   /* the ink: 6.0 / 5.8:1 on the paper, >= 4.5 on the darkest stain */
body[data-wear-letopis="3"] .book-layer.lp-book .book-flow { --lp-ink: #614f3b; --lp-ink-2: #685037; --lp-meta: #665139; --lp-rubric: #8c3c2c; }   /* the ink: 6.0 / 5.8:1 on the paper, >= 4.5 on the darkest stain */
body[data-wear-azbuka="3"] .az-layer .az-pg, body[data-wear-azbuka="3"] .az-layer .az-flow { --az-ink: #66594b; --az-ink-2: #6b5b48; --az-meta: #6d5a47; --az-red: #a9351e; }   /* the ink: 6.0 / 5.8:1 on the paper, >= 4.5 on the darkest stain */

/* ---------------------------------------------------------------------------------------------- stage 4: Falling apart */
body[data-wear-nauka="4"] .nk-layer, body[data-wear-letopis="4"] .book-layer.lp-book, body[data-wear-azbuka="4"] .az-layer {
  --bw-cover: var(--bw-scuff2) 0 0 / 220px 220px,
    var(--bw-scuff2) 90px 60px / 220px 220px,
    var(--bw-scuff) 40px 20px / 180px 180px,
    linear-gradient(118deg, rgba(0, 0, 0, 0) 0 61%, rgba(255, 255, 255, 0.104) 61% 61.18%, rgba(0, 0, 0, 0.26) 61.18% 61.45%, rgba(0, 0, 0, 0) 61.45%),
    linear-gradient(62deg, rgba(0, 0, 0, 0) 0 23%, rgba(255, 255, 255, 0.08) 23% 23.18%, rgba(0, 0, 0, 0.2) 23.18% 23.45%, rgba(0, 0, 0, 0) 23.45%),
    linear-gradient(150deg, rgba(0, 0, 0, 0) 0 82%, rgba(255, 255, 255, 0.064) 82% 82.18%, rgba(0, 0, 0, 0.16) 82.18% 82.45%, rgba(0, 0, 0, 0) 82.45%),
    radial-gradient(ellipse 80px 56px at 0 100%, rgba(var(--bw-board), 0.6), rgba(var(--bw-board), 0) 75%),
    radial-gradient(ellipse 64px 44px at 100% 0, rgba(var(--bw-board), 0.5), rgba(var(--bw-board), 0) 75%),
    radial-gradient(ellipse 180px 110px at 0 100%, rgba(var(--bw-wornc), 0.24), rgba(var(--bw-wornc), 0) 70%),
    radial-gradient(ellipse 170px 100px at 100% 0, rgba(var(--bw-wornc), 0.22), rgba(var(--bw-wornc), 0) 70%);
  --bw-pl: var(--bw-crumple2) 0 0 / 300px 300px,
    radial-gradient(ellipse 150px 100px at 24% 78%, rgba(var(--bw-st), 0.015), rgba(var(--bw-st), 0) 72%),
    radial-gradient(circle at 30% 24%, rgba(0, 0, 0, 0) 0 32px, rgba(var(--bw-st), 0.04) 33.5px, rgba(var(--bw-st), 0.018) 37px, rgba(0, 0, 0, 0) 39px),
    linear-gradient(45deg, var(--bw-dog) 0 15px, rgba(60, 40, 15, 0.32) 15px 16px, var(--bw-flap) 16px 27px, rgba(60, 40, 15, 0.14) 27px 28px, rgba(0, 0, 0, 0) 28px) left bottom / 35px 35px no-repeat,
    linear-gradient(135deg, var(--bw-dog) 0 10px, rgba(60, 40, 15, 0.32) 10px 11px, var(--bw-flap) 11px 18px, rgba(60, 40, 15, 0.14) 18px 19px, rgba(0, 0, 0, 0) 19px) left top / 26px 26px no-repeat,
    radial-gradient(circle at 13px 61%, rgba(var(--bw-blot), 0.6) 0 3.2px, rgba(var(--bw-blot), 0.22) 4.4px, rgba(var(--bw-blot), 0) 6.2px),
    radial-gradient(circle at 9px 64%, rgba(var(--bw-blot), 0.6) 0 1.6px, rgba(var(--bw-blot), 0.22) 2.8px, rgba(var(--bw-blot), 0) 4.6px),
    linear-gradient(90deg, rgba(var(--bw-grime), 0.12), rgba(var(--bw-grime), 0) 30px),
    linear-gradient(180deg, rgba(var(--bw-grime), 0.07), rgba(var(--bw-grime), 0) 26px),
    linear-gradient(0deg, rgba(var(--bw-grime), 0.07), rgba(var(--bw-grime), 0) 22px);
  --bw-pr: var(--bw-crumple2) 140px 50px / 300px 300px,
    linear-gradient(225deg, var(--bw-dog) 0 18px, rgba(60, 40, 15, 0.32) 18px 19px, var(--bw-flap) 19px 33px, rgba(60, 40, 15, 0.14) 33px 34px, rgba(0, 0, 0, 0) 34px) right top / 41px 41px no-repeat,
    radial-gradient(circle at 74% 70%, rgba(0, 0, 0, 0) 0 42px, rgba(var(--bw-st), 0.04) 43.5px, rgba(var(--bw-st), 0.018) 47px, rgba(0, 0, 0, 0) 49px),
    radial-gradient(circle at 30% 106%, rgba(0, 0, 0, 0) 0 70px, rgba(var(--bw-st), 0.035) 71.5px, rgba(var(--bw-st), 0.016) 75px, rgba(0, 0, 0, 0) 77px),
    radial-gradient(ellipse 130px 85px at 30% 22%, rgba(var(--bw-st), 0.015), rgba(var(--bw-st), 0) 72%),
    radial-gradient(ellipse 90px 60px at 68% 42%, rgba(var(--bw-st), 0.012), rgba(var(--bw-st), 0) 72%),
    radial-gradient(circle at calc(100% - 15px) 27%, rgba(var(--bw-blot), 0.6) 0 3.6px, rgba(var(--bw-blot), 0.22) 4.8px, rgba(var(--bw-blot), 0) 6.6px),
    radial-gradient(circle at calc(100% - 9px) 29%, rgba(var(--bw-blot), 0.6) 0 1.8px, rgba(var(--bw-blot), 0.22) 3.0px, rgba(var(--bw-blot), 0) 4.8px),
    radial-gradient(circle at calc(100% - 18px) 83%, rgba(var(--bw-blot), 0.6) 0 2.4px, rgba(var(--bw-blot), 0.22) 3.6px, rgba(var(--bw-blot), 0) 5.4px),
    linear-gradient(270deg, rgba(var(--bw-grime), 0.12), rgba(var(--bw-grime), 0) 30px),
    linear-gradient(180deg, rgba(var(--bw-grime), 0.07), rgba(var(--bw-grime), 0) 26px),
    linear-gradient(0deg, rgba(var(--bw-grime), 0.07), rgba(var(--bw-grime), 0) 22px);
  --bw-gut: var(--bw-crack2) center / 40px 100% no-repeat; }
body[data-wear-nauka="4"] .nk-layer .nk { border-radius: 16px 17px 20px 18px; }
body[data-wear-letopis="4"] .book-layer.lp-book .book-cover.codex-frame { border-radius: 20px 21px 24px 21px; }
body[data-wear-azbuka="4"] .az-layer .az { border-radius: 16px 18px 20px 16px; }
body[data-wear-nauka="4"] .nk-layer .nk-corner, body[data-wear-nauka="4"] .nk-layer .nk-seal, body[data-wear-nauka="4"] .nk-layer .nk-hb, body[data-wear-letopis="4"] .book-layer.lp-book .lp-fl, body[data-wear-letopis="4"] .book-layer.lp-book .lp-rule, body[data-wear-letopis="4"] .book-layer.lp-book .lp-hb, body[data-wear-azbuka="4"] .az-layer .az-hb, body[data-wear-azbuka="4"] .az-layer .az-thumb { filter: saturate(0.36) brightness(0.66); }
body[data-wear-nauka="4"] .nk-layer:not([data-tab="exams"]) .nk-page { --nk-ink: #83715d; --nk-ink-2: #87725b; --nk-meta: #87725a; }   /* the ink: 3.98 / 3.88:1 on the paper, >= 3.0 on the darkest stain */
body[data-wear-letopis="4"] .book-layer.lp-book .book-flow { --lp-ink: #7f6a50; --lp-ink-2: #836b4e; --lp-meta: #826b4f; --lp-rubric: #a05d4a; }   /* the ink: 3.98 / 3.88:1 on the paper, >= 3.0 on the darkest stain */
body[data-wear-azbuka="4"] .az-layer .az-pg, body[data-wear-azbuka="4"] .az-layer .az-flow { --az-ink: #857462; --az-ink-2: #887661; --az-meta: #897660; --az-red: #ba5e4a; }   /* the ink: 3.98 / 3.88:1 on the paper, >= 3.0 on the darkest stain */
body[data-wear-nauka="4"] .nk-layer:not(.is-small) .nk-page.r, body[data-wear-letopis="4"] .book-layer.lp-book:not(.is-single) .book-page--r, body[data-wear-azbuka="4"] .az-layer:not(.is-small) .az-pg--r { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 40px), calc(100% - 6px) calc(100% - 31px), calc(100% - 3px) calc(100% - 22px), calc(100% - 12px) calc(100% - 15px), calc(100% - 9px) calc(100% - 7px), calc(100% - 20px) calc(100% - 3px), calc(100% - 28px) 100%, 0 100%); }   /* a torn corner: only the margin (the right 30 px, the last 40 px) */
body[data-wear-nauka="4"] .nk-layer:not([data-tab="exams"]) .nk-in, body[data-wear-letopis="4"] .book-layer.lp-book .book-flow, body[data-wear-azbuka="4"] .az-layer .az-flow { text-shadow: 0 0 0.6px rgba(110, 82, 50, 0.55); }   /* the ink blotched: it bleeds (heavier, never lighter) */
body[data-wear-nauka="4"] .nk-layer .nk-corner.br { clip-path: polygon(100% 22%, 100% 100%, 30% 100%, 52% 74%, 70% 62%); }   /* a brass corner lost */

/* ---------------------------------------------------------------------------------------------- THE BINDINGS (a rebind: looks only) */
.nk-layer, .book-layer.lp-book, .az-layer { --bw-gilt: rgba(226, 196, 138, 0.75); --bw-giltc: 226, 196, 138; }
.book-layer.lp-book { --bw-gilt: rgba(244, 213, 140, 0.8); --bw-giltc: 244, 213, 140; }
body[data-bind-nauka="1"] .nk-layer, body[data-bind-letopis="1"] .book-layer.lp-book, body[data-bind-azbuka="1"] .az-layer { --bw-bind: linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px calc(100% - 7px) / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / 1px calc(100% - 12px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) calc(100% - 7px) 6px / 1px calc(100% - 12px) no-repeat; }
body[data-bind-nauka="2"] .nk-layer, body[data-bind-letopis="2"] .book-layer.lp-book, body[data-bind-azbuka="2"] .az-layer { --bw-bind: linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px calc(100% - 7px) / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / 1px calc(100% - 12px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) calc(100% - 7px) 6px / 1px calc(100% - 12px) no-repeat,
    radial-gradient(circle at 13px 13px, var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at calc(100% - 13px) 13px, var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at 13px calc(100% - 13px), var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at 13px 13px, rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at calc(100% - 13px) 13px, rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at 13px calc(100% - 13px), rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px); }
body[data-bind-nauka="3"] .nk-layer, body[data-bind-letopis="3"] .book-layer.lp-book, body[data-bind-azbuka="3"] .az-layer { --bw-bind: linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px calc(100% - 7px) / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / 1px calc(100% - 12px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) calc(100% - 7px) 6px / 1px calc(100% - 12px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 10px 10px / calc(100% - 20px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 10px calc(100% - 11px) / calc(100% - 20px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 10px 10px / 1px calc(100% - 20px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) calc(100% - 11px) 10px / 1px calc(100% - 20px) no-repeat,
    radial-gradient(circle at 13px 13px, var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at calc(100% - 13px) 13px, var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at 13px calc(100% - 13px), var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at 13px 13px, rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at calc(100% - 13px) 13px, rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at 13px calc(100% - 13px), rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px); }
body[data-bind-nauka="4"] .nk-layer, body[data-bind-letopis="4"] .book-layer.lp-book, body[data-bind-azbuka="4"] .az-layer { --bw-bind: linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px calc(100% - 7px) / calc(100% - 12px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 6px 6px / 1px calc(100% - 12px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) calc(100% - 7px) 6px / 1px calc(100% - 12px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 10px 10px / calc(100% - 20px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 10px calc(100% - 11px) / calc(100% - 20px) 1px no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) 10px 10px / 1px calc(100% - 20px) no-repeat,
    linear-gradient(var(--bw-gilt), var(--bw-gilt)) calc(100% - 11px) 10px / 1px calc(100% - 20px) no-repeat,
    radial-gradient(circle at 13px 13px, var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at calc(100% - 13px) 13px, var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at 13px calc(100% - 13px), var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), var(--bw-gilt) 0 3px, rgba(0, 0, 0, 0) 3.6px),
    radial-gradient(circle at 13px 13px, rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at calc(100% - 13px) 13px, rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at 13px calc(100% - 13px), rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), rgba(0, 0, 0, 0) 0 5px, var(--bw-gilt) 5.5px 6.4px, rgba(0, 0, 0, 0) 7px),
    repeating-linear-gradient(45deg, rgba(var(--bw-giltc), 0.07) 0 1px, rgba(0, 0, 0, 0) 1px 14px),
    repeating-linear-gradient(-45deg, rgba(var(--bw-giltc), 0.07) 0 1px, rgba(0, 0, 0, 0) 1px 14px); }
body[data-bind-nauka="1"] .hk-book--nauka .hk-bk-cover, body[data-bind-nauka="2"] .hk-book--nauka .hk-bk-cover, body[data-bind-nauka="3"] .hk-book--nauka .hk-bk-cover, body[data-bind-nauka="4"] .hk-book--nauka .hk-bk-cover, body[data-bind-letopis="1"] .hk-book--letopis .hk-bk-cover, body[data-bind-letopis="2"] .hk-book--letopis .hk-bk-cover, body[data-bind-letopis="3"] .hk-book--letopis .hk-bk-cover, body[data-bind-letopis="4"] .hk-book--letopis .hk-bk-cover, body[data-bind-azbuka="1"] .hk-book--azbuka .hk-bk-cover, body[data-bind-azbuka="2"] .hk-book--azbuka .hk-bk-cover, body[data-bind-azbuka="3"] .hk-book--azbuka .hk-bk-cover, body[data-bind-azbuka="4"] .hk-book--azbuka .hk-bk-cover { outline: 1px solid rgba(226, 196, 138, 0.8); outline-offset: -4px; }
body[data-bind-nauka="3"] .hk-book--nauka .hk-bk-cover, body[data-bind-nauka="4"] .hk-book--nauka .hk-bk-cover, body[data-bind-letopis="3"] .hk-book--letopis .hk-bk-cover, body[data-bind-letopis="4"] .hk-book--letopis .hk-bk-cover, body[data-bind-azbuka="3"] .hk-book--azbuka .hk-bk-cover, body[data-bind-azbuka="4"] .hk-book--azbuka .hk-bk-cover { outline-width: 2px; outline-style: double; }

/* ---------------------------------------------------------------------------------------------- THE RESETS (the guards) */
/* the Opsada (the exam planner) and anything you type into keep the book's full ink at every stage */
body[data-wear-nauka] .nk-layer[data-tab="exams"] .nk-page { --nk-ink: #211a12; --nk-ink-2: #4e4031; --nk-meta: #54442f; }
body[data-wear-nauka] .nk-layer [contenteditable="true"], body[data-wear-nauka] .nk-layer input, body[data-wear-nauka] .nk-layer textarea, body[data-wear-nauka] .nk-layer select { --nk-ink: #211a12; --nk-ink-2: #4e4031; --nk-meta: #54442f; text-shadow: none; }
body[data-wear-letopis] .book-layer.lp-book [contenteditable="true"], body[data-wear-letopis] .book-layer.lp-book input, body[data-wear-letopis] .book-layer.lp-book textarea, body[data-wear-letopis] .book-layer.lp-book select { --lp-ink: #22170d; --lp-ink-2: #4a3520; --lp-meta: #4f3f2c; --lp-rubric: #7a1d10; text-shadow: none; }
body[data-wear-azbuka] .az-layer [contenteditable="true"], body[data-wear-azbuka] .az-layer input, body[data-wear-azbuka] .az-layer textarea, body[data-wear-azbuka] .az-layer select { --az-ink: #1d1813; --az-ink-2: #4a3f33; --az-meta: #54473a; --az-red: #a3260f; text-shadow: none; }
@media (prefers-reduced-motion: reduce) { .bw-note { transition: none; } }

/* ---------------------------------------------------------------------------------------------- THE NOTE ON THE BOOK */
/* (js/books.js puts one .bw-note on an open book from Worn on: a small label on the board; its hover says the stage and the
 * Knigovez; a click opens the Knigovez card, which the player asked for) */
.bw-note { position: absolute; z-index: 12; display: inline-flex; align-items: center; gap: 7px; max-width: 46%; height: 22px; padding: 0 10px 0 8px;
  border-radius: 3px; font: 600 11.5px/1 "Avenir Next", Avenir, "Helvetica Neue", "Alegreya Sans", sans-serif; letter-spacing: 0.03em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; color: #f1e6cf; background: rgba(20, 14, 8, 0.72); box-shadow: 0 0 0 1px rgba(226, 196, 138, 0.35); }
.bw-note:hover, .bw-note:focus-visible { background: rgba(30, 20, 10, 0.9); box-shadow: 0 0 0 1px rgba(226, 196, 138, 0.7); outline: none; }
.bw-note i { flex: none; width: 13px; height: 13px; background: currentColor; -webkit-mask: var(--bw-glyph) center / contain no-repeat; mask: var(--bw-glyph) center / contain no-repeat; }
.bw-note { --bw-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 2h8l4 4v8H2z' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3Cpath d='M7 3l-1 4 2 2-1 5' fill='none' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E"); }
.bw-note[data-stage="2"] { color: #eadfc6; }
.bw-note[data-stage="3"] { color: #f2c98a; box-shadow: 0 0 0 1px rgba(242, 201, 138, 0.55); }
.bw-note[data-stage="4"] { color: #ffd2b0; background: rgba(92, 24, 10, 0.86); box-shadow: 0 0 0 1px rgba(255, 170, 120, 0.7), 0 0 10px rgba(160, 40, 10, 0.45); }
.nk-layer .bw-note { position: relative; flex: 0 1 auto; max-width: 330px; margin-right: 14px; }   /* in the band's right part, before "Saved" */
.book-layer.lp-book .bw-note { left: 30px; top: 17px; }   /* the board's top left (the head is centred) */
.az-layer .bw-note { left: 32px; bottom: 9px; }
.nk-layer.is-small .bw-note, .az-layer.is-small .bw-note, .book-layer.lp-book.is-single .bw-note { height: 18px; font-size: 10.5px; max-width: 40%; }
.az-layer.is-small .bw-note { bottom: 2px; }

/* ---------------------------------------------------------------------------------------------- THE HOTBAR'S BOOK BUTTONS */
/* the book buttons wear their book's stage (ui-hotbar.js draws .hk-book--<book>; the Letopis's button is .hk-book--letopis) */
body[data-wear-nauka="2"] .hk-book--nauka .hk-bk-cover::after, body[data-wear-letopis="2"] .hk-book--letopis .hk-bk-cover::after, body[data-wear-azbuka="2"] .hk-book--azbuka .hk-bk-cover::after,
body[data-wear-nauka="3"] .hk-book--nauka .hk-bk-cover::after, body[data-wear-letopis="3"] .hk-book--letopis .hk-bk-cover::after, body[data-wear-azbuka="3"] .hk-book--azbuka .hk-bk-cover::after,
body[data-wear-nauka="4"] .hk-book--nauka .hk-bk-cover::after, body[data-wear-letopis="4"] .hk-book--letopis .hk-bk-cover::after, body[data-wear-azbuka="4"] .hk-book--azbuka .hk-bk-cover::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(118deg, rgba(0, 0, 0, 0) 0 58%, rgba(255, 255, 255, 0.08) 58% 60%, rgba(0, 0, 0, 0.25) 60% 63%, rgba(0, 0, 0, 0) 63%), radial-gradient(ellipse 14px 10px at 0 100%, rgba(230, 215, 185, 0.22), rgba(230, 215, 185, 0) 75%); }
body[data-wear-nauka="3"] .hk-book--nauka .hk-bk-cover::after, body[data-wear-letopis="3"] .hk-book--letopis .hk-bk-cover::after, body[data-wear-azbuka="3"] .hk-book--azbuka .hk-bk-cover::after,
body[data-wear-nauka="4"] .hk-book--nauka .hk-bk-cover::after, body[data-wear-letopis="4"] .hk-book--letopis .hk-bk-cover::after, body[data-wear-azbuka="4"] .hk-book--azbuka .hk-bk-cover::after {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 38 60' preserveAspectRatio='none'%3E%3Cpath d='M5 0L4 14L6.5 27L3.8 41L5.6 60' fill='none' stroke='rgba(255,240,215,0.5)' stroke-width='1.6'/%3E%3Cpath d='M5.6 0L4.6 14L7.1 27L4.4 41L6.2 60' fill='none' stroke='rgba(10,5,0,0.8)' stroke-width='1.1'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat,
    linear-gradient(118deg, rgba(0, 0, 0, 0) 0 58%, rgba(255, 255, 255, 0.1) 58% 60%, rgba(0, 0, 0, 0.3) 60% 63%, rgba(0, 0, 0, 0) 63%), radial-gradient(ellipse 16px 12px at 0 100%, rgba(230, 215, 185, 0.3), rgba(230, 215, 185, 0) 75%); }
/* Falling apart: the strong warning on the button (a torn, ember-rimmed corner; never a gold "!") */
body[data-wear-nauka="4"] .hk-book--nauka .hk-bk-cover, body[data-wear-letopis="4"] .hk-book--letopis .hk-bk-cover, body[data-wear-azbuka="4"] .hk-book--azbuka .hk-bk-cover {
  box-shadow: inset 0 0 0 2px rgba(214, 84, 40, 0.95), inset 0 0 12px rgba(214, 84, 40, 0.55), 0 0 0 1px #050302;   /* inside: the clip below would cut an outer rim */
  clip-path: polygon(0 0, 72% 0, 80% 7%, 88% 3%, 100% 12%, 100% 100%, 0 100%); }   /* a torn top corner */
body[data-wear-nauka="4"] .hk-book--nauka .hk-bk-edge, body[data-wear-letopis="4"] .hk-book--letopis .hk-bk-edge, body[data-wear-azbuka="4"] .hk-book--azbuka .hk-bk-edge {
  background: repeating-linear-gradient(90deg, #d8c9a4 0 1px, #b9a57c 1px 2px), #cdbd96; transform: rotate(1.5deg); }

/* ---------------------------------------------------------------------------------------------- THE KNIGOVEZ CARD (js/ui-wear.js) */
.bw-card { position: fixed; z-index: 1300; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  padding: 18px 20px 16px; border-radius: 6px; background: #15120f; color: #e8e1d3; box-shadow: 0 0 0 1px #3b3832, 0 0 0 2px rgba(0, 0, 0, 0.6), 0 24px 60px rgba(0, 0, 0, 0.7);
  font: 400 14.5px/1.45 "Avenir Next", Avenir, "Helvetica Neue", "Alegreya Sans", sans-serif; }
.bw-card h3 { margin: 0 0 2px; font: 700 21px/1.2 var(--cx-font-title, serif); letter-spacing: 0.04em; color: #f4d58c; }
.bw-card .bw-sub { margin: 0 0 12px; color: #c2baab; font-size: 13.5px; }
.bw-card .bw-x { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border: 0; border-radius: 4px; background: none; color: #c2baab; font-size: 22px; line-height: 1; cursor: pointer; }
.bw-card .bw-x:hover, .bw-card .bw-x:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.08); outline: none; }
.bw-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid #2c2925; }
.bw-row:first-of-type { border-top: 0; }
.bw-bk { width: 36px; height: 46px; border-radius: 2px 4px 4px 2px; box-shadow: 0 0 0 1px #050302, 2px 2px 4px rgba(0, 0, 0, 0.6); }
.bw-bk--nauka { background: linear-gradient(160deg, #2a4170, #15203a); } .bw-bk--letopis { background: linear-gradient(160deg, #6a2219, #2e0d09); } .bw-bk--azbuka { background: linear-gradient(160deg, #3d6b49, #1c3a25); }
.bw-bk[data-stage="2"] { filter: saturate(0.8); } .bw-bk[data-stage="3"] { filter: saturate(0.65) brightness(0.9); } .bw-bk[data-stage="4"] { filter: saturate(0.5) brightness(0.8); box-shadow: 0 0 0 1px #050302, 0 0 0 2px rgba(196, 70, 30, 0.8); }
.bw-name { font-weight: 700; color: #f2ebdd; }
.bw-stage { display: block; color: #c2baab; font-size: 13px; }
.bw-stage b { color: #e3b562; font-weight: 600; }
.bw-bar { display: block; height: 4px; margin-top: 5px; border-radius: 2px; background: #2c2925; overflow: hidden; }
.bw-bar i { display: block; height: 100%; background: linear-gradient(90deg, #b8955a, #c4461e); }
.bw-acts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.bw-btn { min-width: 138px; height: 30px; padding: 0 12px; border: 0; border-radius: 4px; cursor: pointer; font: 600 13px/1 "Avenir Next", Avenir, "Helvetica Neue", "Alegreya Sans", sans-serif; color: #1b140c; background: linear-gradient(180deg, #e8c681, #b8955a); box-shadow: 0 0 0 1px #5f4218; }
.bw-btn:hover, .bw-btn:focus-visible { filter: brightness(1.08); outline: none; box-shadow: 0 0 0 1px #5f4218, 0 0 0 3px rgba(232, 198, 129, 0.35); }
.bw-btn[disabled] { cursor: default; color: #8f877a; background: #2c2925; box-shadow: 0 0 0 1px #3b3832; filter: none; }
.bw-btn--ghost { color: #e8e1d3; background: #24201b; box-shadow: 0 0 0 1px #3b3832; }
.bw-msg { min-height: 20px; margin: 10px 0 0; color: #e3b562; font-size: 13.5px; }
.bw-msg.is-bad { color: #f2a07a; }
.bw-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid #2c2925; color: #a39c8f; font-size: 13px; }
.bw-foot button { margin-left: 6px; }

