:root {
  --forest: #1c261b;      /* surround, toolbar */
  --moss: #34492a;        /* window bars */
  --moss-2: #4b6638;
  --lichen: #e4e6d3;      /* window paper */
  --lichen-2: #d4d8bf;
  --ink: #22251c;
  --ink-soft: #545a45;
  --gold: #d9b13b;        /* roads + labels on the map: hex links */
  --gold-deep: #8a6a10;
  --ley: #8b4f8f;         /* ley lines on the map: page references */
  --focus: #f0cf62;
  --fell: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --fell-sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --body: "Alegreya", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--forest); color: var(--ink); font-family: var(--body); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; background: var(--forest); }
.leaflet-container { font-family: var(--body); background: var(--forest); }
.hexpoly { cursor: pointer; transition: fill-opacity .12s; }
.leaflet-tooltip.hextip {
  background: var(--forest); color: #f1ecd2; border: 1px solid var(--gold); border-radius: 3px;
  font-family: var(--fell); font-size: 15px; padding: 3px 9px; box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.leaflet-tooltip.hextip::before { display: none; }
.hextip b { color: var(--gold); font-family: var(--body); font-weight: 700; margin-right: .35em; }

/* ---------- toolbar ---------- */
#bar {
  position: fixed; top: 0; left: 0; right: 0; height: 46px; z-index: 900;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: linear-gradient(var(--forest), rgba(28,38,27,.86)); color: #efe9cf;
  border-bottom: 1px solid rgba(217,177,59,.35);
}
#bar h1 { font-family: var(--fell-sc); font-weight: 400; font-size: 23px; margin: 0 6px 0 2px; letter-spacing: .02em; color: var(--gold); }
#hoverInfo { font-family: var(--fell); font-size: 16px; color: #d8d3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#hoverInfo b { color: var(--gold); font-family: var(--body); margin-right: .3em; }
.spacer { flex: 1; }
.tbtn {
  background: transparent; border: 1px solid rgba(239,233,207,.28); color: #efe9cf; border-radius: 4px;
  padding: 5px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 15px;
}
.tbtn:hover { border-color: var(--gold); color: var(--gold); }
.tbtn[aria-pressed="true"], .tbtn[aria-expanded="true"] { background: rgba(217,177,59,.16); border-color: var(--gold); color: var(--gold); }
.leaflet-top.leaflet-left { top: 50px; }

