* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0d1117;
  color: #e6edf3;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px;
}

#app {
  display: grid;
  grid-template-columns: 1fr 220px;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  max-width: 1200px;
  width: 100%;
}

#hud-top {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 12px;
}

#clock-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 600;
}

#clock-time { letter-spacing: 0.04em; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: #238636;
  color: #fff;
}
.pill.warn { background: #d29922; color: #000; }
.pill.flood { background: #da3633; }
.pill.hub { background: #1f6feb; }

#zone-label { flex: 1; color: #8b949e; font-size: 0.9rem; }

#vitals {
  display: flex;
  gap: 12px;
  align-items: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 600;
}
.vital { color: #8b949e; }
.vital span { color: #e6edf3; }
.vital.salt span { color: #d2a8ff; }
.vital.level span { color: #e3b341; }

#msg-banner {
  width: 100%;
  background: #3d1f1f;
  border: 1px solid #da3633;
  color: #ffb4b0;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
}

#game {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  height: auto;
  background: #010409;
  border: 1px solid #30363d;
  border-radius: 8px;
  display: block;
  image-rendering: pixelated;
  cursor: crosshair;
}

#hud-side {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 10px;
}
.panel.tip p { margin-top: 4px; line-height: 1.35; }
.panel h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b949e;
  margin-bottom: 6px;
}
.panel ul {
  list-style: none;
  font-size: 0.85rem;
  min-height: 1.5em;
}
.panel li {
  padding: 3px 0;
  border-bottom: 1px solid #21262d;
}
.panel li:last-child { border-bottom: none; }
.panel li.rare { color: #d2a8ff; }
/* Diablo haul line: white 0, blue 1, yellow 2–3, orange unique. Mythic stays its own color. */
.panel li.rarity-scrap,
.panel li.rarity-sealed,
.panel li.hue-white {
  color: #ffffff;
  border-left: 4px solid #ffffff;
  padding-left: 8px;
}
.panel li.rarity-brackish,
.panel li.hue-blue {
  color: #4da3ff;
  border-left: 4px solid #4da3ff;
  padding-left: 8px;
}
.panel li.rarity-wake-forged,
.panel li.hue-yellow {
  color: #ffe14a;
  border-left: 4px solid #ffe14a;
  padding-left: 8px;
}
.panel li.rarity-god-salt,
.panel li.hue-orange {
  color: #ff7a18;
  border-left: 4px solid #ff7a18;
  padding-left: 8px;
}
.panel li.rarity-mythic,
.panel li.hue-mythic {
  color: #ff4b8b;
  border-left: 4px solid #ff4b8b;
  padding-left: 8px;
}
.panel li.rarity-plate,
.panel li.hue-plate {
  color: #9fb0c3;
  border-left: 4px solid #9fb0c3;
  padding-left: 8px;
}
/* Set pieces are green even if a white or orange hue class is also present. */
.panel li.rarity-set,
.panel li.hue-green {
  color: #3dff6e;
  border-left: 4px solid #3dff6e;
  padding-left: 8px;
}
/* Tidemark: one tier above orange. Not mythic pink, not set green. */
.panel li.rarity-tidemark,
.panel li.hue-tidemark {
  color: #7ef0ff;
  border-left: 4px solid #7ef0ff;
  padding-left: 8px;
}
.panel .empty { color: #484f58; font-style: italic; }
.muted { color: #8b949e; font-weight: 400; font-size: 0.75rem; text-transform: none; letter-spacing: 0; }

#hud-bottom {
  grid-column: 1 / -1;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#debug-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.dbg-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #d29922;
  letter-spacing: 0.08em;
  margin-right: 4px;
}

button {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
button:hover { background: #30363d; border-color: #8b949e; }
button:active { background: #484f58; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

#help { font-size: 0.75rem; }

#toast-stack {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 420px;
  width: 90%;
}

.toast {
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid #58a6ff;
  color: #e6edf3;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  animation: toast-in 0.25s ease-out;
}
.toast.fade-out { animation: toast-out 0.4s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-8px); }
}

@media (max-width: 800px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }
  #game { grid-column: 1; grid-row: 2; }
  #hud-side { grid-column: 1; grid-row: 3; flex-direction: row; flex-wrap: wrap; }
  #hud-side .panel { flex: 1 1 140px; }
  #hud-bottom { grid-row: 4; }
}

.depth-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.depth-btn {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.depth-btn.active {
  background: #1f6feb;
  border-color: #58a6ff;
  color: #fff;
}
.depth-btn:disabled {
  opacity: 0.45;
}
#depth-hint { margin-top: 2px; line-height: 1.35; }
.vital.depth span { color: #58a6ff; }

/* Urgency / froth when IN_WARN or Venture low */
#zone-label.urgent {
  color: #d29922;
  font-weight: 700;
}
#venture-label.urgent {
  color: #ff7b72;
  font-weight: 700;
  animation: venture-pulse 0.9s ease-in-out infinite;
}
#landmark-label {
  color: #e3b341;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.03em;
}
@keyframes venture-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
body.tide-warn #clock-panel {
  box-shadow: 0 0 0 2px rgba(210, 153, 34, 0.55);
  border-radius: 8px;
}
body.tide-flood #clock-panel {
  box-shadow: 0 0 0 2px rgba(218, 54, 51, 0.7);
  border-radius: 8px;
}
body.tide-warn #hud-top {
  border-color: #d29922;
}
body.tide-flood #hud-top {
  border-color: #da3633;
}

