/* The end of a descent: run gear in the pack and on a card (run-gear-plan.js), "What you carry out" (carry-out.js),
   the summary and the arrival in the hall (run-end.js). The game's own iron, ember and brass (forge.css tokens); a
   ledger struck on a plate, read from the left. State is always a word as well as a color. */

/* ---------------- run gear: the word on a pack tile, the line in an item's details and on a card ---------------- */
.tile .run-tag {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0; text-align: center;
  font: 700 11px/1.25 var(--body); letter-spacing: 0; color: #1b1408; background: var(--brass); overflow: hidden; white-space: nowrap;
}
/* The rarity letter sits above the band, never under it. */
.tile .mark:has(~ .run-tag) { bottom: 15px; }
.run-fate { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--brass); background: #231e15; font-size: calc(15px * var(--ts, 1)); text-align: left; }
.run-fate.loose { border-left-color: var(--ember); }
.run-fate .tag { margin-right: 6px; font-weight: 700; color: #1b1408; background: var(--brass); padding: 2px 7px; border-radius: 0; }
.hub.camp .inv-status.run-loose { border-left-color: var(--ember); }
.loot-rule { flex: 1 0 100%; margin: 0; color: var(--muted); font-size: calc(13px * var(--ts, 1)); text-align: left; }

/* ---------------- what you carry out ---------------- */
.carry-out { text-align: left; margin: 0; }
.carry-out h2, .run-end h2 { margin: 0 0 4px; font: 600 calc(19px * var(--ts, 1)) / 1.2 var(--display); letter-spacing: 0.03em; color: var(--brass); }
.carry-out p { margin: 4px 0; }
.co-intro { color: var(--text); max-width: 62ch; }
.co-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.co-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; align-items: center;
  padding: 8px 10px; background: #1c1913; box-shadow: inset 3px 0 0 var(--rc, var(--seam)), inset 0 0 0 1px var(--seam);
}
.co-row.r-common { --rc: #bdb6a6; } .co-row.r-uncommon { --rc: #6fbf73; } .co-row.r-rare { --rc: #5b8fd9; } .co-row.r-epic { --rc: #b07ad6; }
.co-what { display: grid; min-width: 0; }
.co-name { font: 700 calc(16px * var(--ts, 1)) / 1.25 var(--body); overflow-wrap: anywhere; }
.co-kind, .co-gate { color: var(--muted); font-size: calc(14px * var(--ts, 1)); }
.co-gate { color: #f1b2a8; }
.co-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.co-acts .chip, .co-all .chip { min-height: 44px; min-width: 44px; padding: 6px 14px; border-radius: 0; font: 600 calc(15px * var(--ts, 1)) / 1.2 var(--body); }
.co-acts .chip[aria-disabled="true"] { opacity: 0.5; }
.co-all { margin-top: 8px; display: flex; justify-content: flex-end; }
.co-kept { color: var(--muted); font-size: calc(14px * var(--ts, 1)); }
.carry-out button:focus-visible, .run-end button:focus-visible, .run-end summary:focus-visible { outline: 3px solid #91d1bd; outline-offset: 2px; }
@media (max-width: 520px) {
  .co-row { grid-template-columns: auto minmax(0, 1fr); }
  .co-acts { grid-column: 1 / -1; justify-content: stretch; }
  .co-acts .chip { flex: 1 1 120px; }
  .co-all .chip { flex: 1; }
}

/* ---------------- the summary (the run's last panel) ---------------- */
.screen.run .panel:has(> .run-end) { text-align: left; }
.run-end { display: grid; gap: 18px; text-align: left; font: calc(16px * var(--ts, 1)) / 1.45 var(--body); min-width: 0; }
.run-end p { margin: 0; max-width: 68ch; }
.run-end h3 { margin: 10px 0 4px; font: 700 calc(15px * var(--ts, 1)) / 1.2 var(--body); color: var(--text); }

/* The outcome: one plate with a struck edge, ember for a clear and blood for a fall, and the word beside the place. */
.re-head { display: grid; gap: 6px; padding: 14px 16px 12px; background: #1c1913; box-shadow: inset 6px 0 0 var(--ember), inset 0 0 0 1px var(--seam); }
.re-head.fell { box-shadow: inset 6px 0 0 var(--blood), inset 0 0 0 1px var(--seam); }
.re-place { color: var(--muted); font-size: calc(15px * var(--ts, 1)); }
.re-state { margin-left: 8px; padding: 1px 8px; font-weight: 700; color: #1b1408; background: var(--ember); }
.re-head.fell .re-state { color: #fff; background: var(--blood); }
.screen.run .run-end h1 { margin: 0; font: 600 clamp(24px, 6.4vw, 34px) / 1.15 var(--display); letter-spacing: 0.03em; color: var(--brass); outline: none; overflow-wrap: anywhere; }
.re-where { color: var(--text); }
.re-tally { margin: 8px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--seam); }
.re-tally div { display: flex; flex-direction: column-reverse; padding: 8px 10px 0 0; min-width: 0; }
.re-tally div + div { padding-left: 12px; border-left: 1px solid var(--seam); }
.re-tally dt { color: var(--muted); font-size: calc(14px * var(--ts, 1)); line-height: 1.2; }
.re-tally dd { margin: 0; font: 700 clamp(26px, 8vw, 40px) / 1.05 var(--display); color: var(--text); font-variant-numeric: tabular-nums; }

.re-remarks { display: grid; gap: 6px; }
.re-remarks p { padding: 8px 12px; border-left: 3px solid var(--ember); background: #231e15; }
.re-remarks b { color: var(--brass); }

.re-sec { display: grid; gap: 6px; min-width: 0; padding-top: 12px; border-top: 1px solid var(--seam); }
.re-sec .cards.loot-choice { margin: 4px 0; }
.re-lost { color: var(--text); padding: 8px 12px; border-left: 3px solid var(--blood); background: #231a16; }
.re-home, .re-facts { margin: 0; display: grid; gap: 4px; }
.re-home div, .re-facts div { display: grid; grid-template-columns: minmax(96px, 9.5em) minmax(0, 1fr); gap: 2px 12px; padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.re-home dt, .re-facts dt { color: var(--muted); }
.re-home dd, .re-facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Growth: the level in words, the bar as a picture of the same thing. The dull part is where the descent began. */
.re-skills { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.re-skill { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; align-items: baseline; }
.re-skill-name { font: 600 calc(17px * var(--ts, 1)) / 1.2 var(--display); letter-spacing: 0.04em; }
.re-skill-level { color: var(--muted); font-variant-numeric: tabular-nums; }
.re-up { font-weight: 700; color: #1b1408; background: var(--brass); padding: 1px 8px; }
.re-bar { grid-column: 1 / -1; position: relative; height: 10px; background: #14110d; box-shadow: inset 0 0 0 1px var(--seam); overflow: hidden; }
.re-bar i { position: absolute; inset: 0 auto 0 0; width: var(--to); background: linear-gradient(var(--ember-hi), var(--ember-lo)); animation: re-fill 0.7s ease-out both; }
.re-bar::before { content: ""; position: absolute; z-index: 1; inset: 0 auto 0 0; width: var(--from); background: #6f4a1c; box-shadow: 1px 0 0 #14110d; }
@keyframes re-fill { from { width: var(--from); } }
@media (prefers-reduced-motion: reduce) { .re-bar i { animation: none; } }
.re-skill-xp { grid-column: 1 / -1; color: var(--muted); font-size: calc(14px * var(--ts, 1)); font-variant-numeric: tabular-nums; }
.re-none, .re-note, .re-story { color: var(--muted); }

/* What opened: tiles of their own, cut at the corners like every plate in the game, with the kind written on them. */
.re-tiles { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 8px; }
.re-tile { display: grid; gap: 2px; padding: 10px 14px; background: linear-gradient(#332d20, #262117); clip-path: var(--cut); box-shadow: inset 0 0 0 2px #5a4a2a; }
.re-tile-kind { font-size: calc(13px * var(--ts, 1)); color: var(--verdigris); font-weight: 700; }
.re-tile b { font: 600 calc(17px * var(--ts, 1)) / 1.2 var(--display); color: var(--brass); overflow-wrap: anywhere; }
.re-tile span:last-child { color: var(--text); font-size: calc(15px * var(--ts, 1)); }

.re-details, .re-more { border-top: 1px solid var(--seam); }
.re-details > summary, .re-more > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--brass); font-weight: 700; }
.re-rooms { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: calc(15px * var(--ts, 1)); font-variant-numeric: tabular-nums; }
.re-rooms caption { text-align: left; font-weight: 700; padding: 4px 0; }
.re-rooms th, .re-rooms td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-weight: 400; }
.re-rooms thead th { color: var(--muted); }
.re-rooms tbody th { overflow-wrap: anywhere; }

.re-go { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.re-go .chip { min-height: 48px; padding: 8px 18px; border-radius: 0; font: 700 calc(16px * var(--ts, 1)) / 1.2 var(--body); }
.re-go .chip.strong { flex: 1 1 220px; color: #1b1408; border: 0; clip-path: var(--cut); background: linear-gradient(var(--ember-hi), var(--ember-lo)); box-shadow: inset 0 0 0 2px #6b4212; }
/* Its corners are cut, and a cut takes an outline with it: the focus is drawn inside the button, a dark band and a pale one (seen on a keyboard and with a controller). */
.run-end .re-go .chip.strong:focus-visible, body.pad-on .run-end .re-go .chip.strong:focus { outline: none; box-shadow: inset 0 0 0 3px #16140f, inset 0 0 0 6px #f3ead2; }

/* ---------------- what waits at Lastheat, told on the summary itself: quest steps, who came, what was earned ---------------- */
.re-at { gap: 10px; }
.re-sub { display: grid; gap: 6px; min-width: 0; }
.run-end .re-sub h3 { margin: 0; font: 600 calc(16px * var(--ts, 1)) / 1.2 var(--display); letter-spacing: 0.04em; color: var(--brass); }
.re-count { margin-left: 6px; font: 700 calc(13px * var(--ts, 1)) var(--body); color: var(--muted); }
.re-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.re-lines li { padding: 8px 12px; border-left: 3px solid var(--ember); background: #1c1913; font-size: calc(16px * var(--ts, 1)); line-height: 1.4; }
.re-quests .re-lines li { border-left-color: var(--brass); }
.re-earned .re-lines li { border-left-color: var(--verdigris); }
.re-lines b { color: var(--brass); }
.re-more > .re-lines { margin-top: 6px; }

@media (max-width: 520px) {
  .re-head { padding: 12px 12px 10px; }
  .re-tally div + div { padding-left: 8px; }
  .re-home div, .re-facts div { grid-template-columns: minmax(0, 1fr); }
  .re-go .chip { flex: 1 1 100%; }
}
@media (max-height: 430px) and (orientation: landscape) {
  .run-end { gap: 12px; }
  .re-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 16px; align-items: end; }
  .re-head > * { grid-column: 1; }
  .re-head > .re-tally { grid-column: 2; grid-row: 1 / span 3; margin: 0; border-top: 0; align-self: center; }
}

/* The line at the head of a descent's summary while its save has not landed (expedition.js endSaveLine): words first,
   and a bar and a border beside them, never colour alone. */
.end-save { margin: 0 0 12px; padding: 10px 12px; border: 1px solid currentColor; border-left-width: 6px; text-align: left; font-size: calc(15px * var(--ts, 1)); line-height: 1.4; color: var(--text); }
.end-save.warn { color: #f6c9bf; font-weight: 600; }
.end-save[hidden] { display: none; }
/* On a narrow screen the summary's column runs under the Read aloud button in the panel's corner (read-aloud.css
   .say-corner, 44px at 8px from the top and the left): the line begins below it, so none of its words are covered. */
@media (max-width: 680px) { #campPanel:has(> .say-btn.say-corner) .end-save { margin-top: 36px; } }
