/* The print font, served from this site (not from Google Fonts: no visitor data goes to Google). SIL Open Font License, assets/fonts/OFL.txt. */
@font-face {
  font-family: "Germania One";
  src: url("../assets/fonts/GermaniaOne-Regular.ttf") format("truetype");
  font-display: swap;
}

/* ==========================================================================
   D&D Placeholder Crafter – own styles on top of Bootstrap 5.
   Only what Bootstrap does not have: the brand mark, the printer-bed
   preview and the empty state. Keep this file small; use Bootstrap
   utilities and components first.
   ========================================================================== */

:root {
  --pm-black: #151515;   /* default base colour of a placeholder */
  --pm-white: #ecebe6;   /* default rim colour of a placeholder */
  /* The bed preview: app chrome, not a filament colour. Keep equal in D&D Placeholder Crafter and D&D Condition Ring Crafter. */
  --pm-bed: #1e1e1e;
  --pm-bed-label: #f4f2ec;
  --pm-bed-grid: rgba(255, 255, 255, 0.12);
}

/* Brand: the site icon (assets/brand/favicon.svg, made by tools/build-brand.ps1). */
.brand-mark {
  display: block;
  width: 26px;
  height: 26px;
}

/* Family of D&D Crafters (js/sites.js): the bar on top, the cards on the start page. Keep equal in every site.
   The bar is the dark printer-bed colour in both themes, so it reads as the frame around all tools. */
.site-icon { flex-shrink: 0; border-radius: 22%; }

.site-bar { background: #1e1e1e; color: #f4f2ec; font-size: 0.875rem; }
.site-bar__inner { display: flex; align-items: stretch; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.site-bar__inner::-webkit-scrollbar { display: none; }
.site-bar__label { align-self: center; margin-right: 0.5rem; font-family: "Germania One", Georgia, serif; font-size: 1rem; letter-spacing: 0.02em; opacity: 0.7; white-space: nowrap; }
.site-bar__tab {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.7rem; white-space: nowrap;
  color: inherit; text-decoration: none; opacity: 0.72;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
  transition: opacity 0.15s, background-color 0.15s;
}
a.site-bar__tab:hover, a.site-bar__tab:focus-visible { opacity: 1; color: inherit; background: rgba(255, 255, 255, 0.07); }
a.site-bar__tab:focus-visible { outline: 2px solid #f4f2ec; outline-offset: -2px; }
.site-bar__tab.is-current { opacity: 1; font-weight: 600; border-bottom-color: var(--site-color, #f4f2ec); }
.site-bar__tab.is-soon { opacity: 0.45; cursor: default; }
.site-bar__tab small { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; border: 1px solid currentColor; border-radius: 4px; padding: 0 0.3rem; }

.site-cards { margin-top: 3rem; }
.site-card { transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
a.site-card:hover, a.site-card:focus-visible { border-color: var(--bs-primary); box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.12); transform: translateY(-2px); }
.site-card.is-soon { opacity: 0.65; }
.min-w-0 { min-width: 0; }

@media (max-width: 575.98px) {
  .site-bar__label { display: none; }
  .site-bar__tab { padding-inline: 0.55rem; }
}
@media (prefers-reduced-motion: reduce) { .site-card, .site-bar__tab { transition: none; } a.site-card:hover { transform: none; } }
/* Phones: the long site name gets a smaller size and, if still too long, an ellipsis, so the buttons stay in view. */
@media (max-width: 575.98px) {
  .navbar-brand { min-width: 0; margin-right: 0.5rem; font-size: 1rem; }
  .navbar-brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .navbar-brand > .brand-mark { flex-shrink: 0; }
}

/* Frame around a bed preview. */
.bed-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
}
.bed-frame--lg { width: 100%; height: 140px; }

/* The printer bed itself, drawn to scale with a faint grid. */
.bed {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--pm-bed);
  background-image:
    linear-gradient(var(--pm-bed-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--pm-bed-grid) 1px, transparent 1px);
  background-size: 12px 12px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition: width 0.15s, height 0.15s;
}
.bed--empty { width: 96px; height: 96px; border-radius: 10px; background-size: 16px 16px; }

.bed__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pm-bed-label);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- plate preview ---------- */
.pv-stage { width: 100%; aspect-ratio: 1; color: var(--bs-body-color); }
.pv-svg { display: block; width: 100%; height: 100%; }
.pv-plate { fill: var(--bs-secondary-bg); stroke: var(--bs-border-color); stroke-width: 0.6; }
.pv-text {
  font-family: "Germania One", Impact, "Arial Narrow", sans-serif;
  fill: #ECEBE6;
  text-transform: uppercase;
  user-select: none;
}
/* colour swatches in the settings and the editor */
.colour-row { display: flex; align-items: center; gap: 0.75rem; }
.colour-row .form-control-color { width: 3rem; flex-shrink: 0; }
.pv-canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }
.pv-canvas:active { cursor: grabbing; }

/* on-screen camera buttons in the corner of a 3D preview (touch friendly) */
.pv-controls {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  gap: 3px;
  user-select: none;
  -webkit-user-select: none;
}
.pv-controls__row { display: grid; grid-template-columns: repeat(3, 34px); gap: 3px; }
.pv-ctl {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  touch-action: none;
}
.pv-ctl:hover, .pv-ctl:active { opacity: 1; }

/* placeholder rows: the grip drags, the name area opens the editor, the checkbox selects */
.ph-open { background: none; cursor: pointer; }
.ph-open:hover .fw-semibold { text-decoration: underline; }
.list-group-item.active-soft { background: var(--bs-primary-bg-subtle); }
.list-group-item.is-dragging { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4); position: relative; z-index: 3; background: var(--bs-tertiary-bg); cursor: grabbing; }
/* while a row is dragged, the others slide out of its way */
.is-sorting > .list-group-item:not(.is-dragging) { position: relative; transition: transform 0.15s ease; }
.is-sorting, .is-sorting * { user-select: none; -webkit-user-select: none; }
@media (prefers-reduced-motion: reduce) { .is-sorting > .list-group-item:not(.is-dragging) { transition: none; } }