/* ---------- drawer ---------- */
#drawer {
  position: fixed; top: 46px; left: 0; bottom: 0; width: min(360px, 100vw); z-index: 950;
  background: var(--lichen); border-right: 1px solid var(--moss); display: flex; flex-direction: column;
  box-shadow: 8px 0 30px rgba(0,0,0,.35);
}
#drawer[hidden] { display: none; }
.drawer-head { padding: 12px 12px 0; background: var(--lichen-2); border-bottom: 1px solid #b9bf9f; }
#search {
  width: 100%; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid #9ea583; border-radius: 4px; background: #f5f6ea; color: var(--ink);
}
.tabs { display: flex; gap: 2px; margin-top: 10px; }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 7px 4px 6px; cursor: pointer; font-family: var(--fell); font-size: 17px; color: var(--ink-soft); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--moss-2); }
#drawerBody { overflow: auto; flex: 1; padding: 6px 0 20px; }
.dlist { list-style: none; margin: 0; padding: 0; }
.dlist button {
  display: flex; width: 100%; text-align: left; background: none; border: 0; padding: 6px 14px; cursor: pointer; gap: 10px; align-items: baseline; font-size: 16px; line-height: 1.3;
}
.dlist button:hover { background: rgba(75,102,56,.14); }
.dlist .num { font-weight: 700; color: var(--gold-deep); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.dlist .lvl1 { font-family: var(--fell-sc); font-size: 18px; margin-top: 10px; color: var(--moss); }
.dlist .lvl2 { padding-left: 26px; }
.dlist .snip { display: block; font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.dlist .snip mark { background: rgba(217,177,59,.45); color: inherit; padding: 0 1px; }
.dlist .res { display: block; }
.dempty { padding: 16px; color: var(--ink-soft); font-style: italic; }

/* ---------- windows ---------- */
#desk { position: fixed; inset: 46px 0 0 0; pointer-events: none; z-index: 800; }
.win {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  width: 644px; height: 620px; min-width: 280px; min-height: 160px; max-width: calc(100vw - 8px);
  background: var(--lichen); border: 1px solid #2c3b23; border-radius: 6px 6px 3px 3px;
  box-shadow: 0 18px 50px rgba(8,12,6,.55), 0 2px 6px rgba(8,12,6,.4);
  resize: both; overflow: hidden;
  animation: winIn .16s ease-out;
}
@keyframes winIn { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .win { animation: none; } }
.win.flash { animation: winFlash .5s; }
@keyframes winFlash { 30% { box-shadow: 0 0 0 4px var(--gold), 0 18px 50px rgba(8,12,6,.55); } }
.win-bar {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; cursor: grab; user-select: none; touch-action: none;
  background: var(--moss); color: #f1ecd2; border-bottom: 2px solid #253419;
}
.win.top .win-bar { background: var(--moss-2); }
.win-bar:active { cursor: grabbing; }
.win-tag { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; font-size: 17px; }
.win-tag:empty { display: none; }
.win-title { flex: 1; margin: 0; font-family: var(--fell); font-weight: 400; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-actions { display: flex; gap: 2px; }
.wbtn { background: none; border: 0; color: #e6e0c2; padding: 5px; border-radius: 3px; cursor: pointer; display: grid; place-items: center; }
.wbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
.wbtn[hidden] { display: none; }
.win-body { flex: 1; overflow: auto; padding: 4px 22px 30px; font-size: 16.5px; line-height: 1.55; overscroll-behavior: contain; }
.win-body.img-body { padding: 0; overflow: hidden; background: #2a2f22; }

/* book content */
.win-body h1, .win-body h2, .win-body h3, .win-body h4, .win-body h5 { font-family: var(--fell); font-weight: 400; color: var(--moss); line-height: 1.2; margin: 1.1em 0 .35em; }
.win-body h1 { font-size: 30px; }
.win-body h2 { font-size: 26px; border-bottom: 1px solid #b9bf9f; padding-bottom: 4px; }
.win-body h3 { font-size: 21px; font-family: var(--fell-sc); }
.win-body h4 { font-size: 19px; color: #2e3d24; }
.win-body h5, .win-body h6 { font-size: 17px; }
.win-body p { margin: .5em 0 .75em; max-width: 72ch; }
.win-body ul, .win-body ol { padding-left: 1.3em; max-width: 72ch; }
.win-body li { margin: .2em 0; }
.win-body blockquote { margin: .8em 0; padding: .2em 1em; border-left: 3px solid var(--lichen-2); color: var(--ink-soft); font-style: italic; }
.win-body table { border-collapse: collapse; margin: .8em 0 1.2em; font-size: 15px; line-height: 1.35; width: 100%; }
.win-body th, .win-body td { border: 1px solid #b9bf9f; padding: 4px 7px; vertical-align: top; text-align: left; }
.win-body th { background: var(--lichen-2); font-weight: 700; }
.win-body tr:nth-child(even) td { background: rgba(255,255,255,.28); }
.win-body .pgmark { font-size: 12.5px; color: #8a8f78; text-align: right; border-top: 1px dashed #c4c8ae; margin: 1.6em 0 .3em; padding-top: 2px; }
.win-body img.mapimg { display: block; max-width: 100%; height: auto; margin: .6em auto .2em; border: 1px solid #9ea583; cursor: zoom-in; background: #cfd3b9; }
.win-body img.mapimg + em, .win-body p:has(> img.mapimg) + p > em:only-child { font-size: 13.5px; color: var(--ink-soft); }

/* references */
a.hexref, a.ref { text-decoration: none; border-radius: 2px; cursor: pointer; }
a.hexref { color: #6d520a; font-weight: 700; background: rgba(217,177,59,.22); padding: 0 3px; box-shadow: inset 0 -2px 0 var(--gold); }
a.hexref:hover { background: var(--gold); color: var(--ink); }
a.ref { color: var(--ley); box-shadow: inset 0 -1.5px 0 rgba(139,79,143,.55); }
a.ref:hover { background: rgba(139,79,143,.14); }
.target-flash { animation: tflash 2.2s ease-out; border-radius: 3px; }
@keyframes tflash { 0%, 35% { background: rgba(217,177,59,.6); box-shadow: 0 0 0 4px rgba(217,177,59,.6); } 100% { background: transparent; box-shadow: none; } }

.win-hint { font-size: 14px; color: var(--ink-soft); margin: 8px 0 0; font-style: italic; }
.nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 2em; border-top: 1px solid #b9bf9f; padding-top: 10px; font-size: 15px; }
.nav-row button { background: none; border: 1px solid #9ea583; border-radius: 4px; padding: 5px 10px; cursor: pointer; max-width: 48%; text-align: left; }
.nav-row button:hover { border-color: var(--moss-2); background: rgba(75,102,56,.1); }

/* image viewer */
.imgmap { position: absolute; inset: 0; background: #2a2f22; }
.img-body { position: relative; }

/* standalone reader (popped out) */
body.reader { overflow: auto; background: var(--lichen); }
body.reader #map, body.reader #bar, body.reader #drawer { display: none; }
body.reader #desk { position: static; pointer-events: auto; }
body.reader .win { position: relative; width: 100% !important; height: auto !important; min-height: 100vh; resize: none; border: 0; border-radius: 0; box-shadow: none; animation: none; left: 0 !important; top: 0 !important; max-width: none; }
body.reader .win-bar { position: sticky; top: 0; z-index: 2; cursor: default; }
body.reader .win-body { overflow: visible; max-width: 860px; margin: 0 auto; width: 100%; }
body.reader .win-body.img-body { height: calc(100vh - 40px); max-width: none; }
body.reader .act-close, body.reader .act-map { display: none; }

@media (max-width: 640px) {
  #bar h1 { font-size: 19px; }
  #labelsBtn { display: none; }
  .win { left: 4px !important; right: 4px; width: auto !important; top: 6px !important; height: calc(100% - 12px) !important; resize: none; }
  .win-body { padding: 4px 14px 24px; }
}

/* ---------- map overlays ---------- */
.hextile { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.notepin span {
  display: grid; place-items: center; width: 26px; height: 22px; border-radius: 11px;
  background: var(--forest); color: var(--gold); border: 1.5px solid var(--gold);
  font: 700 13px/1 var(--body); box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.hextip .tipx { display: block; font-family: var(--body); font-size: 13px; color: #cfc9ac; margin-top: 1px; }
body.role-dm.viewing-player #bar { border-bottom-color: #8fb3ff; }

/* ---------- buttons & forms ---------- */
.btn {
  font: inherit; font-size: 15px; padding: 6px 12px; border-radius: 4px; cursor: pointer;
  border: 1px solid #9ea583; background: #f3f4e6; color: var(--ink);
}
.btn:hover { border-color: var(--moss-2); }
.btn.primary { background: var(--moss); border-color: var(--moss); color: #f6f2dc; }
.btn.primary:hover { background: var(--moss-2); }
.btn:disabled { opacity: .6; cursor: progress; }
.lnk { background: none; border: 0; padding: 0 2px; color: var(--ink-soft); cursor: pointer; font: inherit; font-size: 13.5px; text-decoration: underline; text-underline-offset: 2px; }
.lnk:hover { color: var(--ink); }
.win-body input[type=text], .win-body input[type=password], .win-body textarea {
  font: inherit; font-size: 15.5px; width: 100%; padding: 7px 9px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; color: var(--ink);
}
.win-body textarea { resize: vertical; line-height: 1.45; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.row input[type=text] { flex: 1; min-width: 150px; }
.grp-err { color: #9a2a1a; font-size: 14.5px; min-height: 1em; margin: 8px 0 0; }

/* ---------- group panel ---------- */
.grp { padding: 4px 0 6px; }
.grp h3 { font-family: var(--fell-sc); font-weight: 400; font-size: 19px; color: var(--moss); margin: 14px 0 6px; }
.grp-empty { color: var(--ink-soft); font-style: italic; font-size: 15px; margin: 2px 0 6px; }
.grp-tile { display: block; width: 100%; max-width: 360px; margin: 10px auto 4px; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.grp-revealbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding: 8px 10px; border-radius: 4px; background: rgba(75,102,56,.1); border: 1px solid #b9bf9f; font-size: 15px; }
.grp-revealbar.on { background: rgba(217,177,59,.18); border-color: var(--gold); }
.grp-frames, .grp-notes { list-style: none; padding: 0; margin: 0; }
.grp-frames li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 15.5px; }
.grp-frames .who { font-weight: 700; }
.grp-frames .lbl { color: var(--ink-soft); }
.grp-frames .x { margin-left: auto; background: none; border: 0; font-size: 20px; line-height: 1; color: var(--ink-soft); cursor: pointer; padding: 0 6px; }
.grp-frames .x:hover { color: #9a2a1a; }
.sw { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 2px solid rgba(0,0,0,.35); flex: none; vertical-align: -3px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatches .sw { width: 26px; height: 26px; cursor: pointer; padding: 0; }
.swatches .sw.sel { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatches .custom { position: relative; overflow: hidden; background: conic-gradient(#e6c229, #e0592a, #c0283c, #7b4fd0, #2f7fd8, #17a8a0, #3e9b3a, #e6c229); }
.swatches .custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.grp-notes li { padding: 8px 0 10px; border-bottom: 1px solid #ccd0b5; }
.grp-notes .nh { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.grp-notes .who { font-weight: 700; font-size: 15px; }
.grp-notes .when { color: var(--ink-soft); }
.grp-notes .acts { margin-left: auto; display: flex; gap: 10px; }
.grp-notes .nt { white-space: pre-wrap; margin: 4px 0 0; overflow-wrap: anywhere; }
.grp-noteform { margin-top: 10px; }
.grp-wrap { margin: 10px 0 4px; border: 1px solid #b9bf9f; border-radius: 5px; background: rgba(255,255,255,.3); }
.grp-wrap > summary { cursor: pointer; padding: 8px 12px; font-family: var(--fell); font-size: 17px; color: var(--moss); }
.grp-wrap[open] > summary { border-bottom: 1px solid #ccd0b5; }
.grp-wrap > .grp { padding: 0 12px 12px; }
.win-body.grp-body { padding-top: 0; }
.swrow { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: -2px; }
.swrow .sw { width: 13px; height: 13px; border-width: 1.5px; }

/* account */
.acct label { display: block; margin: 10px 0 0; font-size: 15px; }
.acct label input { margin-top: 3px; }

/* ---------- login ---------- */
body.login { overflow: auto; display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, #2d3d29, var(--forest) 70%); }
.login-card { width: min(380px, 100%); background: var(--lichen); border-radius: 6px; padding: 26px 26px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5); border-top: 4px solid var(--gold); }
.login-card h1 { font-family: var(--fell-sc); font-weight: 400; color: var(--moss); font-size: 34px; margin: 0; }
.login-sub { color: var(--ink-soft); margin: 4px 0 16px; }
.login-card label { display: block; margin-bottom: 12px; font-size: 15px; }
.login-card input { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.login-card .btn { width: 100%; padding: 9px; font-size: 16px; margin-top: 4px; }

@media (max-width: 640px) {
  #userBtn, #playerViewBtn { display: none; }
}
.tbtn[hidden] { display: none; }
#groupBox[hidden] { display: none; }
#groupBox .grp-name { font-family: var(--fell); font-size: 16px; color: #efe9cf; padding: 2px 9px; border: 1px solid rgba(217,177,59,.45); border-radius: 12px; white-space: nowrap; }
#groupSel { font: inherit; font-size: 15px; color: #efe9cf; background: rgba(0,0,0,.25); border: 1px solid rgba(217,177,59,.55); border-radius: 4px; padding: 3px 6px; max-width: 230px; }
#groupSel option { color: #222; background: #f4f1e4; }
@media (max-width: 640px) { #groupBox .grp-name { display: none; } #groupSel { max-width: 120px; } }

.grp-revealbar { margin-top: 12px; }
.grp-revealbar .grp-err { flex-basis: 100%; margin: 0; min-height: 0; }
.grp-revealbar .grp-err:empty { display: none; }
.tabs[hidden] { display: none; }

/* ---------- party token ---------- */
.party-token { border-radius: 50%; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); cursor: pointer; }
body.role-dm .party-token { cursor: grab; }
.party-token.dragging { cursor: grabbing; filter: drop-shadow(0 10px 16px rgba(0,0,0,.65)); }
.party-token { transition: opacity .35s ease; }
.rb-btns { display: flex; gap: 6px; flex-wrap: wrap; }
#partyBtn img { border-radius: 50%; margin: -3px 0; }
.grp-here, .grp-revealbar .here { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--moss); }
.grp-here { margin: 12px 0 0; padding: 6px 10px; background: rgba(217,177,59,.18); border: 1px solid var(--gold); border-radius: 4px; }
.grp-here img, .grp-revealbar .here img { width: 28px; height: 28px; }
.grp-revealbar { flex-direction: column; align-items: stretch; }
.rb-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dparty { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px 10px; border-bottom: 1px solid #c4c8ae; }
.dparty-go { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font: inherit; font-size: 16px; }
.dparty-go img { width: 40px; height: 40px; }
.dparty-go .snip { display: block; font-size: 13.5px; color: var(--ink-soft); }

/* ---------- player's book ---------- */
.win.pbwin .win-bar { background: #a33b2c; border-bottom-color: #7c2a1f; }
.win.pbwin.top .win-bar { background: #b84634; }
.win.pbwin .win-tag { font-family: var(--body); font-size: 13px; font-weight: 600; color: #e9d9f0; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 3px; }
a.figref { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0; padding: 2px 9px 2px 6px; border: 1px solid #b9bf9f; border-radius: 4px; background: rgba(255,255,255,.35); color: var(--ink-soft); font-size: 14px; text-decoration: none; cursor: zoom-in; }
a.figref::before { content: ""; width: 14px; height: 11px; border: 1.5px solid currentColor; border-radius: 2px; background: linear-gradient(135deg, transparent 55%, currentColor 55% 62%, transparent 62%); }
a.figref:hover { border-color: var(--moss-2); color: var(--ink); }
a.figref .figimg { display: none; }
body.show-figs a.figref { display: block; padding: 0; border: 0; background: none; max-width: 100%; }
body.show-figs a.figref::before, body.show-figs a.figref .figlabel { display: none; }
body.show-figs a.figref .figimg { display: block; max-width: 100%; max-height: 420px; margin: .4em auto; }
.figtoggle { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #c4c8ae; font-size: 15px; cursor: pointer; }
.bktag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 3px; background: #5d4c66; color: #f1e6f6; font-size: 11.5px; vertical-align: 1px; }
.back-row { margin-top: 14px; padding-top: 8px; border-top: 1px dashed #b9bf9f; }
.back-row h4 { margin: 0 0 6px; font-family: var(--fell-sc); font-size: 16px; color: var(--ink-soft); font-weight: 400; }
.back-list { display: flex; flex-wrap: wrap; gap: 6px; }
.back-list button { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid #b9bf9f; border-radius: 4px; padding: 3px 8px; font: inherit; font-size: 13.5px; cursor: pointer; }
.back-list button:hover { border-color: var(--moss-2); background: rgba(75,102,56,.1); }
.back-list .bk { width: 8px; height: 8px; border-radius: 50%; }
.back-list .bk.cb { background: var(--moss-2); }
.back-list .bk.pb { background: #5d4c66; }
a.pbref { color: #5d3f6e; }
a.mbref { color: #8a3324; }
a.cbref { color: #2f5a3a; }
.win.mbwin .win-bar { background: #6b3326; border-bottom-color: #4a2219; }
.win.mbwin.top .win-bar { background: #81402f; }
.win.mbwin .win-tag { font-family: var(--body); font-size: 13px; font-weight: 600; color: #f6e2d9; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 3px; }
.bktag.mb { background: #81402f; color: #fbeee8; }
.back-list .bk.mb { background: #81402f; }
.tabs button { font-size: 15.5px; }
.win-body thead:not(:has(th:not(:empty))) { display: none; }

/* collapsible table of contents */
.toc-tools { display: flex; gap: 14px; padding: 4px 14px 2px; }
.toc-head { display: flex; align-items: stretch; }
.toc-head .lvl1 { flex: 1; margin-top: 0 !important; padding-left: 4px !important; display: flex; justify-content: space-between; }
.toc-tog, .toc-tog-sp { flex: none; width: 30px; }
.toc-tog { background: none; border: 0; cursor: pointer; color: var(--moss); display: grid; place-items: center; }
.toc-tog::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.toc-tog[aria-expanded="true"]::before { transform: rotate(45deg); }
.toc-tog:hover { background: rgba(75,102,56,.14); }
.toc-part { border-bottom: 1px solid rgba(0,0,0,.06); }
.toc-n { font-family: var(--body); font-size: 12.5px; color: var(--ink-soft); align-self: center; }
.toc-sub { padding-bottom: 6px !important; }
.toc-sub .lvl2 { padding-left: 34px; }
@media (prefers-reduced-motion: reduce) { .toc-tog::before { transition: none; } }
.dlist .toc-tog { width: 30px; padding: 0; display: grid; place-items: center; }
.dlist .toc-tools button { width: auto; padding: 2px 0; font-size: 13.5px; }

/* ---------- drawer tabs wrap when there are many ---------- */
.tabs { flex-wrap: wrap; }
.tabs button { flex: 1 1 30%; }

/* ---------- character sheets ---------- */
.win.charwin .win-bar { background: #5a3a24; border-bottom-color: #3e2716; }
.win.charwin.top .win-bar { background: #6d4a2f; }
.win.charwin .win-tag { font-size: 14px; }
.win-body.cs-wrap { padding-top: 0; }
.cs-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 -22px; padding: 8px 22px; background: var(--lichen-2); border-bottom: 1px solid #b9bf9f; font-size: 14.5px; }
.cs-bar .sp { flex: 1; }
.cs-bar select { font: inherit; padding: 4px 6px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.cs-saved, .cs-hint, .cs-owner { color: var(--ink-soft); font-size: 13.5px; }
.cs-owner { font-weight: 700; color: var(--ink); }
.btn.danger { color: #8b2416; border-color: #c9a59c; }
.btn.danger:hover { background: #f6e3de; border-color: #8b2416; }
.charform { padding-bottom: 20px; }
.cs-sec { margin-top: 12px; border: 1px solid #c4c8ae; border-radius: 5px; background: rgba(255,255,255,.28); }
.cs-sec > summary { cursor: pointer; padding: 7px 12px; font-family: var(--fell-sc); font-size: 19px; color: #5a3a24; }
.cs-sec[open] > summary { border-bottom: 1px solid #d3d6c0; }
.cs-body { padding: 10px 12px 12px; }
.cs-body h4 { font-family: var(--fell); font-weight: 400; font-size: 16px; color: var(--ink-soft); margin: 12px 0 4px; }
.cs-grid { display: grid; gap: 8px 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cs-grid.id { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cs-grid.id .wide { grid-column: span 2; }
.cs-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cs-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cs-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cs-grid + .cs-grid { margin-top: 8px; }
.cf { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cfl { font-size: 12.5px; color: var(--ink-soft); }
.cfl:empty { display: none; }
.cfh { font-size: 11.5px; color: #8a8f78; font-style: italic; }
.charform input[type=text], .charform textarea { font: inherit; font-size: 15px; width: 100%; padding: 5px 7px; border: 1px solid #a9af8f; border-radius: 3px; background: #fbfcf4; color: var(--ink); }
.charform input[type=text]:focus, .charform textarea:focus { border-color: #5a3a24; outline: 2px solid rgba(217,177,59,.5); outline-offset: 0; }
.charform textarea { resize: vertical; line-height: 1.4; }
.cs-abil { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cs-abil .ab { border: 1px solid #c4c8ae; border-radius: 4px; padding: 6px; background: #f3f4e7; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.cs-abil .abn { grid-column: span 2; font-family: var(--fell); font-size: 15px; text-align: center; color: #5a3a24; }
.cs-abil input { text-align: center; font-size: 17px !important; font-weight: 700; }
.cs-enc { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.cf.chk { flex-direction: row-reverse; align-items: center; gap: 6px; }
.cf.chk .cfl { font-size: 14.5px; color: var(--ink); }
.itm { display: grid; grid-template-columns: 1fr 64px; gap: 6px; margin-bottom: 5px; }
.cs-total { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; max-width: 320px; }
.chars-head { padding: 10px 14px; border-bottom: 1px solid #c4c8ae; }
.chars-head .btn { width: 100%; }
.charitem .cn { font-weight: 700; }
.charitem.st-dead .cn { text-decoration: line-through; text-decoration-color: rgba(139,36,22,.6); }
.charitem.st-archived .cn, .charitem.st-dead .cn { color: var(--ink-soft); }
@media (max-width: 640px) {
  .cs-grid.id, .cs-grid.four, .cs-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-grid.three, .cs-grid.two { grid-template-columns: 1fr; }
  .cs-abil { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cs-bar { margin: 0 -14px; padding: 8px 14px; }
}
.charform select { font: inherit; font-size: 15px; width: 100%; padding: 4px 5px; border: 1px solid #a9af8f; border-radius: 3px; background: #fbfcf4; color: var(--ink); }
.cf-pb { margin-left: 6px; font-size: 11.5px; }

/* DM account list */
.users h3 { font-family: var(--fell-sc); font-weight: 400; color: var(--moss); margin: 22px 0 2px; font-size: 20px; }
.userlist { list-style: none; padding: 0; margin: 8px 0 0; }
.userlist li { padding: 8px 0 10px; border-bottom: 1px solid #ccd0b5; }
.userlist li.locked { background: rgba(192,40,60,.07); }
.userlist .uh { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.userlist .role { font-size: 13px; color: var(--ink-soft); }
.lockbadge { font-size: 12.5px; font-weight: 700; color: #fff; background: #a3283a; padding: 1px 7px; border-radius: 3px; }
.userlist .uh .btn { margin-left: auto; padding: 3px 10px; font-size: 14px; }
.userlist .row input { flex: 1; min-width: 160px; }

/* ---------- calendar ---------- */
#calBtn.static { cursor: default; }
#calBtn.static:hover { border-color: rgba(239,233,207,.28); color: #efe9cf; }
.win.calwin .win-bar { background: #2f3f55; border-bottom-color: #1f2a39; }
.win.calwin.top .win-bar { background: #3b4f6a; }
.win-body.cal-wrap { padding-top: 0; }
.cal-today { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 -22px; padding: 10px 22px; background: #dfe3d4; border-bottom: 1px solid #b9bf9f; }
.ct-date { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 200px; }
.ct-wd { font-family: var(--fell-sc); font-size: 18px; color: #2f3f55; }
.ct-d { font-family: var(--fell); font-size: 26px; color: var(--ink); }
.ct-y { font-size: 15px; color: var(--ink-soft); }
.ct-nav { display: flex; gap: 6px; }
.ct-set { flex-basis: 100%; font-size: 14px; }
.ct-set summary { cursor: pointer; color: var(--ink-soft); }
.cal-dateform { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.cal-dateform select, .cal-dateform input, .cal-day select, .cal-day input[type=text], .cal-day textarea, .cal-filter {
  font: inherit; font-size: 15px; padding: 5px 7px; border: 1px solid #a9af8f; border-radius: 3px; background: #fbfcf4; color: var(--ink); }
.cal-dateform input { width: 5.5em; }
.cal-start { padding: 24px 0; }
.cal-start h3 { font-family: var(--fell); font-weight: 400; font-size: 24px; color: #2f3f55; margin: 0 0 6px; }
.cal-day { margin-top: 14px; padding: 12px 14px; border: 1px solid #c4c8ae; border-radius: 5px; background: rgba(255,255,255,.3); }
.cal-day.is-today { border-color: #6f86a8; box-shadow: inset 4px 0 0 #6f86a8; }
.cd-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cd-head h3 { margin: 0; font-family: var(--fell); font-weight: 400; font-size: 21px; color: #2f3f55; flex: 1; }
.cal-day .badge { background: #3b4f6a; color: #fff; font-size: 12.5px; padding: 1px 8px; border-radius: 3px; }
.cd-meta { margin: 4px 0 10px; font-size: 14px; color: var(--ink-soft); }
.cd-meta .feast { color: #7a3d0c; font-weight: 700; }
.cd-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; margin: 8px 0; }
.cd-row.col { grid-template-columns: 1fr; }
.cd-row .cfl { font-size: 13.5px; }
.cal-hexes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #c4c8ae; border-radius: 4px; padding: 1px 2px 1px 4px; background: #f3f4e7; }
.chip .x { background: none; border: 0; cursor: pointer; color: var(--ink-soft); font-size: 16px; line-height: 1; padding: 0 4px; }
.chip .x:hover { color: #9a2a1a; }
.cd-weather { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cd-weather input { flex: 1; min-width: 160px; }
.cd-fx { margin: -2px 0 4px 98px; padding-left: 1.1em; font-size: 13.5px; color: #7a3d0c; }
.cd-roll { margin: 0 0 0 98px; font-size: 13px; color: var(--ink-soft); min-height: 0; }
.cd-roll:empty { display: none; }
.cal-day textarea { width: 100%; resize: vertical; line-height: 1.45; }
.danger-lnk { color: #8b2416; }
.cal-grid { margin-top: 14px; }
.cg-nav { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.cg-nav b { font-family: var(--fell); font-weight: 400; font-size: 19px; }
.cg-nav .lnk { font-size: 22px; text-decoration: none; padding: 0 6px; }
.cg-nav .cfh { flex: 1; }
.cg-wk, .cg-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cg-wk span { font-size: 11.5px; color: var(--ink-soft); text-align: center; }
.cg-wys { display: flex; gap: 3px; margin-top: 3px; }
.cg-wys .cg-d { flex: 1; }
.cg-d { position: relative; min-height: 44px; padding: 3px 4px; border: 1px solid #cfd3bd; border-radius: 3px; background: #f7f8ee; cursor: pointer; text-align: left; font: inherit; display: flex; flex-direction: column; justify-content: space-between; }
.cg-d:hover { border-color: #6f86a8; }
.cg-d .n { font-size: 13.5px; }
.cg-d.wys { background: #ece6d6; }
.cg-d.wys .n { font-size: 12px; font-style: italic; }
.cg-d .h { font-size: 11.5px; font-weight: 700; color: #6d520a; }
.cg-d.has { background: #eef1e2; border-color: #9fb07f; }
.cg-d.feast::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #b5651d; }
.cg-d.today { box-shadow: inset 0 0 0 2px #3b4f6a; }
.cg-d.sel { background: #d6dfee; }
.cal-logwrap { margin-top: 14px; border-top: 1px solid #c4c8ae; padding-top: 6px; }
.cal-logwrap summary { cursor: pointer; font-family: var(--fell-sc); font-size: 18px; color: #2f3f55; }
.cal-filter { width: 100%; margin: 8px 0; }
.cal-log { list-style: none; padding: 0; margin: 0; }
.cal-log button { display: grid; grid-template-columns: 9.5em 7em 1fr; gap: 2px 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid #dde0cc; padding: 6px 2px; cursor: pointer; font: inherit; font-size: 14px; }
.cal-log button:hover, .cal-log button.sel { background: rgba(111,134,168,.12); }
.cal-log .lh { font-weight: 700; color: #6d520a; }
.cal-log .ln { grid-column: 1 / -1; color: var(--ink-soft); font-size: 13px; }
.cal-visits { margin-top: 8px; font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.grp-notes .gday { font-weight: 700; color: #2f3f55; font-size: 13.5px; }
@media (max-width: 640px) {
  .cal-today { margin: 0 -14px; padding: 8px 14px; }
  .cd-row { grid-template-columns: 1fr; }
  .cd-fx, .cd-roll { margin-left: 0; }
  .cal-log button { grid-template-columns: 1fr 1fr; }
  .ct-date .ct-wd { display: none; }
}

.newuser .row input[type=text], .newuser .row input[type=password] { flex: 1; min-width: 130px; font: inherit; font-size: 15px; padding: 6px 8px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.newuser select { font: inherit; font-size: 15px; padding: 5px 6px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.newuser .cfh { margin: 6px 0 0; }
.userlist .uacts { margin-left: auto; display: flex; gap: 12px; }
.userlist .uh .btn + .uacts { margin-left: 10px; }
.win-body .loading { color: var(--ink-soft); font-style: italic; padding: 12px 0; }

/* ---------- play groups in the accounts window ---------- */
.gcard { border: 1px solid #c3c8a8; border-radius: 6px; padding: 8px 12px 10px; margin: 12px 0; background: rgba(255,255,255,.35); }
.gcard.current { border-color: var(--moss); box-shadow: inset 3px 0 0 var(--moss); }
.gcard .gh { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gcard .gh h3 { margin: 0; }
.gcard .gh .uacts { margin-left: auto; display: flex; gap: 12px; }
.gcard .members li { padding: 5px 0; }
.gcard .members select { font: inherit; font-size: 14px; padding: 2px 4px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.gcard form.row { margin-top: 8px; }
.adminbadge { font-size: 12px; padding: 0 6px; border-radius: 3px; background: var(--moss); color: #f4f1e4; }
.users > .grp-err.umsg { min-height: 1.2em; }
.newuser.row input[type=text], .newuser.row input[type=password], .gcard form.row input[type=text] { flex: 1; min-width: 120px; font: inherit; font-size: 15px; padding: 5px 8px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.newuser.row select { font: inherit; font-size: 15px; padding: 4px 6px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }

/* ---------- the DM's own notes ---------- */
.grp.dmnotes { background: #ece3d6; border: 1px solid #c9b79c; border-left: 4px solid #81402f; border-radius: 5px; padding: 2px 12px 8px; margin: 12px 0; }
.grp.dmnotes h3 { color: #6b3326; display: flex; align-items: baseline; gap: 8px; }
.secret-tag { font-family: var(--body); font-size: 12px; padding: 0 6px; border-radius: 3px; background: #81402f; color: #fbeee8; letter-spacing: .02em; }
.notepin.dm span { background: #81402f; color: #fbeee8; border-color: #f0d9cf; }

/* ---------- notes overview ---------- */
.nov-wrap { display: flex; flex-direction: column; padding: 0 !important; }
.nov-bar { position: sticky; top: 0; z-index: 2; background: var(--lichen-2); border-bottom: 1px solid #b9bf9f; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.nov-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.nov-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 6px; border-radius: 14px; border: 1px solid #9ea583; background: #f7f8ee; font-size: 14px; cursor: pointer; }
.nov-chip.dm { border-color: #81402f; } .nov-chip.cal { border-color: #2f3f55; }
.nov-q { flex: 1; min-width: 160px; font: inherit; font-size: 15px; padding: 5px 8px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.nov-acts { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.nov-old { font-size: 14px; display: inline-flex; gap: 4px; align-items: center; }
.nov-list { padding: 4px 16px 24px; overflow: auto; }
.nov-sum { color: var(--ink-soft); font-size: 14px; margin: 8px 0 0; }
.nov-day { font-family: var(--fell-sc); font-weight: 400; font-size: 18px; color: var(--moss); margin: 18px 0 6px; border-bottom: 1px solid #c3c8a8; padding-bottom: 2px; }
.nov-day .lnk { font: inherit; color: inherit; }
.nov-day.today { color: #2f3f55; }
.nov-item { padding: 7px 10px 8px; margin: 6px 0; border-radius: 5px; border-left: 4px solid var(--moss); background: rgba(255,255,255,.4); }
.nov-item.dm { border-left-color: #81402f; background: rgba(129,64,47,.07); }
.nov-item.cal { border-left-color: #2f3f55; background: rgba(47,63,85,.07); }
.nov-item .nh { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.nov-item .when { color: var(--ink-soft); margin-left: auto; }
.nov-type { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.nov-item.dm .nov-type { color: #81402f; } .nov-item.cal .nov-type { color: #2f3f55; }
.nov-hex { font: 700 13px/1 var(--body); padding: 2px 6px; border-radius: 3px; border: 1px solid #9ea583; background: #f7f8ee; cursor: pointer; color: var(--ink); }
.nov-hex:hover { border-color: var(--moss); background: #fff; }
.nov-item .nt, .nov-weather { white-space: pre-wrap; margin: 4px 0 0; overflow-wrap: anywhere; }
.nov-weather { font-style: italic; color: #2f3f55; }
@media (max-width: 640px) { #notesBtn { font-size: 0; gap: 0; } }

/* ---------- terrain types (Player's Book, Travel): three columns with their rules underneath ---------- */
.win-body .tt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: .6em 0 1.2em; align-items: start; }
.win-body .tt-grid table.terrain { margin: 0; }
.win-body table.terrain td:first-child { white-space: nowrap; }
.win-body table.terrain th { text-align: left; }
.win-body table.terrain tr.tt-rule td { background: #e3e6d3; border-color: #b9bf9f; font-size: 14px; }
.win-body table.terrain tr.tt-rule.first td { border-top: 2px solid var(--moss); }
.win-body table.terrain tr.tt-rule td:first-child { white-space: normal; }
.win-body table.terrain tr.tt-rule td:last-child:not([colspan]) { text-align: center; }

/* ---------- Player's Book table of contents: parts with entries and dotted page leaders ---------- */
.win-body .ptoc { columns: 2 300px; column-gap: 32px; margin: .6em 0 1.4em; }
.win-body .ptoc-part { break-inside: avoid; margin: 0 0 1.3em; }
.win-body .ptoc a { box-shadow: none; }
.win-body a.ptoc-head { display: flex; align-items: baseline; gap: 14px; padding: 0 0 4px; margin-bottom: 6px; border-bottom: 1.5px solid #b5654f; color: #5b3a2a; text-decoration: none; }
.win-body a.ptoc-head .pn { font-family: var(--body); font-weight: 700; font-size: 19px; color: #c0583d; min-width: 2.2em; }
.win-body a.ptoc-head .t { font-family: var(--body); font-weight: 800; font-size: 16px; letter-spacing: .06em; text-transform: uppercase; }
.win-body a.ptoc-head:hover .t { color: var(--ley); }
.win-body .ptoc ul { list-style: none; margin: 0; padding: 0 0 0 calc(2.2em + 14px); max-width: none; }
.win-body .ptoc li { display: flex; align-items: baseline; margin: 0; line-height: 1.45; font-size: 15.5px; }
.win-body .ptoc li.sub { margin-left: 1.1em; }
.win-body .ptoc li a { color: var(--ink); }
.win-body .ptoc li a:hover { color: var(--ley); background: none; }
.win-body .ptoc li .pn { margin-left: auto; padding-left: .3em; font-variant-numeric: tabular-nums; }
.win-body .ptoc li a::after { content: ""; }
.win-body .ptoc li::after { content: none; }
.win-body .ptoc li .pn::before { content: ""; }
.win-body .ptoc li { background-image: radial-gradient(circle, #8a8f78 .8px, transparent 1.1px); background-size: 5px 4px; background-repeat: repeat-x; background-position: 0 calc(100% - 4px); }
.win-body .ptoc li a, .win-body .ptoc li .pn { background: var(--lichen); }
.win-body .ptoc li a { padding-right: .3em; }
@media (max-width: 640px) { .win-body .ptoc ul { padding-left: 1em; } }

/* ---------- adventures (Winter's Daughter): the book's own look ---------- */
.win.advwin { --wd-teal: #1b8184; --wd-teal-2: #52979b; --wd-teal-3: #dde9e8; --wd-brown: #552d17; --wd-brown-2: #ecdcd2; --wd-paper: #fffdf8; }
.win.advwin .win-bar { background: var(--wd-teal); border-bottom-color: #136265; }
.win.advwin.top .win-bar { background: #20959a; }
.win.advwin .win-tag { font-family: var(--body); font-size: 13px; font-weight: 600; color: #e9f6f5; background: rgba(255,255,255,.14); padding: 1px 7px; border-radius: 3px; }
.win.advwin .win-body { background: var(--wd-paper); color: #231f20; font-family: "Noto Serif", Georgia, serif; font-size: 15px; line-height: 1.55; padding: 4px 26px 36px; }
.win.advwin .win-body p { max-width: none; margin: .45em 0 .6em; }
.win.advwin .win-body strong { font-weight: 700; color: inherit; }
.win.advwin .win-body .pgmark { color: #9aa8a6; border-top-color: #e3e8e6; }
.win.advwin .win-body h2 { font-family: "Uncial Antiqua", var(--fell); font-weight: 400; color: var(--wd-teal); font-size: 40px; line-height: 1.15; text-align: center; margin: .4em 0 .5em; padding-bottom: 8px; border-bottom: 4px double var(--wd-teal-2); }
.win.advwin .win-body a.ref, .win.advwin .win-body a.hexref { color: var(--wd-teal); }

/* numbered area bars */
.win.advwin h3.wd-area { display: flex; align-items: center; gap: 12px; margin: 1.6em 0 .7em; padding: 0 16px 0 0; min-height: 38px; background: var(--wd-teal-2); color: #fff; border-radius: 4px 20px 20px 4px; font-family: var(--body); font-weight: 800; font-size: 19px; letter-spacing: .03em; text-transform: uppercase; border: 0; }
.win.advwin h3.wd-area .no { flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin: -1px 0 -1px -6px; border-radius: 50%; background: var(--wd-teal); color: #fff; font-size: 19px; box-shadow: 0 0 0 3px var(--wd-paper); }
.win.advwin h4.wd-h3, .win.advwin h3.wd-h2 { font-family: var(--body); font-weight: 800; color: var(--wd-brown); font-size: 21px; margin: 1.1em 0 .35em; letter-spacing: 0; text-transform: none; }
.win.advwin h3.wd-h2 { color: var(--wd-teal); font-size: 22px; text-transform: uppercase; letter-spacing: .02em; }
.win.advwin h4.wd-h3 a { color: inherit; text-decoration: underline; text-decoration-color: rgba(85,45,23,.35); }

/* tinted description boxes: "Stone blocks (walls…). Musty (…)." */
.win.advwin .wd-desc { background: var(--wd-teal-3); border-left: 5px solid var(--wd-teal-2); border-radius: 0 8px 8px 0; padding: 7px 12px; margin: .4em 0 .8em; }

/* random events */
.win.advwin .wd-events { margin: .6em 0 1.2em; }
.win.advwin .wd-events-h { font-family: var(--body); font-weight: 800; font-size: 19px; color: var(--wd-teal-2); text-transform: uppercase; letter-spacing: .02em; padding: 0 0 4px 34px; position: relative; border-bottom: 1px solid #c9dcda; }
.win.advwin .wd-events-h::before { content: "▲"; position: absolute; left: 2px; top: 1px; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--wd-teal); color: var(--wd-teal); font-size: 11px; display: grid; place-items: center; box-sizing: border-box; }
.win.advwin .wd-events-h small { font-size: 14px; text-transform: none; letter-spacing: 0; }
.win.advwin .wd-events ol { list-style: none; margin: 0; padding: 0; max-width: none; border-left: 26px solid var(--wd-teal-2); border-radius: 0 0 0 13px; }
.win.advwin .wd-events li { display: flex; gap: 10px; margin: 0; padding: 5px 4px 5px 0; border-bottom: 1px solid #dfe7e6; position: relative; }
.win.advwin .wd-events li .n { position: absolute; left: -26px; width: 26px; text-align: center; color: #fff; font-family: var(--body); font-weight: 800; }
.win.advwin .wd-events li > div { padding-left: 10px; }

/* stat blocks */
.win.advwin .wd-stat { border: 2px solid var(--wd-brown); border-radius: 10px; overflow: hidden; margin: 1em 0 1.2em; background: var(--wd-paper); max-width: 460px; }
.win.advwin .wd-stat-h { background: var(--wd-brown); color: #fff; text-align: center; font-family: var(--body); font-weight: 800; font-variant: small-caps; font-size: 21px; letter-spacing: .04em; padding: 3px 10px 4px; }
.win.advwin .wd-stat-sub { text-align: center; font-family: "Noto Serif", serif; font-stretch: 62.5%; font-weight: 700; text-transform: uppercase; font-size: 13.5px; color: var(--wd-brown); padding: 3px 8px; border-bottom: 1px solid #d8c3b6; }
.win.advwin .wd-stat-sub span { color: #b0907e; padding: 0 2px; }
.win.advwin .wd-stat-stats { background: var(--wd-brown-2); padding: 6px 12px; border-bottom: 1px solid #d8c3b6; }
.win.advwin .wd-stat-stats strong { color: var(--wd-brown); }
.win.advwin .wd-stat p { margin: .45em 12px; }

/* illustrations and maps */
.win.advwin figure.wd-fig { margin: 1em 0; text-align: center; }
.win.advwin figure.wd-fig img { max-width: 100%; height: auto; border-radius: 3px; cursor: zoom-in; }
.win.advwin figure.wd-fig:not(.wide):not(.page) img { max-width: min(100%, 360px); }
.win.advwin figure.wd-fig.page img { box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.win.advwin figure.wd-fig.page:not(.spread) img { max-width: min(100%, 440px); }

/* title page and contents */
.win.advwin .wd-title { font-family: "Uncial Antiqua", var(--fell); color: var(--wd-teal); font-size: 34px; text-align: center; margin: .8em 0 .1em; }
.win.advwin .wd-subtitle, .win.advwin .wd-authors { text-align: center; color: var(--wd-brown); }
.win.advwin ul.wd-toc { list-style: none; padding: 0; margin: .5em 0 1.4em; max-width: 520px; }
.win.advwin ul.wd-toc li { display: flex; align-items: baseline; line-height: 1.6; background-image: radial-gradient(circle, #9aa8a6 .8px, transparent 1.1px); background-size: 5px 4px; background-repeat: repeat-x; background-position: 0 calc(100% - 5px); }
.win.advwin ul.wd-toc li.top { font-family: var(--body); font-weight: 800; text-transform: uppercase; color: var(--wd-teal); margin-top: .5em; letter-spacing: .02em; }
.win.advwin ul.wd-toc li.sub { margin-left: 1.4em; }
.win.advwin ul.wd-toc li a, .win.advwin ul.wd-toc li .pn { background: var(--wd-paper); }
.win.advwin ul.wd-toc li a { padding-right: .3em; color: inherit; }
.win.advwin ul.wd-toc li .pn { margin-left: auto; padding-left: .3em; }

.bktag.adv { background: #1b8184; color: #effaf9; }
.back-list .bk.adv { background: #1b8184; }
@media (max-width: 640px) { .win.advwin .win-body { padding: 4px 14px 30px; } .win.advwin .win-body h2 { font-size: 30px; } }

/* ---------- the core books (Campaign, Player's and Monster Book): their house style ----------
   red Winona-style titles, IM Fell lede, orange caps headings, brown sub-headings, brown table
   bars with salmon rows, red stat labels, cream stat boxes. Fonts: Uncial Antiqua (for Winona),
   Alegreya (for Alverata), Alegreya Sans (as in the books), Source Serif 4 (for TheAntiqua). */
.win.corebook { --bk-red: #d54134; --bk-red-2: #dd6d54; --bk-label: #d2232a; --bk-brown: #562e19; --bk-bar: #86604d; --bk-row: #ebdfd8; --bk-cream: #f5eedf; --bk-paper: #fffdf9; }
.win.cbwin .win-bar { background: #5a3a28; border-bottom-color: #3e271a; }
.win.cbwin.top .win-bar { background: #6e4732; }
.win.corebook .win-body { background: var(--bk-paper); color: #1f1b18; font-family: "Source Serif 4", "Iowan Old Style", Georgia, serif; font-size: 15.5px; line-height: 1.55; }
.win.corebook .win-body p { max-width: 70ch; }
.win.corebook .win-body h1, .win.corebook .win-body h2 { font-family: "Uncial Antiqua", var(--fell); font-weight: 400; color: var(--bk-red); text-align: center; border: 0; line-height: 1.15; letter-spacing: 0; text-transform: none; }
.win.corebook .win-body h1 { font-size: 30px; margin: .6em 0 .2em; }
.win.corebook .win-body h2 { font-size: 36px; margin: .4em 0 .25em; }
.win.corebook .win-body p.lede { font-family: var(--fell); font-size: 18.5px; line-height: 1.4; text-align: center; margin: 0 auto 1em; max-width: 60ch; padding-bottom: .55em; border-bottom: 2px solid var(--bk-red-2); }
.win.corebook .win-body h3 { font-family: var(--body); font-weight: 800; color: var(--bk-red-2); text-transform: uppercase; letter-spacing: .03em; font-size: 20px; margin: 1.2em 0 .35em; border: 0; }
.win.corebook .win-body h4 { font-family: var(--body); font-weight: 800; color: var(--bk-brown); font-size: 18.5px; margin: 1em 0 .3em; border: 0; text-transform: none; letter-spacing: 0; }
.win.corebook .win-body p.dropcap::first-letter { float: left; font-family: var(--fell); color: var(--bk-label); font-size: 3.3em; line-height: .82; padding: .06em .08em 0 0; }

/* tables: the title becomes the dark header bar */
.win.corebook .win-body .tblhead { width: 100%; box-sizing: border-box; max-width: 640px !important; background: var(--bk-bar); color: #fff; font-family: "Alegreya Sans", var(--body); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; text-align: center; margin: 1.3em 0 0; padding: 4px 10px; border-radius: 5px 5px 0 0; max-width: 72ch; }
.win.corebook .win-body table.booktbl { border-collapse: collapse; margin: .5em 0 1.2em; font-size: 14.5px; border: 0; max-width: 640px; }
.win.corebook .win-body .tblhead + table.booktbl { margin-top: 0; width: 100%; }
.win.corebook .win-body table.booktbl th { background: var(--bk-bar); color: #fff; font-family: "Alegreya Sans", var(--body); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; border: 0; padding: 3px 8px; text-align: left; }
.win.corebook .win-body .tblhead + table.booktbl th { background: #a7887a; }
.win.corebook .win-body table.booktbl td { border: 0; padding: 3px 8px; vertical-align: top; }
.win.corebook .win-body table.booktbl tbody tr:nth-child(even) td { background: var(--bk-row); }
.win.corebook .win-body table.booktbl td:first-child strong { color: var(--bk-label); }

/* stat blocks */
.win.corebook .win-body .statblock { background: var(--bk-cream); border-top: 2px solid var(--bk-red-2); border-bottom: 2px solid var(--bk-red-2); padding: 6px 12px 4px; margin: .7em 0 1em; max-width: 70ch; }
.win.corebook .win-body .statblock p { margin: 0 0 .25em; }
.win.corebook .win-body .statblock p.stattags { font-family: var(--body); font-weight: 800; font-size: 13.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--bk-brown); margin-bottom: .35em; }
.win.corebook .win-body .statblock p.stattags em { font-style: normal; }
.win.corebook .win-body .statblock strong { color: var(--bk-label); font-weight: 800; }
.win.corebook .win-body h4.stathead { color: var(--bk-red-2); text-transform: uppercase; font-size: 16px; letter-spacing: .04em; margin-bottom: 0; }
.win.corebook .win-body h4.stathead + .statblock { margin-top: .3em; }
.win.corebook .win-body .pgmark { color: #b3a79c; }
@media (max-width: 640px) { .win.corebook .win-body h2 { font-size: 28px; } .win.corebook .win-body p.lede { font-size: 16.5px; } }
.win.corebook .win-body p.partquote { font-style: italic; font-size: 17px; line-height: 1.5; max-width: 60ch; margin: .6em auto .3em; }
.win.corebook .win-body p.partquote::first-letter { color: var(--bk-label); font-family: var(--fell); font-style: normal; font-size: 2.6em; float: left; line-height: .85; padding-right: .06em; }
.win.corebook .win-body p.attrib { text-align: right; max-width: 60ch; margin: 0 auto 1.2em; font-family: var(--fell); color: var(--bk-brown); }
/* the DM's notes and the group panel keep their own look inside book windows */
.win.corebook .win-body .grp h3 { font-family: var(--body); font-size: 18px; letter-spacing: 0; text-transform: none; color: var(--moss); margin: .6em 0 .3em; }
.win.corebook .win-body .grp.dmnotes h3 { color: #6b3326; }

/* ---------- character sheet in the Player's Book style ---------- */
.win.charwin { --bk-red: #d54134; --bk-red-2: #dd6d54; --bk-label: #d2232a; --bk-brown: #562e19; --bk-bar: #86604d; --bk-row: #ebdfd8; --bk-cream: #f5eedf; --bk-paper: #fffdf9; --bk-line: #d9c7ba; }
.win.charwin .win-bar { background: #a33b2c; border-bottom-color: #7c2a1f; }
.win.charwin.top .win-bar { background: #b84634; }
.win.charwin .win-tag { color: #fbe9e4; background: rgba(255,255,255,.14); padding: 1px 7px; border-radius: 3px; font-family: "Alegreya Sans", var(--body); font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.win.charwin .win-body { background: var(--bk-paper); color: #1f1b18; font-family: "Source Serif 4", "Iowan Old Style", Georgia, serif; }
.win.charwin .cs-bar { background: var(--bk-cream); border-bottom: 2px solid var(--bk-red-2); font-family: var(--body); }
.win.charwin .cs-bar select, .win.charwin .charform select, .win.charwin .charform input[type=text], .win.charwin .charform textarea {
  background: #fff; border: 1px solid #cdb9ab; border-radius: 3px; color: #1f1b18; font-family: "Source Serif 4", Georgia, serif; }
.win.charwin .charform input[type=text]:focus, .win.charwin .charform textarea:focus, .win.charwin .charform select:focus {
  border-color: var(--bk-label); outline: 2px solid rgba(213,65,52,.22); outline-offset: 0; }
.win.charwin .btn.primary { background: #a33b2c; border-color: #7c2a1f; color: #fff; }
.win.charwin .btn.primary:hover { background: #b84634; }

/* sections: a dark brown title bar, like the book's table headers */
.win.charwin .cs-sec { border: 1px solid var(--bk-line); border-radius: 6px; background: #fff; overflow: hidden; margin-top: 14px; }
.win.charwin .cs-sec > summary { background: var(--bk-bar); color: #fff; font-family: "Alegreya Sans", var(--body); font-weight: 800; font-size: 15.5px; letter-spacing: .07em; text-transform: uppercase; padding: 6px 12px; }
.win.charwin .cs-sec > summary::marker { color: #f0d9cc; }
.win.charwin .cs-sec[open] > summary { border-bottom: 0; }
.win.charwin .cs-sec > summary:hover { background: #95705d; }
.win.charwin .cs-body { padding: 12px 14px 14px; }
.win.charwin .cs-body h4 { font-family: var(--body); font-weight: 800; color: var(--bk-red-2); text-transform: uppercase; letter-spacing: .04em; font-size: 15px; margin: 16px 0 6px; padding-bottom: 2px; border-bottom: 1px solid #efd9cf; }

/* field labels: small caps sans, as printed on the sheet */
.win.charwin .cfl { font-family: "Alegreya Sans", var(--body); font-weight: 800; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--bk-brown); }
.win.charwin .cfh { font-family: var(--fell); color: #8f7a6c; font-size: 12.5px; }
.win.charwin .cf.chk .cfl { font-size: 13px; }
.win.charwin .cf-pb { color: var(--bk-red); }

/* ability scores: cream cards with the name in red */
.win.charwin .cs-abil .ab { background: var(--bk-cream); border: 1px solid var(--bk-line); border-top: 3px solid var(--bk-red-2); border-radius: 4px; }
.win.charwin .cs-abil .abn { font-family: var(--body); font-weight: 800; font-size: 16px; color: var(--bk-red); }
.win.charwin .cs-abil .cfl { text-align: center; font-size: 10.5px; }
.win.charwin .cs-abil input { font-family: "Source Serif 4", Georgia, serif; font-size: 19px !important; }

/* ---------- VTT maps with fog of war ---------- */
.win.vttwin .win-bar { background: #2f3f55; border-bottom-color: #1f2a3a; }
.win.vttwin.top .win-bar { background: #3b4f6a; }
.win.vttwin.vtt-live .win-bar { box-shadow: inset 0 -3px 0 #d9b13b; }
.win.vttwin .win-tag { color: #e6edf7; background: rgba(255,255,255,.14); padding: 1px 7px; border-radius: 3px; font-size: 13px; }
.win-body.vtt-body { display: flex; flex-direction: column; padding: 0 !important; overflow: hidden; }
.vtt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; background: var(--lichen-2); border-bottom: 1px solid #b9bf9f; font-size: 14.5px; }
.vtt-bar .sp { flex: 1; }
.vtt-tools { display: inline-flex; }
.vtt-tools .btn { border-radius: 0; margin-left: -1px; padding: 4px 10px; }
.vtt-tools .btn:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.vtt-tools .btn:last-child { border-radius: 0 4px 4px 0; }
.vtt-tools .btn[aria-pressed="true"] { background: #2f3f55; color: #fff; border-color: #2f3f55; }
.vtt-brush select { font: inherit; padding: 3px 5px; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; }
.vtt-state { color: var(--ink-soft); font-size: 13.5px; }
.vtt-map { flex: 1; min-height: 240px; background: #1b1d22; }
.vtt-map.painting, .vtt-map.painting .leaflet-interactive { cursor: crosshair; }
.vtt-map.painting { touch-action: none; }
.vtt-fog { fill: rgba(16, 20, 30, .62); }
.vtt-blank { fill: #e9e4d6; }
.dlist li.dsub { position: sticky; top: 0; z-index: 1; display: flex; flex-direction: column; gap: 1px; margin: 14px 0 4px; padding: 7px 14px 6px; background: #5a3a28; color: #fff; border-left: 5px solid #d9b13b; }
.dlist li.dsub:first-child { margin-top: 0; }
.dlist li.dsub.adv { background: #1b8184; border-left-color: #9fd6d3; }
.dlist li.dsub .t { font-family: var(--body); font-weight: 800; font-size: 17px; line-height: 1.2; }
.dlist li.dsub .s { font-size: 12.5px; opacity: .85; }
.vttitem button { display: flex; gap: 8px; align-items: center; }
.vtt-optbox, .vtt-opts { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vtt-hint { color: var(--ink-soft); font-size: 13.5px; font-style: italic; }
.vtt-swatches { display: inline-flex; gap: 4px; }
.vtt-sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px #8a8f78; cursor: pointer; padding: 0; }
.vtt-sw[aria-checked="true"] { box-shadow: 0 0 0 2px #2f3f55, 0 0 0 4px #d9b13b; }
.vtt-map[data-mode="draw"] { cursor: crosshair; }
.vtt-map[data-mode="erase"] { cursor: not-allowed; }
.vtt-map[data-mode="ping"] { cursor: pointer; }
.vtt-draw path { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.vtt-draw path.light { filter: drop-shadow(0 0 1.5px rgba(0,0,0,.7)); }
.vtt-ping { fill: none; stroke: var(--pc, #e8b923); transform-box: fill-box; transform-origin: center; animation: vttping 1.4s ease-out 1 both; }
.vtt-ping-dot { fill: var(--pc, #e8b923); stroke: #1d1d1d; stroke-width: 2px; animation: vttdot 4.2s ease-out 1 both; }
.vtt-ping-label { width: auto !important; height: auto !important; white-space: nowrap; padding: 2px 9px 3px; border-radius: 12px; background: var(--pc, #e8b923); color: #fff; font-family: var(--body); font-weight: 800; font-size: 15px; line-height: 1.2; box-shadow: 0 1px 4px rgba(0,0,0,.45); border: 2px solid #fff; animation: vttdot 4.2s ease-out 1 both; }
.vtt-mycolor { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--pc); border: 2px solid #fff; box-shadow: 0 0 0 1px #8a8f78; margin-right: 6px; vertical-align: -1px; }
.vtt-mode[aria-pressed="true"] .vtt-mycolor { border-color: #2f3f55; }
@keyframes vttping { from { transform: scale(.25); opacity: 1; } to { transform: scale(3.2); opacity: 0; } }
@keyframes vttdot { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .vtt-ping { animation-duration: 2.5s; } }

/* ---------- library of uploads, and pictures/maps in hex windows ---------- */
.dlist li.dsub.lib { background: #2f3f55; border-left-color: #9fb6d6; }
.win.libwin .win-bar { background: #2f3f55; border-bottom-color: #1f2a3a; }
.win.libwin .win-body { padding: 10px 16px 24px; }
.lib-up { margin: 8px 0 12px; border: 1px solid #c3c8a8; border-radius: 6px; background: rgba(255,255,255,.45); }
.lib-up > summary { cursor: pointer; padding: 7px 12px; font-weight: 700; }
.lib-up form { padding: 4px 12px 12px; }
.lib-filter { display: flex; gap: 8px; margin: 6px 0 10px; }
.lib-filter select { font: inherit; border: 1px solid #9ea583; border-radius: 4px; background: #f7f8ee; padding: 3px 6px; }
.lib-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; max-width: none; }
.lib-card { margin: 0; border: 1px solid #c3c8a8; border-radius: 6px; background: #fbfbf4; overflow: hidden; display: flex; flex-direction: column; }
.lib-card.map { border-color: #9fb6d6; }
.lib-thumb { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: #e9e7dc; cursor: zoom-in; overflow: hidden; }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-kind { position: absolute; left: 6px; top: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 7px; border-radius: 3px; background: rgba(32,40,28,.78); color: #fff; }
.lib-card.map .lib-kind { background: rgba(47,63,85,.9); }
.lib-meta { padding: 6px 9px 2px; display: flex; flex-direction: column; gap: 1px; font-size: 14px; overflow-wrap: anywhere; }
.lib-acts { padding: 4px 9px 9px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: auto; }
.lib-acts .btn { padding: 3px 10px; font-size: 14px; }
form.upl { display: grid; gap: 8px; }
form.upl label { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
form.upl label > span { font-weight: 700; font-size: 13px; }
form.upl input[type=text] { font: inherit; font-size: 15px; padding: 5px 8px; border: 1px solid #9ea583; border-radius: 4px; background: #fff; }
form.upl input[type=file] { font: inherit; font-size: 14px; }
form.upl .upl-kind { border: 1px solid #d3d6c0; border-radius: 4px; padding: 4px 10px 6px; margin: 0; }
form.upl .upl-kind legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
form.upl .upl-kind label { flex-direction: row; align-items: baseline; gap: 6px; }
form.upl .upl-kind small { color: var(--ink-soft); }
form.upl progress { flex: 1; min-width: 120px; height: 10px; }
.mediap { margin: 12px 0; padding: 2px 12px 10px; border: 1px solid #c9cdb6; border-left: 4px solid #2f3f55; border-radius: 5px; background: #f3f4ec; }
.mediap[hidden] { display: none; }
.win.corebook .win-body .mediap h3, .mediap h3 { font-family: var(--body); font-size: 18px; letter-spacing: 0; text-transform: none; color: #2f3f55; margin: .6em 0 .4em; }
.mp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-width: none; }
.mp-item { margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mp-thumb { flex: none; width: 92px; height: 68px; padding: 0; border: 1px solid #c3c8a8; border-radius: 4px; background: #e9e7dc; overflow: hidden; cursor: zoom-in; display: grid; place-items: center; }
.mp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mp-mapicon { font-size: 30px; }
.mp-meta { flex: 1; min-width: 140px; display: flex; flex-direction: column; font-size: 14.5px; }
.mp-acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mp-acts .btn { padding: 3px 10px; font-size: 14px; }
.mp-add { margin-top: 10px; gap: 8px; }
.mp-lib { margin-top: 8px; display: grid; gap: 8px; }
.win.corebook .win-body .mediap p, .mediap p { max-width: none; }
.grp-body .mediap { margin-top: 0; }
.upl-status { font-size: 13.5px; color: var(--ink-soft); }
