/* ============================================================================
 * Main-screen layout (online-game style):
 *   left  — hero avatar (ARPG hireables class portrait) + mercenary / summons + party members
 *   right — FPS · mini-map · icon dock (Settings / Quests / Realm) · status chips · area info
 * Portraits: assets/ui/pt_*.webp (hd/global/ui/hireables/*icon.sprite, 120px with gold frame).
 * ============================================================================ */

/* ---- Left column ---- */
#top-bar {
  top: 10px;
  left: 12px;
  gap: 8px;
  max-width: none;
}

#hero-frame {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: linear-gradient(90deg, rgba(14, 10, 7, 0.88), rgba(14, 10, 7, 0.66) 70%, rgba(14, 10, 7, 0.1));
  border-left: 2px solid #9a7b45;
  pointer-events: auto;
}
.hf-portrait {
  position: relative;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  border: 0;
  padding: 0;
  background: #000 center / 100% 100% no-repeat;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
}
.hf-portrait:hover { filter: brightness(1.15); }
#hero-frame.low .hf-portrait { box-shadow: 0 0 12px rgba(220, 40, 30, 0.75); }
.hf-lvl {
  position: absolute;
  right: -6px;
  bottom: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 11px;
  background: radial-gradient(circle at 40% 35%, #4a3519, #160f07);
  border: 1px solid #d6b15e;
  color: #ffe39b;
  font: 12px/20px var(--font-title);
  text-align: center;
  text-shadow: 0 1px 2px #000;
}
.hf-body { width: 158px; }
.hf-name {
  font: 15px/1.15 var(--font-title);
  color: #f2d892;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.hf-bar {
  position: relative;
  height: 12px;
  margin-bottom: 3px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid #4a3a26;
  overflow: hidden;
}
.hf-bar.mp { height: 10px; }
.hf-bar > div { height: 100%; transition: width 0.15s linear; }
.hf-bar.hp > div { background: linear-gradient(180deg, #e04a3a, #8e1a12 60%, #5c0d08); }
.hf-bar.mp > div { background: linear-gradient(180deg, #4f7ff0, #1d3d9c 60%, #10235e); }
.hf-bar > span {
  position: absolute;
  inset: 0;
  font: 9.5px/12px var(--font-ui);
  text-align: center;
  color: #f5ecd6;
  text-shadow: 0 1px 1px #000, 0 0 2px #000;
}
.hf-bar.mp > span { line-height: 10px; font-size: 9px; }
.hf-xp {
  height: 3px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #3c2f1e;
}
.hf-xp > div { height: 100%; background: linear-gradient(90deg, #a8822f, #f1cf6f); }

/* mercenary + summons */
#companion-frames {
  display: flex;
  gap: 6px;
  padding-left: 4px;
}
#companion-frames:empty { display: none; }
.comp-frame { width: 44px; }
.comp-frame[data-key="merc"] { pointer-events: auto; cursor: pointer; }
.comp-portrait {
  position: relative;
  width: 44px;
  height: 44px;
  background: #000 center / 100% 100% no-repeat;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
.comp-count {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font: 13px/1 var(--font-title);
  color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}
.comp-hp {
  height: 5px;
  margin-top: 2px;
  background: url('../../assets/ui/pt_hpbarback.webp') 0 0 / 100% 100% no-repeat, #000;
  border: 1px solid #2d2418;
}
.comp-hp > div {
  height: 100%;
  background: url('../../assets/ui/pt_hpbar.webp') 0 0 / 44px 100% no-repeat;
}

/* party members (other players) — rendered by hud.syncCoopHud */
#party-frames {
  position: static;
  top: auto;
  left: auto;
  gap: 5px;
}
#party-frames .party-frame-card {
  min-width: 0;
  width: 214px;
  padding: 4px 8px 4px 4px;
  background: linear-gradient(90deg, rgba(12, 10, 8, 0.86), rgba(12, 10, 8, 0.55));
  border: 0;
  border-left: 2px solid #5d8a4c;
  box-shadow: none;
}
#party-frames .party-frame-badge {
  width: 40px;
  height: 40px;
  border: 0;
  background: #000 center / 100% 100% no-repeat;
  font-size: 0;
}
#party-frames .party-frame-hp {
  height: 6px;
  border-color: #2d2418;
  background: url('../../assets/ui/pt_hpbarback.webp') 0 0 / 100% 100% no-repeat, #000;
}
#party-frames .party-frame-hp > div {
  background: url('../../assets/ui/pt_hpbar.webp') 0 0 / 160px 100% no-repeat;
}

/* ---- Right column ---- */
#top-right-hud { gap: 6px; }
#top-right-hud .fps-badge { padding: 2px 7px; font-size: 10.5px; }
.top-dock.icons {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  pointer-events: auto;
}
.top-dock.icons .dock-btn {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}
.top-dock.icons .dock-btn svg { width: 18px; height: 18px; }
.top-dock.icons .dock-btn.active {
  border-color: #d8b55d;
  color: #ffe89e;
  box-shadow: 0 0 10px rgba(216, 181, 93, 0.55), inset 0 0 8px rgba(120, 210, 110, 0.25);
}
#chip-autoplay {
  max-width: 248px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-dock.icons .dock-btn.alert::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5a3c;
  box-shadow: 0 0 6px #ff5a3c;
}
#top-right-hud .top-status { justify-content: flex-end; pointer-events: auto; }
#top-right-hud #area-card {
  min-width: 0;
  max-width: 256px;
  padding: 2px 10px 3px 12px;
  text-align: right;
  background: linear-gradient(270deg, rgba(12, 9, 6, 0.72), rgba(12, 9, 6, 0.35) 75%, rgba(12, 9, 6, 0));
  border-left: 0;
  border-right: 2px solid #a6834a;
}
#top-right-hud #area-name { font-size: 13px; }
#top-right-hud #area-card #stats { font-size: 11px; margin-top: 1px; }

