/* stat colours for multi-series charts — tuned for both palettes */
:root { --c-end: #b5562b; --c-str: #5f7a35; --c-vit: #2f7a8c; --c-wis: #7a5aa0; --c-spd: #b8860b; --c-will: #4a5aa8; }
[data-mode="dark"] { --c-end: #e08a5c; --c-str: #9fbf6a; --c-vit: #6cc1d4; --c-wis: #b99ae0; --c-spd: #e3b44a; --c-will: #8f9ff0; }
.span3 { grid-column: 1 / -1; }

/* ============================================================ Bag End */
.home .hero { overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: center; }
.hero .avatar-fig { width: min(180px, 46vw); margin: 0 auto; }
.hero .avatar-fig .sample { position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%); white-space: nowrap; background: var(--paper); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
@media (min-width: 640px) { .hero-grid { grid-template-columns: 190px minmax(0, 1fr); } .hero .avatar-fig { width: 190px; } }
.evt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--paper-2); margin-bottom: 8px; }
.evt svg { width: 22px; height: 22px; flex: none; color: var(--mute); }
.evt .grow { flex: 1; min-width: 0; }
.evt b { display: block; font-family: var(--font-display); font-size: 14px; letter-spacing: .04em; }
.evt span { display: block; font-size: 14px; color: var(--mute); }
.evt b .sample, .evt span.sample { display: inline-block; vertical-align: 2px; margin-left: 6px; font-size: 9px; }
.evt.bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); } .evt.bad svg { color: var(--danger); }
.evt.warn { border-color: color-mix(in srgb, var(--gold) 55%, transparent); } .evt.warn svg { color: var(--gold); }
.evt.good { border-color: color-mix(in srgb, var(--good) 45%, transparent); } .evt.good svg { color: var(--good); }