/* Tide return / shelter hold (core-loop) */
.pill.shelter {
  background: #9e6a03;
  color: #fff;
}
body.tide-shelter #clock-panel {
  box-shadow: 0 0 0 2px rgba(227, 179, 65, 0.7);
  border-radius: 8px;
}
body.tide-shelter #hud-top {
  border-color: #e3b341;
}

#shelter-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 9, 0.55);
  pointer-events: auto;
}
#shelter-panel[hidden] {
  display: none !important;
}
.shelter-card {
  background: #161b22;
  border: 2px solid #e3b341;
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 420px;
  width: 92%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
.shelter-card h2 {
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: #e3b341;
  margin-bottom: 8px;
}
.shelter-card > p {
  color: #c9d1d9;
  font-size: 0.9rem;
  margin-bottom: 14px;
  line-height: 1.4;
}
.shelter-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shelter-btn {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
}
.shelter-btn.home {
  background: #238636;
  border-color: #3fb950;
  color: #fff;
}
.shelter-btn.home:hover {
  background: #2ea043;
}
.shelter-btn.deeper {
  background: #9e6a03;
  border-color: #e3b341;
  color: #fff;
}
.shelter-btn.deeper:hover {
  background: #bb8009;
}
.shelter-note {
  margin-top: 12px;
  line-height: 1.35;
}

#account-panel p { margin: 0.25rem 0; font-size: 12px; }
#paragon-board[hidden],
#ascendancy-board[hidden],
#wake-mark-board[hidden] { display: none !important; }
#paragon-points-label,
#ascendancy-points-label,
#wake-mark-points-label { line-height: 1.35; }
#paragon-node-list,
#ascendancy-node-list,
#wake-mark-node-list { list-style: none; margin: 4px 0 0; padding: 0; }
#paragon-node-list li,
#ascendancy-node-list li,
#wake-mark-node-list li { margin: 0 0 4px; }
#paragon-node-list button,
#ascendancy-node-list button,
#wake-mark-node-list button {
  width: 100%;
  text-align: left;
  font-size: 11px;
  line-height: 1.3;
  padding: 4px 6px;
}
#paragon-node-list button.is-locked,
#ascendancy-node-list button.is-locked,
#wake-mark-node-list button.is-locked { opacity: 0.55; }
.tree-branch { margin: 0 0 6px; }
.tree-branch-name {
  margin: 6px 0 2px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b949e;
}
.tree-branch ul { list-style: none; margin: 0; padding: 0; }

#chaos-label { color: #c9a0ff; }


/* Help / Art ref overlay (H) */
#help-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(1, 4, 9, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#help-overlay[hidden] { display: none !important; }
.help-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 16px 18px 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
}
.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.help-head h2 { font-size: 1.1rem; }
.help-cols {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
}
@media (max-width: 720px) {
  .help-cols { grid-template-columns: 1fr; }
}
.help-card h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b949e;
  margin: 8px 0 6px;
}
.help-keys {
  list-style: none;
  font-size: 0.85rem;
  line-height: 1.45;
}
.help-keys li { padding: 2px 0; }
.help-keys kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 1px 6px;
  border: 1px solid #484f58;
  border-radius: 4px;
  background: #21262d;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
}
.art-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.art-gallery a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: #8b949e;
  font-size: 0.7rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 4px;
  overflow: hidden;
}
.art-gallery a:hover { border-color: #58a6ff; color: #e6edf3; }
.art-gallery img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  image-rendering: auto;
  border-radius: 4px;
  background: #010409;
}
#chart-perk-label { margin-top: -2px; margin-bottom: 4px; }
#stall-meta { font-weight: 400; text-transform: none; letter-spacing: 0; }

.rank-badge {
  display: inline-block;
  width: 28px;
  height: 18px;
  object-fit: cover;
  object-position: left center;
  border-radius: 3px;
  border: 1px solid #484f58;
  vertical-align: middle;
  margin-left: 4px;
  image-rendering: auto;
}
.rank-badge[hidden] { display: none !important; }

/* Class picker (text/placeholder thumbs — art still iterating) */
.linkish {
  background: none;
  border: none;
  color: #58a6ff;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0 0 0 6px;
}
.linkish:hover { color: #79c0ff; }

#class-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 9, 0.72);
  padding: 16px;
}
#class-picker-overlay[hidden] { display: none !important; }

.class-picker-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  max-width: 720px;
  width: 100%;
  padding: 16px 18px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.class-picker-card h2 { margin: 0; font-size: 1.15rem; }