/* ---- Mobile ---- */
body.mobile-mode #top-bar {
  max-width: none;
  gap: 4px;
}
body.mobile-mode #hero-frame { padding: 3px 8px 3px 3px; gap: 6px; }
body.mobile-mode .hf-portrait { width: 42px; height: 42px; }
body.mobile-mode .hf-lvl { min-width: 17px; height: 17px; font-size: 10px; line-height: 15px; right: -4px; bottom: -4px; }
body.mobile-mode .hf-body { width: 108px; }
body.mobile-mode .hf-name { font-size: 11px; margin-bottom: 2px; }
body.mobile-mode .hf-bar { height: 9px; margin-bottom: 2px; }
body.mobile-mode .hf-bar > span { font-size: 8px; line-height: 9px; }
body.mobile-mode .hf-bar.mp { height: 7px; }
body.mobile-mode .hf-bar.mp > span { display: none; }
body.mobile-mode .comp-frame,
body.mobile-mode .comp-portrait { width: 32px; }
body.mobile-mode .comp-portrait { height: 32px; }
body.mobile-mode .top-dock.icons .dock-btn { width: 28px; height: 28px; }
body.mobile-mode #top-right-hud #area-card { display: none; }

/* Display current area name cleanly on #area-card below circular mini-map */
#top-right-hud #area-card #area-name { display: block; }

body.mobile-mode #minimap-wrap .mm-body { overflow: hidden; }
body.mobile-mode #party-frames .party-frame-card { width: 150px; padding: 2px 6px 2px 2px; gap: 5px; }
body.mobile-mode #party-frames .party-frame-badge { width: 28px; height: 28px; }
body.mobile-mode #party-frames .party-frame-title { font-size: 10px; }
body.mobile-mode #party-frames .party-frame-sub { font-size: 9px; }
body.mobile-mode #party-frames .party-frame-hp { height: 4px; margin: 1px 0; }
