/* ==========================================================================
   Mapwright Design System — HUD & Floating Overlays
   ========================================================================== */

/* Top Navigation Bar — Floating Capsule */
.top {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 6px 12px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-panel, 10px);
  box-shadow: var(--hud-shadow);
  max-width: calc(100vw - 420px);
}

.grow {
  flex: 1;
}

.status {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
}

#status::before {
  content: "● ";
  color: #2ecc71;
  text-shadow: 0 0 6px rgba(46, 204, 113, 0.7);
  font-size: 10px;
  margin-right: 4px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brass);
}

/* Floating HUD Overlays */
.ov {
  position: absolute;
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}

.ov > * {
  pointer-events: auto;
}

.ov.tc {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--brass);
  color: var(--brass-bright);
  padding: 5px 14px;
  border-radius: var(--r-item, 7px);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--hud-shadow);
}

.ov.tl {
  top: 12px;
  left: 76px;
  max-width: min(440px, calc(100% - 460px));
  font-size: 12.5px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px 8px 6px 11px;
  border-radius: 8px;
  align-items: flex-start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ov.tl button {
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  color: var(--muted);
}

/* Baldur's Gate 3 / Obsidian & Eldritch Brass Initiative Strip */
.init-strip {
  position: fixed;
  top: 12px;
  left: auto;
  right: 76px;
  transform: none;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(680px, calc(100vw - 520px));
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--r-panel, 10px);
  padding: 5px 8px;
  box-shadow: var(--hud-shadow);
  pointer-events: auto;
  user-select: none;
  transition: right 0.22s ease, opacity 0.2s ease;
}

.init-round {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--r-item, 7px);
  background: var(--panel2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--brass);
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.init-list {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px 2px;
  max-width: 600px;
}

.init-list::-webkit-scrollbar {
  display: none;
}

/* Portrait Card in the Initiative Strip */
.init-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 5px 4px;
  border-radius: var(--r-item, 8px);
  background: var(--panel2);
  border: 1px solid var(--line-subtle);
  color: var(--fg);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.init-chip:hover {
  border-color: var(--brass);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.init-chip.active-turn {
  background: color-mix(in srgb, var(--brass) 18%, var(--panel2));
  border: 1.5px solid var(--brass);
  color: var(--brass-bright);
  font-weight: 700;
  box-shadow: 0 0 16px var(--brass-glow), 0 4px 14px rgba(0, 0, 0, 0.55);
  transform: translateY(3px);
  z-index: 2;
}

.init-chip.down {
  opacity: 0.55;
  filter: grayscale(0.8);
}

.init-portrait-frame {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.6);
}

.init-chip.active-turn .init-portrait-frame {
  width: 46px;
  height: 46px;
  border-color: var(--brass);
  box-shadow: 0 0 12px var(--brass-glow);
}

.init-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.init-avatar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.init-val-badge {
  position: absolute;
  top: 1px;
  left: 1px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  color: var(--brass-bright);
  background: color-mix(in srgb, var(--canvas) 90%, #000);
  border: 1px solid var(--brass);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.init-down-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 6, 6, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: inherit;
  pointer-events: none;
}

.init-chip-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.init-name {
  font-size: 10px;
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.init-chip.active-turn .init-name {
  max-width: 64px;
  font-size: 10.5px;
}

.init-hp-bar {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 1px;
}

.init-hp-bar i {
  display: block;
  height: 100%;
  transition: width 0.25s ease;
}

.init-hp-bar i.hp-high { background: #10b981; }
.init-hp-bar i.hp-mid  { background: #facc15; }
.init-hp-bar i.hp-low  { background: #ef4444; }

.init-econ-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.init-econ-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
}

.init-econ-dot.act { background: #4ade80; }
.init-econ-dot.bon { background: #facc15; }
.init-econ-dot.react { background: #c084fc; }
.init-econ-dot.spent {
  opacity: 0.25;
  background: #64748b !important;
  box-shadow: none;
}

.init-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.init-strip[hidden] { display: none !important; }

/* Bottom-Left Unified HUD Dock */
.hud-bottom-left {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100% - 240px);
}

.hud-pad-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: auto;
}

#hud-pad-box, #coords, #hint {
  display: none !important;
}

.hud-bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hud-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}

.hud-pill.hint {
  color: var(--muted);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-pill.hint:empty {
  display: none;
}


/* Shift strip to the left when side panel is open */
.app.sideopen .init-strip {
  right: 418px;
  max-width: min(560px, calc(100vw - 880px));
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 940px) {
  .init-strip {
    top: 56px;
    right: 12px;
    left: auto;
    max-width: calc(100vw - 24px);
  }
  .app.sideopen .init-strip {
    right: 12px;
  }
  .top {
    max-width: calc(100vw - 24px);
  }
  .ov.tl {
    left: 64px;
    max-width: calc(100% - 200px);
  }
  .hud-bottom-left {
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 100px);
  }
  .hud-pill.hint {
    display: none;
  }
}

@media (max-width: 600px) {
  .hud-pill#coords {
    display: none;
  }
}

@media (max-width: 640px) {
  .acctchip .al {
    display: none;
  }
  .top {
    padding: 6px 10px;
    gap: 6px 8px;
  }
  .brand {
    font-size: 18px;
    margin-right: 0;
  }
  .brand small {
    display: none;
  }
}
