/* Bastion view (#bastion): overview, Bauplan (tools, Räume and Natur panels), the gold popover and
   the Verteidigung section under the Bastionszug tab (bastion-zug.css styles the turn itself).
   Reuses the tokens and surfaces of style.css (.card, .btn, .chip, .seg2, .field …).
   Layers inside the view: canvas 1 · stories/status 2 · side panel 3 · bottom bar 4 · header 5 ·
   confirm bar 6 · popovers 8 · modals (.bscrim/.bmodal) 26 · dice tray 27 (bastion-zug.css). */

/* ---------- Visibility ---------- */

.bastion { display: none; }
body[data-view="bastion"] #bastion { display: block; }
body[data-view="bastion"] .cartouche, body[data-view="bastion"] .modebox, body[data-view="bastion"] .tools,
body[data-view="bastion"] .sub, body[data-view="bastion"] .panel, body[data-view="bastion"] .zoom,
body[data-view="bastion"] .scale, body[data-view="bastion"] .compass, body[data-view="bastion"] .hint,
body[data-view="bastion"] .menu, body[data-view="bastion"] .finder { display: none !important; }
body[data-view="bastion"] .toast { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 58px); left: var(--btoast-x, 50%); }
body[data-view="bastion"].btoast-oben .toast { top: var(--btoast-top, 96px); bottom: auto !important; }

#bastion {
  position: fixed; inset: 0; z-index: 25; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 45% 42%, rgba(120, 92, 62, .38), rgba(31, 24, 19, 0) 70%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0) 60%),
    var(--table);
  color: var(--ink);
  --bh: 56px;                                   /* header height */
  --btop: calc(max(10px, env(safe-area-inset-top)) + var(--bh));
  --bside-w: min(400px, 44vw);
  --bbar-h: calc(60px + env(safe-area-inset-bottom));
}
.bastion:not([data-ansicht="bastion"]) .bstage,
.bastion:not([data-ansicht="bastion"]) .bside,
.bastion:not([data-ansicht="bastion"]) .bbar { display: none; }
.bastion:not([data-ansicht="overview"]) .bover { display: none; }
.bastion:not([data-ansicht="laden"]) .bloading { display: none; }

