/* ==========================================================================
   FredeMMO · windows.css — every window, each with its own trade.
   Shared parts (frame, head, buttons, tabs, slots, parchment) live in theme.css;
   here a window only says what makes it different: its emblem, its material
   and the layout of what it shows.
   ========================================================================== */

/* ---- Bank: the strongbox ------------------------------------------------ */
#bank-dialog {
  --emblem: var(--emb-chest);
  width: min(900px, calc(100% - 24px));
  height: min(680px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
#bank-dialog[open] { display: flex; flex-direction: column; }
.bank-toolbar { flex: 0 0 auto; display: flex; gap: 10px; padding: 11px 18px 10px; }
#bank-search { flex: 1; min-width: 140px; }
#bank-deposit-materials { white-space: nowrap; }
.bank-filters { flex: 0 0 auto; }
.bank-layout {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr);
  background: #00000040;
}
.bank-vault, .bank-bag {
  min-height: 0; padding: 12px 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
}
/* The vault is lined with plate iron; your bags are leather. */
.bank-vault { background: var(--tex-iron), linear-gradient(#17130e, #0f0c08); box-shadow: inset 0 0 40px #000b; border-right: 1px solid #000; }
.bank-bag { background: var(--tex-leather), linear-gradient(#2e2014, #1c130b); box-shadow: inset 0 0 30px #000a, inset 1px 0 0 var(--bronze-0); }
.bank-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.bank-section-head .rule { flex: 1; }
.bank-meter { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.bank-meter .trough { width: 74px; height: 9px; }
.bank-meter strong { font: 600 var(--fs-1)/1 var(--font); color: var(--text-2); font-variant-numeric: tabular-nums; }
.bank-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; align-content: start; }
.bank-pack { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bank-slot { aspect-ratio: 1; min-width: 0; width: 100%; cursor: pointer; }
span.bank-slot { cursor: default; }
.bank-slot .item-icon { width: 76%; height: 76%; }
.bank-empty { grid-column: 1 / -1; margin: 22px 0; text-align: center; color: var(--text-3); font-style: italic; }
.bank-selected {
  flex: 0 0 auto; min-height: 62px;
  display: flex; align-items: center; gap: 14px;
  padding: 9px 18px;
  background: var(--tex-grain), linear-gradient(#2c2013, #1a120a);
  border-top: 1px solid #000; box-shadow: 0 -1px 0 var(--bronze-1);
}
.bank-hint { margin: 0; color: var(--text-3); font-style: italic; }
.bank-detail-icon { flex: 0 0 46px; width: 46px; height: 46px; }
.bank-detail-icon .item-icon { width: 78%; height: 78%; }
.bank-detail-text { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.bank-detail-text strong { font: 600 var(--fs-3)/1.2 var(--font); }
.bank-selected-count { color: var(--text-2); font-size: var(--fs-1); }
.bank-selected-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 800px) {
  #bank-dialog { width: calc(100% - 12px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .bank-layout { display: block; overflow-y: auto; overscroll-behavior: contain; }
  .bank-vault, .bank-bag { overflow: visible; }
  .bank-vault { border-right: 0; border-bottom: 1px solid #000; }
  .bank-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .bank-pack { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .bank-toolbar { flex-direction: column; }
  .bank-grid, .bank-pack { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bank-selected { flex-wrap: wrap; padding: 8px 12px; }
  .bank-selected-actions { width: 100%; justify-content: stretch; }
  .bank-selected-actions button { flex: 1; }
  .win-head { padding-left: 14px; }
}

/* ---- Bags: leather pouches with stitched edges ---------------------------- */
.bags-dialog {
  --emblem: var(--emb-pouch);
  position: fixed; inset: auto 14px 14px auto; margin: 0;
  /* As wide as its slots need (Frederik: the bags were very big); a big bag only adds rows. */
  width: min(252px, calc(100% - 20px));
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  z-index: 41;
}
.bags-dialog[open] { display: flex; flex-direction: column; }
#bag-windows { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 9px; padding: 11px 12px 4px; }
.bag-window {
  position: relative;
  padding: 8px 10px 9px;
  background: var(--tex-leather), linear-gradient(#3d2a19, #271a0e);
  border: 1px solid #000;
  box-shadow: inset 0 0 0 1px #5a4126, inset 0 2px 8px #000a, 0 1px 0 #ffffff12;
  border-radius: var(--corner);
}
.bag-window::after { /* the stitching */
  content: ''; position: absolute; inset: 3px; pointer-events: none;
  border: 1px dashed #b78c4e66; border-radius: 1px;
}
.bag-head { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; font: 600 var(--fs-2)/1.1 var(--font); color: var(--bronze-4); }
.bag-head .item-icon { width: 20px; height: 20px; flex: 0 0 20px; }
.bag-head strong { text-shadow: 0 1px 0 #000; }
.bag-grid { display: grid; grid-template-columns: repeat(4, 46px); gap: 4px; position: relative; z-index: 1; }
.bag-slot, .char-slot { width: 100%; aspect-ratio: 1; cursor: pointer; }
.bag-slot .item-icon, .char-slot .item-icon { width: 76%; height: 76%; }
.char-slot.empty .item-icon { opacity: .22; filter: grayscale(1); }
.bag-foot { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; color: var(--text-2); font-size: var(--fs-1); }
.bag-over { color: var(--bad); }
.bag-gold { color: var(--bronze-4); font-weight: 600; }
.bag-places { position: relative; z-index: 1; display: flex; gap: 5px; margin-top: 7px; }
/* Sort and Sell junk under the backpack (src/junk.js), and the list of what would be sold. */
.bag-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.bag-actions button { min-height: 28px; padding: 4px 10px; }
.bag-slot.junk .junk-sign { position: absolute; left: 3px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f3dc8a, #a77b23 70%); box-shadow: 0 0 0 1px #000, 0 1px 2px #000a; pointer-events: none; }
.junk-list { margin: 4px 0 8px; padding-left: 18px; display: grid; gap: 2px; font-size: var(--fs-1); max-height: 9.5em; overflow: auto; }
.bag-place { width: 30px; height: 30px; }
.bag-place .item-icon { width: 78%; height: 78%; }
.bag-place.empty { --rar-ring: #261d12; opacity: .8; }
.bag-place.empty .item-icon { opacity: .22; }
.bag-tools { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.bag-tools-label { font: 600 var(--fs-0)/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--bronze-2); margin-right: 2px; }
.bag-tool { width: 32px; height: 32px; }
.bag-tool .item-icon { width: 80%; height: 80%; }
.bag-overflow { box-shadow: inset 0 0 0 1px #9a3b30, inset 0 2px 8px #000a; }
.bag-overflow .bag-head { color: var(--bad); }
.bag-info { flex: 0 0 auto; margin: 0; padding: 9px 12px 11px; border-top: 1px solid #000; box-shadow: 0 -1px 0 var(--bronze-0); background: #0000003d; }
.bag-info p { margin: 4px 0; }
.bag-detail { padding-bottom: 8px; margin-bottom: 7px; border-bottom: 1px dashed #5a4526; }
.bag-detail > strong { font: 600 var(--fs-3)/1.2 var(--font); }
.item-detail { margin: 2px 0; color: var(--text-2); font-size: var(--fs-1); }
.item-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.item-buttons button, .bag-info button { padding: 5px 10px; min-height: 28px; font-size: var(--fs-1); }
#inventory-status { min-height: 1.3em; color: var(--bronze-3); font-style: italic; margin: 2px 0; }
#inventory-trade-hint { margin: 0; color: var(--text-3); font-size: var(--fs-1); font-style: italic; }
.store-buy { display: block; margin-top: 6px; width: 100%; text-align: left; }
@media (max-width: 600px) { .bags-dialog { inset: auto 6px 6px 6px; width: auto; max-width: none; } .bag-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ---- Character: the knight in his alcove --------------------------------- */
.character-dialog { --emblem: var(--emb-helm); width: min(458px, calc(100% - 20px)); }
.character-dialog[open] { position: fixed; inset: 0; margin: auto; max-height: calc(100dvh - 28px); overflow: auto; z-index: 40; }
@media (min-width: 900px) { .character-dialog[open] { inset: 0 410px 0 0; } }
.character-dialog .win-head { position: sticky; top: 0; z-index: 3; background: linear-gradient(#2c2013f2, #1a120af2); }
.char-level { display: flex; align-items: center; gap: 10px; padding: 9px 18px 2px; }
.char-badge {
  flex: 0 0 auto; min-width: 32px; height: 32px; padding: 0 4px; display: grid; place-items: center;
  font: 700 var(--fs-3)/1 var(--font); color: #1d1306;
  background: linear-gradient(#e6cc84, #a9812f); border: 1px solid #000;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  text-shadow: 0 1px 0 #ffffff66;
}
.char-level .trough { flex: 1; height: 12px; --hi: #c093ee; --lo: #6b3fa0; }
.char-xp-text { flex: 0 0 auto; font-size: var(--fs-1); color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 8em; text-align: right; }
.char-body { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 10px; padding: 10px 18px 6px; align-items: start; }
.char-slots { display: flex; flex-direction: column; gap: 7px; }
.char-slots .char-slot { width: 52px; height: 52px; }
.char-figure {
  position: relative; aspect-ratio: 1 / 1.1; overflow: hidden;
  border: 1px solid #000;
  /* an arched niche cut into stone, lit from the front */
  background:
    radial-gradient(70% 55% at 50% 38%, #4a4234aa, #0000 70%),
    var(--tex-iron),
    linear-gradient(#262016, #0e0b07);
  box-shadow: inset 0 0 0 1px var(--bronze-0), inset 0 0 36px #000, 0 1px 0 #ffffff14;
  border-radius: 90px 90px 2px 2px / 70px 70px 2px 2px;
}
.char-figure canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.char-turn { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; gap: 8px; }
.char-turn button { width: 28px; height: 22px; min-height: 0; padding: 0; position: relative; }
.char-turn button::after { content: ''; position: absolute; inset: 0; margin: auto; width: 9px; height: 10px; background: var(--bronze-3); }
#char-turn-left::after { clip-path: polygon(100% 0, 0 50%, 100% 100%); }
#char-turn-right::after { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.char-bottom { display: flex; justify-content: center; gap: 10px; padding: 4px 18px 10px; }
.char-bottom .char-slot { width: 52px; height: 52px; }
.char-info { margin: 0 18px 10px; padding: 8px 11px; min-height: 52px; background: #00000052; border: 1px solid #000; box-shadow: inset 0 0 0 1px #3a2c18, inset 0 2px 5px #0009; border-radius: var(--corner); font-size: var(--fs-1); }
.char-info p { margin: 3px 0; }
.char-info > strong { font: 600 var(--fs-3)/1.2 var(--font); }
.char-info button { margin-top: 4px; padding: 4px 10px; min-height: 26px; }
.char-stats { margin: 0 18px 12px; padding: 12px 16px 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 4px 28px; }
.char-group { min-width: 0; }
.char-group h3 { margin: 0 0 4px; padding-bottom: 2px; border-bottom: 1px solid #5b442666; }
.char-stat { display: flex; align-items: baseline; gap: 6px; padding: 2px 0; font-size: var(--fs-2); }
.char-stat span { display: flex; flex: 1; align-items: baseline; color: var(--ink-dark-2); }
.char-stat span::after { content: ''; flex: 1; margin: 0 5px; border-bottom: 1px dotted #5b442699; transform: translateY(-3px); }
.char-stat strong { color: var(--ink-dark); font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 600px) {
  .character-dialog[open] { inset: 6px 6px auto 6px; margin: 0 auto; max-height: 54dvh; }
  body:has(.character-dialog[open]) #inventory-dialog[open] { max-height: calc(46dvh - 18px); }
  .char-body { grid-template-columns: 46px minmax(0, 1fr) 46px; padding-left: 12px; padding-right: 12px; gap: 6px; }
  .char-slots .char-slot, .char-bottom .char-slot { width: 46px; height: 46px; }
}

/* ---- Crafting: one recipe book, four trades ------------------------------
   The list on the left, the chosen recipe's page on the right. The trade decides the page:
   the smith's is lit by the forge, the cook's is parchment, the alchemist's a green glass
   and the skinner's stitched leather. */
.craft-win {
  width: min(980px, calc(100% - 24px));
  height: min(660px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
.craft-win[open] { display: flex; flex-direction: column; }
#smith-dialog, #craft-dialog[data-craft=smithing] { --emblem: var(--emb-anvil); }
#cook-dialog { --emblem: var(--emb-pot); }
#alchemy-dialog { --emblem: var(--emb-cauldron); }
#craft-dialog[data-craft=skinning] { --emblem: var(--emb-pouch); }

.craft-notice {
  flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  padding: 9px 18px; background: #00000048; border-bottom: 1px solid #000; box-shadow: 0 1px 0 #ffffff0d;
}
.craft-notice p { margin: 0; flex: 1; color: var(--text-2); font-style: italic; font-size: var(--fs-1); }
.craft-notice p[hidden], .craft-notice button[hidden] { display: none; }
.craft-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 16px; padding: 9px 18px 8px; }
.craft-bar .rule { flex: 1; }
.craft-bar label { display: flex; align-items: center; gap: 7px; font-size: var(--fs-1); white-space: nowrap; }
.craft-bar label[hidden] { display: none; }
.craft-tabs { flex: 0 0 auto; }

.craft-layout { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); border-top: 1px solid #000; }
.craft-side { display: flex; flex-direction: column; min-height: 0; background: #00000040; border-right: 1px solid #000; box-shadow: inset -1px 0 0 var(--bronze-0); }
.craft-side .craft-toolbar { padding: 7px 8px 0; gap: 2px; }
.craft-side .craft-filter { padding: 5px 9px 4px; font-size: var(--fs-0); letter-spacing: .03em; }
.craft-rows { flex: 1 1 auto; min-height: 0; margin: 0; padding: 7px; list-style: none; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 3px; }
.craft-row-item { display: block; }
.craft-row {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 12px; align-items: center; gap: 10px;
  width: 100%; min-height: 0; padding: 5px 9px 5px 5px; text-align: left; letter-spacing: 0;
  color: var(--text); font: var(--fs-2)/1.2 var(--font);
  background: linear-gradient(90deg, #1e160e, #17110a);
  border: 1px solid #000; border-radius: 1px;
  box-shadow: inset 0 0 0 1px #2d2314;
  text-shadow: none;
}
.craft-row .slot { width: 38px; height: 38px; }
.craft-row .slot .item-icon { width: 78%; height: 78%; }
.craft-row-text { display: flex; flex-direction: column; min-width: 0; }
.craft-row-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.craft-row-text small { color: var(--text-3); font-size: var(--fs-0); }
.craft-row-badge { color: var(--text-3); font-size: var(--fs-0); white-space: nowrap; }
.craft-row.blocked .craft-row-text strong { opacity: .72; }
.craft-row.blocked .slot { filter: saturate(.55) brightness(.8); }
.craft-row:hover { background: linear-gradient(90deg, #2c2012, #1d1510); box-shadow: inset 0 0 0 1px var(--bronze-0); filter: none !important; }
.craft-row.chosen { background: linear-gradient(90deg, #4a3718, #251a0d); box-shadow: inset 0 0 0 1px var(--bronze-2), inset 4px 0 0 var(--bronze-3); }
.craft-row .pip { justify-self: center; }

.craft-detail { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px 22px; position: relative; }
.craft-page { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.craft-page.empty { height: 100%; justify-content: center; align-items: center; color: var(--text-3); font-style: italic; }
.cd-head { display: flex; align-items: center; gap: 16px; }
.cd-icon { flex: 0 0 76px; width: 76px; height: 76px; }
.cd-icon .item-icon { width: 78%; height: 78%; }
.cd-title { min-width: 0; }
.cd-title h3 { font: 600 var(--fs-5)/1.1 var(--font); font-variant: normal; text-transform: none; letter-spacing: .01em; text-shadow: 0 2px 0 #000; }
.cd-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 5px 0 0; font: 600 var(--fs-0)/1.2 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.cd-rarity { color: var(--rar, var(--r-common)); }
.cd-stat { margin: 0; color: var(--text); font-size: var(--fs-2); }
.cd-desc { margin: 0; color: var(--text-2); font-style: italic; }
.cd-effects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cd-effects li { position: relative; padding-left: 16px; }
.cd-effects li::before { content: ''; position: absolute; left: 3px; top: .5em; width: 6px; height: 6px; transform: rotate(45deg); background: var(--bronze-1); }
.cd-effects li.buff { padding: 6px 9px 6px 24px; color: var(--bronze-4); background: linear-gradient(90deg, #6b4f1833, #0000); border-left: 2px solid var(--bronze-2); }
.cd-effects li.buff::before { left: 9px; top: .75em; background: var(--bronze-3); }
.cd-needs { margin-top: 4px; }
.cd-needs h4 { margin: 0 0 8px; font: 600 var(--fs-1)/1.2 var(--font); font-variant: small-caps; letter-spacing: .12em; text-transform: lowercase; color: var(--bronze-3); display: flex; align-items: center; gap: 10px; }
.cd-needs h4::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--bronze-1), #0000); }
.cd-need-row { display: flex; flex-wrap: wrap; gap: 14px; }
.need { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 76px; text-align: center; outline-offset: 3px; }
.need .slot { width: 52px; height: 52px; }
.need .slot .item-icon { width: 78%; height: 78%; }
.need .coin-slot { background: var(--emb-coin) center / 62% no-repeat, radial-gradient(circle at 50% 30%, #2a2013 0, #0f0b07 80%); --rar-ring: #6f5420; }
.need-count { font: 700 var(--fs-2)/1 var(--font); font-variant-numeric: tabular-nums; }
.need.have .need-count { color: var(--ok); }
.need.missing .need-count { color: var(--bad); }
.need.missing .slot { --rar-ring: #7a2f22; filter: saturate(.6); }
.need-name { font-size: var(--fs-0); color: var(--text-3); line-height: 1.15; overflow-wrap: anywhere; }
.cd-note { margin: 0; font-size: var(--fs-1); color: var(--warn); font-style: italic; }
.cd-state { margin: 2px 0 0; padding: 7px 10px; font: 600 var(--fs-1)/1.35 var(--font); border: 1px solid #000; }
.cd-state.ready { color: var(--ok); background: #1a2a1466; box-shadow: inset 0 0 0 1px #2d4a2255; }
.cd-state.blocked { color: #eaa08c; background: #2a141066; box-shadow: inset 0 0 0 1px #5a2a2255; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cd-actions button { min-height: 36px; }
.craft-win .cd-actions .cd-primary { min-height: 42px; padding: 10px 30px; font-size: var(--fs-3); letter-spacing: .08em; }

/* The smith: the page glows from below, the button is a coal. */
#smith-dialog .craft-detail, #craft-dialog[data-craft=smithing] .craft-detail {
  background: radial-gradient(70% 45% at 50% 108%, #e7812f2e, #0000 70%), var(--tex-iron), linear-gradient(#1b1611, #100c08);
}
#smith-dialog .cd-primary, #craft-dialog[data-craft=smithing] .cd-primary {
  background: linear-gradient(#f3a851, #cf6a1f 55%, #a24c12); color: #1d0c02; box-shadow: inset 0 1px 0 #ffe2b0aa, inset 0 -2px 0 #0005, inset 0 0 0 1px #7a3a0c, 0 0 14px #e7812f44, 0 2px 3px #0007;
}
#smith-dialog .cd-head, #craft-dialog[data-craft=smithing] .cd-head { padding-bottom: 12px; border-bottom: 2px solid; border-image: linear-gradient(90deg, var(--ember), #0000) 1; }

/* The cook: a recipe written on parchment. */
#cook-dialog .craft-detail { background: var(--tex-paper), radial-gradient(120% 100% at 30% 10%, #ead9ae, #c9b282 75%, #b09960); box-shadow: inset 0 0 50px #6b4f1e88; color: var(--ink-dark); }
#cook-dialog .craft-page { color: var(--ink-dark); }
#cook-dialog .cd-title h3 { color: #5a2f0d; text-shadow: none; }
#cook-dialog .cd-title h3.rarity-uncommon { color: #2d6a1e; } #cook-dialog .cd-title h3.rarity-rare { color: #1c5aa0; } #cook-dialog .cd-title h3.rarity-epic { color: #6c2fa6; }
#cook-dialog .cd-meta, #cook-dialog .need-name { color: var(--ink-dark-3); }
#cook-dialog .cd-rarity { color: var(--ink-dark-2); }
#cook-dialog .cd-desc, #cook-dialog .cd-stat, #cook-dialog .cd-effects li { color: var(--ink-dark); }
#cook-dialog .cd-note { color: #7a4a10; }
#cook-dialog .cd-needs h4 { color: #6b4210; }
#cook-dialog .cd-needs h4::after { background: linear-gradient(90deg, #6b421088, #0000); }
#cook-dialog .cd-effects li.buff { color: #5a3a08; background: linear-gradient(90deg, #8a5a1a2e, #0000); border-left-color: #8a5a1a; }
#cook-dialog .cd-effects li::before { background: #7a4a14; }
#cook-dialog .need.have .need-count { color: #2d6a1e; } #cook-dialog .need.missing .need-count { color: #a3301f; }
#cook-dialog .cd-state.ready { color: #2d5a1e; background: #5a8a3a22; box-shadow: inset 0 0 0 1px #4a7a3044; border-color: #5a431f66; }
#cook-dialog .cd-state.blocked { color: #8a2a1a; background: #a3301f1a; box-shadow: inset 0 0 0 1px #8a2a1a44; border-color: #5a431f66; }
#cook-dialog .cd-icon { box-shadow: inset 0 0 0 2px var(--rar-ring, #34291a), inset 0 3px 7px #000d, 0 0 0 3px #00000040; }
#cook-dialog .cd-head { padding-bottom: 12px; border-bottom: 1px dashed #6b421099; }

/* The alchemist: green glass, and the herbs are laid out as a formula. */
#alchemy-dialog .craft-detail { background: radial-gradient(80% 55% at 50% 0, #3e7a5e30, #0000 70%), var(--tex-slate), linear-gradient(#101a16, #0b100d); }
#alchemy-dialog .cd-primary { background: linear-gradient(#7fd0a8, #3f9a78 55%, #2b7058); color: #04140d; box-shadow: inset 0 1px 0 #d6ffeeaa, inset 0 -2px 0 #0005, inset 0 0 0 1px #1d4a38, 0 0 14px #5fc9a044, 0 2px 3px #0007; }
#alchemy-dialog .cd-need-row { gap: 6px; align-items: flex-start; }
#alchemy-dialog .need + .need::before { content: '+'; position: absolute; margin: 16px 0 0 -14px; font: 700 18px/1 var(--font); color: #5fc9a0; }
#alchemy-dialog .need { position: relative; margin-left: 12px; }
#alchemy-dialog .need:first-child { margin-left: 0; }
#alchemy-dialog .craft-side { background: #06100b66; }
#alchemy-dialog .craft-row.chosen { background: linear-gradient(90deg, #1f4a38, #0d1c15); box-shadow: inset 0 0 0 1px #4fb08a, inset 4px 0 0 #7fd0a8; }

/* The skinner's bench: stitched leather. */
#craft-dialog[data-craft=skinning] .craft-detail { background: var(--tex-leather), linear-gradient(#3b2916, #25190d); }
#craft-dialog[data-craft=skinning] .craft-page { padding: 14px 16px; border: 1px dashed #b78c4e77; outline: 1px solid #000; outline-offset: 5px; }
#craft-dialog[data-craft=skinning] .cd-primary { background: linear-gradient(#d9ab6c, #a8743a 55%, #82552a); }

@media (max-width: 760px) {
  .craft-win { width: calc(100% - 12px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .craft-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 40%) minmax(0, 60%); }
  .craft-side { border-right: 0; border-bottom: 1px solid #000; }
  .craft-detail { padding: 14px 14px 18px; }
  .cd-icon { flex-basis: 60px; width: 60px; height: 60px; }
  .cd-title h3 { font-size: var(--fs-4); }
  .craft-notice { flex-wrap: wrap; padding: 8px 14px; }
}

/* ---- Waystones: the old stones, each with its own rune ---------------------
   A cool slab of rock in place of the warm planks: nothing else in the game is
   lit from within, so it is plain at once that this is not a shop. */
.waystone-win {
  --emblem: var(--emb-rune);
  --rivet: radial-gradient(circle, #d9fbff 0 1px, #5fc3d3 2px, #174a55 3.6px, #0000 4.4px);
  width: min(660px, calc(100% - 22px));
  background:
    var(--rivet) left 4px top 4px / 10px 10px no-repeat,
    var(--rivet) right 4px top 4px / 10px 10px no-repeat,
    var(--rivet) left 4px bottom 4px / 10px 10px no-repeat,
    var(--rivet) right 4px bottom 4px / 10px 10px no-repeat,
    var(--tex-slate),
    radial-gradient(90% 60% at 50% -10%, #3a8ea040, #0000 70%),
    linear-gradient(#1b2527, #0e1517);
  box-shadow: 0 0 0 1px #000, 0 0 0 4px #1a2426, 0 0 0 5px #3b6f78, 0 0 0 6px #000, 0 0 40px #3abce926, 0 26px 70px #000d;
}
.waystone-win .win-head::before { box-shadow: inset 0 0 0 1px #3b6f78, 0 0 10px #5fc3d355; background-image: var(--emblem), radial-gradient(circle at 50% 38%, #27414a, #0b1316); }
.waystone-win .win-head h2 { color: #bdeffa; text-shadow: 0 2px 0 #000, 0 0 16px #5fc3d355; }
.waystone-win .win-head { box-shadow: 0 1px 0 #3b6f78, 0 2px 0 #000; background: linear-gradient(#0000004d, #0000001a); }
.waystone-win .win-head::after { background: linear-gradient(135deg, #bdeffa, #3b8ea0); box-shadow: 0 0 0 1px #3b6f78, 0 0 8px #5fc3d388; }
.waystone-win h3 { color: #8fd6e4; }
.waystone-body { padding: 14px 18px 16px; }
.waystone-progress-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.waystone-meter { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; }
.waystone-meter strong { font: 600 var(--fs-2)/1.2 var(--font); color: #d4f6ff; }
.waystone-meter .trough { height: 9px; --hi: #aef0ff; --lo: #2f93ad; box-shadow: inset 0 1px 3px #000, 0 1px 0 #ffffff14, 0 0 0 1px #2b5560; }
.waystone-progress-row > span { flex: 0 1 200px; text-align: right; font-size: var(--fs-0); font-style: italic; color: #7fa5ad; }
.waystone-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: min(50vh, 420px); overflow: auto; padding-right: 3px; }
.waystone-destination {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 12px 10px 10px;
  background: var(--tex-slate), linear-gradient(145deg, #1f2c30, #121a1d);
  /* a tablet with its top corners cut */
  clip-path: polygon(0 9px, 9px 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 1px #3b565d, inset 0 2px 8px #000a;
}
.waystone-destination.current { box-shadow: inset 0 0 0 1px #7fd6e0, inset 0 0 22px #5fc3d333, inset 0 2px 8px #000a; background: var(--tex-slate), linear-gradient(145deg, #24414a, #132228); }
.waystone-destination.unknown { background: linear-gradient(145deg, #151d20, #0d1315); box-shadow: inset 0 0 0 1px #232f33, inset 0 2px 8px #000a; }
.waystone-rune {
  position: relative; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #12262c, #05090b);
  box-shadow: inset 0 0 0 2px #2f4b53, inset 0 0 14px #000, 0 1px 0 #ffffff14;
}
.rune-glyph { width: 70%; height: 80%; fill: none; stroke: #8fe9f7; stroke-width: 2.6; stroke-linecap: round; filter: drop-shadow(0 0 4px #4fd6ee) drop-shadow(0 0 1px #d9fbff); }
.waystone-destination.current .rune-glyph { stroke: #e4fdff; animation: rune-pulse 3.2s ease-in-out infinite; }
.waystone-destination.unknown .waystone-rune { box-shadow: inset 0 0 0 2px #1f2d32, inset 0 0 14px #000; }
.rune-blank { font: 600 22px/1 var(--font); color: #2f4750; }
.waystone-destination-info { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.waystone-destination-info strong { font: 600 var(--fs-2)/1.25 var(--font); color: #d8f3f8; }
.waystone-destination.unknown .waystone-destination-info strong { color: #55737b; font-style: italic; font-weight: 400; }
.waystone-destination-info span { font-size: var(--fs-0); letter-spacing: .05em; text-transform: uppercase; color: #7fa5ad; }
.waystone-destination button { min-width: 72px; color: #04181d; background: linear-gradient(#b4f1ff, #4fb4cc 55%, #2f8fa6); box-shadow: inset 0 1px 0 #fffc, inset 0 -2px 0 #0004, inset 0 0 0 1px #1d5560, 0 0 10px #4fd6ee33; text-shadow: 0 1px 0 #ffffff66; }
.waystone-empty { grid-column: 1 / -1; padding: 24px 16px; text-align: center; font-style: italic; color: #7fa5ad; box-shadow: inset 0 0 0 1px #2b4047; }
.waystone-status { min-height: 1.3em; margin: 12px 0 0; color: #a9e6f2; font-style: italic; font-size: var(--fs-1); }
@keyframes rune-pulse { 50% { filter: drop-shadow(0 0 7px #7fe6ff) drop-shadow(0 0 2px #fff); } }
@media (prefers-reduced-motion: reduce) { .waystone-destination.current .rune-glyph { animation: none; } }
@media (max-width: 560px) {
  .waystone-list { grid-template-columns: 1fr; }
  .waystone-progress-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .waystone-progress-row > span { text-align: left; flex-basis: auto; }
}

/* ---- The inn: a hearth by the window ----------------------------------------- */
#inn-dialog { --emblem: var(--emb-bed); width: min(520px, calc(100% - 22px)); }
.inn-body { padding: 16px 20px 18px; }
.inn-home-change { display: grid; grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr); align-items: stretch; gap: 8px; margin-bottom: 16px; }
.inn-home-place { min-width: 0; padding: 11px 12px; background: #0000004d; border: 1px solid #000; box-shadow: inset 0 0 0 1px #3a2c18, inset 0 2px 6px #000a; }
.inn-home-place.new { box-shadow: inset 0 0 0 1px var(--bronze-2), inset 0 0 20px #e7812f26, inset 0 2px 6px #000a; background: radial-gradient(90% 100% at 50% 120%, #e7812f2a, #0000), #0000004d; }
.inn-home-place span { display: block; margin-bottom: 4px; font: 600 var(--fs-0)/1.2 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.inn-home-place strong { display: block; font: 600 var(--fs-3)/1.25 var(--font); color: var(--text); overflow-wrap: anywhere; }
.inn-home-place.new strong { color: var(--bronze-4); }
.inn-home-arrow { align-self: center; justify-self: center; font-size: 0; width: 18px; height: 22px; background: var(--bronze-3); clip-path: polygon(0 0, 100% 50%, 0 100%, 25% 50%); }
.inn-question { margin: 0; color: var(--text); }
.inn-status { min-height: 1.3em; margin: 8px 0 0; color: var(--bronze-3); font-style: italic; font-size: var(--fs-1); }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.inn-actions { justify-content: flex-end; margin-top: 12px; }
@media (max-width: 460px) {
  .inn-home-change { grid-template-columns: 1fr; }
  .inn-home-arrow { transform: rotate(90deg); }
  .inn-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---- The journal: quests are pages, the pay is a stamp ---------------------
   Parchment sheets laid on the dark plank, objectives ticked in ink, and a wax
   seal to take or hand in a task. */
.journal { --emblem: var(--emb-scroll); width: min(580px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow: hidden; }
.journal[open] { display: flex; flex-direction: column; }
#questlog-dialog { width: min(900px, calc(100% - 24px)); }
.quest-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.quest-hint { margin: 2px 0; color: var(--text-3); font-style: italic; }
.quest-card {
  position: relative; padding: 16px 20px 16px;
  color: var(--ink-dark);
  background: var(--tex-paper), radial-gradient(120% 100% at 30% 0, #ecdfba, #cdb788 78%, #b59f6c);
  border: 1px solid #000; box-shadow: inset 0 0 0 1px #fff4, inset 0 0 36px #6b4f1e66, 0 3px 8px #000b;
}
.quest-card::before { /* a dog-eared corner */
  content: ''; position: absolute; right: 0; top: 0; width: 22px; height: 22px;
  background: linear-gradient(225deg, #1b140c 50%, #9d8654 50%); box-shadow: -1px 1px 2px #0006;
}
.quest-card.ready { box-shadow: inset 0 0 0 1px #fff4, inset 0 0 36px #6b4f1e66, 0 0 0 2px #5a8a3a, 0 3px 8px #000b; }
.quest-card h3 { margin: 0 24px 4px 0; font: 600 var(--fs-4)/1.15 var(--font); font-variant: normal; text-transform: none; letter-spacing: 0; color: #5a2f0d; }
.quest-card h3.story::before, .questlog-pick strong.story::before { content: ''; display: inline-block; width: .85em; height: .85em; margin-right: .35em; vertical-align: -.05em; background: var(--ink-star) center / contain no-repeat; }
.quest-card p { margin: 6px 0; color: var(--ink-dark); font-size: var(--fs-2); line-height: 1.5; }
.quest-meta { margin: 0 0 8px !important; color: var(--ink-dark-3) !important; font: 600 var(--fs-0)/1.2 var(--font) !important; letter-spacing: .1em; text-transform: uppercase; }
.quest-card .quest-hint { color: var(--ink-dark-2); }
.quest-card.waiting { opacity: .96; }
.quest-goals { list-style: none; margin: 10px 0; padding: 8px 0 0; border-top: 1px dashed #6b421077; display: grid; gap: 6px; }
.quest-goals li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; color: var(--ink-dark); }
.quest-goals li::before { content: ''; width: 15px; height: 15px; border: 1.5px solid #5b4426; background: #f3e8c880; }
.quest-goals li.met::before { background: var(--ink-check) center / 12px no-repeat, #f3e8c880; border-color: #2d5a1e; }
.quest-goals li.met .goal-text { color: #44502a; text-decoration: line-through; text-decoration-color: #44502a88; }
.goal-count { color: var(--ink-dark-2); font: 600 var(--fs-1)/1 var(--font); font-variant-numeric: tabular-nums; }
.quest-goals li.met .goal-count { color: #2d5a1e; }
.goal-bar { grid-column: 2 / -1; height: 5px; background: #6b42101f; border: 1px solid #5b44264d; overflow: hidden; }
.goal-bar span { display: block; height: 100%; background: linear-gradient(90deg, #8a5a1a, #c0903c); }
.quest-goals li.met .goal-bar span { background: #5a8a3a; }
.quest-reward { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 4px; padding: 7px 10px; background: #6b42101a; border: 1px solid #5b44264d; }
.quest-reward-label { font: 600 var(--fs-0)/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dark-3); margin-right: 4px; }
.rw { display: inline-flex; align-items: center; gap: 6px; font: 700 var(--fs-2)/1 var(--font); color: #4a2a08; }
.rw::before { content: ''; width: 16px; height: 16px; background: center / contain no-repeat; }
.rw-xp::before { background-image: var(--ink-star); }
.rw-gold::before { background-image: var(--ink-coin); }
/* The seal: pressed wax that takes the quest or hands it in. */
.quest-card button, .win .quest-card :where(button) {
  min-height: 0; margin-top: 8px; padding: 13px 22px; min-width: 112px;
  font: 700 var(--fs-2)/1.1 var(--font); letter-spacing: .06em; color: #f8e4c4; text-shadow: 0 1px 1px #000a;
  background: radial-gradient(circle at 34% 28%, #d4553f, #8e2415 62%, #5e130a);
  border: 0; border-radius: 47% 53% 50% 50% / 55% 48% 52% 45%;
  box-shadow: inset 0 2px 3px #ffb7a255, inset 0 -3px 5px #0007, 0 3px 5px #000a;
}
.quest-card button:hover:not(:disabled) { filter: brightness(1.12); }
.quest-card button:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.quest-card button.secondary, .win .quest-card :where(button.secondary) {
  min-width: 0; padding: 4px 2px; color: var(--ink-dark-2); font-weight: 600;
  background: none; border: 0; border-radius: 0; border-bottom: 1px dashed var(--ink-dark-3); box-shadow: none; text-shadow: none;
}
.quest-card button:disabled { filter: grayscale(.6) brightness(.8); opacity: .6; }

/* The log: a spine of bookmarks on the left, the open page on the right. */
#questlog-list { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
#questlog-list > .quest-hint { grid-column: 1 / -1; }
.questlog-side { list-style: none; margin: 0; padding: 10px 8px 10px 0; display: flex; flex-direction: column; gap: 5px; background: var(--tex-leather), linear-gradient(#34241a, #20160e); box-shadow: inset 0 0 0 1px #000, inset 0 0 14px #000a; padding-left: 8px; }
.questlog-pick {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 8px 12px 8px 10px; min-height: 0;
  color: var(--ink-dark); background: linear-gradient(90deg, #d8c595, #c4ae7a); border: 1px solid #000; border-radius: 0 3px 3px 0;
  box-shadow: inset 0 1px 0 #fff6, 0 2px 3px #000a; text-shadow: none; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%);
}
.questlog-pick strong { font: 600 var(--fs-2)/1.2 var(--font); color: #4a2606; }
.questlog-pick span { font: var(--fs-0)/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dark-3); }
.questlog-pick.ready span { color: #2d5a1e; font-weight: 700; }
.questlog-pick.chosen { background: linear-gradient(90deg, #f1e4bb, #dcc995); box-shadow: inset 4px 0 0 #8e2415, inset 0 1px 0 #fffa, 0 2px 3px #000a; }
.questlog-pick:hover:not(.chosen) { filter: brightness(1.06); }
.questlog-detail { min-width: 0; }
.questlog-buttons { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.quest-card button.track-button, .win .quest-card :where(button.track-button) { min-width: 96px; padding: 10px 16px; }
.quest-card button.track-button.on { background: radial-gradient(circle at 34% 28%, #e6c46a, #a8781e 62%, #6a4a0e); color: #2a1a04; text-shadow: none; }
.questlog-pick.tracked strong::after { content: '\00a0\27A4'; color: #a8781e; }
@media (max-width: 680px) {
  #questlog-list { grid-template-columns: 1fr; }
  .questlog-side { flex-direction: row; overflow-x: auto; padding: 8px; }
  .questlog-side li { flex: 0 0 180px; }
}

/* ---- Admin (game master): the same journal, plainer ------------------------ */
.admin-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 18px; overflow: auto; }
.admin-body label { display: flex; flex-direction: column; gap: 4px; }
.admin-body fieldset { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; margin: 0; padding: 8px 12px 10px; border: 1px solid #000; box-shadow: inset 0 0 0 1px #3a2c18; }
.admin-body legend { padding: 0 6px; color: var(--bronze-3); font: 600 var(--fs-1)/1 var(--font); letter-spacing: .08em; }
.admin-quest-picker { flex: 1 1 220px; min-width: 0; }
.admin-quest-picker input { min-width: 0; width: 100%; box-sizing: border-box; }
.admin-quest-hint { flex: 1 1 100%; margin: 0; font-size: 12px; line-height: 1.4; color: var(--text-2); }
#admin-item { flex: 1 1 180px; }
#admin-count, #admin-level, #admin-gold, #admin-skill-level { width: 90px; }
#admin-status { min-height: 1.3em; margin: 0; color: var(--bronze-3); font-style: italic; }
.admin-dialog { max-height: calc(100dvh - 24px); }
@media (max-width: 640px) { #admin-item { flex-basis: 100%; } }
.quest-card button + button.secondary, .quest-card button.secondary + button { margin-left: 14px; }

/* ---- Small windows: a head, a few lines and the buttons ----------------------- */
.small-dialog { width: min(470px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.small-dialog[open] { display: flex; flex-direction: column; }
.small-dialog .win-body p { margin: 0 0 12px; color: var(--text-2); }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
#restart-dialog { --emblem: var(--emb-hourglass); }
#skills-dialog { --emblem: var(--emb-book); }
#heroes-dialog { --emblem: var(--emb-helm); }
#player-dialog { --emblem: var(--emb-folk); }
#pause-dialog { --emblem: var(--emb-gear); width: min(780px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
#pause-dialog[open] { display: flex; flex-direction: column; }
#pause-dialog .win-body { text-align: left; }
#account-dialog { --emblem: var(--emb-gear); width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
#account-dialog[open] { display: flex; flex-direction: column; }

/* Skills (F): a level plate and a trough for every trade. */
.skills-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 7px; }
.skills-list li { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 11px; align-items: center; padding: 7px 10px; background: #00000045; border: 1px solid #000; box-shadow: inset 0 0 0 1px #2e2314; }
.skill-level {
  display: grid; place-items: center; width: 40px; height: 44px;
  font: 700 var(--fs-3)/1 var(--font); color: #1d1306; text-shadow: 0 1px 0 #ffffff66;
  background: linear-gradient(#e6cc84, #a9812f);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.skill-body { display: grid; gap: 3px; min-width: 0; }
.skill-body strong { color: var(--text); font-weight: 600; }
.skill-body span { color: var(--text-3); font-size: var(--fs-1); }
progress { appearance: none; width: 100%; height: 9px; border: 1px solid #000; background: linear-gradient(#050302, #17100a); box-shadow: 0 0 0 1px var(--bronze-0); border-radius: 0; overflow: hidden; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: linear-gradient(#e0b86a, #8a6628); box-shadow: inset 0 1px 0 #ffffff55; }
progress::-moz-progress-bar { background: linear-gradient(#e0b86a, #8a6628); }
.win-body > button { margin-top: 4px; }

/* The Hall of Heroes: a roll of names. */
.heroes-board { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--text-2); }
.heroes-list { margin: 0 0 12px; padding: 0 0 0 0; list-style: none; counter-reset: hero; display: grid; gap: 4px; font-size: var(--fs-2); }
.heroes-list li { counter-increment: hero; display: flex; align-items: baseline; gap: 8px; padding: 4px 8px; background: #0000003d; border-bottom: 1px solid #000; box-shadow: 0 1px 0 #ffffff0a; }
.heroes-list li::before { content: counter(hero); min-width: 1.6em; font: 700 var(--fs-1)/1 var(--font); color: var(--bronze-3); text-align: right; }
.heroes-list strong { color: var(--bronze-4); font-weight: 600; }
.heroes-list .me strong { color: var(--ok); }
.heroes-now { margin: 14px 0 6px; }
.online-list li::before { content: ''; min-width: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px #86c46e99; align-self: center; }

/* Another knight (player dialog). */
.player-profile { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; padding: 10px 12px; background: #0000004d; border: 1px solid #000; box-shadow: inset 0 0 0 1px #2e2314; }
.player-profile[hidden], .inspect[hidden], .player-report[hidden] { display: none; }
.player-profile dt { color: var(--text-3); font-size: var(--fs-1); text-transform: uppercase; letter-spacing: .08em; }
.player-profile dd { margin: 0; color: var(--text); }
.inspect { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 12px; }
.inspect-figure { flex: 0 0 124px; width: 124px; height: 156px; border: 1px solid #000; background: radial-gradient(70% 55% at 50% 38%, #4a4234aa, #0000 70%), var(--tex-iron), linear-gradient(#262016, #0e0b07); box-shadow: inset 0 0 0 1px var(--bronze-0), inset 0 0 24px #000; border-radius: 56px 56px 2px 2px / 44px 44px 2px 2px; }
.inspect-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; max-height: 240px; overflow: auto; display: grid; gap: 3px; }
.inspect-row { display: flex; gap: 8px; align-items: center; padding: 3px 6px 3px 3px; background: #0000003d; border-bottom: 1px solid #000; }
.inspect-row .item-icon { flex: 0 0 30px; width: 30px; height: 30px; background: radial-gradient(circle at 50% 30%, #2a2013, #0f0b07 80%); box-shadow: inset 0 0 0 2px var(--rar, #34291a); border: 1px solid #000; padding: 3px; }
.inspect-text { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-1); line-height: 1.3; }
.inspect-text span { color: var(--text-3); }
.player-report { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 12px; }
@media (max-width: 550px) { .inspect { flex-direction: column; align-items: center; } .inspect-list { width: 100%; max-height: 200px; } }

/* Controls (pause): the keys as caps on a ruled list. */
.controls { width: 100%; margin: 0 0 12px; border-collapse: collapse; font-size: var(--fs-1); }
.controls th, .controls td { padding: 5px 10px; border-bottom: 1px solid #00000099; box-shadow: 0 1px 0 #ffffff0a; vertical-align: top; }
.controls thead th { color: var(--bronze-3); font: 600 var(--fs-1)/1 var(--font); font-variant: small-caps; letter-spacing: .12em; text-transform: lowercase; text-align: left; }
.controls tbody th { width: 34%; font-weight: 600; color: var(--bronze-4); text-align: left; }
.controls td { color: var(--text-2); }
.win-body:has(.controls) { overflow: auto; }
.controls-tip { color: var(--bronze-3); font-style: italic; margin: 0 0 14px; }
.controls-touch { display: none; margin: 0 0 12px; font-size: var(--fs-1); line-height: 1.45; }
@media (pointer: coarse) { .controls-touch { display: block; } }
@media (max-width: 520px) { .controls thead th:nth-child(3), .controls td:nth-child(3) { display: none; } .controls th, .controls td { padding: 4px 5px; } }

/* Account window. */
.account-section { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid #000; box-shadow: 0 -1px 0 #ffffff0a; }
.account-section:first-of-type { border-top: 0; box-shadow: none; padding-top: 0; }
.account-section h3 { margin-bottom: 2px; }
.account-section p { margin: 0; font-size: var(--fs-1); line-height: 1.4; }
.account-section .confirm { display: flex; gap: 8px; align-items: center; }
.account-section button { justify-self: start; }
.account-status { min-height: 1.2em; color: var(--bad); }
.account-status.ok { color: var(--ok); }
#account-dialog-user { color: var(--text-2); font-style: italic; margin: 0 0 8px; }
.account-legal { font-size: var(--fs-1); text-align: center; margin: 10px 0 0; }
.account-legal a, .page-text a { color: var(--bronze-3); }

/* ---- The way in: the login window ------------------------------------------ */
.account { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 40%, #0a0805bb, #050403f0); }
.account[hidden] { display: none; }
.account form.win { position: relative; width: min(390px, 100%); padding: 26px 26px 20px; display: grid; gap: 7px; --emblem: var(--emb-star); }
.account h2 { margin: 0; font: 600 var(--fs-5)/1.1 var(--font); font-variant: small-caps; letter-spacing: .06em; text-align: center; color: var(--bronze-4); text-shadow: 0 2px 0 #000, 0 0 18px #b8923f44; }
.account-lead { margin: 0 0 6px; text-align: center; color: var(--text-2); font-style: italic; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 0 0 0; margin-bottom: 8px; gap: 3px; }
.account-tabs button { clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 100%, 0 100%); border-radius: 0; }
.account label { font-size: var(--fs-1); color: var(--text-2); letter-spacing: .04em; }
.account-hint { margin: 2px 0 0; font-size: var(--fs-1); color: var(--text-3); line-height: 1.4; }
.account-error { margin: 0; min-height: 1.2em; font-size: var(--fs-1); color: var(--bad); }
/* "Continue with Google" (server/google.js): a plain button above the name and password, "or" between them. */
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.account-google[hidden], .account-or[hidden], #google-link[hidden] { display: none; }
.account-or { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 4px 0; color: var(--text-3); font-size: var(--fs-1); }
.account-or::before, .account-or::after { content: ''; border-top: 1px solid var(--bronze-0); }
.account-section a.btn { justify-self: start; }
.account button[type=submit] { margin-top: 4px; min-height: 40px; font-size: var(--fs-3); letter-spacing: .08em; }

/* ---- Class: six standards on the wall ----------------------------------------- */
/* What's new (src/whats-new.js): a short list after an update. */
.news-dialog { width: min(520px, calc(100% - 20px)); max-height: calc(100dvh - 24px); overflow: auto; }
.news-list { margin: 0; padding: 14px 20px 4px 36px; display: grid; gap: 8px; line-height: 1.4; }
.news-foot { display: flex; justify-content: flex-end; padding: 10px 18px 16px; }
/* A class trainer asks what to do (Frederik, 2026-10-24): learn new spells, or give the talents back for nothing. */
.trainer-dialog { width: min(420px, calc(100% - 20px)); }
.trainer-choices { display: grid; gap: 10px; padding: 16px 18px 6px; }
.trainer-choices button { display: grid; gap: 4px; justify-items: start; text-align: left; min-height: 58px; padding: 10px 14px; }
.trainer-choices button strong { font: 600 15px/1.1 var(--font); color: var(--bronze-4); }
.trainer-choices button small { font: 12.5px/1.3 var(--font); color: var(--text-2); }
.trainer-choices button.confirm { box-shadow: inset 0 0 0 1px #e66a4e; }
.trainer-status { min-height: 1.3em; margin: 4px 18px 14px; font-size: 13px; color: var(--text-2); }
/* The prologue (src/prologue.js): a few lines on parchment, read before the first steps. */
.prologue-text { margin: 14px 18px 0; padding: 14px 18px; display: grid; gap: 10px; line-height: 1.5; font-size: var(--fs-2); }
.prologue-text p { margin: 0; }
.prologue-text p:first-child::first-letter { font-size: 1.6em; font-weight: 700; color: #6b4210; }
.questlog-story { flex: 0 0 auto; margin-right: 8px; }
.class-dialog { --emblem: var(--emb-swords); width: min(800px, calc(100% - 20px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.class-dialog[open] { display: flex; flex-direction: column; }
.class-list { list-style: none; margin: 0; padding: 16px 18px 6px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.class-card {
  --banner: #6a5a2a;
  position: relative; display: flex; flex-direction: column; gap: 7px; padding: 40px 14px 14px; text-align: center;
  background: linear-gradient(#2b2116, #18120b);
  border: 1px solid #000; box-shadow: inset 0 0 0 1px #3a2c18, 0 2px 4px #0008;
}
.class-card::before { /* the banner hanging from the top */
  content: ''; position: absolute; left: 50%; top: -1px; width: 58px; height: 52px; margin-left: -29px;
  background: linear-gradient(var(--banner), color-mix(in srgb, var(--banner) 55%, #000));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  box-shadow: inset 0 0 0 2px #00000055;
}
.class-guardian { --banner: #2f5a9a; } .class-warrior { --banner: #9a2f25; } .class-hunter { --banner: #3f7a34; }
.class-priest { --banner: #b8a35a; } .class-mage { --banner: #6a3f9a; } .class-skald { --banner: #2f8a86; }
.class-card.current { box-shadow: inset 0 0 0 1px var(--bronze-3), inset 0 0 22px #dcbb6a22, 0 2px 4px #0008; }
.class-head { display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative; z-index: 1; margin-top: -32px; }
.class-crest { width: 30px; height: 30px; background: center / 24px no-repeat; filter: drop-shadow(0 1px 1px #000); }
.class-crest.role-tank { background-image: var(--emb-shield); } .class-crest.role-dps { background-image: var(--emb-swords); }
.class-crest.role-healer { background-image: var(--emb-cross); } .class-crest.role-support { background-image: var(--emb-note); }
.class-role { margin-top: 12px; font: 600 var(--fs-0)/1 var(--font); letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); }
.class-head strong { font: 600 var(--fs-4)/1.2 var(--font); color: var(--bronze-4); }
.class-card p { margin: 0; font-size: var(--fs-1); color: var(--text-2); }
.class-traits { color: var(--text-3) !important; font-style: italic; }
.class-card button { margin-top: auto; }
#class-status { padding: 6px 18px 14px; margin: 0; min-height: 1.5em; color: var(--bronze-3); font-style: italic; }

/* ---- Talents: a night sky of choices -------------------------------------------- */
.talent-dialog {
  --emblem: var(--emb-star);
  --grain: radial-gradient(circle, #fff7 0 .8px, #0000 1.4px) 0 0 / 83px 83px, radial-gradient(circle, #cfe0ff66 0 .7px, #0000 1.3px) 31px 47px / 127px 127px, radial-gradient(circle, #ffeec866 0 .7px, #0000 1.3px) 70px 19px / 59px 59px;
  --glow: radial-gradient(90% 55% at 50% 0, #4f5fbf33, #0000 70%);
  --face: linear-gradient(#141a33, #0a0d1c);
  width: min(1360px, calc(100% - 16px)); max-height: calc(100dvh - 16px); overflow: auto;
}
.talent-dialog[open] { display: block; }
.talent-dialog .win-head { position: sticky; top: 0; z-index: 4; background: linear-gradient(#10152a, #0b0f20); }
.talent-dialog .win-head::before { background-image: var(--emblem), radial-gradient(circle at 50% 38%, #2b3366, #0a0d1c); }
.talent-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 14px 16px; }
.talent-branch { display: flex; flex-direction: column; padding: 10px 10px 12px; background: #05081466; border: 1px solid #000; box-shadow: inset 0 0 0 1px #2a3260; }
.talent-branch h3 { margin: 0 0 10px; text-align: center; font-size: var(--fs-2); color: #c7d0ff; letter-spacing: .14em; }
.talent-rows { display: grid; gap: 8px; }
.talent-row { display: grid; grid-template-columns: 22px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.talent-gate { display: grid; place-items: center; font: 600 var(--fs-0)/1 var(--font); color: #5b6598; position: relative; }
.talent-gate::before { content: ''; position: absolute; left: 50%; top: -9px; bottom: -9px; width: 2px; margin-left: -1px; background: #2a3260; z-index: 0; }
.talent-gate > * { position: relative; }
.talent-gate.open { color: var(--bronze-4); }
.talent-gate.open::before { background: linear-gradient(#b8923f, #6b5428); }
.talent {
  position: relative; display: block; min-height: 92px; padding: 7px 7px 30px 8px; text-align: left; letter-spacing: 0;
  color: var(--text); font: var(--fs-1)/1.25 var(--font); text-shadow: none;
  background: linear-gradient(135deg, #1d2548, #101530);
  border: 1px solid #000; border-radius: 0; box-shadow: inset 0 0 0 1px #3a4580, inset 0 2px 6px #0008;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}
.talent strong { display: block; font: 600 var(--fs-2)/1.2 var(--font); color: #dfe5ff; }
/* The whole line, never cut off with "…"; names break between words, not inside them. */
.talent small { display: block; margin-top: 3px; color: #9aa6d8; font-size: var(--fs-0); line-height: 1.3; }
.talent strong { overflow-wrap: normal; word-break: keep-all; hyphens: none; font-size: var(--fs-1); }
/* Three talents a row (Frederik, 2026-10-22): the rank sits in the lower corner, so the name and its line get the width. */
.talent-rank { position: absolute; right: 5px; bottom: 5px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font: 700 var(--fs-0)/1 var(--font); color: #aab4e8; background: radial-gradient(circle at 50% 30%, #1b2142, #070a18); box-shadow: inset 0 0 0 2px #3a4580; }
.talent:hover:not(:disabled) { filter: brightness(1.18); }
.talent.learned { background: linear-gradient(135deg, #3a3018, #1d170b); box-shadow: inset 0 0 0 1px var(--bronze-2), inset 0 2px 6px #0008; }
.talent.learned .talent-rank { color: var(--bronze-4); box-shadow: inset 0 0 0 2px var(--bronze-2); }
.talent.learned strong { color: var(--bronze-4); } .talent.learned small { color: #c4b48a; }
.talent.maxed { background: linear-gradient(135deg, #4a3a14, #241a08); box-shadow: inset 0 0 0 1px var(--bronze-4), inset 0 0 20px #dcbb6a33, inset 0 2px 6px #0008; }
.talent.maxed .talent-rank { color: #1d1306; background: linear-gradient(#f0dc9c, #b8923f); box-shadow: inset 0 0 0 2px #7a5a20, 0 0 10px #dcbb6a66; }
.talent.capstone { box-shadow: inset 0 0 0 1px var(--bronze-2), inset 0 0 18px #dcbb6a22, inset 0 2px 6px #0008; }
.talent.locked { filter: saturate(.45) brightness(.82); background: linear-gradient(135deg, #14182c, #0a0d1a); box-shadow: inset 0 0 0 1px #232a52; }
.talent:not(:disabled):not(.locked):not(.maxed) { box-shadow: inset 0 0 0 1px #6b7bd6, inset 0 0 14px #6b7bd633, inset 0 2px 6px #0008; }
.talent:disabled:not(.locked) { opacity: 1; }
.talent:disabled { cursor: default; }
.talent-dialog > p { margin: 0 16px; color: #aab4e8; font-style: italic; min-height: 1.4em; }
.talent-dialog > button { margin: 6px 16px 16px; }
@media (min-width: 820px) {
  .talent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto repeat(10, auto); column-gap: 14px; row-gap: 8px; }
  .talent-branch { display: grid; grid-template-rows: subgrid; grid-row: span 11; row-gap: 8px; }
  .talent-branch h3 { margin: 0; align-self: center; }
  .talent-rows { display: contents; }
  .talent-row { grid-row: auto; }
}

/* ---- Friends ------------------------------------------------------------------- */
.friends-dialog { --emblem: var(--emb-folk); width: min(480px, calc(100% - 20px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.friends-dialog[open] { display: flex; flex-direction: column; }
.friends-add { display: flex; gap: 8px; padding: 12px 18px; }
.friends-add input { flex: 1; }
.friends-list { list-style: none; margin: 0; padding: 0 18px 18px; overflow: auto; display: grid; gap: 7px; }
.friend { padding: 8px 11px; background: #00000045; border: 1px solid #000; box-shadow: inset 0 0 0 1px #2e2314; opacity: .7; }
.friend.online { opacity: 1; box-shadow: inset 0 0 0 1px var(--bronze-1); }
.friend-who { display: flex; align-items: center; gap: 8px; }
.friend-who strong { font: 600 var(--fs-3)/1.2 var(--font); color: var(--text); }
.friend-dot { width: 9px; height: 9px; transform: rotate(45deg); background: #4a4438; border: 1px solid #000; }
.friend.online .friend-dot { background: var(--ok); box-shadow: 0 0 7px #86c46e99; }
.friend-about { margin: 2px 0 7px; font-size: var(--fs-1); color: var(--text-3); }
.friend-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.friend-buttons button { padding: 4px 10px; min-height: 26px; }
.friend-empty { color: var(--text-3); font-style: italic; }

/* Guild (guild-ui.js): the friends list's rows, with the rank beside the name and the message of the day on top. */
.guild-dialog { --emblem: var(--emb-folk); width: min(520px, calc(100% - 20px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.guild-dialog[open] { display: flex; flex-direction: column; }
.guild-body { display: flex; flex-direction: column; min-height: 0; overflow: auto; padding-bottom: 14px; }
.guild-about { margin: 14px 18px 0; color: var(--text-2); }
.guild-hint { margin: 0 18px; font-size: var(--fs-1); color: var(--text-3); font-style: italic; }
.guild-motd { margin: 12px 18px 0; padding: 10px 13px; background: #00000045; border: 1px solid #000; box-shadow: inset 0 0 0 1px var(--bronze-0); }
.win .guild-motd h3 { margin: 0 0 4px; font: 600 var(--fs-1)/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--bronze-3); }
.guild-motd p { margin: 0; overflow-wrap: anywhere; }
.guild-motd .guild-hint { margin: 0; }
.guild-form { padding-bottom: 0; }
.guild-roster { padding-top: 12px; padding-bottom: 0; overflow: visible; }
.guild-rank { margin-left: auto; font-size: var(--fs-1); color: var(--text-3); white-space: nowrap; }
.guild-rank.rank-master { color: var(--bronze-4); }
.guild-rank.rank-officer { color: var(--text-2); }
.guild-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 18px 0; }
.guild-foot .guild-hint { margin: 0 auto 0 0; font-style: normal; color: var(--text-2); }
.guild-tabs { margin-top: 2px; }
.guild-level { margin: 12px 18px 0; padding: 10px 13px; background: #00000045; border: 1px solid #000; box-shadow: inset 0 0 0 1px var(--bronze-0); display: grid; gap: 6px; }
.win .guild-level h3 { margin: 0; font: 600 var(--fs-2)/1.2 var(--font); font-variant: normal; text-transform: none; letter-spacing: .02em; color: var(--bronze-4); }
.guild-level .guild-hint { margin: 0; font-style: normal; }
.guild-level-bar { height: 10px; background: #0c0906; border: 1px solid #000; box-shadow: inset 0 1px 2px #000, 0 0 0 1px var(--bronze-0); }
.guild-level-fill { height: 100%; background: linear-gradient(#94dc7c, #4a9a3a 60%, #2a6a22); box-shadow: inset 0 1px 0 #ffffff44; }
.guild-perks, .guild-bank { padding-top: 12px; padding-bottom: 0; overflow: visible; }
.guild-perk:not(.online) .friend-about { color: var(--text-3); }
.guild-bank-tabs { margin: 12px 18px 0; padding: 0; background: none; }
.guild-bank-note { margin-top: 12px; font-style: normal; }
.win .guild-bank-head { margin: 14px 18px 0; font: 600 var(--fs-1)/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--bronze-3); }
.guild-stock .friend-who { margin-bottom: 4px; }
.guild-stock .friend-buttons:empty { display: none; }

/* ---- Dungeons ------------------------------------------------------------------ */
#dungeon-dialog { --emblem: var(--emb-door); --face: linear-gradient(#1c1914, #0f0d0a); --glow: radial-gradient(60% 40% at 50% -5%, #e7812f2a, #0000 70%); width: min(560px, calc(100% - 20px)); max-height: calc(100dvh - 24px); overflow: auto; }
.dungeon-body { padding: 14px 18px 18px; }
.dungeon-body p { margin: 0 0 10px; color: var(--text-2); }
#dungeon-status { color: var(--bronze-3); font-style: italic; }
.dungeon-tiers { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.dungeon-tiers .tier { padding: 7px 12px; min-height: 0; color: var(--text-2); background: linear-gradient(#2d251a, #17110a); box-shadow: inset 0 0 0 1px #3a2c18; text-shadow: 0 1px 0 #000; }
.dungeon-tiers .tier[aria-pressed=true] { color: #1d1306; background: linear-gradient(#e6cc84, #b48a38); box-shadow: inset 0 1px 0 #fff9, inset 0 0 0 1px #6b4f18; text-shadow: 0 1px 0 #ffffff55; }
.dungeon-tiers .tier:disabled { opacity: .5; cursor: not-allowed; }
.dungeon-tiers .tier-elite { color: #9ccaff; } .dungeon-tiers .tier-legendary { color: #ffb36b; } .dungeon-tiers .tier-mythic { color: #e6a4ff; }
.dungeon-tiers .tier[aria-pressed=true] { color: #1d1306; }
.dungeon-ready { box-shadow: 0 0 0 2px var(--ember), 0 0 24px #e7812f66 !important; }
.dungeon-complete { --emblem: var(--emb-dragon); width: min(660px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.dungeon-summary { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px 18px; }
.dungeon-summary-meta { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.dungeon-summary-meta > div, .dungeon-personal-stats > div { padding: 7px 8px; background: #0000004d; border: 1px solid #000; box-shadow: inset 0 0 0 1px #2e2314; text-align: center; }
.dungeon-summary-meta span, .dungeon-personal-stats span { display: block; font: 600 var(--fs-0)/1.2 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.dungeon-summary-meta strong, .dungeon-personal-stats strong { display: block; margin-top: 3px; font: 700 var(--fs-3)/1.1 var(--font); color: var(--bronze-4); font-variant-numeric: tabular-nums; }
.dungeon-personal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dungeon-personal-stats[hidden] { display: none; }
.dungeon-score-head, .dungeon-score li { display: grid; grid-template-columns: minmax(120px, 1fr) 90px 90px 55px; align-items: center; gap: 8px; }
.dungeon-score-head { padding: 0 9px 2px; color: var(--text-3); font: 600 var(--fs-0)/1 var(--font); text-transform: uppercase; letter-spacing: .08em; }
.dungeon-score { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.dungeon-score li { padding: 6px 9px; background: #00000045; border-left: 3px solid var(--bronze-0); font-size: var(--fs-1); }
.dungeon-score li span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.dungeon-score li:first-child { border-left-color: var(--bronze-3); background: #3a2f1466; }
.dungeon-score b { color: var(--bronze-3); font-weight: 600; }
.dungeon-loot h3 { margin: 0 0 6px; }
#dungeon-complete-loot { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.dungeon-loot-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 9px; background: #00000045; border: 1px solid #000; box-shadow: inset 2px 0 0 var(--rar, var(--r-common)); font-size: var(--fs-1); }
.dungeon-loot-row strong { color: var(--rar, var(--text)); }
.dungeon-loot-row span { color: var(--text-3); white-space: nowrap; }
.dungeon-loot-row.gold strong { color: var(--bronze-4); }
.dungeon-complete-buttons { justify-content: flex-end; }
@media (max-width: 620px) { .dungeon-summary-meta { grid-template-columns: repeat(3, 1fr); } .dungeon-personal-stats { grid-template-columns: repeat(2, 1fr); } .dungeon-score-head, .dungeon-score li { grid-template-columns: minmax(90px, 1fr) 62px 62px 38px; gap: 4px; } #dungeon-complete-loot { grid-template-columns: 1fr; } }

/* ---- Trade: two ledgers across a table ----------------------------------------- */
#trade-dialog { --emblem: var(--emb-scales); width: min(680px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.trade-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 14px 18px 0; position: relative; }
.trade-sides section { padding: 12px 14px 14px; }
.trade-sides section:first-child { background: var(--tex-paper), linear-gradient(#e2d2a6, #c8b283); color: var(--ink-dark); box-shadow: inset 0 0 30px #6b4f1e66; }
.trade-sides section:last-child { background: var(--tex-grain), linear-gradient(#2a2015, #17110a); box-shadow: inset 0 0 0 1px #3a2c18; }
.trade-sides section:first-child h3 { color: #6b4210; }
.trade-sides section:first-child label, .trade-sides section:first-child .trade-state { color: var(--ink-dark-2); }
.trade-sides section:first-child li { color: var(--ink-dark); }
.trade-sides section:first-child input { color: var(--ink-dark); background: #f3e8c8; border: 1px solid #5b4426; box-shadow: inset 0 1px 3px #5b442655; }
.trade-sides h3 { margin: 0 0 8px; }
.trade-sides ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-1); }
.trade-sides li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 5px; border-bottom: 1px dotted #5b442666; }
.trade-sides input, .trade-gold input { width: 72px; padding: 4px 6px; text-align: right; }
.trade-gold { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: var(--fs-2); }
.trade-state { margin: 10px 0 0; font-size: var(--fs-1); color: var(--text-2); font-style: italic; }
#trade-status { margin: 12px 18px 8px; min-height: 1.4em; color: var(--bronze-3); font-style: italic; }
#trade-ready { margin: 0 18px 18px; }
@media (max-width: 520px) { .trade-sides { grid-template-columns: 1fr; } }

/* ---- Auction House and Mailbox -------------------------------------------------- */
#auction-dialog { --emblem: var(--emb-scales); width: min(880px, calc(100% - 24px)); height: min(680px, calc(100dvh - 32px)); overflow: hidden; }
#mail-dialog { --emblem: var(--emb-letter); width: min(640px, calc(100% - 24px)); height: min(640px, calc(100dvh - 32px)); overflow: hidden; }
#auction-dialog[open], #mail-dialog[open] { display: flex; flex-direction: column; }
.auction-tabs { flex: 0 0 auto; }
.auction-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px 18px; }
.auction-search { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.auction-search input { flex: 1 1 180px; }
.auction-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.auction-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; grid-template-areas: "slot name price action" "slot info price action"; gap: 1px 12px; align-items: center;
  padding: 6px 10px 6px 6px; background: linear-gradient(90deg, #1e160e, #17110a); border: 1px solid #000; box-shadow: inset 0 0 0 1px #2d2314;
}
.auction-row .auction-slot { grid-area: slot; width: 42px; height: 42px; }
.auction-row .auction-slot .item-icon { width: 78%; height: 78%; }
.auction-row strong { grid-area: name; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auction-row .auction-price { grid-area: price; font: 700 var(--fs-2)/1 var(--font); }
.auction-row .auction-info { grid-area: info; color: var(--text-3); font-size: var(--fs-1); }
.auction-row button { grid-area: action; }
.auction-row:not(:has(.auction-slot)) { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; padding: 8px 12px; }
.auction-empty { color: var(--text-3); font-style: italic; padding: 8px 0; }
.auction-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; color: var(--text-3); font-size: var(--fs-1); }
.auction-sell { display: grid; gap: 10px; max-width: 440px; }
.auction-sell label { display: grid; gap: 4px; }
.auction-fee { margin: 0; color: var(--text-3); font-size: var(--fs-1); font-style: italic; }
.auction-sell button[type=submit], #auction-collect, #mail-collect { margin-top: 10px; }
.auction-status { flex: 0 0 auto; margin: 0; min-height: 2.3em; padding: 8px 18px; background: linear-gradient(#0000003a, #00000066); border-top: 1px solid #000; box-shadow: 0 -1px 0 var(--bronze-0); color: var(--bronze-3); font-style: italic; font-size: var(--fs-1); }
.mail-letter { display: grid; gap: 5px; padding: 12px 16px; color: var(--ink-dark); background: var(--tex-paper), linear-gradient(#e2d2a6, #c8b283); border: 1px solid #000; box-shadow: inset 0 0 30px #6b4f1e66, 0 2px 5px #000a; }
.mail-letter strong { font: 600 var(--fs-3)/1.2 var(--font); color: #5a2f0d; }
.mail-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-style: italic; }
.mail-attached { margin: 0; color: #6b4210; font-size: var(--fs-1); font-weight: 600; }
.mail-letter button { justify-self: start; }
#mail-form textarea { resize: vertical; width: 100%; }
@media (max-width: 640px) { .auction-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "slot name price" "slot info action"; } }
.talent strong { overflow-wrap: break-word; }
@media (max-width: 819px) {
  .talent { height: auto; min-height: 92px; padding-left: 6px; padding-right: 5px; }
  /* Three in a row on a phone: the names a size smaller, so a long one keeps whole. */
  .talent strong { font-size: var(--fs-0); }
}

/* Gear to choose from when a hamlet's story is handed in (src/quest-ui.js). */
.quest-choices { display: grid; gap: 6px; margin: 8px 0 10px; }
.quest-choices-label { margin: 0; font: 600 var(--fs-0)/1.2 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dark-3); }
.quest-card button.quest-choice, .win .quest-card :where(button.quest-choice) {
  display: grid; gap: 3px; width: 100%; text-align: left; padding: 8px 12px; border-radius: 3px;
  background: #fff8e61a; border: 1px solid #5b44264d; box-shadow: none; color: var(--ink-dark-2); text-shadow: none; font: inherit; cursor: pointer;
}
.quest-card button.quest-choice:hover:not(:disabled) { filter: none; background: #c9a2271f; }
.quest-card button.quest-choice:disabled { filter: none; opacity: .9; cursor: default; }
.quest-card button.quest-choice[aria-pressed="true"] { border-color: #c9a227; background: #c9a22738; box-shadow: 0 0 0 1px #c9a227 inset; }
.quest-choice-name { font-weight: 700; color: #2f5fa8; }
.quest-choice-stats { font-size: var(--fs-0); color: var(--ink-dark-3); }

/* ---- Mount Journal (src/mount-ui.js) --------------------------------------------------------- */
.mount-win { width: min(560px, calc(100vw - 24px)); }
.mount-riding { margin: 0 0 10px; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.mount-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 7px; max-height: min(60vh, 520px); overflow-y: auto; }
.mount-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 8px 10px; background: #00000045; border: 1px solid #000; box-shadow: inset 0 0 0 1px #2e2314; }
.mount-row.on-v { box-shadow: inset 0 0 0 1px var(--bronze-2); }
.mount-row.locked { opacity: .62; }
.mount-row.locked strong { filter: saturate(.4); }
.mount-body p { margin: 2px 0 0; font-size: 12px; line-height: 1.35; }
.mount-text { color: var(--text-2); }
.mount-source { color: var(--text-3); }
.mount-buttons { display: grid; gap: 5px; }
.mount-buttons button { min-width: 84px; }
.mount-badge { position: relative; width: 40px; height: 40px; border: 1px solid #000; box-shadow: inset 0 0 0 1px var(--bronze-0); background: #120d08; display: grid; place-items: center; }
.mount-badge.unknown { filter: grayscale(.85) brightness(.7); }
.mount-dot { position: absolute; border-radius: 50%; border: 1px solid #0008; }
.mount-dot.coat { width: 26px; height: 26px; left: 6px; top: 6px; }
.mount-dot.mane { width: 12px; height: 12px; right: 4px; top: 4px; }
.mount-dot.saddle { width: 12px; height: 12px; left: 4px; bottom: 4px; }
.mount-status { min-height: 1.3em; margin: 0; font-size: 13px; color: var(--text-2); }
@media (max-width: 480px) { .mount-row { grid-template-columns: 36px minmax(0, 1fr); } .mount-buttons { grid-column: 1 / -1; grid-auto-flow: column; } }

/* ---- Daily tasks in the quest log (src/quest-ui.js dailyBlock) --------------------------------- */
.questlog-daily:empty { display: none; }
.questlog-daily { padding: 10px 12px 0; }
.daily-card { margin: 0; }
.daily-title { margin: 0 0 6px; font: 600 14px/1.2 var(--font); letter-spacing: .06em; color: var(--bronze-3); }
.daily-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.daily-list li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 8px; background: #00000030; border: 1px solid #0006; }
.daily-list li.paid { opacity: .6; }
.daily-list li.paid strong { text-decoration: line-through; }
.inn-home-change[hidden] { display: none; }

/* ---- General Store (src/store-ui.js): what they sell beside what they will buy ------------------------------ */
.store-dialog { width: min(880px, calc(100vw - 24px)); }
.store-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 4px 18px 6px; }
.store-layout h3 { margin: 6px 0 8px; }
.store-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: min(56vh, 460px); overflow-y: auto; }
.store-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 8px; background: linear-gradient(#2a2015, #1a130c); border: 1px solid #000; box-shadow: inset 0 0 0 1px var(--bronze-0); }
.store-icon { width: 40px; height: 40px; display: grid; place-items: center; background: #120d08; border: 1px solid #000; box-shadow: inset 0 0 0 1px var(--bronze-0); }
.store-icon svg { width: 28px; height: 28px; }
.store-text { min-width: 0; display: grid; gap: 2px; }
.store-text strong { font: 600 var(--fs-2)/1.2 var(--font); }
.store-text span { font: var(--fs-0)/1.3 var(--font); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-price { font: 600 var(--fs-1)/1 var(--font); color: var(--bronze-4); white-space: nowrap; }
.store-buttons { display: flex; gap: 5px; }
.store-buttons button { min-width: 58px; padding: 6px 10px; }
.store-empty { padding: 10px; color: var(--text-3); font-style: italic; }
@media (max-width: 680px) { .store-layout { grid-template-columns: 1fr; } }
.store-text strong { color: var(--rar, var(--text)); }
.store-icon { box-shadow: inset 0 0 0 1px var(--rar, var(--bronze-0)); }
.loot-card-uses { margin: 4px 0 0; font: var(--fs-0)/1.35 var(--font); color: #9fd18a; }

/* ---- Keybinds (src/keybinds-ui.js): a rack of iron key plates on oak, one row per action ------------------------- */
.keybinds-dialog { --emblem: var(--emb-key); width: min(560px, calc(100% - 20px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.keybinds-dialog[open] { display: flex; flex-direction: column; }
.keybinds-list { display: grid; gap: 14px; }
.keybind-group-name { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.keybind-group-name::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--bronze-1), #0000); }
.keybind-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.keybind-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 92px; align-items: center; gap: 8px; padding: 3px 4px 3px 10px; background: #00000030; border: 1px solid #0007; box-shadow: inset 0 1px 0 #ffffff08; }
.keybind-row:hover { background: #0000004a; }
.keybind-name { font: var(--fs-2)/1.25 var(--font); color: var(--text); overflow-wrap: anywhere; }
.win .keybind-key {
  min-height: 30px; padding: 3px 6px;
  font: 600 var(--fs-2)/1.1 var(--font); letter-spacing: .02em;
  color: var(--bronze-4); text-shadow: 0 1px 0 #000;
  background: linear-gradient(#2e2519, #181109);
  border: 1px solid #000; border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--bronze-0), inset 0 1px 0 #ffffff14, 0 2px 0 #000;
}
.win .keybind-key:hover { filter: brightness(1.25); }
.win .keybind-key:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--bronze-0), 0 1px 0 #000; }
.win .keybind-key.empty { color: var(--text-3); font-weight: 400; }
.win .keybind-key.listening { color: #1c140a; text-shadow: none; background: linear-gradient(var(--bronze-4), var(--bronze-2)); box-shadow: inset 0 0 0 1px var(--bronze-1), 0 0 10px #f0dc9c55; animation: keybind-wait 1.1s ease-in-out infinite alternate; }
@keyframes keybind-wait { to { box-shadow: inset 0 0 0 1px var(--bronze-1), 0 0 2px #f0dc9c22; } }
@media (prefers-reduced-motion: reduce) { .win .keybind-key.listening { animation: none; } }
.keybinds-fixed { margin: 14px 0 0; font: italic var(--fs-1)/1.4 var(--font); color: var(--text-3); }
.keybinds-buttons { justify-content: flex-end; margin: 0; padding: 10px 18px 14px; }
@media (max-width: 460px) {
  .keybind-row { grid-template-columns: minmax(0, 1fr) 74px 74px; gap: 5px; padding-left: 7px; }
  .keybind-name { font-size: var(--fs-1); }
}

/* ---- Spellbook (P): the class's spells by talent tree, dragged onto the bar ----------------------------------- */
.spellbook-dialog { --emblem: var(--emb-star); width: min(520px, calc(100% - 20px)); }
.spellbook-dialog[open] { position: fixed; inset: 0 auto 0 12px; margin: auto 0; max-height: calc(100dvh - 190px); overflow: auto; z-index: 40; }
.spellbook-dialog .win-head { position: sticky; top: 0; z-index: 3; }
.spell-tabs { display: flex; gap: 6px; margin: 10px 14px 0; }
.spell-tab { flex: 1; padding: 6px 8px; font: 600 var(--fs-1)/1.2 var(--font); }
.spell-tab.on { box-shadow: inset 0 0 0 2px var(--bronze-4), inset 0 0 12px #dcbb6a44; color: var(--bronze-4); }
.spell-list { list-style: none; margin: 10px 14px; padding: 0; display: grid; gap: 6px; }
.spell-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; background: #0006; box-shadow: inset 0 0 0 1px #3a2c1a; }
.spell-row:not(.known) { opacity: .72; }
.spell-row:not(.known) .spell-icon { filter: grayscale(.85) brightness(.75); }
.spell-row.ult { box-shadow: inset 0 0 0 1px var(--ember, #e7812f); }
.spell-icon { width: 48px; height: 48px; display: grid; place-items: center; background: linear-gradient(135deg, #34362e, #181e1c); box-shadow: inset 0 0 0 2px var(--bronze-2), inset 0 0 0 3px #000; touch-action: none; }
.spell-icon svg { width: 38px; height: 38px; }
.spell-icon.draggable { cursor: grab; }
.spell-text strong { font: 600 var(--fs-2)/1.2 var(--font); }
.spell-text .spell-facts { display: block; color: var(--bronze-3); font-size: var(--fs-0); margin-top: 2px; }
.spell-text p { margin: 3px 0 0; font-size: var(--fs-0); line-height: 1.3; color: var(--text-2, #d5cebb); }
.spell-act { white-space: nowrap; font-size: var(--fs-0); padding: 6px 8px; }
@media (max-width: 520px) {
  .spellbook-dialog[open] { inset: 6px 6px auto 6px; margin: 0 auto; max-height: 58dvh; }
  .spell-row { grid-template-columns: 40px 1fr; }
  .spell-icon { width: 40px; height: 40px; }
  .spell-act { grid-column: 1 / -1; }
}

/* Achievements (src/achievements-ui.js): the categories as tabs, then each with its medal, progress and points. */
.achievements-dialog { width: min(640px, calc(100vw - 24px)); }
.achievements-dialog .tabs { flex-wrap: wrap; }
.achievements-list { list-style: none; margin: 8px 0 0; padding: 0 2px 4px; display: grid; gap: 6px; max-height: min(60vh, 520px); overflow-y: auto; }
.achievement { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 10px; align-items: center; padding: 7px 10px; background: linear-gradient(#ffffff08, #0000); border: 1px solid #0008; box-shadow: inset 0 0 0 1px #ffffff0d; }
.achievement .medal { grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 15px/1 var(--font); color: #2a1d0c; background: radial-gradient(circle at 35% 30%, #fff3c4, #d8a63f 55%, #7a531a); border: 1px solid #000; box-shadow: 0 0 0 2px var(--bronze-0); }
.achievement.locked .medal { filter: grayscale(1) brightness(.55); }
.achievement strong { font: 600 14px/1.2 var(--font); color: var(--bronze-4); }
.achievement.locked strong { color: var(--text); }
.achievement .points { grid-row: span 2; font: 600 13px/1 var(--font); color: var(--bronze-3); text-align: right; min-width: 34px; }
.achievement .detail { display: grid; gap: 3px; font-size: 12.5px; color: var(--text); opacity: .9; }
.achievement .trough { height: 8px; }
/* The toast when one is earned: a moment in the middle top, gold-framed. */
.achievement-toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); z-index: 6; min-width: 240px; max-width: calc(100% - 32px); text-align: center; padding: 10px 18px; background: linear-gradient(#2a1d10f0, #140d07f0); border: 1px solid var(--bronze-2); box-shadow: 0 0 0 1px #000, 0 0 22px #e0b86a55; font: 600 13px/1.4 var(--font); color: var(--text); pointer-events: none; animation: toast-in .35s ease-out; }
.achievement-toast[hidden] { display: none; }
.achievement-toast b { display: block; font-size: 16px; color: var(--bronze-4); font-variant: small-caps; letter-spacing: .06em; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }
@media (prefers-reduced-motion: reduce) { .achievement-toast { animation: none; } }
/* The title menu (the Titles tab): the title shown, and the buttons to hide it or show one's best. */
.achievement.title-head { background: linear-gradient(#e0b86a1f, #0000); }
.title-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.title-choices button { width: auto; }
.achievement > button { grid-row: span 2; }
