/* The combat log and status line. The party cards are in squad.css.
 *
 * One of the stylesheets split out of the old style.css. index.html links them
 * in the order they had in that file, so the cascade is unchanged - keep
 * that order when adding a rule, or a later sheet may win where it used to lose. */

/* ---------- combat ---------- */

#combat-timeline, #combat-log {
  font-family: "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
}

#combat-timeline {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 12px 12px 16px;
  background: rgba(11,13,16,0.92);
  border: 1px solid var(--gold-dark);
  color: #ddd0b2;
  pointer-events: auto;
}
#combat-turns { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.combat-turn {
  position: relative; flex: 0 0 auto; margin: 0; padding: 0; border: 0;
  background: none; color: inherit;
}
.combat-turn-picture {
  position: relative; display: block; width: 44px; height: 44px; min-width: 0; min-height: 0;
  padding: 0; border: 2px solid #80b5b8; border-radius: 0; background: #182328;
  color: #ddd0b2; outline: none; box-shadow: none; transform: none; cursor: help;
}
.enemy-turn .combat-turn-picture { border-color: #d48374; background: #2b1d20; }
.combat-turn-picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; image-rendering: pixelated; }
.enemy-turn .combat-turn-picture img { object-position: center 30%; }
.combat-turn-fallback { display: grid; place-items: center; width: 100%; height: 100%; font-size: 20px; }
.combat-turn[aria-current] .combat-turn-picture {
  width: 56px; height: 56px; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-dark);
}
.combat-turn[aria-current]::before {
  content: ''; position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--gold);
}
.combat-turn-picture:hover, .combat-turn-picture:focus-visible { outline: 2px solid #fff0c9; outline-offset: 3px; transform: none; }
.combat-turn-picture:active:not(:disabled) { transform: none; box-shadow: none; }
.combat-turn-now { position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); padding: 0 3px; color: #ffe1a0; background: #111418; font-size: 9px; line-height: 12px; }
.combat-identity-badge { position: absolute; bottom: 1px; right: 1px; min-width: 13px; padding: 1px 2px; color: #fff0c9; background: #111418; font-size: 10px; line-height: 12px; }
#combat-turn-detail {
  position: absolute; top: calc(100% + 8px); left: 0; width: 100%; padding: 8px 10px;
  box-sizing: border-box; border: 1px solid var(--gold-dark); background: #111418;
  color: #fff0c9; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; pointer-events: none;
}
.combat-turn:nth-child(n+6) { display: none; }
.combat-turn-ended { padding: 8px; font-size: 12px; }
@media (max-width: 760px) {
  .combat-turn:nth-child(n+5) { display: none; }
}
@media (max-width: 560px) {
  .combat-turn-picture { width: 40px; height: 40px; }
  .combat-turn[aria-current] .combat-turn-picture { width: 52px; height: 52px; }
}
@media (max-height: 420px) {
  #combat-timeline { padding: 10px 10px 14px; }
  .combat-turn-picture { width: 36px; height: 36px; }
  .combat-turn[aria-current] .combat-turn-picture { width: 44px; height: 44px; }
}
/* Four pictures fit beneath the monster's bar beside the landscape party dock. */
@media (max-height: 540px) and (min-width: 561px) and (max-width: 900px) {
  .combat-turn:nth-child(n+5) { display: none; }
}

/* Landscape touch: the queue shares the top edge with the vitals, keeping
   the enemy's face clear. Every portrait remains a full touch target. */
@media (orientation: landscape) and (max-height: 540px) and (pointer: coarse) {
  #player-hud.landscape-combat {
    top: 12px;
    left: 12px;
  }
  #combat-timeline {
    top: 12px;
    right: 12px;
    left: auto;
    transform: none;
    padding: 10px 8px 14px;
    background: linear-gradient(160deg, rgba(29,30,27,.94), rgba(9,13,15,.94));
    box-shadow: inset 0 1px 0 rgba(233,207,160,.12), 0 4px 14px rgba(0,0,0,.24);
  }
  #combat-turns { gap: 6px; }
  .combat-turn:nth-child(n+5) { display: none; }
  .combat-turn-picture { width: 44px; height: 44px; }
  .combat-turn[aria-current] .combat-turn-picture { width: 48px; height: 48px; }
  .combat-turn-picture img { image-rendering: auto; }
  #combat-turn-detail { left: auto; right: 0; width: max(100%, 210px); }
  #combat-timeline[data-visible-turns="3"] .combat-turn:nth-child(n+4),
  #combat-timeline[data-visible-turns="2"] .combat-turn:nth-child(n+3) { display: none; }
}
@media (orientation: landscape) and (max-height: 540px) and (pointer: coarse) and (max-width: 760px) {
  .combat-turn:nth-child(n+4) { display: none; }
}

