@font-face {
  font-family: "Cinzel";
  src: url("../fonts/cinzel-400.woff2?v=20261201-encounter6") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel";
  src: url("../fonts/cinzel-700.woff2?v=20261201-encounter6") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-400.woff2?v=20261201-encounter6") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-400i.woff2?v=20261201-encounter6") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-600.woff2?v=20261201-encounter6") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-700.woff2?v=20261201-encounter6") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #2a2118;
  --ink-soft: #5c4f40;
  --parchment: #fbf6ec;
  --parchment-deep: #f3e8d4;
  --desk: #e7d8c0;
  --rule: #d7c4a4;
  --rule-strong: #8d7048;
  --oxblood: #6e2b33;
  --oxblood-deep: #521f26;
  --forest: #234237;
  --gold: #9a7436;
  --gold-soft: #e4d2ae;
  --focus: #8d3b3b;
  --serif: "EB Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  --display: "Cinzel", "Palatino Linotype", Palatino, serif;
  --shadow: 0 22px 50px rgba(62, 42, 24, 0.16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.45;
  background-color: var(--desk);
  background-image:
    radial-gradient(ellipse at 18% 0%, rgba(255, 248, 236, 0.7), transparent 42%),
    radial-gradient(ellipse at 90% 8%, rgba(154, 116, 54, 0.08), transparent 36%),
    linear-gradient(180deg, #f6ead6 0%, #e7d3b4 46%, #dcc6a4 100%);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--oxblood);
  color: #f8f1e6;
  padding: 0.4rem 0.7rem;
  z-index: 5;
}
.skip:focus { top: 0.6rem; }

.site-head, main, .site-foot {
  width: min(1080px, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}

.site-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem 2rem;
  align-items: end;
  padding: 2.2rem 0 1.2rem;
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.mark {
  width: 52px;
  height: 52px;
  flex: none;
  filter: drop-shadow(0 4px 8px rgba(80, 40, 24, 0.12));
}

.kicker, .sheet-kicker, .caption, .field-note, .section-title {
  font-family: var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kicker {
  margin: 0 0 0.15rem;
  color: var(--gold);
  font-size: 0.62rem;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
  color: var(--oxblood-deep);
}

.subtitle {
  margin: 0.2rem 0 0;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.panel, .sheet {
  background: var(--parchment);
  border: 1px solid #e4d3b6;
  box-shadow: var(--shadow);
}

.panel { padding: 1.15rem 1.25rem 1.3rem; margin-bottom: 1.4rem; }

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  border-bottom: 1px solid var(--gold-soft);
  margin-bottom: 1rem;
}

.panel-head h2, .sheet h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--oxblood);
}

.panel-head h2 { margin: 0 0 0.45rem; font-size: 0.78rem; }

.help summary {
  cursor: pointer;
  color: var(--forest);
  font-size: 1rem;
}
.help summary:hover { color: var(--oxblood); }
.help p { margin: 0.4rem 0 0.8rem; max-width: 40rem; color: var(--ink-soft); }

label, legend {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

select, input[type="text"], input[type="number"] {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  background: #fffaf3;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 0.38rem 0.5rem;
  width: 100%;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}
select:hover, input[type="text"]:hover { border-color: var(--oxblood); }
select:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--oxblood);
  box-shadow: 0 0 0 3px rgba(110, 43, 51, 0.16);
}
select:disabled, input:disabled {
  color: #9a8b78;
  background: #f6f0e6;
  border-color: var(--rule);
}