/* A placeholder seen from above: black base, white rim, and the word or icon in white.
   --coin is the diameter; the rim and the text scale with it. */
.coin {
  --coin: 40px;
  position: relative;
  width: var(--coin);
  height: var(--coin);
  border-radius: 50%;
  background: var(--coin-base, var(--pm-black));
  box-shadow: inset 0 0 0 calc(var(--coin) * 0.045) var(--coin-base, var(--pm-black)), inset 0 0 0 calc(var(--coin) * 0.11) var(--coin-rim, var(--pm-white));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* no overflow: hidden here: clipping text to a rounded box makes Firefox draw a dark halo around the letters */
}
.coin--blank { background: transparent; box-shadow: none; border: 2px dashed var(--bs-border-color); font-size: 1.4rem; }
.coin--svg { background: transparent; box-shadow: none; }
.coin__svg { display: block; width: 100%; height: 100%; }
.coin--row { --coin: 44px; }
.coin--sm { --coin: 36px; }
.coin--lg { --coin: 64px; }
.coin--empty { --coin: 56px; }

/* The word, in the print font: --text-scale is the capital height as a share of the diameter. */
.coin--text {
  font-family: "Germania One", Impact, "Arial Narrow", sans-serif;
  font-size: calc(var(--coin) * var(--text-scale, 0.3));
  line-height: 0.95;
  color: var(--coin-fg, var(--pm-white));
  text-align: center;
  text-transform: uppercase;
  padding: 0 calc(var(--coin) * 0.12);
  user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

/* ---------- drop zone for an own SVG ---------- */
.dropzone {
  border: 2px dashed var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.dropzone.is-invalid { border-color: var(--bs-danger); }
.visually-hidden.is-invalid ~ .invalid-feedback { display: block; }

/* The icon: the SVG as a mask, filled white, inside the inner zone. */
.coin--icon::after {
  content: "";
  position: absolute;
  inset: 18%;
  background: var(--coin-fg, var(--pm-white));
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  transform: var(--icon-tf, none);
}

/* ---------- icon placer ---------- */
.placer__stage { width: 100%; max-width: 280px; margin: 0 auto; aspect-ratio: 1; cursor: grab; touch-action: none; user-select: none; }
.placer__stage:active { cursor: grabbing; }
.placer__svg { display: block; width: 100%; height: 100%; }

/* ---------- UI building blocks (PM.ui in js/ui.js): count, tree node, filter tag, side label; used by every dialog ---------- */
/* the numbers next to tree nodes, groups and tags */
.ui-count {
  flex-shrink: 0;
  font-size: 0.72rem;
  line-height: 1.6;
  padding: 0 0.45rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 99px;
  background: var(--bs-body-bg);
  color: var(--bs-secondary-color);
  font-variant-numeric: tabular-nums;
}

.ui-node { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.ui-node--sub { padding-left: 1.1rem; }
.ui-node.is-active { background: var(--bs-primary-bg-subtle); }
.ui-node.is-active .ui-node__name { color: var(--bs-primary-text-emphasis); font-weight: 600; }
.ui-node.is-active .ui-count { border-color: var(--bs-primary); color: var(--bs-primary-text-emphasis); }
.ui-node.is-empty .ui-node__name { opacity: 0.5; }
.ui-node__chev { flex-shrink: 0; width: 22px; height: 26px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--bs-secondary-color); display: grid; place-items: center; font-size: 0.7rem; }
.ui-node__chev i { transition: transform 0.15s; }
.ui-node__chev.is-closed i { transform: rotate(-90deg); }
.ui-node__chev:hover { background: var(--bs-secondary-bg); }
.ui-node__name { flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem 0.25rem 0.1rem; border: 0; background: transparent; color: var(--bs-body-color); font-size: 0.88rem; text-align: left; }
.ui-side-label { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; color: var(--bs-secondary-color); padding: 0.9rem 0.5rem 0.35rem; }
.ui-tag { display: flex; align-items: center; gap: 0.5rem; margin: 0 0.25rem 0.25rem; padding: 0.25rem 0.5rem; border: 1px solid var(--bs-border-color); border-radius: 6px; background: var(--bs-body-bg); color: var(--bs-body-color); font-size: 0.82rem; text-align: left; }
.ui-tag.is-active { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.ui-tag__box { flex-shrink: 0; width: 15px; height: 15px; border: 1.5px solid var(--bs-secondary-color); border-radius: 3px; display: grid; place-items: center; font-size: 0.8rem; line-height: 1; }
.ui-tag.is-active .ui-tag__box { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.ui-tag.is-empty:not(.is-active) { opacity: 0.55; }

/* ---------- library picker: tree · tiles · detail ---------- */
.lib-head { flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.lib-head .modal-title { margin-right: auto; }
.lib-head__search { width: 240px; }
.lib-head__close { order: 3; margin: 0 !important; }

.lib-body { display: grid; grid-template-columns: 230px minmax(0, 1fr) 290px; grid-template-rows: minmax(0, 1fr); height: min(72vh, 680px); }
.lib-side-wrap { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.lib-side-toggle { display: none; }
.lib-side { flex: 1; min-height: 0; overflow-y: auto; padding: 0.6rem 0.5rem 1rem; display: flex; flex-direction: column; gap: 1px; }

.lib-main { overflow-y: auto; padding: 0 1rem 1rem; }
.lib-total { position: sticky; top: 0; z-index: 2; padding: 0.6rem 0 0.2rem; background: var(--bs-modal-bg, var(--bs-body-bg)); }
.lib-group { border-bottom: 1px solid var(--bs-border-color); padding-bottom: 0.75rem; }
.lib-group:last-child { border-bottom: 0; }
.lib-group__head { display: flex; align-items: center; gap: 0.5rem; margin: 0; padding: 0.8rem 0 0.5rem; font-size: inherit; }
.lib-group__title { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; color: var(--bs-secondary-color); }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
}

.lib-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 12px 4px 6px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font-size: 0.75rem;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}
.lib-tile:hover { background: var(--bs-tertiary-bg); }
.lib-tile:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
.lib-tile.is-selected { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.lib-tile__sub { font-size: 0.68rem; color: var(--bs-secondary-color); line-height: 1.1; }
.lib-tile__kinds { position: absolute; top: 4px; right: 4px; display: inline-flex; gap: 2px; }
.lib-tile__kinds i {
  font-style: normal;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1.45;
  padding: 0 3px;
  border: 1px solid var(--bs-border-color);
  border-radius: 3px;
  background: var(--bs-body-bg);
  color: var(--bs-secondary-color);
}
.lib-tile__dnd {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bs-danger-bg-subtle);
  color: var(--bs-danger-text-emphasis);
}

.lib-detail { overflow-y: auto; padding: 1rem; border-left: 1px solid var(--bs-border-color); display: flex; flex-direction: column; align-items: center; gap: 0.9rem; text-align: center; }
.lib-detail__stage { height: 150px; display: grid; place-items: center; flex-shrink: 0; }
.lib-detail__empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; color: var(--bs-secondary-color); font-size: 0.9rem; }
.lib-detail__tags { justify-content: center; }
.lib-pill { font-weight: 600; color: var(--bs-secondary-color) !important; border-color: var(--bs-border-color) !important; background: var(--bs-tertiary-bg) !important; }
.lib-field { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; width: 100%; }
.lib-field__label { font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; color: var(--bs-secondary-color); }
.lib-field__row { justify-content: center; }
.lib-detail__word { font-family: var(--bs-font-monospace); color: var(--bs-body-color); }
.lib-detail__add { width: 100%; margin-top: auto; text-align: left; }
.lib-detail .lib-detail__count { width: 4.75rem; flex: 0 0 4.75rem; }
.lib-detail__add .btn { white-space: nowrap; }

/* icon variants: a small coin with the variant name */
.lib-variant {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem 0.15rem 0.2rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 99px;
}
.lib-variant:hover { border-color: var(--bs-secondary-color); }
.lib-variant.active { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }

/* below lg the dialog is full screen: tree in a drawer above the tiles, detail at the bottom */
@media (max-width: 991.98px) {
  .lib-head__close { order: 0; margin-left: auto !important; }
  .lib-head .modal-title { margin-right: 0; }
  .lib-head__kind { order: 1; }
  .lib-head__search { order: 2; width: 100%; }
  .lib-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: auto; flex: 1; min-height: 0; }
  .lib-side-wrap { border-right: 0; border-bottom: 1px solid var(--bs-border-color); }
  .lib-side-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0.5rem 1rem; border: 0; background: transparent; color: var(--bs-body-color); font-size: 0.88rem; }
  .lib-side-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
  .lib-side { display: none; max-height: 45vh; border-top: 1px solid var(--bs-border-color); }
  .lib-side.is-open { display: flex; }
  .lib-detail { border-left: 0; border-top: 1px solid var(--bs-border-color); display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 0.5rem 1rem; text-align: left; max-height: 45vh; padding: 0.75rem 1rem; }
  .lib-detail > * { grid-column: 2; }
  .lib-detail__stage { grid-column: 1; grid-row: 1 / span 4; height: auto; }
  .lib-detail__tags, .lib-field__row { justify-content: flex-start; }
  .lib-field { align-items: flex-start; }
  .lib-detail__add { grid-column: 1 / -1; }
  .lib-detail__empty { grid-column: 1 / -1; flex-direction: row; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { .ui-node__chev i { transition: none; } }

.coin-slot { width: 64px; height: 64px; }

.empty-state { border: 1px dashed var(--bs-border-color); }

/* Whole card opens the plate; the buttons inside stay clickable (position-relative z-2). */
.card-link { transition: border-color 0.15s, transform 0.1s; }
.card-link:hover { border-color: var(--bs-primary); }
.card-link:has(.stretched-link:focus-visible) { outline: 2px solid var(--bs-primary); outline-offset: 2px; }

.min-w-0 { min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  .bed { transition: none; }
}

/* ready-made colour themes: a small coin with the name under it */
.theme-list { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.theme-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 4.75rem;
  padding: 0.35rem 0.2rem;
  border: 1px solid transparent;
  line-height: 1.15;
}
.theme-btn:hover { border-color: var(--bs-border-color); }
.theme-btn.active { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.theme-btn__name { font-size: 0.75rem; color: var(--bs-secondary-color); white-space: normal; }

/* ---------- text field with one box per line (PM.linesField) ---------- */
.lines-field { display: flex; flex-direction: column; gap: 0.35rem; }
/* number · box · count · × · + : fixed columns, so all boxes are equally wide and the buttons line up */
.lines-row { display: grid; grid-template-columns: 1.1rem minmax(0, 1fr) 1.8rem 2.375rem 2.375rem; align-items: center; gap: 0.35rem; }
.lines-row__no, .lines-row__count { font-size: 0.72rem; color: var(--bs-secondary-color); text-align: right; font-variant-numeric: tabular-nums; }
.lines-row__field { position: relative; min-width: 0; }
.lines-row__btn { width: 2.375rem; height: 2.375rem; padding: 0; display: grid; place-items: center; }
.lines-row__tag {
  display: none;
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bs-warning-bg-subtle);
  color: var(--bs-warning-text-emphasis);
}
.lines-row.is-limiting .form-control { border-color: var(--bs-warning); padding-right: 6.75rem; }
.lines-row.is-limiting .lines-row__tag { display: block; }
/* on a phone the label would cover the text: the yellow border and the hint line say it */
@media (max-width: 575.98px) {
  .lines-row.is-limiting .lines-row__tag { display: none; }
  .lines-row.is-limiting .form-control { padding-right: 0.75rem; }
}

/* ---------- print info (PM.printView): totals, slots, colour chips, the Print block ---------- */
.pi-swatch { width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0; display: inline-block; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.55); }
.pi-swatch.is-square { border-radius: 3px; }
.pi-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.pi-eyebrow { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; color: var(--bs-secondary-color); }
.pi-slots { display: inline-flex; gap: 3px; flex-shrink: 0; }
.pi-slots i { width: 13px; height: 13px; border-radius: 3px; border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); }
.pi-slots i.is-used { border-color: transparent; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.55); }
.pi-slots i.is-extra { outline: 2px solid var(--bs-danger); outline-offset: 1px; }
.pi-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pi-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.55rem 0.1rem 0.2rem; border: 1px solid var(--bs-border-color); border-radius: 99px; font-size: 0.75rem; }
.pi-chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.pi-chip.is-extra { border-color: var(--bs-danger); }
.pi-status { display: flex; gap: 0.4rem; align-items: flex-start; padding: 0.4rem 0.6rem; border-radius: 6px; font-size: 0.78rem; line-height: 1.35; }
.pi-status.is-ok { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.pi-status.is-bad { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }

.pi-block { border: 1px solid var(--bs-border-color); border-radius: 8px; background: var(--bs-tertiary-bg); padding: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; }
.pi-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.pi-fact { display: flex; flex-direction: column; min-width: 0; }
.pi-fact b { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pi-fact span { font-size: 0.72rem; color: var(--bs-secondary-color); }
.pi-bars { display: flex; flex-direction: column; gap: 0.35rem; }
.pi-bar { display: grid; grid-template-columns: 8rem minmax(0, 1fr) 3.5rem; align-items: center; gap: 0.5rem; font-size: 0.78rem; }
.pi-bar__name { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.pi-bar__track { height: 10px; border-radius: 99px; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); overflow: hidden; }
.pi-bar__track b { display: block; height: 100%; border-radius: 99px; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.55); }
.pi-bar__val { text-align: right; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }
.pi-fine { margin: 0; font-size: 0.72rem; color: var(--bs-secondary-color); }

.pi-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--bs-border-color); border-radius: 8px; background: var(--bs-tertiary-bg); }
.pi-sum__cell { display: flex; flex-direction: column; gap: 1px; padding: 0.7rem 0.9rem; min-width: 0; }
.pi-sum__cell + .pi-sum__cell { border-left: 1px solid var(--bs-border-color); }
.pi-sum__label { font-size: 0.75rem; color: var(--bs-secondary-color); }
.pi-sum__big { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pi-sum__small { font-size: 0.75rem; color: var(--bs-secondary-color); }
@media (max-width: 767.98px) {
  .pi-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pi-sum__cell:nth-child(3) { border-left: 0; }
  .pi-sum__cell:nth-child(n+3) { border-top: 1px solid var(--bs-border-color); }
  .pi-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pi-bar { grid-template-columns: 6.5rem minmax(0, 1fr) 3.25rem; }
}



/* ---------- lists: plate cards and placeholder rows share these parts and this look ----------
   pm-item: the clickable thing (a click opens it; in select mode it ticks), pm-grip: drag handle,
   pm-tick: the tick in select mode (in the grip's place), pm-more: the ⋯ menu. */
.pm-item { cursor: pointer; transition: background-color 0.12s, border-color 0.12s; }
.pm-item:hover { background: var(--bs-tertiary-bg); }
.pm-item.is-selected,
.pm-item.is-selected:hover { background: var(--bs-primary-bg-subtle); }
.pm-item:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.pm-item.is-selectable { user-select: none; -webkit-user-select: none; }

.pm-grip {
  flex-shrink: 0; width: 22px; height: 32px; padding: 0; border: 0; border-radius: 4px; background: transparent;
  color: var(--bs-secondary-color); opacity: 0.6; cursor: grab; touch-action: none;
  display: grid; place-items: center; font-size: 1.1rem; line-height: 1;
}
.pm-grip:active { cursor: grabbing; }
.pm-item:hover .pm-grip, .pm-grip:focus-visible { opacity: 1; }
.pm-tick {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--bs-secondary-color); background: var(--bs-body-bg); color: transparent; font-size: 0.85rem;
}
.pm-item.is-selected .pm-tick { border-color: var(--bs-primary); background: var(--bs-primary); color: #fff; }
.pm-more { flex-shrink: 0; width: 32px; display: flex; justify-content: center; }
.pm-more__toggle { width: 32px; height: 32px; padding: 0; border-radius: 6px; color: var(--bs-secondary-color); display: grid; place-items: center; font-size: 1.1rem; line-height: 1; }
.pm-more__toggle:hover, .pm-more__toggle[aria-expanded="true"] { background: var(--bs-secondary-bg); color: var(--bs-body-color); }

/* a list head and the select bar that replaces it: the same height, so nothing jumps */
.pm-listhead { min-height: 52px; padding: 0.5rem 0.75rem 0.5rem 1rem; }
.pm-selbar { background: var(--bs-primary-bg-subtle); border-bottom: var(--bs-border-width) solid var(--bs-border-color); }
.pm-addstrip { display: flex; gap: 0.5rem; padding: 0.6rem 0.75rem; border-top: var(--bs-border-width) solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.pm-addstrip .btn { flex: 1; }

/* a placeholder row: handle · coin · name and one line · ×count · ⋯ */
.pm-row { display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto 32px; align-items: center; gap: 0.75rem; padding: 0.6rem 0.5rem 0.6rem 0.6rem; }
.pm-row__text { min-width: 0; }
.pm-row__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-row__meta { font-size: 0.8rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-row__fact { font-size: 0.82rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }

/* a plate card: handle · name · ⋯, the plate as it prints, then the facts */
.pm-card { box-shadow: var(--bs-box-shadow-sm); }
.pm-card.is-selected { border-color: var(--bs-primary); box-shadow: 0 0 0 1px var(--bs-primary); }
.pm-card__head { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.5rem 0.4rem 0.6rem; }
.pm-card__title { flex: 1; min-width: 0; margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-card__preview { margin: 0 0.75rem; border-radius: 6px; overflow: hidden; border: var(--bs-border-width) solid var(--bs-border-color); max-width: 100%; }
.pm-card__plate { display: block; width: 100%; height: 100%; }
.pm-card__body { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.65rem 0.75rem 0.75rem; }
.pm-card__facts { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.25rem 0.75rem; font-size: 0.82rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }
.pm-card__colours { display: inline-flex; align-items: center; gap: 0.4rem; }

/* dragging a card: it follows the pointer, a dashed gap shows where it lands */
.plate-col.is-dragging .pm-card { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); cursor: grabbing; }
.plate-gap__box { border: 2px dashed var(--bs-primary); border-radius: var(--bs-border-radius); background: var(--bs-primary-bg-subtle); opacity: 0.6; }

/* the placeholder column is narrow: the select bar shows icons only (names as tooltips), except on very wide screens */
#pv-selbar .pm-label { display: none; }
@media (min-width: 1400px) { #pv-selbar .pm-label { display: inline; } }

/* ---------- encounters dialog: party bar · types · cards · detail ---------- */
.enc { --enc-low: #198754; --enc-mod: #fd7e14; --enc-high: #dc3545; --enc-over: #842029; }
.enc-head { flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.enc-head .modal-title { margin-right: auto; }
.enc-head__close { margin: 0 !important; }
.enc-party { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; padding: 0.6rem 1rem; background: var(--bs-tertiary-bg); border-bottom: 1px solid var(--bs-border-color); }
.enc-field { display: flex; align-items: center; gap: 0.5rem; }
.enc-step { width: 7.5rem; flex-wrap: nowrap; }
.enc-step input { -moz-appearance: textfield; appearance: textfield; font-weight: 600; font-variant-numeric: tabular-nums; }
.enc-budget { margin-left: auto; font-variant-numeric: tabular-nums; }
.enc-budget b { color: var(--bs-body-color); }

.enc-body { display: grid; grid-template-columns: 230px minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); height: min(68vh, 640px); }
.enc-side { border-right: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); overflow-y: auto; padding: 0 0.5rem 1rem; }
.enc-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0 0.25rem; }
.enc-chip { border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); color: var(--bs-body-color); border-radius: 99px; padding: 0.1rem 0.65rem; font-size: 0.8rem; }
.enc-chip.is-active { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.enc-side__note { padding: 1rem 0.5rem 0; margin: 0; line-height: 1.4; }

.enc-list { overflow-y: auto; padding: 0.75rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-content: start; gap: 0.6rem; }
.enc-card { text-align: left; display: flex; flex-direction: column; gap: 0.45rem; min-width: 0; padding: 0.6rem 0.75rem; border: 1px solid var(--bs-border-color); border-radius: 8px; background: var(--bs-body-bg); color: var(--bs-body-color); }
.enc-card:hover { background: var(--bs-tertiary-bg); }
.enc-card:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
.enc-card.is-selected { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); box-shadow: 0 0 0 1px var(--bs-primary); }
.enc-card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.enc-card__name { font-weight: 600; }
.enc-card__blurb { font-size: 0.8rem; color: var(--bs-secondary-color); line-height: 1.35; }
.enc-card__coins { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; }
.enc-card__coin { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }
.enc-legend { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.72rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; min-width: 0; }

.enc-pill { flex-shrink: 0; font-size: 0.7rem; font-weight: 600; border-radius: 99px; padding: 0.05rem 0.55rem; white-space: nowrap; }
.enc-pill--trivial { border: 1px solid var(--bs-border-color); color: var(--bs-secondary-color); }
.enc-pill--low { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.enc-pill--mod { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.enc-pill--high { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.enc-pill--over { background: var(--bs-danger); color: #fff; }

/* the meter: the XP of the group against the limits of the party */
.enc-meter { position: relative; height: 8px; border-radius: 99px; background: var(--bs-secondary-bg); }
.enc-meter__fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--bs-primary); }
.enc-meter__tick { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; }
.enc-meter__tick--low { background: var(--enc-low); }
.enc-meter__tick--mod { background: var(--enc-mod); }
.enc-meter__tick--high { background: var(--enc-high); }
.enc-meter__tick--over { background: var(--enc-over); }

.enc-detail { border-left: 1px solid var(--bs-border-color); overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.enc-detail__head { padding: 0.9rem 1rem 0.7rem; border-bottom: 1px solid var(--bs-border-color); }
.enc-members { list-style: none; margin: 0; padding: 0; }
.enc-member { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; padding: 0.55rem 1rem; }
.enc-member + .enc-member { border-top: 1px solid var(--bs-border-color); }
.enc-member__name { font-weight: 600; font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.enc-member__meta { font-size: 0.76rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }
.enc-member__src { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; margin-top: 0.15rem; }
.enc-member__was { font-size: 0.72rem; font-style: italic; color: var(--bs-secondary-color); }
.enc-member__count { width: auto; flex-wrap: nowrap; }
.enc-member__count .input-group-text { min-width: 2.2rem; justify-content: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.enc-role { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid var(--bs-border-color); border-radius: 4px; padding: 0 0.3rem; color: var(--bs-secondary-color); }
.enc-role--leader { border-color: var(--bs-primary); color: var(--bs-primary-text-emphasis); }
.enc-src { font-size: 0.66rem; font-weight: 600; border: 1px solid var(--bs-border-color); border-radius: 4px; padding: 0 0.3rem; color: var(--bs-secondary-color); }
.enc-src--dnd { border-color: transparent; background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.enc-sum { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.7rem 1rem; border-top: 1px solid var(--bs-border-color); }
.enc-sum__row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.enc-out { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem 1rem 1rem; border-top: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.enc-out__top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.enc-out__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.82rem; }
.enc-out__list li { display: flex; justify-content: space-between; gap: 0.5rem; }
.enc-out__list li span:last-child { color: var(--bs-secondary-color); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* below lg: one column (types as a row of chips, the cards, then the detail); the whole body scrolls */
@media (max-width: 991.98px) {
  .enc.modal-content { display: flex; flex-direction: column; }
  .enc-body { display: flex; flex-direction: column; height: auto; flex: 1; overflow-y: auto; }
  .enc-side { border-right: 0; border-bottom: 1px solid var(--bs-border-color); overflow: visible; padding-bottom: 0.6rem; }
  .enc-side__note { display: none; }
  .enc-list { overflow: visible; }
  .enc-detail { border-left: 0; border-top: 1px solid var(--bs-border-color); overflow: visible; }
  .enc-budget { margin-left: 0; width: 100%; }
}
@media (max-width: 575.98px) { .enc-list { grid-template-columns: minmax(0, 1fr); } }
.enc-card__source { font-size: 0.74rem; color: var(--bs-secondary-color); }
.enc-source { font-size: 0.78rem; color: var(--bs-secondary-color); display: flex; flex-direction: column; gap: 0.15rem; }
.enc-tree { display: flex; flex-direction: column; gap: 1px; }
/* the book titles are long: they wrap instead of being cut off */
.enc-tree .ui-node__name { align-items: flex-start; }
.enc-tree .ui-node__name .text-truncate { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
.enc-tags { display: flex; flex-direction: column; }
.enc-member__avg { font-style: italic; }
/* ---------- dice on screen: one shape per die, the number on it; rolled with a tumble ---------- */
.dice-tray { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.3rem; font-variant-numeric: tabular-nums; vertical-align: middle; }
.die { --die: 1.9rem; position: relative; display: inline-grid; place-items: center; width: var(--die); height: var(--die); flex-shrink: 0;
  background: var(--bs-primary); color: #fff; font-weight: 700; font-size: calc(var(--die) * 0.42); line-height: 1; }
.die__face { position: relative; }
.die--d4 { clip-path: polygon(50% 2%, 100% 96%, 0 96%); }
.die--d4 .die__face { top: 0.22em; }
.die--d6 { border-radius: 18%; }
.die--d8 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.die--d10, .die--d100 { clip-path: polygon(50% 0, 100% 42%, 50% 100%, 0 42%); }
.die--d10 .die__face, .die--d100 .die__face { top: -0.08em; }
.die--d12 { clip-path: polygon(50% 0, 97% 35%, 79% 96%, 21% 96%, 3% 35%); }
.die--d20 { clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.die--d100 { --die: 2.3rem; font-size: calc(var(--die) * 0.34); }
.dice-tray__plus { font-weight: 600; }
.dice-tray__total { font-weight: 700; }
.dice-tray__total.is-hidden { visibility: hidden; }
.dice-tray--big .die { --die: 2.6rem; }
.dice-tray--big .die--d100 { --die: 3rem; }
.dice-tray--big .dice-tray__total { font-size: 1.15rem; }
.die.is-rolling { animation: die-tumble 0.66s ease-out; }
@keyframes die-tumble {
  0% { transform: translateY(-0.6rem) rotate(-200deg) scale(0.8); }
  60% { transform: translateY(0.1rem) rotate(20deg) scale(1.05); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .die.is-rolling { animation: none; } }

/* encounters with a roll: the dice icon on the card and in the detail */
.enc-dice-icon { color: var(--bs-primary); margin-right: 0.35rem; }
.enc-pill--table { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.enc-member__roll { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin: 0.25rem 0 0.1rem; font-size: 0.78rem; }
.enc-member__roll .btn { font-size: inherit; }

/* random tables: the rows on the card and in the detail, the rolled one marked */
.enc-card__rows, .enc-table__rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.8rem; }
.enc-card__rows li, .enc-table__rows li { display: flex; gap: 0.5rem; align-items: baseline; border-radius: 4px; padding: 0.05rem 0.3rem; }
.enc-card__rows li.is-rolled, .enc-table__rows li.is-rolled { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.enc-card__roll { flex-shrink: 0; min-width: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.enc-table { padding: 0.7rem 1rem; border-bottom: 1px solid var(--bs-border-color); display: flex; flex-direction: column; gap: 0.6rem; }
.enc-table__roll { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.enc-table__none { padding: 1rem; margin: 0; color: var(--bs-secondary-color); }
.enc-pill--range { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); white-space: normal; text-align: right; max-width: 55%; line-height: 1.3; }
.enc-card__name { min-width: 0; }

/* ---------- plate strip (plate page): every plate as a tab, the open one highlighted ---------- */
.pv-tabs { display: flex; align-items: stretch; gap: 0.5rem; min-width: 0; }
.pv-tabs__all, .pv-tabs__add { flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.25rem; margin: 2px 0; }
.pv-tabs__list {
  position: relative; flex: 1 1 auto; min-width: 0; display: flex; gap: 0.4rem;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding: 2px; scroll-behavior: smooth;
}
.pv-tabs.has-left .pv-tabs__list { -webkit-mask-image: linear-gradient(90deg, transparent, #000 2rem); mask-image: linear-gradient(90deg, transparent, #000 2rem); }
.pv-tabs.has-right .pv-tabs__list { -webkit-mask-image: linear-gradient(270deg, transparent, #000 2rem); mask-image: linear-gradient(270deg, transparent, #000 2rem); }
.pv-tabs.has-left.has-right .pv-tabs__list {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2rem, #000 calc(100% - 2rem), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 2rem, #000 calc(100% - 2rem), transparent);
}
.pv-tab {
  flex: 0 0 auto; display: flex; align-items: center; gap: 0.5rem; max-width: 12rem;
  padding: 0.3rem 0.65rem 0.3rem 0.35rem; border-radius: var(--bs-border-radius);
  border: var(--bs-border-width) solid var(--bs-border-color); background: var(--bs-body-bg);
  color: var(--bs-body-color); text-decoration: none; line-height: 1.15;
  transition: border-color .15s, background-color .15s;
}
.pv-tab:hover { border-color: var(--bs-secondary-color); color: var(--bs-body-color); }
.pv-tab:focus-visible { outline: 0; box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), .35); }
.pv-tab.is-current { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); box-shadow: inset 0 -2px 0 var(--bs-primary); }
.pv-tab__thumb { flex-shrink: 0; width: 2.1rem; border-radius: 3px; overflow: hidden; border: var(--bs-border-width) solid var(--bs-border-color); }
.pv-tab__plate { display: block; width: 100%; height: 100%; }
.pv-tab__text { display: flex; flex-direction: column; min-width: 0; }
.pv-tab__name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-tab__meta { font-size: 0.75rem; color: var(--bs-secondary-color); white-space: nowrap; }
.pv-tab.is-current .pv-tab__meta { color: var(--bs-primary-text-emphasis); }
@media (max-width: 575.98px) { .pv-tabs__label { display: none; } }

/* The labels next to an icon (the space between them was a space in the text; translations replace the text) */
.pm-label, .pv-tabs__label { margin-left: 0.3em; }
