/* docs/40: the Blighted Sea («Море Скверны») — the HUD's block in the top stack while she is in the green water
   (ui/blight.ts, the spot work's pill's own look: seahud.css #hud-spot), the Raft's window with its table of twenty-one
   (the dice window's frame, styles.css .dice), and the chapter's card in the campaign book. Nothing here is on the page
   for a captain the green water has not taken. */

/* ---------------------------------------------------------------------------------------------- the HUD's block */
#hud-stack > #hud-blight { order: -5; }
#hud-blight { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; padding: 3px 6px 4px !important; font: 11.5px/1.2 var(--sans); color: var(--bone);
  border-color: rgba(120, 235, 140, 0.6); background: rgba(8, 16, 11, 0.86); box-shadow: 0 0 10px rgba(80, 230, 120, 0.18), 0 2px 6px rgba(0, 0, 0, 0.55); }
#hud-blight.hidden { display: none; }
body.simple #hud-stack > #hud-blight { align-self: center !important; width: auto !important; max-width: min(440px, 100%) !important; box-sizing: border-box;
  border: 1px solid rgba(120, 235, 140, 0.55) !important; border-image: none !important; border-radius: 3px !important; background: rgba(8, 16, 11, 0.86); }
#hud-blight .bl-main { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1 1 auto; white-space: nowrap; }
#hud-blight .bl-tier { display: inline-flex; align-items: center; gap: 4px; flex: none; }
#hud-blight .bl-tier b { color: #a8ff9a; font-weight: 700; }
#hud-blight .bl-tier .ico-sm, #hud-blight .bl-hold .ico-sm { width: 18px; height: 18px; border-radius: 50%; }
#hud-blight .bl-bar { flex: 1 1 40px; min-width: 30px; max-width: 120px; height: 7px; border-radius: 4px; overflow: hidden; background: rgba(120, 235, 140, 0.16); border: 1px solid rgba(120, 235, 140, 0.35); }
#hud-blight .bl-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #2f9a4a, #9dff6a); transition: width 0.4s linear; }
#hud-blight .bl-hold { display: inline-flex; align-items: center; gap: 3px; flex: none; font-variant-numeric: tabular-nums; }
#hud-blight .bl-hold b { color: var(--gold); font-size: 13px; }
#hud-blight .bl-mul { flex: none; color: #cfe8c4; font-variant-numeric: tabular-nums; }
#hud-blight .bl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; min-width: 0; }
#hud-blight .bl-chip { padding: 1px 6px; border-radius: 9px; background: rgba(120, 235, 140, 0.12); border: 1px solid rgba(120, 235, 140, 0.3); color: #d6f2cf; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
#hud-blight .bl-chosen { color: #e6ff9a; border-color: rgba(214, 255, 138, 0.55); }
#hud-blight .bl-heart { color: #b7ff7a; }
#hud-blight .bl-ev { font-weight: 700; animation: bl-ev 0.5s ease-out; }
#hud-blight .bl-ev.bl-good { color: #a8ff9a; }
#hud-blight .bl-ev.bl-bad { color: #ff9c8a; border-color: rgba(255, 140, 120, 0.5); background: rgba(120, 30, 20, 0.3); }
#hud-blight .bl-ev.bl-info { color: var(--gold); border-color: rgba(232, 196, 106, 0.5); }
#hud-blight .bl-mooring { color: var(--gold); }
#hud-blight .bl-act { min-height: 28px; padding: 3px 10px; white-space: nowrap; }
@keyframes bl-ev { from { transform: scale(1.15); filter: brightness(1.6); } to { transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) { #hud-blight .bl-ev { animation: none; } #hud-blight .bl-bar > i { transition: none; } }
@media (max-height: 520px) { #hud-blight { font-size: 11px; gap: 2px 6px; } #hud-blight .bl-act { min-height: 26px; } }
/* a narrow upright window (a phone upright shows the «поверните телефон» lock instead): the top stack there is a
   150 px slot between her portrait's bars and the minimap — the block takes a strip of its own above the helm */
@media (max-width: 520px) and (min-height: 521px) {
  body #hud #hud-stack > #hud-blight { position: fixed !important; left: calc(var(--sa-l) + 8px) !important; right: calc(var(--sa-r) + 8px) !important; top: auto !important;
    bottom: calc(var(--sa-b) + 236px); width: auto !important; max-width: none !important; justify-content: center; z-index: 2; }
}

/* ---------------------------------------------------------------------------------------------- the Raft's window */
#modal-panel[data-modal="blight"] { display: flex; flex-direction: column; }
@media (min-width: 700px) and (min-height: 521px) { #modal-panel[data-modal="blight"] { width: min(740px, 96vw); height: min(660px, 94vh); } }
#modal-panel[data-modal="blight"] .modal-head .sub { color: #b9e8b0; }
#modal-panel[data-modal="blight"] .tabs { flex: none; }
#modal-panel[data-modal="blight"] .tab.active { color: #a8ff9a; }
.bl-raft { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.bl-raft > * { flex: none; }
.bl-raft p { margin: 0; }
.bl-small { font-size: 12px; line-height: 1.35; }
#modal-panel[data-modal="blight"] .modal-body { min-height: 0; }
/* the foot is never scrolled away (the owner's rule for the phone held sideways) */
.bl-foot { flex: none; display: flex; justify-content: space-between; gap: 8px; padding: 8px 18px 12px; border-top: 1px solid rgba(111, 90, 56, 0.4); }
.bl-art { display: block; width: 100%; aspect-ratio: 4 / 1; object-fit: cover; object-position: center 40%; border: 1px solid rgba(120, 235, 140, 0.35); border-radius: 4px; background: #0b0d10; filter: hue-rotate(55deg) saturate(0.85) brightness(0.9); }
.bl-welcome { font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.35; color: var(--bone); }
.bl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.bl-stat { display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border: 1px solid rgba(120, 235, 140, 0.28); border-radius: 6px; background: rgba(8, 16, 11, 0.6); min-width: 0; }
.bl-stat > span { font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.bl-stat > b { display: inline-flex; align-items: center; gap: 5px; font: 700 20px var(--serif); color: #c9ffb8; overflow-wrap: anywhere; }
.bl-stat > small { font-size: 11.5px; line-height: 1.3; }
.bl-lantern { color: #b7ff7a; font-weight: 600; }

/* twenty-one: the cards are drawn in code — rank and suit on parchment */
.bj-table { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid rgba(120, 235, 140, 0.3); border-radius: 8px; background: radial-gradient(120% 140% at 50% 0%, rgba(24, 54, 34, 0.75), rgba(8, 16, 11, 0.85)); }
.bj-row { display: grid; grid-template-columns: minmax(84px, 120px) minmax(0, 1fr); align-items: center; gap: 10px; }
.bj-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bj-who .giver-h { overflow-wrap: anywhere; }
.bj-n { font: 700 22px var(--serif); color: var(--gold); font-variant-numeric: tabular-nums; }
.bj-hand { display: flex; flex-wrap: wrap; gap: 5px; min-height: 70px; align-items: center; }
.bj-card { width: 50px; height: 70px; flex: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55)); }
.bj-card > rect { fill: #eadfc4; stroke: #6a5733; stroke-width: 2; }
.bj-card text { fill: #2a2218; font-family: var(--serif); }
.bj-card.red text { fill: #a8322a; }
.bj-card .bj-r { font-size: 17px; font-weight: 700; }
.bj-card .bj-s { font-size: 14px; }
.bj-card .bj-big { font-size: 34px; }
.bj-card.bj-back > rect { fill: #1d3a26; stroke: #7a9a5a; }
.bj-card.bj-back .bj-in { fill: none; stroke: rgba(160, 230, 150, 0.5); stroke-width: 1.5; }
.bj-card.bj-back .bj-loz { fill: none; stroke: rgba(160, 230, 150, 0.7); stroke-width: 1.5; }
.bj-sum { display: flex; align-items: center; justify-content: space-between; gap: 4px 14px; flex-wrap: wrap; min-height: 24px; }
.bj-pot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.bj-pick { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; }
.bj-result { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font: 600 17px var(--serif); }
.bj-result.bj-win, .bj-result.bj-blackjack { color: #9be08a; }
.bj-result.bj-push { color: var(--gold); }
.bj-result.bj-lose, .bj-result.bj-bust { color: #e08a7a; }
.bj-controls { border-color: rgba(120, 235, 140, 0.3) !important; }
.bj-coins, .bj-stakes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bj-coins .btn.on, .bj-stakes .btn.on { border-color: #9dff6a; box-shadow: 0 0 8px rgba(157, 255, 106, 0.35); color: #eaffdf; }
.bj-stakes .btn { display: inline-flex; align-items: center; gap: 4px; min-width: 76px; justify-content: center; }
.bj-kind { color: #d8e6b0; font-family: var(--serif); font-style: italic; font-size: 14px; }
.bj-limits { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bl-raft .money { display: inline-flex; align-items: center; gap: 3px; }

.bj-table.bj-empty { align-items: center; opacity: 0.7; }
.bj-table.bj-empty .bj-hand { justify-content: center; }

/* the shop */
.bl-shop-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bl-shop { display: flex; flex-direction: column; gap: 6px; }
.bl-ware { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid rgba(120, 235, 140, 0.25); border-radius: 6px; background: rgba(8, 16, 11, 0.55); }
.bl-ware.owned { opacity: 0.7; }
.bl-ware-art { width: 44px; height: 44px; object-fit: cover; border-radius: 5px; border: 1px solid rgba(120, 235, 140, 0.4); background: #0b0d10; }
.bl-ware-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bl-ware-t b { font-family: var(--serif); font-size: 15px; overflow-wrap: anywhere; }
.bl-ware-t .muted { font-size: 12px; line-height: 1.3; }
.bl-ware-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bl-price { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: #c9ffb8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-price.poor { color: #e08a7a; }
.bl-owned { color: #9be08a; font-size: 12px; white-space: nowrap; }
.bl-lines { display: flex; flex-wrap: wrap; gap: 6px; }
button.bl-piece { width: 100%; text-align: left; cursor: pointer; color: inherit; font: inherit; }

/* the chapter (the Raft's page and the campaign book's card) */
.cb-ch.cb-blight { border-color: rgba(120, 235, 140, 0.55); box-shadow: inset 0 0 12px rgba(80, 230, 120, 0.1); }
.cb-ch.cb-blight > summary b { color: #c9ffb8; }
.bl-ch-h { font: 600 18px var(--serif); color: #c9ffb8; }
.bl-chapter { display: flex; flex-direction: column; gap: 6px; }
.bl-giver { font-size: 12px; margin: 2px 0 6px; }
.bl-quest { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 4px; padding: 8px 10px; border: 1px solid rgba(120, 235, 140, 0.35); border-radius: 6px; background: rgba(8, 16, 11, 0.6); }
.bl-qt { font: 600 17px var(--serif); color: var(--bone); }
.bl-qb { margin: 0; font-family: var(--serif); font-style: italic; font-size: 14.5px; line-height: 1.35; color: #d9d2c0; }
.bl-qfoot { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin-top: 2px; }
.bl-qact { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.bl-contract { margin-top: 4px; }
.bl-contract.paid { opacity: 0.6; }

/* the week's board */
.bl-week { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.bl-week th { text-align: left; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--brass); padding: 3px 6px; border-bottom: 1px solid rgba(111, 90, 56, 0.4); }
.bl-week td { padding: 4px 6px; border-bottom: 1px solid rgba(111, 90, 56, 0.2); }
.bl-week td.bl-wn { overflow-wrap: anywhere; }
.bl-week tr.me td { color: #c9ffb8; background: rgba(120, 235, 140, 0.08); }

/* a phone held sideways, and upright */
@media (max-height: 520px) {
  #modal-panel[data-modal="blight"] .tab { padding: 5px 9px; }
  .bl-foot { padding: 5px 12px 7px; }
  .bl-art { display: none; }
  .bl-welcome { font-size: 13.5px; }
  .bj-card { width: 40px; height: 56px; }
  .bj-hand { min-height: 56px; }
  .bj-table { padding: 6px 8px; gap: 5px; }
  .bj-row { grid-template-columns: minmax(70px, 100px) minmax(0, 1fr); }
  .bl-stat > b { font-size: 17px; }
  /* twenty-one beside its buttons: nothing of a hand is scrolled for */
  .bl-raft[data-tab="bj"] { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(190px, 1fr); grid-template-areas: "rules rules" "table controls" "limits limits"; gap: 5px 10px; align-content: start; }
  .bl-raft[data-tab="bj"] > .bj-rules { grid-area: rules; margin: 0; font-size: 11px; line-height: 1.25; }
  .bl-raft[data-tab="bj"] > .bj-table { grid-area: table; }
  .bl-raft[data-tab="bj"] > .dc-controls, .bl-raft[data-tab="bj"] > .bj-acts { grid-area: controls; align-self: start; }
  .bl-raft[data-tab="bj"] > .bj-acts { flex-direction: column; }
  .bl-raft[data-tab="bj"] > .bj-acts .btn { flex: none; }
  .bl-raft[data-tab="bj"] > .bj-limits { grid-area: limits; }
  .bj-controls { padding: 6px !important; gap: 6px !important; }
  .bj-stakes .btn { min-width: 0; }
}
@media (max-width: 520px) {
  #modal-panel[data-modal="blight"] .tabs { padding: 0 8px; }
  #modal-panel[data-modal="blight"] .tab { padding: 6px 8px; font-size: 11px; letter-spacing: 0.02em; }
  .bj-card { width: 44px; height: 62px; }
  .bj-row { grid-template-columns: 1fr; gap: 4px; }
  .bj-who { flex-direction: row; align-items: baseline; gap: 8px; }
  .bl-ware { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 7px; }
  .bl-ware-art { width: 38px; height: 38px; }
}