.bastion .bi { display: inline-grid; place-items: center; flex: none; }
.bastion .bi svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bastion .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bastion h3 { margin: 16px 0 6px; font: 400 15px "IM Fell English SC", Georgia, serif; letter-spacing: .04em; color: var(--sepia); }
.bastion h4 { margin: 0 0 6px; font: 400 15px "IM Fell English SC", Georgia, serif; letter-spacing: .03em; color: var(--sepia); }
.bastion p { margin: 4px 0; }
.bastion .bempty { font-style: italic; color: var(--sepia); font-size: 15px; margin: 6px 0; }
.bastion .bok { color: var(--ok); }
.bastion .bwarn { color: var(--seal); font-style: italic; }
.bastion .btn.armed { background: var(--seal); color: #f6e6cf; border-color: var(--seal); }
.bastion .link { margin-left: 0; }
.bastion .btn { display: inline-flex; align-items: center; gap: 5px; }
.bastion .btn .bi svg { width: 17px; height: 17px; }

/* ---------- Header ---------- */

.bhead {
  position: absolute; z-index: 5; left: 12px; right: 12px; top: max(10px, env(safe-area-inset-top));
  min-height: var(--bh); padding: 6px 12px; display: flex; flex-direction: column; justify-content: center;
}
.bhead-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bhbtn {
  flex: none; display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent; background: transparent;
  cursor: pointer; border-radius: 2px; padding: 5px 10px 5px 6px; color: var(--sepia);
  font: 400 15px "IM Fell English SC", Georgia, serif; letter-spacing: .04em;
}
@media (hover: hover) { .bhbtn:hover { background: var(--paper-2); color: var(--ink); } }
.bhbtn.bx { padding: 5px; }
.bhead-title { flex: 1; min-width: 0; }
.bhead-name {
  display: block; max-width: 100%; margin: 0; padding: 0; border: 0; background: none; text-align: left; color: var(--ink);
  font: 400 22px/1.15 "IM Fell English", Georgia, serif; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
button.bhead-name { cursor: text; border-bottom: 1px dashed transparent; }
@media (hover: hover) { button.bhead-name:hover { border-bottom-color: var(--edge); } }
.bname-input, .binline {
  font: 400 22px/1.15 "IM Fell English", Georgia, serif; border: 0; border-bottom: 1px solid var(--seal);
  background: transparent; padding: 0; width: min(420px, 100%); outline: none; color: var(--ink);
}
.binline { font: 400 15px "EB Garamond", Georgia, serif; width: 180px; }
.bhead-sub { margin: 1px 0 0 !important; font-style: italic; font-size: 14px; color: var(--sepia); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blink {
  border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit;
  text-decoration: underline dotted rgba(109, 82, 53, .6); text-underline-offset: 3px;
}
@media (hover: hover) { .blink:hover { color: var(--seal); text-decoration-color: var(--seal); } }
.bhead-right { flex: none; display: flex; align-items: center; gap: 12px; }
.bsltag {
  font: 400 12px "IM Fell English SC", Georgia, serif; letter-spacing: .08em; padding: 1px 7px; border-radius: 2px;
  background: var(--ink); color: var(--paper);
}

/* Gold chip */
.bgold {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--edge); border-radius: 16px; background: var(--paper-3); color: var(--ink);
  font: 400 16px "IM Fell English SC", Georgia, serif; letter-spacing: .02em; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 2px var(--paper-3), inset 0 0 0 3px rgba(109, 82, 53, .18);
}
@media (hover: hover) { .bgold:hover { background: #fff8e8; } }
.bgold .bi { color: #c0902f; }
.bgold .bi svg { width: 19px; height: 19px; fill: rgba(243, 210, 122, .55); }
.bgold-l { font-size: 12px; color: var(--sepia); }

/* Turn chip */
.bzugchip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--seal); color: #f6e6cf; font-size: 14.5px; font-style: italic; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
@media (hover: hover) { .bzugchip:hover { background: #7a2318; } }
.bzugdot { width: 8px; height: 8px; border-radius: 50%; background: #f6e6cf; flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .bzugdot, .btabdot { animation: bpulse 1.6s ease-in-out infinite; }
}
@keyframes bpulse { 50% { opacity: .45; } }

/* Threat widget */
.bthreat { position: relative; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.bthreat-l { font: 400 12px "IM Fell English SC", Georgia, serif; letter-spacing: .05em; color: var(--sepia); }
.bpips { display: inline-flex; gap: 1px; align-items: center; padding: 0; border: 0; background: none; }
button.bpips { cursor: pointer; padding: 6px 4px; margin: -6px -4px; }
.bpip { width: 11px; height: 13px; }
.bpip path { fill: var(--paper-3); stroke: var(--edge); stroke-width: 1.2; stroke-linejoin: round; }
.bpip.on path { fill: var(--seal); stroke: #5e1a12; }
.bthreat[data-n="0"] .bpips { opacity: .9; }
.bthreat-n { font-style: italic; font-size: 14px; color: var(--sepia); }
.bthreat[data-n="4"] .bthreat-n, .bthreat[data-n="5"] .bthreat-n { color: var(--seal); }
.bthreat-btn {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--edge); background: var(--paper-3); cursor: pointer;
  display: inline-grid; place-items: center; padding: 0; font-size: 16px; line-height: 1; color: var(--ink);
}
@media (hover: hover) { .bthreat-btn:hover:not(:disabled) { background: var(--paper-2); } }
.bthreat-btn:disabled { opacity: .35; cursor: default; }
.bthreat-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 9; width: max-content; max-width: 240px; padding: 8px 12px;
  display: flex; flex-direction: column; gap: 2px; white-space: normal; font-size: 14px;
}
.bthreat-pop strong { font: 400 14px "IM Fell English SC", Georgia, serif; letter-spacing: .04em; }
.bthreat.kompakt button.bpips { gap: 1px; margin: -6px 0; padding: 6px 2px; color: var(--sepia); }
.bthreat-k { display: inline-flex; align-items: baseline; gap: 4px; margin-right: 5px; }
.bthreat-kl { font: 400 11.5px "IM Fell English SC", Georgia, serif; letter-spacing: .05em; color: var(--sepia); }
.bthreat-kn { font: italic 400 13px Georgia, serif; color: var(--ink-2, var(--ink)); }
.bthreat.kompakt .bpip { width: 9px; height: 11px; }
.bthreat.kompakt[data-n="4"] .bthreat-kn, .bthreat.kompakt[data-n="5"] .bthreat-kn { color: var(--seal); }
.bthreat.kompakt .bthreat-btn { background: transparent; border-color: rgba(109, 82, 53, .35); color: var(--sepia); }

/* ---------- Loading, notices ---------- */

.bloading {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 18px 26px; font-style: italic; color: var(--sepia);
}
.bloading p { margin: 0; }
.bnotice { padding: 18px 22px; margin: 0 auto 18px; max-width: 560px; text-align: center; }
.bnotice h2 { margin: 0 0 6px; font: 400 22px/1.2 "IM Fell English SC", Georgia, serif; }
.bnotice p { color: var(--sepia); font-style: italic; margin-bottom: 12px !important; }

/* ---------- Overview ---------- */

.bover {
  position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--btop) + 8px); overflow: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.bover-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px calc(40px + env(safe-area-inset-bottom)); }
.bpultwrap { margin-bottom: 18px; }
.bcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; align-items: start; }
.bcard {
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer; text-align: left; padding: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
@media (hover: hover) { .bcard:hover { transform: translateY(-2px); } }
.bcard:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .bcard { transition: none; } .bcard:hover { transform: none; } }
.bcard-art {
  height: 150px; display: grid; place-items: center; position: relative; margin: 4px 4px 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 55%),
    radial-gradient(rgba(51, 37, 26, .12) 1px, transparent 1.4px) 0 0 / 9px 9px,
    var(--aussen, #d6c9a8);
  border-bottom: 1px solid rgba(109, 82, 53, .35);
}
.bcard-art::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 26px rgba(61, 42, 24, .35); pointer-events: none; }
.bcard-art.thumb { background: #f1e3c3; }
.bcard-art.thumb canvas { width: 100% !important; height: 150px !important; object-fit: cover; display: block; }
.bcard-art canvas { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .25)); }
.bcard-body { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.bcard-top { display: flex; align-items: flex-start; gap: 8px; width: 100%; }
.bcard-name { flex: 1; margin: 0 !important; font: 400 21px/1.15 "IM Fell English", Georgia, serif !important; color: var(--ink) !important; letter-spacing: 0 !important; overflow-wrap: anywhere; }
.bcard-sub { font-style: italic; color: var(--sepia); font-size: 14.5px; }
.bcard-feld { font: 400 13.5px "IM Fell English SC", Georgia, serif; letter-spacing: .06em; color: var(--sepia); }
.bcard .btnrow { margin-top: 6px; }
.bstar {
  flex: none; border: 0; background: none; cursor: pointer; font-size: 23px; line-height: 1; color: var(--edge); padding: 0 2px;
}
.bstar.on { color: #c0902f; }
@media (hover: hover) { .bstar:hover { color: #c0902f; } }
.bchip {
  display: inline-block; padding: 1px 10px; border-radius: 12px; font-size: 13.5px; font-style: italic; white-space: nowrap;
}
.bchip.seal { background: var(--seal); color: #f6e6cf; }
.bchip.ok { background: rgba(79, 107, 58, .14); color: var(--ok); border: 1px solid rgba(79, 107, 58, .45); }
.bcard-neu {
  min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px;
  background: rgba(243, 231, 203, .9); border: 2px dashed var(--edge); box-shadow: 0 8px 28px rgba(0, 0, 0, .35); text-align: center;
  font: inherit; color: var(--ink);
}
.bcard-neu strong { font: 400 19px "IM Fell English SC", Georgia, serif; letter-spacing: .03em; }
.bcard-neu small { font-style: italic; color: var(--sepia); font-size: 14px; max-width: 220px; }
@media (hover: hover) { .bcard-neu:hover { background: var(--paper); border-color: var(--seal); } }
.bplus svg { width: 42px; height: 42px; stroke: var(--seal); fill: none; stroke-width: 1.4; }
.bover .bempty { color: #d9c9a6; text-align: center; margin: 22px auto; max-width: 520px; font-size: 16px; }

/* ---------- Stage (canvas and its chrome) ---------- */

.bstage { position: absolute; inset: 0; }
.bcanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.bcanvas.dragging { cursor: grabbing; }
.bastion[data-werkzeug="raeume"] .bcanvas, .bastion[data-werkzeug="mauer"] .bcanvas,
.bastion[data-werkzeug="treppen"] .bcanvas, .bastion[data-werkzeug="moebel"] .bcanvas,
.bastion[data-werkzeug="natur"] .bcanvas { cursor: crosshair; }
.bastion[data-werkzeug="tueren"] .bcanvas, .bastion[data-werkzeug="abriss"] .bcanvas { cursor: pointer; }
.bcanvas.tierhover:not(.dragging) { cursor: pointer; }   /* a pet under the mouse (Ansehen, Tiere) */

.bstories {
  position: absolute; z-index: 2; top: calc(var(--btop) + 12px); left: 16px; right: calc(var(--bside-w) + 40px);
  display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none;
}
.bstories > * { pointer-events: auto; }
.bstory {
  border: 1px solid var(--edge); cursor: pointer; padding: 4px 12px; color: var(--sepia);
  font: 400 14px "IM Fell English SC", Georgia, serif; letter-spacing: .03em; box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
@media (hover: hover) { .bstory:hover { color: var(--ink); background: var(--paper-3); } }
.bstory[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.bstory-neu { font-size: 17px; padding: 2px 11px; line-height: 1.2; }

.berste {
  position: relative; margin: 0 0 12px; padding: 10px 34px 10px 14px; background: #fbf3df;
  border-left: 3px solid var(--seal);
}
.berste h4 { margin: 0 0 6px; }
.berste-n { font: italic 400 13px Georgia, serif; letter-spacing: 0; color: var(--sepia); text-transform: none; }
.berste.fertig { padding: 6px 34px 6px 12px; border-left-color: var(--ok); }
.berste.fertig h4 { margin: 0; color: var(--sepia); }
.berste ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.berste li { display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
.berste li.done { color: var(--sepia); }
.berste li.done .link, .berste li.done > span:nth-child(2) { text-decoration: line-through; color: var(--sepia); }
.btick {
  flex: none; width: 17px; height: 17px; border: 1px solid var(--edge); border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 12px; line-height: 1; color: var(--paper); background: var(--paper-3); transform: translateY(2px);
}
li.done .btick { background: var(--ok); border-color: var(--ok); }
.berste-x { position: absolute; top: 4px; right: 6px; border: 0; background: none; cursor: pointer; color: var(--sepia); font-size: 22px; line-height: 1; padding: 2px 6px; }
.berste .link { font-size: 15px; font-style: normal; color: var(--ink); text-decoration-color: rgba(142, 42, 31, .55); text-align: left; }

.bhist { position: absolute; z-index: 2; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 2px; padding: 4px; }
.bzoom { position: absolute; z-index: 2; right: calc(var(--bside-w) + 32px); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 2px; padding: 4px; }
.bz, .bhist .btool {
  width: 38px; height: 34px; border: 0; background: transparent; cursor: pointer; border-radius: 2px; color: var(--ink);
  display: grid; place-items: center; font-size: 21px; line-height: 1; padding: 0;
}
@media (hover: hover) { .bz:hover, .bhist .btool:hover:not(:disabled) { background: var(--paper-2); } }
.bz[data-b="raster"] { color: var(--sepia); border-right: 1px solid rgba(109, 82, 53, .25); border-radius: 2px 0 0 2px; margin-right: 2px; }
.bz[data-b="raster"][aria-pressed="true"] { color: var(--ink); background: rgba(109, 82, 53, .16); }
.bz[data-b="raster"][aria-pressed="false"] .bi svg { opacity: .55; }
.bz .bi svg { width: 19px; height: 19px; }
.bhist .btool:disabled { opacity: .35; cursor: default; }
.bhist .btool .bl { display: none; }

.bstatus {
  position: absolute; z-index: 2; bottom: max(18px, env(safe-area-inset-bottom));
  left: calc((100% - var(--bside-w) - 32px) / 2); transform: translateX(-50%);
  max-width: calc(100% - var(--bside-w) - 300px); min-width: 0;
  background: rgba(31, 24, 19, .86); color: #eadcbc; padding: 6px 16px; border-radius: 16px; font-style: italic; font-size: 14.5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); text-align: center; line-height: 1.35;
}
.bstatus.error { background: rgba(110, 26, 18, .94); color: #f6e6cf; }
.bstatus .bstatus-t, .bstatus .bstatus-t.err { color: inherit; }
.bstatus:empty { display: none; }
.bundo {
  border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-style: normal; color: #f3d27a;
  text-decoration: underline; text-underline-offset: 2px;
}
@media (hover: hover) { .bundo:hover { color: #fff1c2; } }

.bconfirm {
  position: absolute; z-index: 6; left: calc((100% - var(--bside-w) - 32px) / 2); transform: translateX(-50%);
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 46px); width: min(620px, calc(100% - var(--bside-w) - 80px));
}
.bconfirm-in {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px;
  background: var(--paper-3); border-top: 3px solid var(--seal);
}
.bconfirm-lines { flex: 1 1 260px; min-width: 0; }
.bconfirm-text { margin: 0 !important; font-size: 16px; font-weight: 600; }
.bconfirm-sub { margin: 1px 0 0 !important; font-size: 14px; font-style: italic; color: var(--sepia); }
.bconfirm-gold { margin: 2px 0 0 !important; font-size: 15px; font-variant-numeric: tabular-nums; }
.bconfirm-gold.err { color: var(--seal); }
.bconfirm-err { color: var(--seal); font-weight: 600; font-size: 15px; }
.bconfirm-btns { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Side panel ---------- */

.bside {
  position: absolute; z-index: 3; top: calc(var(--btop) + 12px); right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  width: var(--bside-w); display: flex; flex-direction: column; overflow: hidden;
}
.btabs { flex: none; margin: 12px 14px 0; }
.btabs.seg2 { background: var(--paper-3); }
.btabs .btab {
  position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 13px "IM Fell English SC", Georgia, serif; letter-spacing: 0; padding: 6px 3px; color: var(--sepia);
}
.btabs .btab[aria-selected="true"] { color: var(--paper); background: var(--ink); }
.btabdot { position: absolute; top: 1px; right: 1px; width: 6px; height: 6px; border-radius: 50%; background: var(--seal); box-shadow: 0 0 0 1.5px var(--paper); }
.bpanel { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 12px 18px 20px; }
.bhandle { display: none; }

/* Tools */
.btools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-bottom: 12px; }
.btool {
  border: 1px solid transparent; border-radius: 2px; background: transparent; cursor: pointer; color: var(--sepia);
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px; font-size: 12px; line-height: 1.15; text-align: center;
}
@media (hover: hover) { .btool:hover:not(:disabled) { background: var(--paper-2); } }
.btool[aria-pressed="true"], .btool[aria-pressed="true"]:hover { background: var(--ink); color: var(--paper); }
.btool .bi svg { width: 23px; height: 23px; }
.bopts { display: flex; flex-direction: column; gap: 6px; }
.bopts > h4 { margin-top: 2px; }
.bopts .small { margin: 2px 0 0; }
.bopts .btnrow { margin-top: 4px; }
.bfacts { font-size: 14px; color: var(--sepia); }
.binfo { font-size: 15px; }

.bchips { display: flex; flex-wrap: wrap; gap: 4px; }
.bchips .chip { border-color: var(--edge); background: var(--paper-3); padding: 3px 10px; font-size: 14.5px; }
.bchips .chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* Room list */
.brooms { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px; }
.broomrow { display: flex; align-items: center; gap: 4px; min-width: 0; }
.broomrow .broom { flex: 1 1 auto; min-width: 0; }
.braum-details { flex: none; font-size: 13.5px; padding: 6px 4px; color: var(--sepia); }
@media (hover: hover) { .braum-details:hover { color: var(--seal); } }
.broom, .broomcard-h {
  display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer; width: 100%;
  border: 1px solid transparent; background: transparent; padding: 4px 8px 4px 5px; border-radius: 2px; color: var(--ink);
}
@media (hover: hover) { .broom:hover, .broomcard-h:hover { background: var(--paper-2); } }
.broom[aria-pressed="true"] { border-color: var(--ink); background: var(--paper-2); }
.broom-t { display: flex; flex-direction: column; min-width: 0; }
.broom-t strong { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.broom-t small { font-style: italic; color: var(--sepia); font-size: 13px; line-height: 1.2; }
.bsw {
  width: 24px; height: 24px; flex: none; border: 1px solid var(--ink); border-radius: 2px; display: inline-grid; place-items: center; overflow: hidden;
  box-shadow: inset 0 0 6px rgba(61, 42, 24, .25);
}
.bsw.art { border: 0; box-shadow: none; }
.bsw.flur { background-image: repeating-linear-gradient(90deg, rgba(51, 37, 26, .18) 0 1px, transparent 1px 6px) !important; }

/* Shop */
.bshopwrap { display: flex; flex-direction: column; gap: 8px; }
.bsearch {
  width: 100%; font-size: 15px; color: var(--ink); background: var(--paper-3); border: 1px solid var(--edge); border-radius: 2px; padding: 5px 9px;
}
.bkats { display: flex; flex-wrap: wrap; gap: 3px; }
.bkats .chip { border: 1px solid var(--edge); background: var(--paper-3); font-size: 13px; padding: 1px 8px; gap: 0; }
.bkats .chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.bshop { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.bitem {
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 5px 2px 6px; border: 1px solid transparent; border-radius: 2px;
  background: transparent; cursor: pointer; text-align: center; min-width: 0; color: var(--ink);
}
@media (hover: hover) { .bitem:hover { background: var(--paper-2); } }
.bitem[aria-pressed="true"] { border-color: var(--ink); background: var(--paper-2); }
.bitem canvas { display: block; margin-bottom: 2px; }
.bitem-n { font-size: 13.5px; line-height: 1.15; overflow-wrap: anywhere; }
.bitem small { font-size: 11.5px; color: var(--sepia); font-style: italic; line-height: 1.2; }
.bitem-p { font: 400 13px "IM Fell English SC", Georgia, serif; letter-spacing: .03em; color: var(--sepia); font-variant-numeric: tabular-nums; }
.bitem.teuer { opacity: .42; }
.bshop-items { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.bshop-items .bitem { padding: 6px 4px 7px; gap: 3px; border-color: rgba(109, 82, 53, .18); background: rgba(255, 250, 238, .5); }
.bitem-tile { position: relative; display: block; line-height: 0; transition: transform .15s ease; }
.bitem-tile canvas { margin: 0; box-shadow: 0 1px 3px rgba(51, 37, 26, .25); border-radius: 5px; }
@media (hover: hover) {
  .bshop-items .bitem:hover .bitem-tile { transform: scale(1.08) translateY(-2px); }
  .bshop-items .bitem:hover { border-color: var(--edge); }
}
.bitem[aria-pressed="true"] .bitem-tile canvas { box-shadow: 0 0 0 2px var(--ink), 0 2px 6px rgba(51, 37, 26, .35); }
.bitem-seal {
  position: absolute; right: -7px; bottom: -6px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px;
  display: flex; align-items: baseline; justify-content: center; gap: 1.5px; padding-top: 6px; line-height: 1; font: 600 12px Georgia, serif; font-variant-numeric: tabular-nums;
  color: #f6e6cf; background: radial-gradient(circle at 35% 30%, #a8392b, #7a2318 70%); box-shadow: 0 1px 2px rgba(0, 0, 0, .35), inset 0 0 0 1.5px rgba(246, 230, 207, .25);
}
.bitem.teuer .bitem-seal { background: #8a7a68; }
.bitem-seal small { font: 600 8.5px Georgia, serif; color: #f3d9b8; font-style: normal; letter-spacing: .02em; }
.bitem-fuss { display: inline-grid; gap: 1px; margin-top: 1px; }
.bitem-fuss i { width: 5px; height: 5px; background: rgba(109, 82, 53, .55); border-radius: 1px; }
.bgold.klirr { animation: bklirr .6s ease-out; }
.bgold.klirr .bi { animation: bmuenze .6s ease-out; display: inline-block; }
@keyframes bklirr { 0% { transform: scale(1); } 25% { transform: scale(1.08) rotate(-2deg); background: #fff1c2; } 55% { transform: scale(.98) rotate(1.5deg); } 100% { transform: none; } }
@keyframes bmuenze { 0% { transform: translateY(0); } 30% { transform: translateY(-6px) rotate(-25deg); } 60% { transform: translateY(1px) rotate(10deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .bgold.klirr, .bgold.klirr .bi { animation: none; } }
.bdach { padding: 8px; background: rgba(233, 217, 180, .45); border: 1px dashed var(--edge); border-radius: 2px; }
.barmed {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px; border: 1px dashed var(--ink); border-radius: 2px; background: var(--paper-2);
}
.barmed-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barmed-t small { font-style: italic; color: var(--sepia); font-size: 13px; }
.barmed-raum { margin-bottom: 6px; }
.barmed .btn { flex: none; }

/* Inline gold field */
.bgoldform { display: flex; flex-direction: column; gap: 6px; }
.bgoldform .btnrow { margin-top: 0; }
.bgoldform .err { font-size: 14px; }
.bgoldform.inline { padding: 8px 10px; background: rgba(243, 210, 122, .22); border-left: 3px solid #c0902f; border-radius: 2px; }
.bgoldline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.bgoldq { font-style: italic; font-size: 14.5px; }
.bgoldline input {
  width: 110px; font-size: 15px; color: var(--ink); background: var(--paper-3); border: 1px solid var(--edge); border-radius: 2px; padding: 3px 8px;
  font-variant-numeric: tabular-nums;
}
.bgoldline .btn.primary { padding: 3px 12px; }

/* Selection and room details */
.bdetail { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.bdetail-h { display: flex; align-items: center; gap: 9px; }
.bdetail-h h3 { margin: 0; font: 400 21px/1.15 "IM Fell English", Georgia, serif; letter-spacing: 0; color: var(--ink); }
.bdetail .title-input { font-size: 20px !important; }
.btype { color: var(--sepia); font-style: italic; font-size: 14.5px; }
.bstate { color: var(--seal); font-style: italic; }
.bdetail .btnrow { margin-top: 6px; }
.bdetail .btnrow .btn { font-size: 14.5px; }
.bdetail .btn:disabled { opacity: .5; cursor: default; }
.bsondercard { margin-top: 10px; padding: 10px 12px; background: var(--paper-3); border: 1px solid var(--paper-2); border-left: 3px solid var(--edge); }
.bref { margin: 4px 0; padding-left: 18px; font-size: 14.5px; line-height: 1.35; }
.bref li + li { margin-top: 3px; }
.bdmg { font-size: 13px; font-style: italic; color: var(--sepia); }

/* Räume panel sections and the Verteidigung section (§14.8.3, §14.8.5) */
.bsec { padding-bottom: 10px; border-bottom: 1px solid rgba(109, 82, 53, .22); margin-bottom: 6px; }
.bsec:last-child { border-bottom: 0; }
.bsec > h4 { margin: 2px 0 4px; }
.bsec > .btn { margin-top: 6px; }
.bsec .btnrow { margin-top: 4px; }
.bsec .bhead-sub { white-space: normal; font-size: 15px; margin-bottom: 4px !important; }
.bsec .bempty { font-size: 14.5px; margin: 2px 0; }
.bbau { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; font-size: 15px; }
.bprog { height: 7px; border: 1px solid var(--ink); border-radius: 1px; background: var(--paper-3); overflow: hidden; }
.bprog span { display: block; height: 100%; background: repeating-linear-gradient(135deg, var(--sepia) 0 3px, #8a6a45 3px 6px); }
.bbig { font: 400 19px "IM Fell English", Georgia, serif; margin-top: 6px !important; }
.bline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bzugtab { min-height: 0; }
.bverteidigung { margin-top: 18px; padding-top: 4px; border-top: 1px solid rgba(109, 82, 53, .35); border-bottom: 0; }
.bverteidigung > h3 { margin-top: 10px; }
.bgilde { margin-top: 12px; padding: 8px 12px 10px; background: var(--paper-3); border-left: 3px solid var(--edge); }
.bgilde h4 { margin: 0 0 4px; }

/* Gold popover (§14.8.5): balance, form, the newest bookings and the Wertsachen */
.bgoldpop { max-height: 60vh; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; }
.bgp-top { text-align: center; padding: 2px 0 0; }
.bbal-l { font: 400 13px "IM Fell English SC", Georgia, serif; letter-spacing: .08em; color: var(--sepia); }
.bbal { font: 400 34px/1.1 "IM Fell English", Georgia, serif; font-variant-numeric: tabular-nums; }
.bgp-buch, .bgp-werte { border-top: 1px solid rgba(109, 82, 53, .25); padding-top: 8px; }
.bgp-buch h4, .bgp-werte h4 { margin: 0 0 4px; }
.bgp-buch .link { margin-top: 4px; font-size: 14px; }
.bbuch { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; font-size: 14px; font-variant-numeric: tabular-nums; }
.bbuchung { display: grid; grid-template-columns: 3.4em minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px dotted rgba(109, 82, 53, .25); }
.bbuchung:last-child { border-bottom: 0; }
.bbu-d { color: var(--sepia); white-space: nowrap; }
.bbu-g { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bbu-n { text-align: right; white-space: nowrap; }
.bbu-n.plus { color: var(--ok); }
.bbu-n.minus { color: var(--seal); }
.bwerte { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bwerte li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 4px 0; border-bottom: 1px dotted rgba(109, 82, 53, .25); font-size: 14.5px; }
.bwerte li:last-child { border-bottom: 0; }
.bw-n { flex: 1 1 120px; overflow-wrap: anywhere; }
.bw-v { font-variant-numeric: tabular-nums; color: var(--sepia); }
.bwerte .btn { font-size: 13.5px; padding: 2px 9px; }

/* Haustiere (§15.6): list, editor with a live preview, colour dots and chips */
.btiere-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.btiere-h h4 { margin: 2px 0 4px; }
.btiere-n { font: italic 400 13.5px Georgia, serif; color: var(--sepia); font-variant-numeric: tabular-nums; }
.btierliste { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin: 2px 0 2px; }
.btier {
  display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; cursor: pointer; color: var(--ink);
  border: 1px solid rgba(109, 82, 53, .18); border-radius: 22px 4px 4px 22px; background: rgba(255, 250, 238, .5); padding: 2px 8px 2px 2px;
}
@media (hover: hover) { .btier:hover { background: var(--paper-2); border-color: var(--edge); } }
.btier[aria-pressed="true"] { border-color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--ink); }
.btier canvas, .btiere-peeksel canvas { flex: none; display: block; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #fbf4e2 55%, #eadbb8); }
.btier-t { display: flex; flex-direction: column; min-width: 0; }
.btier-n { font-weight: 600; font-size: 15px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btier-t small { font-style: italic; color: var(--sepia); font-size: 12.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btiersw { display: inline-block; flex: none; border-radius: 50%; border: 1px solid var(--ink); box-shadow: inset -3px -4px 8px rgba(51, 37, 26, .3); }
.btierholen .bi svg { width: 19px !important; height: 19px !important; }
.btn.btierholen { display: inline-flex; align-items: center; gap: 6px; }
.btn.btierholen:disabled { opacity: .45; cursor: default; }
/* Pet slots (§15.9): the way to the next slot, and the hint in the Räume panel */
.btierziel { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 2px; }
.btierziel .small { margin: 0; }
.btierziel.gesperrt .small { color: var(--ink); }
.bprog.btierbar { height: 4px; border-color: rgba(51, 37, 26, .55); }
.btierhinweis.small { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0; color: var(--sepia); }
.btierhinweis .bi svg { width: 17px; height: 17px; margin-top: 1px; }

.btiered {
  display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 10px 10px 12px;
  background: rgba(255, 250, 238, .55); border: 1px solid rgba(109, 82, 53, .25); border-top: 3px solid var(--edge); border-radius: 2px;
}
.btiered-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 2px; }
.btiered-vorschau {
  position: relative; flex: none; width: 108px; height: 108px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 50%; color: var(--ink);
  background: radial-gradient(circle at 50% 62%, #fff8e8 0 52%, #efdfba 72%, #e2cc9c);
  box-shadow: inset 0 -6px 12px rgba(109, 82, 53, .18), 0 2px 6px rgba(51, 37, 26, .18);
}
@media (hover: hover) { .btiered-vorschau:hover { border-color: var(--ink); } }
.btiered-vorschau canvas, .btiered-vorschau .btiersw { display: block; }
.btiered-vorschau.hopst > canvas, .btiered-vorschau.hopst > .btiersw { animation: btierhops .55s cubic-bezier(.3, .7, .4, 1); }
@keyframes btierhops {
  0% { transform: none; } 20% { transform: translateY(2px) scale(1.06, .92); } 50% { transform: translateY(-14px) scale(.97, 1.05) rotate(-4deg); }
  75% { transform: translateY(0) scale(1.04, .95); } 100% { transform: none; }
}
.btierblase {
  position: absolute; z-index: 1; left: 58%; bottom: 84%; max-width: 150px; padding: 3px 10px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: italic 400 15px "IM Fell English", Georgia, serif; color: var(--ink); background: #fffaf0;
  border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 0 2px 5px rgba(51, 37, 26, .25); pointer-events: none; transform-origin: 12px 100%;
  animation: btierblase .18s ease-out;
}
.btierblase::after {
  content: ""; position: absolute; left: 12px; bottom: -6px; width: 9px; height: 9px; background: #fffaf0;
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg) skew(8deg, 8deg);
}
.btierblase[hidden] { display: none; }
@keyframes btierblase { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .btiered-vorschau.hopst > *, .btierblase { animation: none !important; } }
.btiered-kopf { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.btiered-kopf .field input { font: 400 18px "IM Fell English", Georgia, serif; padding: 3px 8px; }
.btierseg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; padding: 3px 4px; }
.btierseg .bi svg { width: 18px; height: 18px; }
.btierseg.klein button { font-size: 13px; padding: 1px 4px; }
.btierrow { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 2px 8px; align-items: start; }
.btierrow-l { font: 400 13px "IM Fell English SC", Georgia, serif; letter-spacing: .04em; color: var(--sepia); padding-top: 5px; }
.btierwahl { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; align-items: center; }
.btierwahl.dots { gap: 5px; }
.btierwahl.stapel { flex-direction: column; align-items: stretch; gap: 2px; }
.btierwahl.stapel .small { margin: 0; font-size: 12.5px; }
.chip.btierchip {
  gap: 5px; border-color: rgba(109, 82, 53, .4); background: var(--paper-3); padding: 2px 9px; font-size: 13.5px; line-height: 1.25; border-radius: 12px;
}
.chip.btierchip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btierpunkt { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); border: 1px solid rgba(51, 37, 26, .55); }
.btierdot {
  flex: none; width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer; background: var(--c, #ccc);
  border: 1px solid rgba(51, 37, 26, .7); box-shadow: inset -3px -4px 6px rgba(51, 37, 26, .22), inset 2px 2px 3px rgba(255, 255, 255, .35);
  transition: transform .12s ease;
}
@media (hover: hover) { .btierdot:hover { transform: scale(1.12); } }
.btierdot[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--paper-3), 0 0 0 4px var(--ink), inset -3px -4px 6px rgba(51, 37, 26, .22); transform: scale(1.06); }
@media (prefers-reduced-motion: reduce) { .btierdot { transition: none; } }
.btierwesen { margin: -2px 0 0 80px !important; font-size: 13.5px; }
.btierfeld {
  width: 100%; min-width: 0; font-size: 15px; color: var(--ink); background: var(--paper-3); border: 1px solid var(--edge); border-radius: 2px; padding: 4px 8px;
}
.btiered-btns { margin-top: 6px !important; }
.btiered-btns .btn { display: inline-flex; align-items: center; gap: 5px; }
.btiere-peek { display: flex; flex-direction: column; gap: 5px; padding: 2px 0 4px; }
.btiere-peeksel { display: flex; align-items: center; gap: 8px; min-width: 0; }
.btiere-peeksel .btier-t { flex: 1; }
.btiere-peeksel .btn { flex: none; }
.bpeek-tiere { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; padding-bottom: 2px; }
.bpeek-tiere::-webkit-scrollbar { display: none; }
.bpeek-tiere > * { flex: none; }
.bpeek-tiere .btier { max-width: 170px; min-height: 44px; }
.bpeek-tiere .btn { min-height: 44px; white-space: nowrap; }
.bpeek-tiere .btn.btierholen { padding: 3px 10px; font-size: 14px; gap: 4px; }
.btiere-peek > .small { margin: 0; font-size: 13px; }

/* Natur tool (§14.8.2) */
.bgelaende { font: 400 16px "IM Fell English SC", Georgia, serif; letter-spacing: .03em; margin: 0 !important; }
.bfrei { margin-top: 0 !important; color: var(--ok); font-style: italic; }
.bngroup { margin-top: 6px; }
.bngroup h4 { margin: 0 0 4px; }
.bngroup .small { margin-top: 4px; }
.bnpasst { padding: 6px 8px 8px; background: rgba(79, 107, 58, .08); border: 1px solid rgba(79, 107, 58, .28); border-radius: 2px; }
.bnchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px; }
.bnchip {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 5px 2px 6px; cursor: pointer; color: var(--ink);
  border: 1px solid rgba(109, 82, 53, .18); border-radius: 2px; background: rgba(255, 250, 238, .5); text-align: center;
}
@media (hover: hover) { .bnchip:hover { background: var(--paper-2); border-color: var(--edge); } }
.bnchip[aria-pressed="true"] { border-color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--ink); }
.bnchip canvas, .bnsw { display: block; border-radius: 4px; box-shadow: 0 1px 2px rgba(51, 37, 26, .22); }
.bnsw { background: #d3d89b; }
.bnsw.lichten { background: repeating-linear-gradient(135deg, rgba(51, 37, 26, .3) 0 2px, transparent 2px 6px), #cdb98a; }
.bnchip-n { font-size: 13px; line-height: 1.15; overflow-wrap: anywhere; }

/* ---------- Popovers, menus ---------- */

.bpop { position: fixed; z-index: 8; padding: 12px 14px; }
.bpop .link { margin-top: 6px; font-size: 14px; }
.bpop .field { font-size: 15px; }
.bgoldpop input { font-size: 18px !important; font-variant-numeric: tabular-nums; }
.bmenu { padding: 6px; display: flex; flex-direction: column; }
.bmenuitem { text-align: left; border: 0; background: transparent; padding: 7px 12px; cursor: pointer; border-radius: 2px; font-size: 15.5px; color: var(--ink); }
@media (hover: hover) { .bmenuitem:hover:not(:disabled) { background: var(--paper-2); } }
.bmenuitem:disabled { opacity: .45; cursor: default; }

/* ---------- Modals ---------- */

.bscrim { position: fixed; inset: 0; z-index: 26; background: rgba(20, 15, 11, .55); }
.bmodal {
  position: fixed; z-index: 26; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain;
  padding: 18px 22px 20px;
}
.bmodal.bwide { width: min(780px, calc(100vw - 24px)); }
.bmodal h2 { margin: 0 34px 12px 0; font: 400 23px/1.2 "IM Fell English SC", Georgia, serif; letter-spacing: .03em; }
.bmodal-x { position: absolute; top: 8px; right: 8px; border: 0; background: none; cursor: pointer; color: var(--sepia); padding: 6px; border-radius: 50%; }
@media (hover: hover) { .bmodal-x:hover { background: var(--paper-2); color: var(--ink); } }
.bmodal-body { display: flex; flex-direction: column; gap: 10px; }
.bmodal .warn { margin: 0; }
.bmodal .dlgbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.blage { font-size: 15px; }
.blage-l { font: 400 14px "IM Fell English SC", Georgia, serif; letter-spacing: .04em; color: var(--sepia); }

.bflavours { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.bflavour {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 6px 8px; border: 1px solid var(--edge); border-radius: 3px;
  background: var(--paper-3); cursor: pointer; color: var(--ink); font-style: normal;
}
@media (hover: hover) { .bflavour:hover { background: #fff8e8; } }
.bflavour[aria-checked="true"] { border-color: var(--seal); box-shadow: inset 0 0 0 1px var(--seal); background: var(--paper-2); }
.bflavour-art { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden; box-shadow: inset 0 0 10px rgba(61, 42, 24, .35); border: 1px solid rgba(51, 37, 26, .5); }
.bflavour-art canvas { width: 56px !important; height: 56px !important; }
.bflavour-t { display: flex; flex-direction: column; min-width: 0; }
.bflavour-t strong { font: 400 16px "IM Fell English SC", Georgia, serif; letter-spacing: .03em; }
.bflavour-t small { font-style: italic; color: var(--sepia); font-size: 13px; line-height: 1.25; }

.bpicklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bpickgroup { grid-column: 1 / -1; margin: 8px 0 0 !important; }
.bpick {
  display: flex; flex-direction: column; color: var(--ink); align-self: start;
  border: 1px solid var(--edge); border-radius: 3px; background: var(--paper-3); font-size: 14px; line-height: 1.3;
  transition: border-color .15s, box-shadow .15s;
}
.bpick-sel {
  display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; cursor: pointer; padding: 9px 10px 7px;
  border: 0; background: none; color: inherit; font: inherit; border-radius: 3px 3px 0 0;
}
@media (hover: hover) { .bpick-sel:hover:not(:disabled) { background: #fff8e8; } }
.bpick.on { border-color: var(--seal); box-shadow: inset 0 0 0 1.5px var(--seal), 0 2px 10px rgba(142, 42, 31, .14); }
.bpick.on .bpick-sel { background: #fff8e8; }
.bpick.locked { opacity: .55; filter: grayscale(.5); }
.bpick.locked .bpick-sel { cursor: default; }
.bpick-h { display: flex; align-items: center; gap: 10px; }
.bpick-h canvas { flex: none; filter: drop-shadow(0 1px 1px rgba(51, 37, 26, .25)); }
.bpick-h > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bpick-h strong { font: 400 17px "IM Fell English SC", Georgia, serif; letter-spacing: .03em; }
.bpick-h small { font-style: italic; color: var(--sepia); font-size: 13px; }
.bpick-r { flex: none; font-size: 12.5px; font-style: italic; color: var(--seal); border: 1px solid rgba(142, 42, 31, .4); border-radius: 10px; padding: 0 7px; }
.bpick-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bpick-befehl { font: 400 12px "IM Fell English SC", Georgia, serif; letter-spacing: .06em; color: var(--seal); margin-right: 2px; }
.bpick-chip { font-size: 12.5px; padding: 1px 8px; border-radius: 10px; background: var(--paper); border: 1px solid rgba(109, 82, 53, .35); white-space: nowrap; }
.bpick-chip.mehr { font-style: italic; color: var(--sepia); }
.bpick-regeln { border-top: 1px dotted rgba(109, 82, 53, .45); padding: 0 10px; }
.bpick-regeln summary {
  cursor: pointer; padding: 5px 0; font: 400 12.5px "IM Fell English SC", Georgia, serif; letter-spacing: .06em; color: var(--sepia);
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.bpick-regeln summary::-webkit-details-marker { display: none; }
.bpick-regeln summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 15px; line-height: 1; }
.bpick-regeln[open] summary::before { transform: rotate(90deg); }
.bpick-regeln[open] { padding-bottom: 8px; }
.bpick-v { margin: 2px 0 0 !important; font-size: 13.5px; color: var(--sepia); }
.bpick-hr { flex: none; margin: 0 !important; font: 400 11.5px "IM Fell English SC", Georgia, serif; letter-spacing: .08em; color: var(--seal); }
.bpick .bref { font-size: 13.5px; }
.bpick-note { margin: 0 0 6px !important; font-style: italic; color: var(--sepia); }
.bpickfoot { position: sticky; bottom: -20px; background: var(--paper); padding: 10px 0 2px; border-top: 1px solid var(--edge); display: flex; flex-direction: column; gap: 6px; }
.bpickextra { display: flex; flex-direction: column; gap: 6px; }

.bsizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bsize {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border: 1px solid var(--edge); border-radius: 3px;
  background: var(--paper-3); cursor: pointer; color: var(--ink); font-style: normal;
}
.bsize strong { font: 400 16px "IM Fell English SC", Georgia, serif; }
.bsize small { font-style: italic; color: var(--sepia); font-size: 12.5px; }
.bsize span { font-size: 14px; font-variant-numeric: tabular-nums; }
.bsize[aria-checked="true"] { border-color: var(--seal); box-shadow: inset 0 0 0 1.5px var(--seal); background: var(--paper-2); }
.bpreview-l { font-size: 15.5px; font-variant-numeric: tabular-nums; }
.bpreview-l.err { color: var(--seal); }
.bmodal .field > .bchips, .bmodal .field > .bsizes, .bmodal .field > .bflavours { font-style: normal; }

/* ---------- Hex panel badge ---------- */

.bbadge { display: flex; gap: 10px; align-items: flex-start; }
.bbadge-icon { flex: none; margin-top: 2px; }
.bbadge-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bbadge-t strong { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.bbadge-sub { font-style: italic; color: var(--sepia); font-size: 14px; }
.bbadge .bchip { align-self: flex-start; margin-top: 2px; }

/* ---------- Bottom bar (phone) ---------- */

.bbar { display: none; }

/* ---------- Narrow desktops ---------- */

@media (min-width: 701px) and (max-width: 1100px) {
  #bastion { --bside-w: min(380px, 46vw); }
  .bhead-right { gap: 8px; }
  .bthreat-l { display: none; }
  .bstatus { max-width: calc(100% - var(--bside-w) - 140px); }
}
@media (min-width: 701px) and (max-width: 960px) {
  .bthreat-n { display: none; }
  .bhbtn .bl { display: none; }
  .bshop { grid-template-columns: repeat(3, 1fr); }
  .bpicklist { grid-template-columns: 1fr; }
}


/* ---------- Phone ---------- */

@media (max-width: 700px) {
  #bastion { --bh: 84px; --btop: calc(max(6px, env(safe-area-inset-top)) + var(--bh)); --bpeek-h: 164px; }
  body[data-view="bastion"] .toast { bottom: var(--btoast-b, calc(max(8px, env(safe-area-inset-bottom)) + 72px)); max-width: calc(100vw - 24px); white-space: normal; }
  .bhead { left: 6px; right: 6px; top: max(6px, env(safe-area-inset-top)); padding: 3px 6px 4px; min-height: 0; }
  .bhead:not(.zwei) { min-height: 52px; }
  .bhead-row { gap: 6px; min-height: 44px; }
  .bhead-row2 { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 4px 0 6px; border-top: 1px solid rgba(109, 82, 53, .2); }
  .bhead-row2 .bthreat-btn { width: 28px; height: 28px; }
  .bhead-row2 .bzugchip { padding: 2px 10px; font-size: 13px; }
  .bhead-name { font-size: 19px; }
  .bhead:not(.zwei) .bhead-name { font-size: 18px; }
  .bhead-sub { font-size: 12.5px; }
  .bhbtn { padding: 8px; min-width: 40px; min-height: 40px; justify-content: center; }
  .bhbtn .bl { display: none; }
  .bhead-right { gap: 4px; }
  .bgold { padding: 4px 9px 4px 6px; font-size: 15px; }
  .bgold .bi svg { width: 17px; height: 17px; }
  .bname-input { font-size: 19px; }
  .bthreat-pop { left: 0; }

  .bover { top: calc(max(6px, env(safe-area-inset-top)) + 60px); }
  .bover-in { padding: 8px 10px calc(40px + env(safe-area-inset-bottom)); }
  .bcards { grid-template-columns: 1fr; gap: 14px; }
  .bcard-neu { min-height: 120px; }
  .bcard .btnrow .btn { min-height: 40px; }

  .bstories { top: calc(var(--btop) + 8px); left: 8px; right: 8px; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .bstories::-webkit-scrollbar { display: none; }
  .bstory { flex: none; padding: 7px 11px; font-size: 13px; min-height: 36px; }
  .bastion:not([data-tab="bauplan"]) .bstories { display: none; }
  .bhist, .bzoom, .berste:not(.bpanel .berste) { display: none; }
  .bpanel .berste { position: static; width: auto; margin: 0 0 8px; padding: 6px 30px 6px 10px; display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
  .bpanel .berste h4 { margin: 0; font-size: 13px; }
  .bpanel .berste ol { flex-direction: row; flex-wrap: wrap; gap: 2px 12px; }
  .bpanel .berste li { font-size: 13.5px; gap: 5px; }
  .bpanel .berste .link { font-size: 13.5px; }
  .bpanel .berste .btick { width: 15px; height: 15px; font-size: 10px; }
  .bpanel .berste-x { top: 2px; right: 2px; padding: 2px 8px; }

  .bstatus {
    left: 50%; max-width: calc(100vw - 24px); width: max-content; white-space: normal;
    bottom: calc(var(--bbar-h) + var(--bpeek-h) + 6px); font-size: 13.5px; padding: 5px 12px;
  }
  .bastion:has(.bside.peek.auf) .bstatus { display: none; }
  .bconfirm { left: 8px; right: 8px; width: auto; transform: none; bottom: calc(var(--bbar-h) + var(--bpeek-h) + 2px); }
  .bastion.tabsbar .bconfirm, .bastion:not([data-tab="bauplan"]) .bconfirm { bottom: calc(var(--bbar-h) + 8px); z-index: 7; }
  .bconfirm-in { padding: 10px 12px; gap: 8px 10px; }
  .bconfirm-btns { width: 100%; }
  .bconfirm-btns .btn { flex: 1; min-height: 42px; justify-content: center; }

  .bside {
    left: 0; right: 0; top: auto; width: auto; bottom: var(--bbar-h); border-radius: 10px 10px 0 0;
    box-shadow: 0 -6px 22px rgba(0, 0, 0, .45), inset 0 0 0 3px var(--paper), inset 0 0 0 4px rgba(109, 82, 53, .32);
  }
  .bside.peek { height: var(--bpeek-h); transition: height .18s ease; }
  .bside.peek.auf { height: 60%; }
  .bside.sheet { height: 70%; transition: height .18s ease; }
  .bastion.sheetzu .bside.sheet { height: 46px; }
  @media (prefers-reduced-motion: reduce) { .bside.peek, .bside.sheet { transition: none; } }
  .btabs { display: none; }
  .bhandle {
    display: flex; flex: none; align-items: center; gap: 8px; min-height: 26px; padding: 4px 14px 2px; cursor: grab; touch-action: none;
    position: relative;
  }
  .bside.sheet .bhandle { min-height: 42px; padding-top: 10px; }
  .bgrip { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); width: 42px; height: 4px; border-radius: 2px; background: rgba(109, 82, 53, .45); }
  .bhandle-t { flex: 1; font: 400 15px "IM Fell English SC", Georgia, serif; letter-spacing: .04em; color: var(--sepia); }
  .bhandle .link { font-size: 14px; padding: 6px 0; }
  .bpanel { padding: 4px 12px calc(14px + env(safe-area-inset-bottom)); }
  .bside.peek .bpanel { padding-top: 0; }

  /* Peek strip (collapsed): one horizontal row of chips, rooms or shop items. */
  /* Collapsed: category chips above one horizontal catalogue strip (search when dragged up). */
  .bside.peek:not(.auf) .bshopwrap { gap: 4px; }
  .bside.peek:not(.auf) .bsearch { display: none; }
  .bside.peek:not(.auf) .bshop { display: flex; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .bside.peek:not(.auf) .bshop::-webkit-scrollbar { display: none; }
  .bside.peek:not(.auf) .bshop .bitem { flex: 0 0 92px; padding: 4px 3px 3px; }
  .bside.peek:not(.auf) .bshop .bitem canvas { width: 40px !important; height: 40px !important; }
  .bside.peek:not(.auf) .bshop .bitem > small, .bside.peek:not(.auf) .bitem-fuss { display: none; }
  .bside.peek:not(.auf) .bitem-n { font-size: 12.5px; line-height: 1.12; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .bside.peek:not(.auf) .bitem-seal { right: -10px; bottom: -4px; min-width: 22px; height: 20px; font-size: 11px; }
  /* While a piece is armed the strip keeps its names: the category chips step aside instead. */
  .bside.peek:not(.auf) .bshopwrap.armed .bkats { display: none; }
  .bside.peek:not(.auf) .barmed { padding: 3px 6px; }
  .bside.peek:not(.auf) .barmed canvas { width: 28px !important; height: 28px !important; }
  .bside.peek:not(.auf) .bdach { padding: 4px 6px; }
  .bside.peek:not(.auf) .bdach h4 { font-size: 13px; margin-bottom: 2px; }
  .bside.peek:not(.auf) .brooms { flex-direction: row; overflow-x: auto; max-height: none; }
  .bside.peek:not(.auf) .broom { flex: 0 0 auto; max-width: 200px; }
  .bside.peek:not(.auf) .bchips, .bside.peek:not(.auf) .bkats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .bside.peek:not(.auf) .bkats .chip, .bside.peek:not(.auf) .bchips .chip { flex: none; }
  /* Collapsed Räume and Natur peeks: one horizontal row (actions first, then rooms or items). */
  .braeume-peek, .bnatur-peek {
    display: flex; align-items: stretch; gap: 4px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    padding: 2px 0 4px;
  }
  .braeume-peek::-webkit-scrollbar, .bnatur-peek::-webkit-scrollbar { display: none; }
  .braeume-peek > *, .bnatur-peek > * { flex: none; }
  .braeume-peek .btn, .bnatur-peek .btn { min-height: 44px; white-space: nowrap; }
  /* Räume: actions on top, the room chips below; each row scrolls sideways on its own. */
  .braeume-peek { flex-direction: column; gap: 5px; overflow: visible; padding: 0 0 2px; }
  .bpeek-aktionen, .bpeek-raeume { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .bpeek-aktionen::-webkit-scrollbar, .bpeek-raeume::-webkit-scrollbar { display: none; }
  .bpeek-aktionen > *, .bpeek-raeume > * { flex: none; }
  .braeume-peek .bpeek-aktionen .btn { min-height: 40px; padding: 4px 12px; font-size: 14px; }
  .braeume-peek .broom { max-width: 190px; min-height: 44px; padding: 3px 8px 3px 4px; border-color: rgba(109, 82, 53, .25); }
  .braeume-peek .broom small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bnatur-peek .bnchip { width: 70px; padding: 4px 2px; }
  .bnatur-peek .bnchip-n { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .bnchips { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .btiered { padding: 8px 8px 10px; }
  .btiered-top { gap: 10px; }
  .btierrow { grid-template-columns: 62px minmax(0, 1fr); gap: 2px 6px; }
  .btierwesen { margin-left: 68px !important; }
  .btierdot { width: 30px; height: 30px; }
  .chip.btierchip { min-height: 32px; padding: 3px 10px; }
  .btierliste { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btier { min-height: 44px; }
  .braum-details { padding: 10px 6px; }
  .bshop { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
  .bchips .chip, .bkats .chip { min-height: 36px; }
  .bkats .chip { min-height: 32px; font-size: 13px; }
  .broom { min-height: 44px; }

  .bbar {
    display: flex; position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: var(--bbar-h);
    padding: 4px 4px env(safe-area-inset-bottom); border-radius: 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .35), inset 0 0 0 3px var(--paper), inset 0 0 0 4px rgba(109, 82, 53, .32);
  }
  .btoolrow, .btabbar { display: flex; align-items: stretch; gap: 2px; width: 100%; min-width: 0; }
  .bhistrow { display: flex; flex-direction: column; gap: 1px; flex: none; border-right: 1px solid rgba(109, 82, 53, .3); padding-right: 3px; }
  .btoolrow .bhistrow .btool { width: 40px; flex: 1 1 0; min-height: 0; padding: 0; justify-content: center; }
  .btoolrow .bhistrow .btool .bl { display: none; }
  .btoolrow .bhistrow .btool .bi svg { width: 19px; height: 19px; }
  .btoolrow .bhistrow .btool:disabled { opacity: .35; }
  .btoolscroll {
    flex: 1; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
    scroll-snap-type: x mandatory; scroll-padding-inline: 0; overscroll-behavior-x: contain;
    --fl: 0px; --fr: 0px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  }
  .btoolscroll.mehr-links { --fl: 22px; }
  .btoolscroll.mehr-rechts { --fr: 18px; }
  .btoolscroll > .btool { scroll-snap-align: start; }
  .btoolscroll::-webkit-scrollbar { display: none; }
  .btoolrow .btool { flex: none; width: 58px; font-size: 11px; padding: 5px 0 3px; }
  /* A partly visible fifth tool and the fade show that the row scrolls. */
  .btoolscroll { scroll-snap-type: x proximity; }
  .btoolrow .bmore { border-left: 1px solid rgba(109, 82, 53, .3); border-radius: 0; }
  .btab {
    flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    border: 0; background: transparent; cursor: pointer; color: var(--sepia); font-size: 10.5px; line-height: 1.1; padding: 3px 0; border-radius: 2px;
  }
  .btab .bl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .btab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
  .btab .btabdot { top: 4px; right: calc(50% - 16px); }
  .bbauen { flex: 0 0 56px; background: var(--seal); color: #f6e6cf; }

  .bmodal { padding: 14px 14px 16px; width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .bmodal.bwide { width: calc(100vw - 16px); }
  .bpicklist { grid-template-columns: 1fr; }
  .bsizes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bflavours { grid-template-columns: 1fr; }
  .bpickfoot { bottom: -16px; }
  .row2 { grid-template-columns: 1fr; }
  .bmodal .row2 { grid-template-columns: 1fr 1fr; }
  .bbal { font-size: 30px; }
  .bgoldpop { max-height: 60vh; }
  .btn { min-height: 38px; }
  .bthreat-btn { width: 32px; height: 32px; }
}

/* Text only screen readers hear (e.g. "Bastionszug wartet" next to a dot). */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btabbar-tabs { display: contents; }