/* ============================================================ the Ranger's Camp */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--paper-2); text-align: center; min-width: 0; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--paper); }
.day.future { opacity: .75; }
.day .dn { font-family: var(--font-display); font-size: 10.5px; letter-spacing: .1em; color: var(--mute); }
.day .dd { font-family: var(--font-display); font-size: 17px; }
.day .ds svg { width: 20px; height: 20px; color: var(--accent); }
.day .dt { font-size: 12px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.day .chip { padding: 1px 6px; font-size: 11px; }
@media (max-width: 520px) { .day .dt { display: none; } }
.runlog { display: grid; gap: 0; }
.run { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.run:last-child { border-bottom: 0; }
.run .rd { font-weight: 600; }
.run .rk { font-size: 16px; text-align: right; }
.run .rp, .run .rw, .run .rs { font-size: 13.5px; }
.run .rs, .run .rw { color: var(--mute); }
.run .rr { text-align: right; font-size: 13.5px; }
.run .chip { justify-self: start; }
@media (min-width: 820px) { .run { grid-template-columns: 120px 90px 90px 90px minmax(0, 1fr) 110px auto; } .run .rk, .run .rr { text-align: right; } .run .chip { justify-self: end; } }

/* ============================================================ the Red Book */
.page-input { min-height: 120px; font-size: 18px; line-height: 1.55; background: repeating-linear-gradient(transparent 0 27px, var(--line) 27px 28px); background-color: var(--paper); }
.diarylist { max-height: none; }
.diarylist .month { font-family: var(--font-display); letter-spacing: .14em; font-size: 12px; color: var(--mute); text-transform: uppercase; margin: 16px 0 6px; }
.diarylist .month:first-child { margin-top: 0; }
.entry { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--mute); }
.entry .meta .num { color: var(--ink); }
.entry p { margin: 4px 0 0; font-size: 17px; }
.entry.entry p { font-size: 17.5px; }
.book .cover-mini { border-radius: 6px 12px 12px 6px; padding: 22px 16px; text-align: center; color: #e7c777; background: linear-gradient(135deg, #8a2416, #4d130c 70%); box-shadow: inset 0 0 0 6px #5e170e, inset 0 0 0 8px #c9a24a; margin-bottom: 14px; }
.book .cover-mini .a { display: block; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: .06em; }
.book .cover-mini .b { display: block; font-style: italic; font-size: 14px; opacity: .85; }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chapters button { appearance: none; width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-2); color: inherit; }
.chapters .cn { font-family: var(--font-display); font-size: 11px; letter-spacing: .12em; color: var(--mute); text-transform: uppercase; }
.chapters .ct { grid-column: 1; font-size: 17px; }
.chapters .cs { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.chapters .cw { grid-column: 1; }
.chapters .next { padding: 6px 4px; }
.prose p { font-size: 18.5px; line-height: 1.65; margin: 0 0 14px; }
.prose p:first-child::first-letter { font-family: var(--font-display); float: left; font-size: 52px; line-height: .85; margin: 6px 10px 0 0; color: var(--danger); }

/* ============================================================ the Archives */
.shelf { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding: 0 8px; overflow-x: auto; }
.spine { position: relative; flex: none; width: 54px; height: var(--h, 80%); border-radius: 3px 3px 1px 1px; background: linear-gradient(90deg, rgba(0, 0, 0, .25), transparent 18%, transparent 82%, rgba(0, 0, 0, .3)), var(--bg); color: var(--fg); display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.spine span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-display); font-size: 12.5px; letter-spacing: .08em; white-space: nowrap; max-height: 92%; overflow: hidden; text-overflow: ellipsis; }
.spine::before, .spine::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; background: var(--fg); opacity: .6; }
.spine::before { top: 12px; } .spine::after { bottom: 12px; }
.spine.reading { outline: 2px dashed var(--gold); outline-offset: 3px; }
.spine.reading i { position: absolute; left: 0; bottom: 0; width: 4px; background: var(--gold); }
.spine.ghost { background: transparent; border: 1.5px dashed var(--line-strong); box-shadow: none; color: var(--mute); }
.spine.ghost::before, .spine.ghost::after { display: none; }
.shelf-plank { height: 14px; border-radius: 3px; background: linear-gradient(#8a6a44, #5c4128); box-shadow: 0 6px 12px -6px rgba(0, 0, 0, .5); }
.vol { margin-bottom: 12px; }
.vol .vname { font-family: var(--font-display); font-size: 13.5px; letter-spacing: .04em; margin-bottom: 6px; }
.bk { display: grid; grid-template-columns: 64px minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.bk .bn { font-size: 13.5px; color: var(--mute); }
.bk .bp { font-size: 13px; text-align: right; }
.bf { margin: 0 0 8px 72px; }

/* ============================================================ the Council */
.deltas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .deltas { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.delta { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--paper-2); }
.delta .k { display: block; font-size: 13px; color: var(--mute); }
.delta b { font-size: 20px; margin-right: 6px; }
.ins { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 10px; font-size: 15.5px; }
.ins svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.ins.good svg { color: var(--good); } .ins.warn svg { color: var(--gold); }
.panorama { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 280px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding: 0 20px 0; border-radius: var(--radius-sm); }
.pano-bg { position: sticky; left: 0; flex: none; width: 0; }
.panorama::before { content: ""; position: absolute; inset: 0; min-width: 100%; width: max(100%, calc(var(--n, 12) * 130px)); background: linear-gradient(#e9d7a8 0%, #d8c08a 52%, #7d6b4a 52.5%, #6b5a3c 100%); opacity: .55; border-radius: var(--radius-sm); }
[data-mode="dark"] .panorama::before { background: linear-gradient(#2a2f3a 0%, #3a3a3e 52%, #1e1a16 52.5%, #15120f 100%); }
.pfig { position: relative; flex: none; width: 120px; height: 100%; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; scroll-snap-align: center; padding-bottom: 8px; }
.pfig .pf-art { height: 170px; display: flex; align-items: flex-end; justify-content: center; }
.pfig .fig-svg { width: auto; }
.pfig figcaption { text-align: center; margin-top: 6px; background: color-mix(in srgb, var(--paper) 85%, transparent); border-radius: 8px; padding: 4px 8px; min-width: 100px; }
.pfig figcaption b { display: block; font-family: var(--font-display); font-size: 13.5px; letter-spacing: .04em; }
.pfig figcaption span { display: block; font-size: 12px; color: var(--mute); line-height: 1.2; }
.pfig.left { opacity: .55; filter: grayscale(.6); }
.pfig.more { opacity: .6; }
.past details { border-bottom: 1px solid var(--line); padding: 8px 0; }
.past summary { cursor: pointer; }
.qa { margin: 6px 0 0; display: grid; gap: 2px; }
.qa dt { color: var(--mute); font-size: 13.5px; }
.qa dd { margin: 0 0 6px; }

/* ============================================================ the Mathom-house (TCG binder) */
.binder { margin-top: 18px; }
.binder > h3 { margin: 0 0 10px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); } }
.tcg { appearance: none; border: 0; padding: 0; background: none; color: inherit; aspect-ratio: 5 / 7.2; perspective: 900px; text-align: left; position: relative; }
.tcg-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .6s var(--ease); }
.tcg.flipped .tcg-inner { transform: rotateY(180deg); }
.tcg-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; overflow: hidden;
  background: linear-gradient(180deg, #f3e7cb, #e6d4ac); color: #33261a; box-shadow: 0 0 0 3px var(--frame, #cbb88f), 0 10px 22px -12px rgba(0, 0, 0, .6); }
.tcg-face.back { transform: rotateY(180deg); justify-content: center; text-align: center; padding: 14px 10px; }
.tcg-top { display: flex; justify-content: space-between; align-items: center; }
.tcg .gem { width: 12px; height: 12px; border-radius: 3px; transform: rotate(45deg); background: var(--gemc, #9a8a6a); box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.tcg .serial { font-size: 10.5px; opacity: .7; }
.tcg-art { flex: 1; min-height: 0; border-radius: 7px; overflow: hidden; position: relative; background: #2a221a; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35); }
.tcg-name { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .03em; line-height: 1.15; }
.tcg-type { font-size: 11px; opacity: .75; }
.tcg-line { font-size: 11.5px; font-style: italic; line-height: 1.2; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcg-foot { font-size: 10px; opacity: .7; border-top: 1px solid rgba(0, 0, 0, .15); padding-top: 3px; }
.tcg .snap { display: grid; grid-template-columns: repeat(3, auto auto); gap: 2px 6px; justify-content: center; font-size: 11px; margin: 8px 0; }
.tcg .snap span { opacity: .7; }
.tcg.r-common { --frame: #cbb88f; --gemc: #9a8a6a; }
.tcg.r-uncommon { --frame: #7fa36a; --gemc: #5f8a48; }
.tcg.r-rare { --frame: #b9c3cc; --gemc: #8fa4b8; }
.tcg.r-epic { --frame: #d9a441; --gemc: #e0561a; }
.tcg.r-epic .tcg-face.front { box-shadow: 0 0 0 3px var(--frame), 0 0 18px -2px rgba(224, 86, 26, .55), 0 10px 22px -12px rgba(0, 0, 0, .6); }
.tcg.r-legendary { --frame: #e7c777; --gemc: #ffcf5a; }
.tcg.r-legendary .tcg-face.front::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 245, 200, .55) 45%, transparent 60%); background-size: 300% 100%; animation: sweep 4s ease-in-out infinite; pointer-events: none; }
@keyframes sweep { 0% { background-position: 120% 0; } 60%, 100% { background-position: -40% 0; } }
.tcg.r-mythic { --frame: #9fd4ff; --gemc: #b0e0ff; }
.tcg.locked .tcg-face { background: repeating-linear-gradient(45deg, var(--paper-2) 0 8px, color-mix(in srgb, var(--paper-2) 80%, var(--ink)) 8px 9px); box-shadow: 0 0 0 2px var(--line-strong); display: grid; place-items: center; }
.tcg.locked .sil-q { font-family: var(--font-display); font-size: 26px; color: var(--mute); letter-spacing: .1em; }
.tcg.more .tcg-face, .tcg.more { display: grid; place-items: center; border: 1.5px dashed var(--line-strong); border-radius: 12px; color: var(--mute); font-family: var(--font-display); font-size: 12px; letter-spacing: .06em; }
.art-scene { position: absolute; inset: 0; }
.art-scene > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.art-ally { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: linear-gradient(#e9d7a8, #b9a070); padding-top: 8px; }
.art-ally .fig-svg { height: 92% !important; width: auto; }
.art-icon { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle, #4a3a2a, #1e1610); color: #e7c777; }
.art-icon svg { width: 56%; height: 56%; }
.art-tome { position: absolute; inset: 12% 22%; border-radius: 3px 8px 8px 3px; background: var(--bg); box-shadow: inset 0 0 0 4px rgba(0, 0, 0, .25), inset 0 0 0 6px var(--fg), 0 8px 16px -6px rgba(0, 0, 0, .7); display: grid; place-items: center; color: var(--fg); font-family: var(--font-display); font-size: 12px; text-align: center; padding: 8px; }
.art-tome::after { content: ""; width: 34%; aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--fg); position: absolute; opacity: .8; }
.art-photo { position: absolute; inset: 0; } .art-photo img { width: 100%; height: 100%; object-fit: cover; }
.art-feat { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(circle at 50% 35%, #fff3cc, #d9b86a 70%); color: #6b4a1a; }
.art-feat > svg { width: 38%; height: 38%; }
.art-feat .btn { font-size: 10px; min-height: 28px; padding: 4px 10px; background: rgba(255, 255, 255, .7); }
.art-sil { position: absolute; inset: 0; background: radial-gradient(circle at 50% 70%, #6a2a14, #140806 75%); display: grid; place-items: center; }
.art-sil .sil { width: 46%; height: 70%; background: #050202; border-radius: 45% 45% 10% 10% / 55% 55% 8% 8%; box-shadow: 0 0 24px 4px rgba(255, 90, 20, .35); }
.art-sil.deed { background: radial-gradient(circle at 50% 50%, #f2e2b8, #b89a5a); } .art-sil.deed .sil { background: #5b3a1a; border-radius: 50%; width: 40%; height: 40%; box-shadow: none; }
.art-sil.trophy { background: radial-gradient(circle, #5a5040, #1c1812); } .art-sil.trophy .sil { box-shadow: none; background: #0c0a08; }
.art-sil.quest { background: radial-gradient(circle, #e8eed8, #8aa070); } .art-sil.quest .sil { width: 40%; height: 40%; border-radius: 10px; transform: rotate(45deg); background: #4a5a30; box-shadow: none; }
.art-sil .sample { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); background: rgba(255, 255, 255, .85); color: #33261a; }

/* ============================================================ the Ledger */
.ledger-sec h2.big { margin-bottom: 12px; }
.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-family: var(--font-display); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl .r { text-align: right; }