fieldset {
  border: 1px dashed var(--rule);
  margin: 0.95rem 0 0;
  padding: 0.7rem 0.8rem 0.85rem;
  background: rgba(255, 252, 247, 0.45);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
fieldset.is-active, .name-entry.is-active input {
  border-color: var(--gold);
}
fieldset.is-active { background: #fffaf3; }

.field-note {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: none;
  font-family: var(--serif);
  color: var(--ink-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn {
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 2px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.65; cursor: progress; transform: none; }

.btn-primary {
  background: var(--oxblood);
  color: #f8f1e6;
  border: 1px solid var(--oxblood-deep);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset;
}
.btn-primary:hover { background: var(--oxblood-deep); }

.btn-ghost {
  background: transparent;
  color: var(--oxblood-deep);
  border: 1px solid var(--rule-strong);
}
.btn-ghost:hover { background: #fffaf3; border-color: var(--oxblood); }

.sheet {
  position: relative;
  padding: 1.85rem 1.7rem 1.9rem;
  margin-bottom: 2rem;
  background-color: var(--parchment);
  background-image:
    linear-gradient(180deg, rgba(255, 252, 246, 0.65), transparent 7rem),
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(141, 112, 72, 0.035) 4px);
}
.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.sheet::before {
  inset: 0.55rem;
  border: 1px solid rgba(154, 116, 54, 0.55);
  box-shadow: inset 0 0 0 4px rgba(251, 246, 236, 0.4), inset 0 0 0 5px rgba(154, 116, 54, 0.28);
}
.sheet::after {
  inset: 0.38rem;
  background:
    linear-gradient(var(--gold), var(--gold)) left top / 16px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) left top / 1px 16px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right top / 16px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right top / 1px 16px no-repeat,
    linear-gradient(var(--gold), var(--gold)) left bottom / 16px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) left bottom / 1px 16px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right bottom / 16px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right bottom / 1px 16px no-repeat;
}
.sheet:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sheet-banner {
  text-align: center;
  padding-bottom: 0.8rem;
  margin-bottom: 0.9rem;
  border-bottom: 3px double var(--gold);
}
.sheet-kicker {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
}
.treasure-title {
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--ink);
}
.treasure-types {
  margin: 0.15rem 0 0;
  font-style: italic;
  font-size: 1.35rem;
  color: var(--ink-soft);
}

.site-foot {
  padding: 0 0 2.4rem;
  color: var(--ink-soft);
  font-size: 1rem;
}
.site-foot p { margin: 0.2rem 0; }
.site-foot a { color: var(--oxblood-deep); }
.site-foot a:hover { background: rgba(110, 43, 51, 0.08); }

.noscript {
  width: min(1080px, calc(100% - 2rem));
  margin: 1rem auto;
  padding: 0.8rem 1rem;
  background: #fff4e4;
  border: 1px solid var(--gold);
}

.sheet-placeholder { text-align: center; color: var(--ink-soft); font-style: italic; }

/* Treasure controls and ledger. */
main { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.controls { position: static; }
.panel { padding: 1.15rem; }
.panel-head { margin-bottom: .65rem; }
.help { margin-bottom: 1rem; }
.help p { font-size: 1rem; }
.option-switches { margin: 0 0 1rem; border: 1px solid var(--rule); background: #fffaf3; }
.ua-switch { display: grid; grid-template-columns: 1.2rem 1fr; gap: .6rem; align-items: center; cursor: pointer; font-size: .72rem; letter-spacing: .05em; }
.ua-switch input { accent-color: var(--oxblood); width: 1.15rem; height: 1.15rem; margin: 0; }
.hoard-count { max-width: 12rem; margin-top: 1rem; }
.type-picker { margin: 0; padding: .65rem .7rem .85rem; }
.picker-heading { font-family: var(--display); font-size: .65rem; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; margin: .8rem 0 .4rem; color: var(--ink-soft); }
.filters { display: flex; border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; }
.filters button { flex: 1; border: 0; border-right: 1px solid var(--rule); color: var(--ink-soft); padding: .4rem .2rem; background: transparent; cursor: pointer; font-family: var(--serif); font-size: 1rem; }
.filters button:last-child { border-right: 0; }
.filters button[aria-pressed="true"] { background: var(--gold-soft); color: var(--ink); font-weight: 600; }
.mode-choice { margin-bottom: 1rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mode-choice button { border-bottom: 1px solid var(--rule); min-height: 44px; padding: .4rem .1rem; font-size: .95rem; line-height: 1.15; }
.mode-choice button:nth-child(4n) { border-right: 0; }
.mode-choice button:nth-last-child(-n+4) { border-bottom: 0; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.category { min-height: 44px; padding: .45rem .3rem; font-family: var(--serif); font-size: 1rem; line-height: 1.2; overflow-wrap: normal; }
.category[data-table="rods-staves-wands"] { grid-column: 1 / -1; white-space: nowrap; }
.letter-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.letter { display: grid; place-items: center; min-height: 34px; padding: .25rem 0; font-family: var(--display); font-size: .88rem; color: var(--ink); background: #fffaf3; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; transition: background .15s, border-color .15s; }
.letter:hover { border-color: var(--oxblood); background: var(--parchment-deep); }
.letter.deemphasized:not([aria-pressed="true"]) { color: #8c7c69; background: transparent; border-style: dashed; }
.letter[aria-pressed="true"] { background: var(--oxblood); color: #fffaf3; border-color: var(--oxblood-deep); box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.actions { gap: .5rem; }
.actions .btn { flex: 1 1 40%; padding: .7rem .4rem; font-size: .65rem; letter-spacing: .06em; }
.actions #generate, .actions #print { flex-basis: 100%; }
.status { min-height: 2.8em; border-top: 1px solid var(--gold-soft); padding-top: .65rem; color: var(--forest); }
.sheet { min-width: 0; padding: 1.7rem 1.5rem; }
.treasure-title { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.treasure-types { font-size: 1.2rem; }
.record-meta { margin: .35rem 0 0; color: var(--ink-soft); font-size: .98rem; }
.totals-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; margin: 0 0 1.4rem; }
.totals-strip > div { padding: .55rem .65rem; background: rgba(255,252,247,.75); border: 1px solid var(--rule); text-align: center; break-inside: avoid; }
.totals-strip dt { font-family: var(--display); font-size: .56rem; letter-spacing: .06em; color: var(--ink-soft); }
.totals-strip dd { margin: .18rem 0 0; font-size: 1.45rem; font-weight: 600; line-height: 1.2; font-variant-numeric: lining-nums tabular-nums; }
.totals-strip small { font-family: var(--display); font-size: .6rem; color: var(--gold); }
.totals-strip .grand-total { border-color: var(--rule-strong); background: var(--parchment-deep); }
.totals-strip .grand-total dt, .totals-strip .grand-total dd { color: var(--oxblood-deep); }
.treasure-table { width: 100%; border-collapse: collapse; margin: 0 0 1.35rem; font-size: 1.06rem; font-variant-numeric: lining-nums tabular-nums; }
.treasure-table caption, .maps-card h3 { text-align: left; font-family: var(--display); font-weight: 700; font-size: .72rem; letter-spacing: .1em; color: var(--oxblood); padding: .25rem 0 .4rem; }
.treasure-table th, .treasure-table td { text-align: left; border-bottom: 1px solid var(--rule); padding: .4rem .3rem; vertical-align: top; }
.treasure-table thead th { color: var(--ink-soft); font-family: var(--display); font-size: .58rem; letter-spacing: .06em; font-weight: 400; background: var(--parchment-deep); }
.treasure-table thead th:not(:first-child), .treasure-table .numeric { text-align: right; }
.treasure-table .numeric { white-space: nowrap; }
.treasure-table td:first-child { overflow-wrap: anywhere; }
.treasure-table:has(th:nth-child(4)) td:nth-child(2) { white-space: normal; font-size: .88rem; color: var(--ink-soft); min-width: 5rem; }
.treasure-table tbody tr:nth-child(even) { background: rgba(243,232,212,.3); }
.treasure-table tfoot th, .treasure-table tfoot td { border-bottom: 3px double var(--gold-soft); font-weight: 600; }
.record-note { font-size: .9rem; color: var(--ink-soft); margin: .6rem 0 0; }
.empty-hoard { border-left: 3px solid var(--gold); background: var(--parchment-deep); padding: .85rem 1rem; font-style: italic; }
.maps-card { border: 1px solid var(--rule); padding: .6rem .8rem; margin: .8rem 0 1.1rem; break-inside: avoid; }
.maps-card h3, .maps-card p { margin: 0; }
.copy-buffer { position: fixed; top: 0; left: -10000px; }
dialog { background: var(--parchment); color: var(--ink); border: 1px solid var(--rule-strong); padding: 1.2rem; max-width: min(90vw, 44rem); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(42,33,24,.5); }
.manual-copy { width: 100%; height: 50vh; font-family: var(--serif); font-size: 1rem; display: block; margin-bottom: 1rem; }
@media (min-width: 1200px) {
  .site-head, main, .site-foot { width: min(1200px, calc(100% - 3rem)); }
  main { grid-template-columns: 350px minmax(0, 1fr); }
  .totals-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .totals-strip .grand-total { grid-column: auto; }
}
@media (max-width: 860px) {
  main { display: block; }
  .controls { position: static; }
  .letter-grid { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .totals-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .totals-strip .grand-total { grid-column: auto; }
}
@media (max-width: 580px) {
  body { font-size: 1.05rem; }
  .site-head, main, .site-foot { width: calc(100% - 1.2rem); }
  .site-head { padding-top: 1.5rem; }
  h1 { font-size: 1.65rem; line-height: 1.1; }
  .brand { gap: .65rem; }
  .mark { width: 42px; height: 42px; }
  .subtitle { font-size: .66rem; letter-spacing: .12em; }
  .letter-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .sheet { padding: 1.15rem .85rem; }
  .sheet::before { inset: .35rem; }
  .totals-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals-strip .grand-total { grid-column: auto; }
  .treasure-table { font-size: .97rem; }
  .treasure-table td, .treasure-table th { padding: .35rem .2rem; }
  .treasure-table:has(th:nth-child(4)) td:nth-child(2) { min-width: 0; font-size: .78rem; }
}
/* Narrow screens keep the full item description above its category and values. */
@media screen and (max-width: 580px) {
  .totals-strip dd { font-size: 1.2rem; overflow-wrap: anywhere; }
  .magic-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .magic-table tbody { display: block; }
  .magic-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: .7rem; border-bottom: 1px solid var(--rule); padding: .3rem .2rem; }
  .magic-table td { display: block; border: 0; padding: .15rem 0; }
  .magic-table td:first-child { grid-column: 1 / -1; }
  .treasure-table.magic-table td:nth-child(2) { text-align: left; }
  .magic-table td:nth-child(3)::after { content: " XP"; }
  .magic-table td:nth-child(4)::after { content: " GP"; }
  .magic-table td:nth-child(3), .magic-table td:nth-child(4) { font-size: .85rem; color: var(--ink-soft); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .btn:hover { transform: none; }
}
[hidden] { display: none !important; }

.map-entry { margin: .4rem 0 .8rem; }
.map-entry h4 { font-family: var(--display); font-size: .78rem; letter-spacing: .04em; margin: 0 0 .25rem; color: var(--oxblood); }
.map-entry ul { margin: .25rem 0 0 1.1rem; padding: 0; }
.map-entry li { margin: .15rem 0; }
/* Encounter controls and field sheets use the treasure site's house style. */
[hidden] { display: none !important; }
.level-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; }
.level-grid .letter { min-height: 43px; }
#wilderness-picker fieldset + fieldset { margin-top: .85rem; }
.matrix-preview { font-size: .88rem; line-height: 1.5; margin-top: .7rem; }
.check-hint { font-size: .88rem; border-top: 1px solid var(--gold-soft); padding-top: .8rem; }
.hoard-count { max-width: 100%; }
#count { width: 5.2rem; min-height: 44px; margin-top: .3rem; }
.results { min-width: 0; }
.sheet-tools { display: flex; gap: .55rem; justify-content: flex-end; }
.sheet-tools .btn { padding: .55rem .7rem; letter-spacing: .05em; font-size: .63rem; min-height: 40px; }
.print-help { margin: .35rem 0 .75rem; text-align: right; font-size: .82rem; }
.totals-strip dd { font-size: 1.35rem; }
.encounter-card { border: 1px solid var(--rule); background: rgba(255,252,247,.65); margin-bottom: 1.1rem; break-inside: avoid; page-break-inside: avoid; }
.encounter-head { display: flex; align-items: center; gap: .65rem; background: var(--parchment-deep); padding: .7rem .8rem; border-bottom: 1px solid var(--rule); }
.encounter-index { display: grid; place-items: center; font-family: var(--display); font-size: .75rem; color: var(--oxblood); border: 1px solid var(--gold); width: 2rem; height: 2rem; flex-shrink: 0; }
.sheet .encounter-head h3 { font-size: 1rem; letter-spacing: .035em; text-transform: none; margin: 0; }
.encounter-head p { margin: .15rem 0 0; font-size: .83rem; color: var(--ink-soft); }
.encounter-xp { margin-left: auto; white-space: nowrap; font-size: 1.05rem; color: var(--oxblood-deep); font-variant-numeric: tabular-nums; }
.encounter-xp small { font-family: var(--display); font-size: .55rem; }
.creature-group { margin: .7rem .8rem; }
.creature-group + .creature-group { border-top: 1px solid var(--rule-strong); padding-top: .65rem; }
.creature-group h4 { margin: 0; color: var(--oxblood); font-size: 1.1rem; }
.creature-source, .number-roll, .airborne-note { color: var(--ink-soft); font-size: .85rem; margin: .35rem 0 .55rem; }
.number-roll, .airborne-note { margin: .55rem .8rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem .8rem; margin: .6rem 0; }
.stat-grid > div { min-width: 0; border-bottom: 1px solid var(--gold-soft); padding-bottom: .35rem; }
.stat-grid .wide { grid-column: 1 / -1; }
.stat-grid dt { color: var(--ink-soft); font-family: var(--display); font-size: .55rem; letter-spacing: .06em; }
.stat-grid dd { margin: .1rem 0 0; font-size: 1rem; overflow-wrap: anywhere; }
.hp-list { font-variant-numeric: tabular-nums; font-size: 1rem; overflow-wrap: anywhere; margin: .6rem 0; }
.hp-list strong { margin-right: .3rem; color: var(--oxblood); }
.treasure-line, .group-detail { font-size: .95rem; margin: .55rem 0; }
.treasure-link { display: inline-block; color: var(--forest); margin-left: .3rem; white-space: nowrap; text-underline-offset: .15em; }
.xp-details, .hp-details, .party-magic { font-size: .9rem; margin: .65rem 0; }
.xp-details summary, .hp-details summary, .party-magic summary { color: var(--forest); cursor: pointer; }
.xp-details p, .party-magic p { margin: .3rem 0; overflow-wrap: anywhere; }
.xp-details summary span { font-size: .85rem; color: var(--ink-soft); }
.monster-notes, .encounter-notes { font-size: .87rem; color: var(--ink-soft); padding-left: 1.1rem; margin: .65rem 0; }
.encounter-notes { margin: .65rem .8rem .65rem 1.9rem; }
.monster-notes li + li, .encounter-notes li + li { margin-top: .3rem; }
.meeting { padding: .6rem .8rem; border-top: 1px solid var(--gold-soft); background: rgba(243,232,212,.35); }
.meeting p, .reaction { margin: .25rem 0; font-size: .9rem; }
.meeting span { color: var(--ink-soft); }
.reaction { margin: .65rem .8rem; color: var(--ink-soft); }
.roll-trail { margin: 0; padding: .65rem .8rem; font-size: .8rem; color: var(--ink-soft); border-top: 1px dashed var(--rule); line-height: 1.5; }
.adjudication { font-size: .9rem; color: var(--oxblood-deep); background: var(--parchment-deep); border-left: 2px solid var(--gold); padding: .55rem .65rem; margin: .65rem .8rem; }
.creature-group .adjudication, .sheet-adjudication { margin-left: 0; margin-right: 0; }

.npc-block { margin: .7rem .8rem; border-top: 1px solid var(--rule-strong); padding-top: .6rem; break-inside: avoid; }
.npc-block h4 { margin: 0; color: var(--oxblood); font-size: 1.05rem; }
.npc-block .npc-index { color: var(--ink-soft); margin-right: .2rem; }
.npc-block .stat-grid dd { font-size: .92rem; }
.npc-block.soldiers p { margin: .45rem 0; font-size: .92rem; overflow-wrap: anywhere; }
.party-table { border-collapse: collapse; width: calc(100% - 1.6rem); margin: .7rem .8rem; font-size: .95rem; }
.party-table th, .party-table td { text-align: left; padding: .35rem .25rem; border-bottom: 1px solid var(--rule); }
.party-table th { font-family: var(--display); font-size: .55rem; color: var(--ink-soft); }
.party-table caption { text-align: left; font-size: .88rem; color: var(--ink-soft); }
.party-table small { display: block; font-size: .8rem; color: var(--ink-soft); }
.party-table th:last-child, .party-table td:last-child { text-align: right; }
.party-magic { margin: .8rem; }
.encounter-card > p:not([class]) { margin: .65rem .8rem; }
.fortress-type { margin: .8rem; color: var(--oxblood); font-size: 1.15rem; }
@media (max-width: 580px) {
  .level-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sheet-tools { justify-content: stretch; }
  .sheet-tools .btn { flex: 1; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .65rem; }
  .encounter-head { padding: .6rem; gap: .45rem; flex-wrap: wrap; }
  .sheet .encounter-head h3 { font-size: .95rem; }
  .encounter-xp { font-size: .95rem; }
  .print-help { text-align: left; }
}