.class-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.class-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 10px;
  color: #e6edf3;
  cursor: pointer;
  font: inherit;
}
.class-card:hover:not(.locked) { border-color: #58a6ff; }
.class-card.selected {
  border-color: #3fb950;
  box-shadow: 0 0 0 1px #3fb950;
}
.class-card.locked,
.class-card[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.class-card strong { font-size: 0.95rem; }
.class-card .kit {
  font-size: 0.72rem;
  color: #8b949e;
  margin-top: 4px;
}
.class-thumb {
  width: 100%;
  height: 96px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  border: 1px solid #484f58;
  overflow: hidden;
  background: #010409;
}
.class-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  pointer-events: none;
}
/* Canonical sheet L→R: Nailwright | Salt-Chanter | Wake-Runner */
/* One figure per card: the sheet is 3 figures wide, so size by height and
   slide so that class's figure sits centered. */
.class-thumb { position: relative; overflow: hidden; }
.class-thumb img {
  position: absolute;
  width: auto;
  height: 178%;
  top: -24%;
  left: 50%;
  object-fit: initial;
}
.class-thumb.nailwright img { transform: translateX(-16%); }
.class-thumb.chanter img { transform: translateX(-49%); }
.class-thumb.runner img { transform: translateX(-80%); }
.class-thumb.reliquarist {
  background: linear-gradient(135deg, #2d1f3d, #6e40c9);
  color: #d2a8ff;
}


/* Undertow Lattice overlay */
#lattice-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 9, 0.78);
  padding: 16px;
}
#lattice-overlay[hidden] { display: none !important; }

.lattice-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 16px 18px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.lattice-card h2 { margin: 0; font-size: 1.15rem; color: #79c0ff; }
#lattice-marks { font-weight: 600; margin: 6px 0; color: #d2a8ff; }
#lattice-marks-hud { color: #d2a8ff; font-weight: 600; }

.lattice-art-refs {
  display: flex;
  gap: 8px;
  margin: 8px 0 4px;
  overflow-x: auto;
}
.lattice-art-refs img {
  height: 56px;
  width: auto;
  border-radius: 6px;
  border: 1px solid #30363d;
  object-fit: cover;
  image-rendering: auto;
}

.lattice-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.lattice-region h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b949e;
  margin: 0 0 6px;
}
.lattice-row { display: flex; flex-wrap: wrap; gap: 8px; }

.lattice-node {
  flex: 1 1 140px;
  min-width: 130px;
  max-width: 200px;
  text-align: left;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 10px;
  color: #e6edf3;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lattice-node:hover { border-color: #58a6ff; }
.lattice-node.focused {
  border-color: #e3b341;
  box-shadow: 0 0 0 1px #e3b341;
}
.lattice-node.sunk {
  border-color: #3fb950;
  background: #0d1f14;
}
.lattice-node.kind-undertow.dormant { opacity: 0.55; }
.lattice-node.kind-undertow.awake {
  border-color: #58a6ff;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.25);
  opacity: 1;
}
.lattice-node.kind-hymn { border-style: dashed; }
.lattice-node.kind-lighthouse { border-color: #6cb6c9; }
.lattice-node.locked { opacity: 0.45; }
.lattice-node .lock-tag { font-size: 0.68rem; color: #e3b341; font-weight: 700; }
.lattice-node .nid {
  font-size: 0.68rem;
  color: #8b949e;
  font-family: ui-monospace, monospace;
}
.lattice-node strong { font-size: 0.85rem; }
.lattice-node .eff { font-size: 0.72rem; color: #8b949e; line-height: 1.3; }
.lattice-node .sunk-tag { font-size: 0.68rem; color: #3fb950; font-weight: 700; }
.lattice-node .cost { font-size: 0.68rem; color: #d2a8ff; }

.lattice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #30363d;
}

.class-card.focused {
  border-color: #e3b341;
  box-shadow: 0 0 0 1px #e3b341;
}

/* Hub equip seats — always show the 7 slots; click haul/stash/slot to swap. */
.panel li.equip-slot .equip-slot-name {
  display: inline-block;
  min-width: 3.8em;
  color: #8b949e;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.panel li.inv-clickable {
  cursor: pointer;
}
.panel li.inv-clickable:hover {
  background: #21262d;
}
/* Bag rows: headline, then one muted line per affix (or the base implicit). */
.panel li .inv-name { display: block; }
.panel li.equip-slot .inv-name { display: inline; }
.panel li .inv-sub {
  display: block;
  padding-left: 10px;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #9da7b3;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Action bar (life orb · class kit · haul orb) ──────────────
   Sits UNDER the canvas so it never covers play space. --sig is the class
   fight hue, matching CLASS_FX in game.js. */
#game-wrap {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  align-self: start;
  min-width: 0;
}
#action-bar {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 88px;
  align-items: end;
  gap: 12px;
  margin-top: 6px;
  padding: 8px 12px 8px;
  background:
    linear-gradient(180deg, rgba(58, 46, 30, 0.35), rgba(10, 12, 16, 0) 40%),
    linear-gradient(180deg, #17140f, #0c0d10);
  border: 1px solid #3b3122;
  border-top: 2px solid #5b4a2e;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.06), 0 6px 18px rgba(0, 0, 0, 0.45);
}
.ab-center { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* Orbs */
.orb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 60%, #0b0d12 0%, #050608 70%);
  border: 3px solid #6b5631;
  box-shadow:
    0 0 0 2px #1a140c,
    inset 0 0 14px rgba(0, 0, 0, 0.9),
    0 4px 12px rgba(0, 0, 0, 0.6);
}
.orb-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 100%;
  transition: height 180ms ease-out;
}
.orb-life .orb-fill {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 120, 110, 0.55), rgba(0,0,0,0) 45%),
    linear-gradient(180deg, #c8282b 0%, #8e0f18 55%, #4a060c 100%);
  box-shadow: inset 0 2px 0 rgba(255, 170, 160, 0.55);
}
.orb-haul .orb-fill {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(160, 240, 255, 0.45), rgba(0,0,0,0) 45%),
    linear-gradient(180deg, #2a8fa8 0%, #155a70 55%, #0a2c38 100%);
  box-shadow: inset 0 2px 0 rgba(180, 240, 255, 0.5);
}
.orb-haul.full .orb-fill {
  background: linear-gradient(180deg, #d29922 0%, #8a5a08 60%, #3d2803 100%);
}
.orb-gloss {
  position: absolute;
  left: 16%; top: 8%;
  width: 44%; height: 30%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,0.35), rgba(255,255,255,0) 70%);
  pointer-events: none;
}
.orb-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
}
.orb-cap {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  text-align: center;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 240, 220, 0.75);
  text-shadow: 0 1px 0 #000;
}
.orb-life.low { animation: orb-low 0.9s ease-in-out infinite; }
@keyframes orb-low {
  0%, 100% { box-shadow: 0 0 0 2px #1a140c, inset 0 0 14px rgba(0,0,0,0.9), 0 0 6px rgba(218, 54, 51, 0.4); }
  50% { box-shadow: 0 0 0 2px #1a140c, inset 0 0 14px rgba(0,0,0,0.9), 0 0 18px rgba(255, 60, 50, 0.9); }
}
.orb-life.hit { animation: orb-hit 260ms ease-out; }
@keyframes orb-hit {
  0% { transform: scale(1.06); filter: brightness(1.8); }
  100% { transform: scale(1); filter: none; }
}

/* Level XP strip */
.xp-bar {
  position: relative;
  height: 9px;
  border-radius: 5px;
  background: #0a0b0e;
  border: 1px solid #3b3122;
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #8a6a1c, #e3b341);
  box-shadow: 0 0 8px rgba(227, 179, 65, 0.5);
  transition: width 260ms ease-out;
}
.xp-text {
  position: absolute;
  inset: -2px 0 0 0;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 11px;
  color: #f4e6c4;
  text-shadow: 0 1px 0 #000, 0 0 3px #000;
  letter-spacing: 0.04em;
}

#ability-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 0.8fr);
  gap: 6px;
  align-items: stretch;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  position: relative;
  --sig: 181, 88, 52;
  --deep: 74, 78, 84;
}
#ability-hud[data-cls="salt_chanter"] { --sig: 150, 118, 224; --deep: 36, 26, 58; }
#ability-hud[data-cls="wake_runner"] { --sig: 70, 214, 222; --deep: 24, 92, 98; }

.ab-slot {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 8px 5px 5px;
  background: linear-gradient(180deg, #1b1d22, #101115);
  border: 1px solid rgba(var(--sig), 0.95);
  border-radius: 6px;
  color: #e6edf3;
  transition: border-color 120ms, opacity 120ms, background 120ms;
}
.ab-fill {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 0;
  background: rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid rgba(var(--sig), 0.6);
  pointer-events: none;
  z-index: 2;
}
.ab-key, .ab-text, .ab-cd { position: relative; z-index: 3; }
.ab-key {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 32px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgb(var(--sig)), rgba(var(--sig), 0.7));
  color: #0d1117;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.ab-key small { font-size: 0.52rem; font-weight: 700; opacity: 0.8; margin-top: 2px; }
.ab-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ab-name { font-size: 0.78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-sys { font-size: 0.62rem; color: #8b949e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-cd {
  min-width: 40px;
  text-align: right;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgb(var(--sig));
}

.ab-slot.ready { box-shadow: 0 0 0 1px rgba(var(--sig), 0.35), 0 0 8px rgba(var(--sig), 0.35); }
.ab-slot.active {
  background: rgba(var(--deep), 0.9);
  box-shadow: 0 0 12px rgba(var(--sig), 0.75);
}
.ab-slot.active .ab-cd { color: #fff; }
.ab-slot.cooling { border-color: #30363d; }
.ab-slot.cooling .ab-key { background: #30363d; color: #8b949e; box-shadow: none; }
.ab-slot.cooling .ab-name { color: #8b949e; }
.ab-slot.cooling .ab-cd { color: #e6edf3; font-size: 0.82rem; }
.ab-slot.none { opacity: 0.45; border-color: #30363d; }
.ab-slot.none .ab-key { background: #30363d; color: #8b949e; }
.ab-slot.none .ab-cd { color: #8b949e; }
.ab-slot.pop { animation: ab-pop 320ms ease-out; }
@keyframes ab-pop {
  from { transform: scale(1.06); box-shadow: 0 0 16px rgba(var(--sig), 0.95); }
  to { transform: scale(1); }
}
#ability-hud.idle .ab-slot { opacity: 0.55; box-shadow: none; }
.ab-note {
  display: none;
  position: absolute;
  right: 0;
  top: -26px;
  font-size: 0.65rem;
  color: #e3b341;
  background: rgba(13, 17, 23, 0.9);
  border: 1px solid #9e6a03;
  border-radius: 4px;
  padding: 2px 6px;
}
#ability-hud.board-keys .ab-note { display: block; }
#ability-hud.board-keys .ab-key { background: #30363d; color: #e3b341; }

/* Pixel ability icons (Phase 7): 24px art at integer 2x, cooldown sweep, ready glow, dim, glyph badge */
.ab-icon {
  position: relative; z-index: 3; flex: 0 0 auto;
  width: 48px; height: 48px;
  background-image: url("../art/ui/px/skill-icons.png");
  background-size: 1248px 144px;           /* atlas 624x72 at 2x (26 icons per class row) */
  background-repeat: no-repeat;
  image-rendering: pixelated;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #0a0806, 0 0 0 2px rgba(var(--sig), 0.55);
}
.ab-sweep {
  position: absolute; inset: 0; border-radius: 3px; pointer-events: none;
  background: conic-gradient(rgba(6, 8, 12, 0.72) calc(var(--cd, 0) * 1turn), transparent 0);
}
.ab-cdnum {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font: 800 0.86rem/1 ui-sans-serif, system-ui, sans-serif; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000;
}
.ab-slot.cooling .ab-cdnum, .ab-slot.active .ab-cdnum { display: flex; }
.ab-slot.active .ab-cdnum { color: rgb(var(--sig)); font-size: 0.7rem; }
.ab-glyph { position: absolute; right: -5px; bottom: -5px; display: flex; }
.ab-glyph .g { min-width: 1.15rem; height: 1.15rem; font-size: 0.6rem; box-shadow: 0 0 0 1px #0a0806, inset 0 -2px 0 rgba(0,0,0,0.25); }
.ab-glyph .g.k-kb { background: #e8dcc0; color: #17130d; border-radius: 3px; }
.ab-slot.ready .ab-icon { animation: ab-ready 1.8s ease-in-out infinite; }
@keyframes ab-ready {
  0%, 100% { box-shadow: 0 0 0 1px #0a0806, 0 0 0 2px rgba(var(--sig), 0.7), 0 0 4px rgba(var(--sig), 0.4); }
  50% { box-shadow: 0 0 0 1px #0a0806, 0 0 0 2px rgba(var(--sig), 1), 0 0 10px rgba(var(--sig), 0.85); }
}
.ab-slot.cooling .ab-icon, .ab-slot.none .ab-icon { filter: grayscale(0.7) brightness(0.75); }
.ab-slot.blocked .ab-icon { filter: brightness(0.55) saturate(0.6); }
.ab-slot .ab-fill { display: none; }
#action-bar .ab-slot.cooling .ab-cd, #action-bar .ab-slot.active .ab-cd { display: none; }
.ab-slot.ab-chaos.none .ab-icon::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 8px; margin: -2px 0 0 -5px;
  background: #3a3a40; box-shadow: 0 0 0 1px #0a0806; border-radius: 1px;
}
.ab-slot.ab-chaos.none .ab-icon::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -7px 0 0 -4px;
  border: 1px solid #8b949e; border-bottom: none; border-radius: 3px 3px 0 0; z-index: 1;
}

@media (max-width: 900px) {
  #action-bar { grid-template-columns: 64px minmax(0, 1fr) 64px; gap: 8px; padding: 6px; }
  .orb { width: 62px; height: 62px; }
  #ability-hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ab-sys, .ab-key small { display: none; }
}

/* Hub loop coach + gate readability */
#gate-status {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
#gate-status.leave-open { color: #3fb950; }
#gate-status.leave-sealed { color: #d29922; }
#gate-status.return-sealed { color: #ff7b72; }

.objective-chip {
  flex: 1 1 180px;
  max-width: 420px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #388bfd;
  background: rgba(31, 111, 235, 0.18);
  color: #e6edf3;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.objective-chip.soft {
  border-color: #30363d;
  background: rgba(48, 54, 61, 0.45);
  color: #8b949e;
  font-weight: 550;
}

#paragon-board.board-pulse,
#ascendancy-board.board-pulse,
#wake-mark-board.board-pulse {
  outline: 2px solid #e3b341;
  outline-offset: 2px;
  border-radius: 6px;
  animation: board-pulse 0.7s ease-in-out 3;
  background: rgba(227, 179, 65, 0.08);
}
@keyframes board-pulse {
  0%, 100% { outline-color: #e3b341; background: rgba(227, 179, 65, 0.08); }
  50% { outline-color: #f0c674; background: rgba(227, 179, 65, 0.2); }
}

/* Canvas cursors: gold arrow to move, red blade over a foe, hand over loot. */
#game { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M2 2 L2 19 L7 14 L11 22 L14 21 L10 13 L17 13 Z' fill='%23e9c97a' stroke='%23140d05' stroke-width='1.5' stroke-linejoin='round'/></svg>") 2 2, default; }
#game[data-cursor="attack"] { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M3 3 L14 14 M14 14 L12 18 L18 12 Z M3 3 L6 3 L16 13 L13 16 L3 6 Z' fill='%23ff6a4a' stroke='%23140d05' stroke-width='1.5' stroke-linejoin='round'/><path d='M15 15 L21 21' stroke='%23140d05' stroke-width='3'/><path d='M15 15 L21 21' stroke='%23c9a46a' stroke-width='1.5'/></svg>") 3 3, crosshair; }
#game[data-cursor="loot"] { cursor: pointer; }

/* ══ Polish pass 2026-10-10: shared panel language, toasts, loot feed, tooltips ══ */
:root {
  --sw-ink: #0b0c0f;
  --sw-panel: #14151a;
  --sw-panel-2: #1b1c22;
  --sw-edge: #3a3226;
  --sw-edge-hi: #6b5631;
  --sw-gold: #d9b56a;
  --sw-text: #e9e4d8;
  --sw-muted: #9a9384;
  --hue-white: #e8e6e1;
  --hue-blue: #4da3ff;
  --hue-yellow: #ffe14a;
  --hue-orange: #ff7a18;
  --hue-green: #3dff6e;
  --hue-mythic: #ff4b8b;
  --hue-tidemark: #7ef0ff;
  --hue-plate: #9fb0c3;
}
body {
  background: radial-gradient(ellipse at 50% -10%, #1c1a16 0%, #0a0b0d 60%) fixed, #0a0b0d;
  color: var(--sw-text);
  font-size: 14px;
}
#app { max-width: 1480px; grid-template-columns: minmax(0, 1fr) 280px; }
#hud-top, #hud-bottom, .panel {
  background: linear-gradient(180deg, var(--sw-panel-2), var(--sw-panel));
  border: 1px solid var(--sw-edge);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.05), 0 4px 14px rgba(0, 0, 0, 0.35);
}
#hud-top { flex-wrap: nowrap; gap: 14px; min-width: 0; }
#clock-panel { flex: 0 0 auto; min-width: 0; }
#gate-status { overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
#zone-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sw-muted); }
#vitals { flex: 0 0 auto; }
.panel h3, .help-head h2, .shelter-card h2 {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  color: var(--sw-gold);
  letter-spacing: 0.08em;
}
.panel h3 { font-size: 0.82rem; font-weight: 700; border-bottom: 1px solid rgba(217, 181, 106, 0.18); padding-bottom: 4px; margin-bottom: 6px; }
.panel h3 .muted { font-family: ui-sans-serif, system-ui, sans-serif; letter-spacing: 0; }
.muted { color: var(--sw-muted); }
.panel ul { font-size: 0.86rem; }
.panel li { border-bottom: 1px solid rgba(255, 255, 255, 0.04); transition: background 100ms, box-shadow 100ms; border-radius: 3px; }
.panel li .inv-name { font-weight: 650; }
.panel li .inv-sub { display: block; font-size: 0.74rem; color: #b8b2a3; font-weight: 400; padding-left: 2px; }
.panel li.inv-clickable { cursor: pointer; }
.panel li.inv-clickable:hover, .panel li[data-tip-bag]:hover { background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px rgba(217, 181, 106, 0.25); }
.panel li.equip-slot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.panel li.equip-slot .equip-slot-name { flex: 0 0 52px; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sw-muted); }
.panel li.equip-slot .inv-sub { flex-basis: 100%; padding-left: 58px; }
.panel li.equip-slot.empty { color: #4d4a43; }
button {
  background: linear-gradient(180deg, #24252c, #1a1b20);
  border: 1px solid #3a3530;
  color: var(--sw-text);
  transition: border-color 100ms, background 100ms, transform 60ms;
}
button:hover { background: linear-gradient(180deg, #2e2f37, #22232a); border-color: var(--sw-edge-hi); }
button:active { transform: translateY(1px); }
.depth-btn.active { background: linear-gradient(180deg, #2b5aa8, #1f4588); border-color: #6fa8ff; }

/* Toasts: over the top of the play view, max 3, compact */
#toast-stack {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  width: min(560px, 80%);
  max-width: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  background: linear-gradient(180deg, rgba(24, 22, 18, 0.92), rgba(12, 12, 14, 0.92));
  border: 1px solid rgba(217, 181, 106, 0.45);
  border-radius: 6px;
  color: #f1ead8;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 #000;
  animation: toast-in 0.18s ease-out;
}
.toast-count { color: var(--sw-gold); font-size: 0.75rem; }
.toast.bump { animation: toast-bump 0.2s ease-out; }
.toast.fade-out { animation: toast-out 0.3s ease-in forwards; }
@keyframes toast-bump { from { transform: scale(1.06); } to { transform: scale(1); } }

/* Loot feed: bottom-left of the play view */
#loot-feed {
  position: absolute;
  left: 10px;
  bottom: 118px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  max-width: 46%;
}
.loot-feed-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: rgba(8, 8, 10, 0.78);
  border-left: 3px solid currentColor;
  padding: 3px 10px 3px 8px;
  border-radius: 0 4px 4px 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-shadow: 0 1px 0 #000;
  animation: lf-in 0.22s ease-out;
  transition: opacity 0.5s;
}
.loot-feed-row .lf-meta { font-size: 0.66rem; color: var(--sw-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.loot-feed-row.fade { opacity: 0; }
@keyframes lf-in { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.hue-white { color: var(--hue-white); }
.hue-blue { color: var(--hue-blue); }
.hue-yellow { color: var(--hue-yellow); }
.hue-orange { color: var(--hue-orange); }
.hue-green { color: var(--hue-green); }
.hue-mythic { color: var(--hue-mythic); }
.hue-tidemark { color: var(--hue-tidemark); }
.hue-plate { color: var(--hue-plate); }
.hue-currency { color: #e8cf96; }
.hue-chart { color: #a8f0c8; }

/* Item tooltip */
#item-tip {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}
#item-tip[hidden] { display: none; }
.tip-card, .tip-compare, .tip-hint {
  background: linear-gradient(180deg, rgba(20, 18, 15, 0.97), rgba(9, 9, 11, 0.97));
  border: 1px solid #4a4030;
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
}
.tip-card { border-top: 3px solid currentColor; }
.tip-name { font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-size: 1.02rem; font-weight: 700; line-height: 1.2; }
.tip-sub { color: var(--sw-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.tip-trade { color: #c9c2b0; font-size: 0.75rem; margin-top: 2px; }
.tip-implicit { color: #c9c2b0; font-style: italic; margin-top: 6px; padding-bottom: 5px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.tip-affixes { list-style: none; margin: 6px 0 0; padding: 0; color: #8fb4ff; }
.tip-affixes li { padding: 1px 0; border: none !important; }
.tip-blurb { color: #e3c98a; margin-top: 6px; font-style: italic; }
.tip-note { color: #d29922; margin-top: 6px; font-size: 0.76rem; }
.tip-foot { color: #6f6a5f; margin-top: 6px; font-size: 0.7rem; }
.tip-heading { color: var(--sw-muted); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.tip-delta { font-weight: 700; font-size: 0.8rem; }
.tip-delta.up { color: #4ee07a; }
.tip-delta.down { color: #ff6b5e; }
.tip-delta.same { color: #8b8578; font-weight: 500; }
.tip-hint { color: var(--sw-gold); font-size: 0.72rem; padding: 4px 10px; text-align: center; }

/* Banner: compact, inside the header row */
#msg-banner {
  position: absolute;
  left: 50%;
  top: 23%;
  transform: translateX(-50%);
  z-index: 7;
  padding: 8px 18px;
  width: auto;
  max-width: min(720px, 70vw);
  background: linear-gradient(180deg, rgba(40, 30, 18, 0.95), rgba(18, 14, 10, 0.95));
  border: 1px solid var(--sw-edge-hi);
  color: #f6e3b4;
  text-align: center;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
#hud-top { position: relative; }
.hue-cacheFore { color: #56d6de; }
.hue-cacheMid { color: #b084ff; }

/* Controller focus on inventory rows (D-pad in the hub). */
#equipped-list li.pad-focus,
#haul-list li.pad-focus,
#stash-list li.pad-focus {
  outline: 2px solid #e9c97a;
  outline-offset: -2px;
  background: rgba(233, 201, 122, 0.12);
  box-shadow: 0 0 10px rgba(233, 201, 122, 0.25);
}
#msg-banner .bn-title { font-size: 1.02rem; color: #f6e3b4; }
#msg-banner .bn-sub {
  margin-top: 3px;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 0.78rem;
  color: #cdbf9c;
  letter-spacing: 0.01em;
}
#msg-banner .bn-sub + .bn-sub { color: #e9c97a; }
#stall-list li.pad-focus,
button.pad-focus {
  outline: 2px solid #e9c97a;
  outline-offset: 1px;
  box-shadow: 0 0 10px rgba(233, 201, 122, 0.35);
}
#stall-list li.pad-focus { outline-offset: -2px; background: rgba(233, 201, 122, 0.12); }
/* pressed while cooling: short red shake instead of a toast */
.ab-slot.deny .ab-icon { animation: abDeny 0.3s steps(6) 1; box-shadow: 0 0 0 2px rgba(220, 70, 60, 0.85); }
@keyframes abDeny { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }

/* Phase 11: slot 4 (signature) and a damage-type pip on every typed slot */
.ab-slot.ab-sig { box-shadow: inset 0 0 0 1px rgba(233, 201, 122, 0.35); }
.ab-slot[data-type]:not([data-type=""]) .ab-icon::after { content: ""; position: absolute; left: 2px; top: 2px; z-index: 4; width: 6px; height: 6px; box-shadow: 0 0 0 1px #08060a; image-rendering: pixelated; }
.ab-slot[data-type="salt"] .ab-icon::after { background: #f6e8c4; }
.ab-slot[data-type="brine"] .ab-icon::after { background: #60e2ec; }
.ab-slot[data-type="frost"] .ab-icon::after { background: #bee8ff; }
.ab-slot[data-type="rot"] .ab-icon::after { background: #96cd4a; }
.ab-slot[data-type="storm"] .ab-icon::after { background: #ffe36a; }

/* P13 tooltips: the shared explain card (js/explain.js), salt-crust pixel frame like the Lattice panel */
.tip-card.xp-card { color: #e9c97a; border: 8px solid transparent; border-image: url("../art/ui/px/frame-saltcrust.png") 8 round; image-rendering: pixelated; border-radius: 0; background: #11100d; padding: 6px 8px; }
.xp-card .tip-kind { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: #a9a08c; }
.xp-card .tip-name { color: #f1e6c8; margin: 1px 0 4px; }
.xp-line { margin: 3px 0 0; color: #ddd4bf; line-height: 1.35; }
.xp-line + .xp-line { color: #a6ece8; }
.xp-detail { margin-top: 6px; padding-top: 5px; border-top: 1px solid #2c271e; color: #b8ae96; font-size: 0.76rem; }
.xp-detail p { margin: 2px 0; }
.xp-aff { color: #a6ece8; font-size: 0.74rem; }
.xp-hint { font-size: 0.7rem; }
.srow[data-explain] { cursor: help; }
.srow.nav-focus { outline: 2px solid var(--sw-gold, #e9c97a); outline-offset: 1px; }
.skd-explain { margin: 0.4rem 0; padding: 0.35rem 0.5rem; border-left: 3px solid var(--ty, #e8e6e1); background: rgba(255,255,255,0.03); font-size: 0.82rem; color: #ddd4bf; }
.skd-explain p { margin: 2px 0; }
.tm-head[data-explain] { cursor: help; }

/* P13 tide timer: last-30s countdown + "The tide took you" */
#tide-final { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 120; pointer-events: none; text-align: center;
  padding: 6px 18px 8px; border: 8px solid transparent; border-image: url("../art/ui/px/frame-saltcrust.png") 8 round; image-rendering: pixelated;
  background: rgba(8, 28, 44, 0.86); color: #d6f0ec; animation: tf-pulse 1s steps(2) infinite; }
#tide-final[hidden] { display: none; }
#tide-final .tf-head { font: 700 0.85rem Georgia, serif; letter-spacing: 0.22em; color: #9fe3f0; }
#tide-final .tf-time { font: 700 2.4rem "Courier New", monospace; color: #ffffff; text-shadow: 2px 2px 0 #0b2a3e; line-height: 1.05; }
#tide-final .tf-sub { font-size: 0.78rem; color: #e9c97a; }
#tide-final.tf-last { background: rgba(70, 14, 18, 0.9); }
#tide-final.tf-last .tf-time { color: #ff8a7a; }
@keyframes tf-pulse { 50% { filter: brightness(1.35); } }
body.tide-final #venture-label { color: #ff8a7a; font-weight: 700; }
.tide-death { max-width: 560px; margin: 14vh auto 0; padding: 22px 28px; text-align: center; border: 8px solid transparent;
  border-image: url("../art/ui/px/frame-saltcrust.png") 8 round; image-rendering: pixelated; background: #0b1a24; color: #d6e4e2; }
.tide-death h2 { font: 700 2rem Georgia, serif; color: #9fe3f0; margin: 6px 0 12px; letter-spacing: 0.04em; }
.tide-death .td-lost { color: #ff9b8a; font-weight: 600; }
.tide-death .td-kept { color: #e9c97a; }
.tide-death .td-wave { height: 12px; background: repeating-linear-gradient(90deg, #d6f0ec 0 8px, #46a0b4 8px 16px); image-rendering: pixelated; }
.tide-death p { margin: 6px 0; line-height: 1.35; }
.tide-death .td-tip { font-size: 0.8rem; }
.tide-death .confirm-row { margin-top: 16px; position: static; }

/* ── P14 HUD: Wake Flare, world events, shrine buffs, flare stock, den prompts ── */
#p14-hud { position: fixed; inset: 0; pointer-events: none; z-index: 110; image-rendering: pixelated; }
#p14-hud [hidden] { display: none !important; }
.p14-flare { position: absolute; top: 150px; left: 50%; transform: translateX(-50%); min-width: 230px; padding: 5px 14px 7px; text-align: center;
  border: 8px solid transparent; border-image: url("../art/ui/px/frame-driftwood.png") 8 round; background: rgba(40, 18, 8, 0.86); color: #ffe2b8; }
.p14-flare-top { display: flex; align-items: center; justify-content: center; gap: 8px; font: 700 0.8rem Georgia, serif; letter-spacing: 0.18em; }
.p14-flare-top img { width: 18px; height: 18px; image-rendering: pixelated; }
.p14-flare-t { font: 700 1.25rem "Courier New", monospace; color: #fff; text-shadow: 2px 2px 0 #3a1408; letter-spacing: 0; }
.p14-hp { height: 8px; margin: 4px 0 3px; background: #2a0c06; border: 1px solid #07060a; }
.p14-hp i { display: block; height: 100%; width: 100%; background: linear-gradient(#ffc070, #ff8a2a 60%, #c85018); }
.p14-flare.low .p14-hp i { background: linear-gradient(#ff8a7a, #e0302a); animation: tf-pulse 0.5s steps(2) infinite; }
.p14-flare small { font-size: 0.68rem; color: #e9c97a; }
.p14-event { position: absolute; top: 214px; right: 14px; width: 236px; padding: 6px 10px 8px; pointer-events: auto;
  border: 8px solid transparent; border-image: url("../art/ui/px/frame-saltcrust.png") 8 round; background: rgba(8, 22, 30, 0.86); color: #d6e4e2; font-size: 0.74rem; }
.p14-event b { display: block; font: 700 0.86rem Georgia, serif; letter-spacing: 0.06em; }
.p14-ev-goal { display: block; margin: 2px 0 4px; color: #b8c8c4; }
.p14-ev-bar { height: 6px; background: #0b1a24; border: 1px solid #07060a; }
.p14-ev-bar i { display: block; height: 100%; width: 0; background: linear-gradient(#9fe3f0, #4aa8b8); }
.p14-ev-note { display: block; margin-top: 3px; color: #e9c97a; }
.p14-buffs { position: absolute; bottom: 132px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: auto; }
.p14-buff { position: relative; width: 44px; height: 54px; text-align: center; color: #f4f0e2; font: 700 0.62rem ui-monospace, monospace; }
.p14-buff .ic { display: block; width: 40px; height: 40px; margin: 0 auto; border-radius: 50%; background-color: #10141a; background-repeat: no-repeat;
  background-size: 32px 60px; background-position: 4px -6px; box-shadow: 0 0 0 2px #07060a, 0 0 0 4px var(--c, #fff);
  -webkit-mask: none; position: relative; }
.p14-buff .ic::after { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(transparent 0 calc(360deg - var(--p, 360deg)), rgba(7, 6, 10, 0.72) 0); }
.p14-buff .tm { position: absolute; left: 0; right: 0; top: 26px; text-shadow: 1px 1px 0 #07060a, -1px -1px 0 #07060a; }
.p14-buff .nm { display: block; margin-top: 2px; font-size: 0.56rem; color: var(--c, #fff); text-shadow: 1px 1px 0 #07060a; }
.p14-buff.ending .ic { animation: tf-pulse 0.4s steps(2) infinite; }
.p14-stock { position: absolute; bottom: 132px; left: 18px; display: flex; align-items: center; gap: 6px; padding: 3px 8px; pointer-events: auto;
  border: 6px solid transparent; border-image: url("../art/ui/px/frame-driftwood.png") 8 round; background: rgba(28, 16, 8, 0.82); color: #ffe2b8; font: 700 0.78rem ui-monospace, monospace; }
.p14-stock img { width: 18px; height: 18px; image-rendering: pixelated; }
.p14-stock .k { font-weight: 400; color: #c8b48a; font-size: 0.66rem; }
.p14-stock.none { filter: grayscale(0.8) brightness(0.8); }
.p14-prompt { position: absolute; bottom: 30%; left: 50%; transform: translateX(-50%); padding: 5px 14px; border: 6px solid transparent;
  border-image: url("../art/ui/px/frame-saltcrust.png") 8 round; background: rgba(12, 10, 20, 0.88); color: #e8dcff; font: 700 0.86rem Georgia, serif; letter-spacing: 0.04em; }