/* An inset iron rail holds the portraits; allegiance stays in the portrait
   edges while brass marks the current turn. No extra outer frame per card. */
#combat-timeline {
  border-color: #45483f;
  border-radius: 6px;
  background: radial-gradient(ellipse at 25% 0, #89795409, transparent 70%),
    repeating-linear-gradient(110deg, #ffffff01 0 1px, transparent 1px 4px),
    linear-gradient(155deg, #121817, #080e10 70%);
  box-shadow: inset 0 1px 0 #a7987014, inset 0 -2px 0 #030708bb, 0 5px 16px #0009;
}
.combat-turn-picture {
  border-color: #536e76;
  border-radius: 3px;
  box-shadow: 0 1px 3px #000a;
}
.enemy-turn .combat-turn-picture { border-color: #87564f; }
.combat-turn-picture img { image-rendering: auto; border-radius: 1px; }
.combat-turn-picture::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: 1px;
  box-shadow: inset 0 1px 0 #c7b38c14, inset 0 -5px 8px #050a0ca6;
}
.combat-turn[aria-current] .combat-turn-picture {
  border-color: #b69c68;
  box-shadow: 0 0 0 2px #4c4332, 0 2px 6px #000b;
}
.combat-turn-now { color: #d4c093; background: #0b1112; font: 600 10px/12px "Segoe UI", system-ui, sans-serif; letter-spacing: .04em; }
#combat-turn-detail { border-color: #635943; border-radius: 4px; background: #0b1213; }

#combat-log {
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) var(--ink);
  width: min(530px, calc(100% - 220px));
  max-height: 116px;
  margin: 0 auto 13px;
  padding: 10px 18px;
  overflow-y: auto;
  color: #ddd0b2;
  background: rgba(11,13,16,0.86);
  border-top: 2px solid var(--gold-dark);
  border-bottom: 2px solid var(--gold-dark);
  pointer-events: auto;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}
#combat-log p { margin: 4px 0; }
#combat-log p:last-child { color: #fff0c9; font-weight: 700; }
#combat-status { min-width: 145px; padding: 12px 15px; color: #f1dfba; white-space: nowrap; font-size: 13px; }

/* Floating combat text. ui/combat.js places each number over the monster or
 * the hero's portrait it is about, on whole pixels; this layer is the whole
 * combat screen so both can be reached. A number lands big and settles to its
 * size in the first fraction of a second - the blow arriving - then rises in
 * whole-pixel steps. (It used to never scale, for the pixel fonts' sake; those
 * are gone, and a pop this short does not blur.) A crit lands bigger still. */
#combat-floating-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 40;
}

