/* ==========================================================================
   Action bar (hotbar.js): docked along the bottom of the battle map.
   Icons: game-icons.net (CC BY 3.0), drawn as masks so they take the text colour.
   ========================================================================== */

.hotbar {
  --hb-bg: rgba(18, 16, 15, 0.88);
  --hb-btn: rgba(46, 44, 41, 0.94);
  --hb-btn-hover: rgba(70, 64, 58, 0.96);
  --hb-line: rgba(232, 228, 223, 0.12);
  --hb-gold: var(--accent, #d97706);
  --hb-action: #2cb67d;
  --hb-bonus: #e0a43a;
  --hb-reaction: #7c9cf6;
  --hb-sz: 42px;                       /* [map] fix3 #32: BG3-style square buttons */
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  z-index: 40;
  background: var(--hb-bg);
  border: 1px solid var(--hb-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text, #e8e4df);
  font-size: 12px;
  padding: 4px 6px 5px;
}
.hotbar[hidden] { display: none; }

.hb-counters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 2px 3px;
  border-bottom: 1px solid var(--hb-line);
  font-size: 11.5px;
  min-height: 22px;
}
.hb-who { display: flex; align-items: baseline; gap: 6px; margin-right: 4px; }
.hb-who strong { font-size: 13px; }
.hb-mode { color: var(--text-muted, #908a84); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.hb-pip { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted, #908a84); }
.hb-pip i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; display: inline-block; }
.hb-pip.on { color: var(--text, #e8e4df); }
.hb-pip.spent { text-decoration: line-through; text-decoration-thickness: 1px; }
.hb-pip-action.on i { background: var(--hb-action); border-color: var(--hb-action); }
.hb-pip-bonus.on i { background: var(--hb-bonus); border-color: var(--hb-bonus); transform: rotate(45deg); border-radius: 2px; }
.hb-pip-reaction.on i { background: var(--hb-reaction); border-color: var(--hb-reaction); }
.hb-move { color: var(--text-secondary, #b8b2ac); white-space: nowrap; }
#hotbar .hb-prompt-badge {
  background: rgba(217, 119, 6, 0.22);
  border: 1px solid var(--hb-gold);
  color: #ffd08a;
  border-radius: 999px;
  padding: 2px 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  animation: hb-pulse 1.6s ease-in-out infinite;
}
@keyframes hb-pulse { 50% { box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.25); } }
#hotbar .hb-prompt-badge.hb-prompt-new { background: var(--hb-gold); color: #1a1208; animation: hb-new 0.5s ease-in-out 8; }
@keyframes hb-new { 50% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.45); } }
.hb-flash { outline: 2px solid var(--accent, #d97706); outline-offset: 2px; transition: outline 0.3s; }
#hotbar .hb-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--hb-line);
  color: var(--text, #e8e4df);
  border-radius: 6px;
  width: 28px;
  height: 22px;
  cursor: pointer;
  padding: 0;
}

/* [map] fix3 #32: groups side by side, scrolling sideways; each group a grid of square buttons, two rows on your
   turn (filled column by column), one row otherwise (.hb-onerow) */
.hb-rows {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  padding-top: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.hotbar.hb-collapsed .hb-rows { display: none; }
.hb-group { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; }
.hb-group + .hb-group { border-left: 1px solid var(--hb-line); margin-left: 6px; padding-left: 6px; }
.hb-group-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 9.5px; line-height: 12px; height: 12px; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted, #908a84);
}
.hb-buttons {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, var(--hb-sz));
  grid-auto-columns: var(--hb-sz);
  gap: 3px;
}
.hotbar.hb-onerow .hb-buttons { grid-template-rows: var(--hb-sz); }
.hb-slotpips { display: inline-flex; gap: 4px; }
.hb-slot { display: inline-flex; align-items: center; gap: 2px; }
.hb-slot i { width: 6px; height: 6px; border-radius: 1px; border: 1px solid var(--hb-gold); display: inline-block; transform: rotate(45deg); }
.hb-slot i.full { background: var(--hb-gold); }
.hb-pact i { border-color: #b07cf6; }
.hb-pact i.full { background: #b07cf6; }

#hotbar .hb-btn {               /* #hotbar: beats base.css's unstyled-button fallback (fix3 #32) */
  position: relative;
  width: var(--hb-sz);
  height: var(--hb-sz);
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 3px 2px 2px;
  background: var(--hb-btn);
  border: 1px solid var(--hb-line);
  border-radius: 6px;
  color: var(--text, #e8e4df);
  cursor: pointer;
  font: inherit;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
#hotbar .hb-btn:hover, #hotbar .hb-btn:focus-visible { background: var(--hb-btn-hover); border-color: var(--hb-gold); outline: none; }
.hb-btn:active { transform: translateY(1px); }
.hb-group-action .hb-btn { box-shadow: inset 0 -2px 0 var(--hb-action); }
.hb-group-bonus .hb-btn { box-shadow: inset 0 -2px 0 var(--hb-bonus); }
.hb-group-reaction .hb-btn { box-shadow: inset 0 -2px 0 var(--hb-reaction); }
.hb-group-spell .hb-btn { box-shadow: inset 0 -2px 0 var(--hb-gold); }
.hb-group-item .hb-btn { box-shadow: inset 0 -2px 0 #b07cf6; }
/* Unavailable: grey icon, struck background, dim text; the reason is in the card */
#hotbar .hb-btn.disabled {
  cursor: not-allowed;
  color: var(--text-muted, #908a84);
  background: repeating-linear-gradient(135deg, rgba(30, 28, 26, 0.92) 0 5px, rgba(40, 37, 34, 0.92) 5px 10px);
  box-shadow: none !important;
  border-style: dashed;
}
.hb-btn.disabled .hb-icon { opacity: 0.35; }
.hb-btn.disabled .hb-label { opacity: 0.6; }
.hb-btn.disabled::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border: 1.5px solid #ff8a8a;
  border-radius: 50%;
  background: linear-gradient(45deg, transparent 43%, #ff8a8a 43% 57%, transparent 57%);
}
#hotbar .hb-btn.disabled:hover { border-color: #ff8a8a; }
#hotbar .hb-btn.approval { border-style: dashed; border-color: var(--hb-gold); }
.hb-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  flex: 0 0 auto;
}
/* A short label: one line, cut with an ellipsis; the full name is in the card and aria-label */
.hb-label {
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
}
.hb-cost { display: none; }          /* in the card */
.hb-btn kbd {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 8.5px;
  line-height: 1;
  padding: 1px 2px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text-secondary, #b8b2ac);
  font-family: inherit;
}
/* Class resources: a count tile per resource */
.hb-res {
  width: var(--hb-sz);
  height: var(--hb-sz);
  box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid var(--hb-line); border-radius: 6px;
  background: rgba(30, 28, 26, 0.6);
  color: var(--text-secondary, #b8b2ac);
}
.hb-res b { color: var(--text, #e8e4df); font-size: 12px; }
.hb-res.empty b { color: #ff8a8a; }

.hb-flyout {
  position: fixed;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, var(--hb-sz));
  gap: 4px;
  padding: 8px;
  background: rgba(20, 18, 17, 0.97);
  border: 1px solid var(--hb-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.hb-flyout[hidden] { display: none; }
#hotbar .hb-fly-btn.open { border-color: var(--hb-gold); background: var(--hb-btn-hover); }
.hb-tip, .hb-picker {
  position: fixed;              /* placed by hotbar.js: above the bar, beside the button, inside the viewport */
  min-width: 200px;
  max-width: 280px;
  background: rgba(20, 18, 17, 0.97);
  border: 1px solid var(--hb-line);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 5;
}
.hb-tip { pointer-events: none; }
.hb-tip[hidden], .hb-picker[hidden], .hb-targetbar[hidden] { display: none; }
.hb-tip-title { font-weight: 700; font-size: 13px; }
.hb-tip-cost { color: var(--hb-gold); font-size: 11px; margin-bottom: 4px; }
.hb-tip-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; }
.hb-tip-row span { color: var(--text-muted, #908a84); }
.hb-tip-reason { margin-top: 6px; color: #ff8a8a; font-weight: 600; font-size: 11.5px; }
.hb-tip-reason.note { color: var(--hb-gold); }
.hb-pick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.hb-pick-row > span { color: var(--text-muted, #908a84); margin-right: 4px; }
#hotbar .hb-chip {
  background: var(--hb-btn);
  border: 1px solid var(--hb-line);
  color: var(--text, #e8e4df);
  border-radius: 999px;
  padding: 2px 9px;
  font: inherit;
  cursor: pointer;
}
#hotbar .hb-chip.on { border-color: var(--hb-gold); background: rgba(217, 119, 6, 0.25); }
.hb-check { display: inline-flex; align-items: center; gap: 3px; }

.hb-targetbar {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
  background: rgba(20, 18, 17, 0.95);
  border: 1px solid var(--hb-gold);
  border-radius: 8px;
  padding: 6px 10px;
}
.hb-tgt-title { font-weight: 600; }

.hb-target-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  cursor: crosshair;
  user-select: none;          /* fix2 combat C23: a drag pans, it doesn't select page text */
  -webkit-user-select: none;
}
.hb-target-overlay[hidden] { display: none; }
.hb-ring { position: absolute; inset: 0; pointer-events: none; }
.hb-ring-circle { fill: rgba(217, 119, 6, 0.08); stroke: var(--accent, #d97706); stroke-width: 2; stroke-dasharray: 6 5; }
.hb-ring-pick { fill: rgba(239, 69, 101, 0.18); stroke: #ef4565; stroke-width: 2; }
.hb-ring-n { fill: #fff; font: 700 12px sans-serif; paint-order: stroke; stroke: #000; stroke-width: 3px; }

/* phone: icons only (the name is in the card and aria-label) */
@media (max-width: 640px) {
  .hotbar { max-width: calc(100% - 12px); bottom: 6px; padding: 3px 4px 4px; }
  .hb-counters { gap: 6px; font-size: 11px; }
  .hb-label, .hb-btn kbd { display: none; }
}

/* Detected creatures (Divine Sense): drawn for the sensing player only */
.hb-detect-layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.hb-detect-mark { fill: rgba(176, 124, 246, 0.25); stroke: #b07cf6; stroke-width: 2; stroke-dasharray: 4 3; }
.hb-detect-ring { fill: rgba(176, 124, 246, 0.06); stroke: #b07cf6; stroke-width: 1.5; stroke-dasharray: 6 5; }
.hb-detect-text { fill: #e6d8ff; font: 600 11px sans-serif; text-anchor: middle; paint-order: stroke; stroke: #000; stroke-width: 3px; }
/* [map] fix3 #28: Detect Magic labels: small, under the square */
.hb-aura-mark { fill: rgba(176, 124, 246, 0.12); stroke-width: 1.5; }
.hb-aura-text { font: 600 9.5px sans-serif; }
.hb-tip-key { margin-left: 6px; font-size: 10px; padding: 0 4px; border: 1px solid var(--hb-line); border-radius: 3px; color: var(--text-secondary, #b8b2ac); }

/* fix2 combat C23: the bar folds while choosing targets (rows and counters hidden), so low tokens can be clicked */
.hotbar .hb-rows[hidden], .hotbar .hb-counters[hidden] { display: none !important; }
.hotbar.hb-targeting { z-index: 42; top: 8px; bottom: auto; background: transparent; border-color: transparent; box-shadow: none; padding: 0; }
.hotbar.hb-targeting .hb-targetbar { position: static; transform: none; }

/* [noclassic] the targeting strip's "or pick a target" list, the DM's roll mode / Override, Telepathy */
.hb-target-list, .hb-dm-roll { max-width: 180px; font-size: 12px; padding: 2px 4px; background: var(--bg-input, #1d1a17);
  color: var(--text, #eee); border: 1px solid var(--border, #555); border-radius: 4px; }
.hb-dm-override-lbl { font-size: 12px; white-space: nowrap; }
.hb-link { font-size: 11px; }