.floating-number {
  position: absolute;
  white-space: nowrap;
  font-family: inherit;
  font-weight: 900;
  color: var(--parchment);
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  animation: combat-number-pop 170ms ease-out, combat-number-rise 900ms forwards, combat-number-fade 900ms forwards;
  pointer-events: none;
  user-select: none;
}
.floating-number.damage { font-size: 24px; color: #fff3d3; }
.floating-number.player-damage { font-size: 22px; color: #e0897f; }
.floating-number.crit {
  font-size: 30px;
  color: #f1c66f;
  animation-name: combat-number-crit-pop, combat-number-rise, combat-number-fade, combat-number-flare;
  animation-duration: 220ms, 900ms, 900ms, 900ms;
}
.floating-number.heal { font-size: 22px; color: #a9c58a; }
.floating-number.block { font-size: 20px; color: #6f9ee0; }
.floating-number.ward { font-size: 20px; color: #c4a3e6; }

/* Up fast, then slowing - an ease-out built from whole-pixel steps, one
   pixel at a time, so the number never sits between pixels and never jumps
   more than one. (The steps(n) of each keyframe run to the next: n is the
   pixels in that stretch.) */
@keyframes combat-number-rise {
  0% { transform: translateY(0); animation-timing-function: steps(14, end); }
  12% { transform: translateY(-14px); animation-timing-function: steps(10, end); }
  33% { transform: translateY(-24px); animation-timing-function: steps(8, end); }
  66% { transform: translateY(-32px); animation-timing-function: steps(4, end); }
  100% { transform: translateY(-36px); }
}
@keyframes combat-number-pop {
  0% { scale: 1.6; }
  65% { scale: 0.94; }
  100% { scale: 1; }
}
@keyframes combat-number-crit-pop {
  0% { scale: 2.1; }
  60% { scale: 0.9; }
  100% { scale: 1; }
}
@keyframes combat-number-fade {
  0%, 75% { opacity: 1; }
  100% { opacity: 0; }
}
/* A crit lands white for two frames before it turns gold. */
@keyframes combat-number-flare {
  0%, 10% { color: #fff3d3; }
  11%, 100% { color: #f1c66f; }
}

/* A hero struck: the portrait shakes and goes red for a moment. The shake
   moves smoothly between its points rather than jumping, so it reads the
   same at any refresh rate; the colour is a flash, so it does jump. */
.is-struck { animation: hero-struck-shake 300ms linear, hero-struck-flash 300ms steps(1, end); }
@keyframes hero-struck-shake {
  0% { transform: translateX(-4px); }
  20% { transform: translateX(4px); }
  40% { transform: translateX(-3px); }
  60% { transform: translateX(2px); }
  80% { transform: translateX(-1px); }
  100% { transform: none; }
}
@keyframes hero-struck-flash {
  0% { filter: brightness(1.6) sepia(1) saturate(5) hue-rotate(-40deg); }
  30% { filter: brightness(1.3) sepia(1) saturate(4) hue-rotate(-40deg); }
  45%, 100% { filter: none; }
}

/* A command with a second, smaller line under its name - Shield Slam and
   Shadow Strike use it to show what their Energy cost does to walking. */
.btn-lines { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.1; text-align: left; }
.special-walk-cost { font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0.02em; opacity: 0.85; }

/* Aftermath: one dark frame, clear rewards, and an explicit way onward.
   Insets are already accounted for by the enclosing game viewport. */
#combat-victory {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  width: min(660px, calc(100% - 32px));
  pointer-events: auto;
}
.victory-card {
  --victory-edge: #5e5b47;
  max-height: calc(100dvh - 152px - var(--edge-top) - var(--edge-bottom));
  padding: 20px 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  color: #d9d3c1;
  border: 1px solid var(--victory-edge);
  border-radius: 6px;
  background: radial-gradient(ellipse at 0 0, #8e794410, transparent 65%),
    repeating-linear-gradient(110deg, #ffffff01 0 1px, transparent 1px 4px),
    linear-gradient(155deg, #121817, #080e10 70%);
  box-shadow: inset 0 1px 0 #c4ad7620, 0 12px 32px #0009;
  font: 400 13px/1.4 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
  animation: victory-arrive 260ms ease-out;
}
.victory-summary { flex: none; min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 24px; }
.victory-body { min-height: 0; padding-right: 10px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; scrollbar-color: #6b6148 #0a1012; }
.victory-heading { min-width: 0; display: flex; align-items: center; gap: 12px; }
.victory-heading > div { min-width: 0; }
.victory-emblem { width: 44px; height: 56px; object-fit: contain; flex: none; opacity: .9; }
.victory-title {
  margin: 0;
  font: 400 34px/1.05 Georgia, serif;
  color: #e0d4b5;
  text-shadow: 0 2px 3px #000;
}
.victory-headline { margin: 6px 0 0; color: #afb1a5; font-size: 12px; overflow-wrap: anywhere; }
.victory-kicker { margin: 0 0 4px; color: #c0a47b; font-size: 11px; }
.victory-boss { margin: 7px 0 0; color: #c3b298; font: italic 13px/1.4 Georgia, serif; overflow-wrap: anywhere; }
.victory-guardian { --victory-edge: #8c7049; border-top: 2px solid #a48652; background: radial-gradient(ellipse at 10% 0, #925d2920, transparent 70%), linear-gradient(155deg, #191916, #080e10 70%); }
.victory-guardian .victory-emblem { height: 68px; opacity: 1; }
.victory-rewards {
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.victory-card li { margin: 0; padding: 0; background: none; border: 0; }
#combat-ui.has-victory #combat-log,
#combat-ui.has-victory .combat-controls { visibility: hidden; }
.victory-reward { display: grid; grid-template-columns: 18px auto; align-items: center; column-gap: 6px; color: #aca993; font-size: 11px; }
.victory-reward .px-icon { grid-column: 1; grid-row: 1; color: #a58a56; }
.victory-reward strong { grid-column: 2; grid-row: 1; color: #e4d6af; font-size: 23px; font-weight: 600; font-variant-numeric: tabular-nums; }
.victory-reward > span { grid-column: 2; grid-row: 2; }
.victory-spoils { flex: none; display: flex; flex-direction: column; gap: 7px; padding-top: 12px; border-top: 1px solid #8974473b; }
.victory-loot-title { margin: 0; color: #c8b590; font: 400 17px/1.2 Georgia, serif; }
.victory-finds {
  margin: 0;
  padding: 0 6px 0 0;
  min-height: 0;
  list-style: none;
  color: #d4cfbc;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.victory-card .victory-finds li { display: grid; grid-template-columns: 26px minmax(0,1fr); align-items: center; gap: 9px; padding: 4px 9px; border-left: 2px solid #776448; background: #c7aa6c07; }
.victory-find-icon { width: 26px; height: 26px; display: grid; place-items: center; color: #b2a079; }
.victory-find-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.victory-card .victory-finds li + li { margin-top: 5px; }
.victory-finds:focus-visible { outline: 2px solid #bcaa7a; outline-offset: -2px; }
/* Gear found in the fight: how it compares in its row, Equip beside Continue. */
.victory-find-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.victory-gear-diff:empty { display: none; }
.victory-gear-diff, .victory-gear-diff .gear-stat-diffs { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; color: #a9b3a8; }
.victory-gear-diff .diff-label { color: #a3a596; }
.victory-gear-diff .stat-diff.positive { color: #a9c88e; font-weight: 600; }
.victory-gear-diff .stat-diff.negative { color: #dea79c; font-weight: 600; }
#combat-victory .victory-equip { min-width: 84px; min-height: 44px; padding: 6px 14px; border: 1px solid #8a754d; border-radius: 3px; background: linear-gradient(#2d3426, #1a211c); color: #e5d8b8; font: 600 13px/1.2 "Segoe UI", system-ui, sans-serif; letter-spacing: 0; text-transform: none; }
#combat-victory .victory-equip:hover:not(:disabled) { background: #343d2c; border-color: #c0a46b; }
#combat-victory .victory-equip:focus-visible { outline: 2px solid #dcc18a; outline-offset: 2px; }
#combat-victory .victory-equip:disabled { opacity: .75; cursor: default; }
#combat-victory .victory-equip.is-equipped { opacity: 1; border-color: #6f8a58; color: #c4dcae; background: #1b2419; }
.victory-footer { flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding-top: 10px; border-top: 1px solid #89744726; }
.victory-hint { margin: 0 auto 0 0; color: #a3a596; font-size: 11px; }
#combat-victory .victory-continue { min-width: 116px; min-height: 44px; padding: 8px 20px; border: 1px solid #8a754d; border-radius: 3px; background: linear-gradient(#283027, #171f1d); color: #e5d8b8; font: 600 13px/1.2 "Segoe UI", system-ui, sans-serif; letter-spacing: 0; text-transform: none; }
#combat-victory .victory-continue:hover { background: #30382b; border-color: #c0a46b; }
#combat-victory .victory-continue:focus-visible { outline: 2px solid #dcc18a; outline-offset: 2px; }
@keyframes victory-arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .victory-card { animation: none; }
}
@media (max-width: 520px) {
  .victory-card { padding: 16px; gap: 12px; }
  .victory-body { gap: 12px; }
  .victory-summary { align-items: start; gap: 12px; grid-template-columns: minmax(0,1fr); }
  .victory-rewards { align-self: stretch; justify-content: start; gap: 30px; }
  .victory-title { font-size: 30px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  #combat-victory { bottom: 12px; width: min(640px, calc(100% - 32px)); }
  .victory-card { max-height: calc(100dvh - 140px - var(--edge-top) - var(--edge-bottom)); padding: 12px 16px 10px; gap: 9px; }
  .victory-body { gap: 9px; }
  .victory-summary { gap: 14px; }
  .victory-title { font-size: 27px; }
  .victory-emblem { width: 32px; height: 42px; }
  .victory-guardian .victory-emblem { height: 48px; }
  .victory-rewards { gap: 12px; }
  .victory-reward strong { font-size: 20px; }
  .victory-spoils { padding-top: 8px; gap: 5px; }
  .victory-card .victory-finds li { padding-block: 3px; }
  .victory-footer { padding-top: 6px; }
}

/* Loss and escape share the result container and its native dismissal.
   The action rail leaves the centre of a landscape phone for the outcome. */
#combat-ui.has-aftermath #combat-timeline { visibility: hidden; }
.aftermath-card { display: grid; grid-template-columns: minmax(0,1fr) 132px; gap: 22px; padding: 20px; }
.aftermath-defeat { --victory-edge: #755449; background: radial-gradient(ellipse at 0 0, #75402e19, transparent 70%), linear-gradient(155deg, #191817, #090f10 75%); box-shadow: inset 3px 0 0 #8e5e4b55, inset 0 1px 0 #b68f6520, 0 12px 32px #000a; }
.aftermath-body { min-width: 0; min-height: 0; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #72594a #0a1012; }
.aftermath-heading { display: flex; gap: 12px; align-items: center; }
.aftermath-emblem { width: 44px; height: 56px; flex: none; object-fit: contain; }
.aftermath-kicker { margin: 0 0 4px; color: #b68e75; font-size: 11px; }
.aftermath-title { margin: 0; color: #dec5b4; font: 400 32px/1.05 Georgia, serif; }
.aftermath-description { margin: 12px 0 0; color: #bdbaad; line-height: 1.4; }
.aftermath-facts { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid #96765a30; }
.victory-card .aftermath-facts li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.aftermath-facts li > div { min-width: 0; }
.aftermath-fact-icon { flex: none; display: flex; color: #ac977b; }
.aftermath-fact-label { display: block; font-size: 11px; color: #a9a496; }
.aftermath-fact-value { display: block; color: #d2c9b4; font: 600 13px/1.35 "Segoe UI", system-ui, sans-serif; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.aftermath-loss .aftermath-fact-value { color: #d5a58f; }
.aftermath-assurance { margin: 10px 0 0; color: #92998d; font-size: 11px; }
.aftermath-actions { display: flex; flex-direction: column; justify-content: center; gap: 10px; min-width: 0; padding-left: 16px; border-left: 1px solid #96765a26; }
.aftermath-actions .victory-hint { margin: 0; text-align: center; }
#combat-victory .aftermath-defeat .victory-continue { border-color: #86654f; background: linear-gradient(#302922, #1c1d19); }
@media (hover: hover) and (pointer: fine) {
  #combat-victory .aftermath-defeat .victory-continue:hover { border-color: #b48b69; background: #382d25; }
}
.aftermath-escape { --victory-edge: #505d53; }
.aftermath-escape .aftermath-title { color: #c9d1bd; }
.aftermath-escape .aftermath-kicker { color: #8eaa96; }
.aftermath-escape .aftermath-facts { grid-template-columns: minmax(0,1fr); }
@media (orientation: landscape) and (max-height: 540px) {
  .aftermath-card { grid-template-columns: minmax(0,1fr) 120px; gap: 16px; padding: 12px 16px; }
  .aftermath-heading { gap: 10px; }
  .aftermath-emblem { width: 32px; height: 42px; }
  .aftermath-title { font-size: 26px; }
  .aftermath-kicker { margin-bottom: 2px; }
  .aftermath-description { margin-top: 6px; }
  .aftermath-facts { gap: 10px; margin-top: 10px; padding-top: 8px; }
  .aftermath-assurance { margin-top: 6px; }
  .aftermath-actions { padding-left: 12px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .aftermath-card { grid-template-columns: minmax(0,1fr); gap: 14px; padding: 16px; }
  .aftermath-actions { flex-direction: row; justify-content: flex-end; padding: 12px 0 0; border-left: 0; border-top: 1px solid #96765a26; }
}

/* Encounter choices use the same dark iron as the battle aftermath. */
.event-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  z-index: 15;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.event-card {
  --event-accent: #ac956b;
  width: min(720px, calc(100% - 32px));
  max-height: calc(100dvh - 152px - var(--edge-top) - var(--edge-bottom));
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0,1fr) 144px;
  gap: 20px;
  overflow: hidden;
  border: 1px solid #5c5a49;
  border-radius: 6px;
  background: radial-gradient(ellipse at 0 0, #8e794410, transparent 65%),
    repeating-linear-gradient(110deg, #ffffff01 0 1px, transparent 1px 4px),
    linear-gradient(155deg, #121817, #080e10 70%);
  box-shadow: inset 0 1px 0 #c4ad7620, 0 10px 28px #0009;
  color: #d9d3c1;
  font: 400 13px/1.4 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
  pointer-events: auto;
}
.event-content { min-width: 0; min-height: 0; overflow-y: auto; padding-right: 5px; scrollbar-width: thin; scrollbar-color: #6b6148 #0a1012; overscroll-behavior: contain; }
.event-heading { display: flex; align-items: center; gap: 12px; }
.event-title { margin: 0; padding: 0; border: 0; min-width: 0; color: #e0d4b5; font: 400 26px/1.15 Georgia, serif; overflow-wrap: anywhere; }
.event-icon { width: 44px; height: 48px; flex: none; display: grid; place-items: center; }
.event-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.event-text { margin: 10px 0 0; color: #b8b8ab; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.event-terms { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid #8974473b; }
.event-term + .event-term { padding-left: 16px; border-left: 1px solid #89744726; }
.event-term-label { display: block; margin-bottom: 4px; color: #aaa995; font-size: 11px; }
.event-term-cost, .event-term-reward { display: block; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.event-term-cost { color: #dba194; }
.event-term-reward { color: #b5c3a0; }
.event-actions { min-width: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; padding-left: 18px; border-left: 1px solid #89744726; }
.event-actions button { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; justify-content: space-between; gap: 8px; color: #d4d0bd; border: 1px solid #555b4d; border-radius: 3px; background: linear-gradient(#212a25, #111a19); font: 600 13px/1.25 "Segoe UI", system-ui, sans-serif; letter-spacing: 0; text-transform: none; }
.event-actions button.primary { border-color: var(--event-accent); color: #e5d8b8; }
.event-actions button.event-leave { background: #0b1314; color: #b3b8ad; border-color: #3f4943; }
@media (hover: hover) and (pointer: fine) {
  .event-actions button:hover:not(:disabled) { background: #2a332b; border-color: #a38e64; }
}
.event-actions button:focus-visible { outline: 2px solid #dcc18a; outline-offset: 2px; }
.event-actions .kbd { order: 1; margin: 0; background: none; border-color: #6f6b5655; color: #a99c7b; }
#shrine-ui[data-kind="fountain"] .event-card { --event-accent: #718e91; }
#shrine-ui[data-kind="reliquary"] .event-card { --event-accent: #927451; }
@media (hover: none), (pointer: coarse) {
  .event-actions .kbd { display: none; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .event-ui { bottom: 12px; }
  .event-ui .event-card { width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 140px - var(--edge-top) - var(--edge-bottom)); padding: 12px; grid-template-columns: minmax(0,1fr) 132px; gap: 14px; }
  .event-heading { gap: 10px; }
  .event-title { font-size: 23px; }
  .event-icon { width: 34px; height: 36px; }
  .event-text { max-height: 2.9em; overflow-y: auto; margin-top: 6px; scrollbar-width: thin; }
  .event-terms { gap: 12px; margin-top: 10px; padding-top: 8px; }
  .event-term + .event-term { padding-left: 12px; }
  .event-term-label { margin-bottom: 2px; }
  .event-actions { padding-left: 12px; }
}
@media (orientation: landscape) and (max-height: 360px) {
  .shrine-panel .event-text { max-height: 1.45em; }
  .event-title { font-size: 21px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .event-ui .event-card { padding: 16px; grid-template-columns: minmax(0,1fr); gap: 16px; }
  .event-actions { flex-direction: row; padding: 12px 0 0; border-left: 0; border-top: 1px solid #89744726; }
  .event-actions button { flex: 1; justify-content: center; }
}

/* Short labels on one line where there is room for them. Heavy (12 MP) and
 * the potion's line used to break over two lines on a 1440 screen. */
@media (min-width: 1200px) {
  #btn-attack, #btn-heavy, #btn-potion, #btn-run, #btn-guard { white-space: nowrap; }
}
/* And when one line each will not fit across, the actions wrap to a second row
 * rather than run off the right edge - Guard did, at 1280x860, the moment the
 * labels stopped breaking (verify-training-screen caught it). */
.combat-controls > .control-group:last-child { flex-wrap: wrap; justify-content: flex-end; min-width: 0; row-gap: 8px; }

/* A level gained, on the victory card (levelUpBand in js/ui/combat.js): the
   level in the card's serif, and beside it what grew. Cool blue against the
   card's gold, so it reads as its own news rather than another reward. */
.victory-levelup {
  flex: none; display: grid; grid-template-columns: 40px auto minmax(0, 1fr); align-items: center; gap: 4px 14px;
  padding: 10px 12px; border: 1px solid #6fa9bf55; border-left: 3px solid #8fc3d6; border-radius: 2px;
  background: linear-gradient(100deg, #2b5a6a33, #0c141600 75%);
  animation: victory-levelup 900ms ease-out both;
}
.victory-levelup-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #b4e0ee;
  background: radial-gradient(circle, #6fb3cc44, transparent 70%); }
.victory-levelup-mark .utility-icon { width: 28px; height: 28px; }
.victory-levelup-copy { min-width: 0; }
.victory-levelup-kicker { margin: 0; font: 700 10.5px "Segoe UI", system-ui, sans-serif; letter-spacing: 0.18em; text-transform: uppercase; color: #8fc3d6; }
.victory-levelup-title { margin: 1px 0 0; font: 400 24px/1.1 Georgia, serif; color: #eef6f8; text-shadow: 0 0 14px #6fb3cc55; }
.victory-card .victory-levelup-gains { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end; }
.victory-card .victory-levelup-gains li { display: flex; align-items: baseline; gap: 6px; font: 500 12px "Segoe UI", system-ui, sans-serif; color: #a9b8b9; white-space: nowrap; }
.victory-levelup-gains strong { color: #e8f2ef; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.victory-card .victory-levelup-gains .victory-levelup-points { color: #cfe6ec; font-weight: 600; }
.victory-card .victory-levelup-gains .victory-levelup-ability { color: #f0d48a; font-weight: 600; }
@keyframes victory-levelup {
  0% { opacity: 0; transform: translateY(6px); box-shadow: 0 0 0 #8fc3d600; }
  45% { opacity: 1; transform: none; box-shadow: 0 0 22px #8fc3d655; }
  100% { box-shadow: 0 0 0 #8fc3d600; }
}
@media (max-width: 520px) {
  .victory-levelup { grid-template-columns: 40px minmax(0, 1fr); }
  .victory-card .victory-levelup-gains { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .victory-levelup { padding: 6px 10px; gap: 2px 12px; grid-template-columns: 32px auto minmax(0, 1fr); }
  .victory-levelup-mark { width: 32px; height: 32px; }
  .victory-levelup-mark .utility-icon { width: 22px; height: 22px; }
  .victory-levelup-title { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .victory-levelup { animation: none; } }
