/**
 * Scarforged HUD + window chrome
 * Diablo-3-inspired (side docks, glass orbs, bronze sockets, ash parchment)
 * — not a copy. Positions stay locked. Dual char+inv is unchanged in JS.
 */
:root {
  --bronze: #c4a056;
  --bronze-hi: #e8d090;
  --bronze-dim: #8a6230;
  --bone: #e4d4b4;
  --iron-ink: #0c0606;
  --ui-parchment: url("/assets/ui/parchment.jpg?v=1");
  --ui-skill-socket: url("/assets/ui/skill-socket.png?v=1");
  --ui-slot-well: url("/assets/ui/slot-well.png?v=1");
  --ui-skill-rail: url("/assets/ui/skillbar-rail.png?v=1");
  --hud-s: 1;
}

/* Bottom/top chrome stays usable over char+inv. Party stays under the left sheet. */
.hud-orbs,
.target-frame,
.hud-top-right {
  z-index: 24;
}
.hud-menu {
  z-index: 80;
}

/* Fluid HUD — --hud-s is a unitless number on :root (set from JS; 1 until then) */
.hud-icon-btn {
  width: calc(60px * var(--hud-s, 1));
  height: calc(60px * var(--hud-s, 1));
  max-width: 70px;
  max-height: 70px;
}
.hud-icon-btn img {
  width: calc(44px * var(--hud-s, 1));
  height: calc(44px * var(--hud-s, 1));
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.orb {
  width: calc(148px * var(--hud-s, 1));
  height: calc(148px * var(--hud-s, 1));
  max-width: 172px;
  max-height: 172px;
}
.skill-slot {
  width: calc(66px * var(--hud-s, 1));
  height: calc(66px * var(--hud-s, 1));
  max-width: 76px;
  max-height: 76px;
  border-width: 1px;
}
.skill-slot .skill-ico-img {
  width: calc(56px * var(--hud-s, 1));
  height: calc(56px * var(--hud-s, 1));
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.potion-hud-slot,
.hud-portal-btn {
  width: calc(50px * var(--hud-s, 1));
  height: calc(50px * var(--hud-s, 1));
  max-width: 58px;
  max-height: 58px;
}
.hud-orbs {
  gap: calc(0.5rem * var(--hud-s, 1));
  max-width: min(1280px, calc(100vw - 22rem));
}
.orb-hp {
  margin-right: calc(1.85rem * var(--hud-s, 1));
}
.orb-res {
  margin-left: calc(1.85rem * var(--hud-s, 1));
}

@media (max-width: 1400px) {
  .hud-menu {
    gap: 0.22rem;
    padding: 0.24rem 0.28rem;
  }
  .minimap-wrap {
    width: clamp(210px, 20vw, 260px);
    height: clamp(210px, 20vw, 260px);
  }
}

@media (max-width: 1480px) {
  .hud-orbs {
    max-width: calc(100vw - 22rem);
  }
}

@media (max-width: 1100px) {
  .hud-orbs {
    bottom: 0.35rem;
    gap: 0.45rem;
    max-width: calc(100vw - 8rem);
  }
  .orb-hp { margin-right: calc(1.45rem * var(--hud-s, 1)); }
  .orb-res { margin-left: calc(1.45rem * var(--hud-s, 1)); }
  .skill-cluster {
    min-width: 0;
  }
  .minimap-wrap {
    width: clamp(196px, 22vw, 236px);
    height: clamp(196px, 22vw, 236px);
  }
}

@media (max-width: 820px) {
  .hud-orbs,
  .target-frame,
  .hud-top-right {
    z-index: 6;
  }
  .hud-menu {
    z-index: 80;
  }
  .chat-panel {
    width: min(220px, 42vw);
  }
  .hud-menu {
    bottom: 7.2rem;
    right: 0.35rem;
    gap: 0.16rem;
    padding: 0.2rem 0.22rem;
  }
  .minimap-wrap {
    width: clamp(180px, 28vw, 220px);
    height: clamp(180px, 28vw, 220px);
  }
  .char-header button.secondary,
  .skill-panel-header button.secondary,
  .quest-header button.secondary,
  .shop-header button.secondary,
  .options-header button.secondary,
  .achievements-header button.secondary,
  .trade-header button.secondary {
    min-height: 1.7rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.58rem;
  }
}

@media (max-height: 720px) {
  .minimap-wrap {
    width: clamp(176px, 22vh, 220px);
    height: clamp(176px, 22vh, 220px);
  }
  .hud-orbs {
    bottom: 0.28rem;
    max-width: calc(100vw - 6rem);
  }
  .orb {
    width: calc(128px * var(--hud-s, 1));
    height: calc(128px * var(--hud-s, 1));
    max-width: 148px;
    max-height: 148px;
  }
}

/* ═══════════════════════════════════════════════
   Shared window language
   ═══════════════════════════════════════════════ */
.char-inner,
.skill-panel-inner,
.options-inner,
.achievements-inner,
.social-inner,
.shop-inner,
.quest-inner,
.trade-inner {
  position: relative;
  border-radius: 0;
  background-color: #120808;
  background-image:
    linear-gradient(165deg, rgba(22, 10, 8, 0.88), rgba(8, 3, 3, 0.94)),
    var(--ui-parchment);
  background-size: auto, cover;
  background-position: center, center;
  background-blend-mode: multiply, normal;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(196, 160, 86, 0.14);
  outline: none;
}

.shop-inner,
.quest-inner,
.trade-inner {
  border: var(--frame-border) solid transparent;
  border-image-source: var(--ui-panel);
  border-image-slice: var(--frame-slice);
  border-image-width: var(--frame-border);
  border-image-repeat: stretch;
  padding: var(--panel-pad);
  background-clip: border-box;
}

/* Inner gold hairline — D3 ledger, Scarforged rust */
.char-inner::before,
.skill-panel-inner::before,
.options-inner::before,
.achievements-inner::before,
.social-inner::before,
.shop-inner::before,
.quest-inner::before,
.trade-inner::before {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  border: 1px solid rgba(196, 160, 86, 0.16);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.28);
  z-index: 0;
}

.char-inner > *,
.skill-panel-inner > *,
.options-inner > *,
.achievements-inner > *,
.social-inner > *,
.shop-inner > *,
.quest-inner > *,
.trade-inner > * {
  position: relative;
  z-index: 1;
}

.char-header,
.skill-panel-header,
.quest-header,
.shop-header,
.options-header,
.achievements-header,
.social-header,
.trade-header {
  position: relative;
  padding-bottom: 0.7rem;
  margin-bottom: 0.85rem;
}

.char-header h2,
.skill-panel-header h2,
.quest-header h2,
.shop-header h2,
.options-header h2,
.achievements-header h2,
.trade-header h2 {
  font-family: var(--font-display);
  color: var(--bronze-hi);
  letter-spacing: 0.12em;
  text-shadow: 0 1px 2px #000, 0 0 12px rgba(180, 120, 40, 0.25);
}

.char-header::after,
.skill-panel-header::after,
.quest-header::after,
.shop-header::after,
.options-header::after,
.achievements-header::after,
.trade-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--bronze-dim) 10%,
    var(--bronze-hi) 50%,
    var(--bronze-dim) 90%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(196, 160, 86, 0.35);
}

.char-header button.secondary,
.skill-panel-header button.secondary,
.quest-header button.secondary,
.shop-header button.secondary,
.options-header button.secondary,
.achievements-header button.secondary,
.trade-header button.secondary {
  min-height: 2rem;
  padding: 0.2rem 0.75rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.char-left h3,
.char-right h3,
.shop-col-title,
.achievements-col h3,
.trade-col-title,
.skill-bar-edit-lbl {
  font-family: var(--font-ui);
  color: var(--bronze);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.char-inner,
.skill-panel-inner,
.options-inner,
.shop-inner,
.quest-inner,
.achievements-inner,
.social-inner,
.trade-inner {
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 160, 86, 0.45) rgba(0, 0, 0, 0.35);
}

/* ═══════════════════════════════════════════════
   Target nameplate — top center
   ═══════════════════════════════════════════════ */
.target-frame-inner {
  padding: 0.4rem 0.85rem 0.5rem;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(28, 16, 10, 0.94), rgba(8, 4, 4, 0.9));
  border: 1px solid rgba(196, 160, 86, 0.42);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(232, 208, 144, 0.18),
    inset 0 0 16px rgba(0, 0, 0, 0.35);
}

.target-frame[data-kind="enemy"] .target-frame-inner {
  border-color: rgba(180, 50, 40, 0.65);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.65),
    0 0 14px rgba(140, 20, 16, 0.25),
    inset 0 1px 0 rgba(232, 160, 120, 0.12);
}

.target-frame[data-kind="ally"] .target-frame-inner {
  border-color: rgba(90, 150, 90, 0.55);
}

.target-frame[data-kind="npc"] .target-frame-inner {
  border-color: rgba(196, 160, 86, 0.55);
}

.target-name {
  font-family: var(--font-display);
  color: var(--bronze-hi);
  letter-spacing: 0.06em;
}

.target-hp-wrap {
  height: 13px;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(196, 160, 86, 0.28);
}

.target-hp-fill {
  background: linear-gradient(180deg, #7ad45e 0%, #3a8a32 55%, #1e4a1c 100%);
}

.target-hp-fill.mid {
  background: linear-gradient(180deg, #e0c050, #8a6018);
}

.target-hp-fill.low {
  background: linear-gradient(180deg, #e06050, #6a1818);
}

/* ═══════════════════════════════════════════════
   Minimap + continent chips — top right
   ═══════════════════════════════════════════════ */
.world-progress {
  display: none !important;
}
.world-progress .wp-chip {
  display: none !important;
}

.world-progress .wp-chip.on {
  color: #1a1208;
  background: linear-gradient(160deg, #e8d090, #c4a056);
  border-color: rgba(232, 208, 144, 0.8);
}

#minimap {
  border-radius: 0;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.6);
}

.minimap-label {
  font-family: var(--font-ui);
  letter-spacing: 0.14em;
  color: var(--bronze-hi);
}

/* ═══════════════════════════════════════════════
   Bottom-right menu
   ═══════════════════════════════════════════════ */
.hud-menu {
  padding: 0.28rem 0.34rem;
  gap: 0.26rem;
  background: linear-gradient(180deg, rgba(22, 10, 8, 0.94), rgba(6, 2, 2, 0.97));
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1px rgba(196, 160, 86, 0.12);
}

.hud-icon-btn {
  width: calc(60px * var(--hud-s, 1));
  height: calc(60px * var(--hud-s, 1));
  max-width: 70px;
  max-height: 70px;
  border-color: #6a4a28;
  background-color: #100606;
  background-image:
    radial-gradient(ellipse at 40% 30%, rgba(90, 50, 20, 0.35), rgba(8, 2, 2, 0.8)),
    var(--ui-icon);
  box-shadow:
    inset 0 1px 0 rgba(232, 208, 144, 0.12),
    inset 0 0 0 1px rgba(0, 0, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.4);
}

.hud-icon-btn img {
  width: calc(44px * var(--hud-s, 1));
  height: calc(44px * var(--hud-s, 1));
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.hud-icon-btn kbd {
  color: rgba(232, 208, 144, 0.9);
  border-color: rgba(138, 98, 48, 0.5);
}

.hud-icon-btn:hover {
  border-color: var(--bronze);
  box-shadow: 0 0 14px rgba(196, 160, 86, 0.35);
}

.hud-icon-btn.active {
  border-color: var(--bronze-hi);
  box-shadow:
    0 0 14px rgba(196, 160, 86, 0.4),
    inset 0 0 12px rgba(180, 120, 40, 0.18);
}

/* ═══════════════════════════════════════════════
   Skill bar + sockets — bottom center
   ═══════════════════════════════════════════════ */
.hud-orbs {
  gap: 0.55rem;
}

.skill-bar {
  --skill-tray: url("/assets/ui/skillbar-tray-warrior.png?v=4");
  --skill-glow: rgba(224, 112, 64, 0.22);
  --skill-rail: calc(15px * var(--hud-s, 1));
  --skill-cap: calc(46px * var(--hud-s, 1));
  position: relative;
  isolation: isolate;
  padding: calc(0.1rem * var(--hud-s, 1)) calc(0.04rem * var(--hud-s, 1)) calc(0.14rem * var(--hud-s, 1));
  gap: calc(0.2rem * var(--hud-s, 1));
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: var(--skill-rail) var(--skill-cap) calc(17px * var(--hud-s, 1)) var(--skill-cap);
  border-image-source: var(--skill-tray);
  border-image-slice: 168 300 168 300;
  border-image-width: var(--skill-rail) var(--skill-cap) calc(17px * var(--hud-s, 1)) var(--skill-cap);
  border-image-repeat: stretch;
  border-image-outset: calc(1px * var(--hud-s, 1)) calc(4px * var(--hud-s, 1));
  box-shadow: none;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.62));
}

.skill-bar[data-class="warrior"] {
  --skill-tray: url("/assets/ui/skillbar-tray-warrior.png?v=4");
  --skill-glow: rgba(224, 112, 64, 0.28);
}

.skill-bar[data-class="mage"] {
  --skill-tray: url("/assets/ui/skillbar-tray-mage.png?v=4");
  --skill-glow: rgba(80, 150, 255, 0.3);
}

.skill-bar[data-class="ranger"] {
  --skill-tray: url("/assets/ui/skillbar-tray-ranger.png?v=4");
  --skill-glow: rgba(90, 173, 62, 0.28);
}

.skill-bar[data-class="necromancer"] {
  --skill-tray: url("/assets/ui/skillbar-tray-necromancer.png?v=4");
  --skill-glow: rgba(155, 107, 255, 0.3);
}

.skill-bar::before {
  display: none;
}

.skill-slot-lmb {
  margin-left: 0.22rem;
}

.skill-slot {
  z-index: 1;
  width: calc(66px * var(--hud-s, 1));
  height: calc(66px * var(--hud-s, 1));
  max-width: 76px;
  max-height: 76px;
  border-radius: 3px;
  border: none;
  background-color: transparent;
  background-image: var(--ui-skill-socket);
  background-size: 100% 100%;
  background-position: center;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 10px var(--skill-glow, rgba(224, 112, 64, 0.16));
}

.skill-slot.empty {
  opacity: 0.62;
}

.skill-slot.skill-slot-locked {
  border: none;
  box-shadow:
    0 0 0 1px rgba(232, 208, 144, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.skill-slot .skill-ico-img {
  width: calc(56px * var(--hud-s, 1));
  height: calc(56px * var(--hud-s, 1));
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.skill-slot .skill-key {
  left: 4px;
  top: 3px;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(196, 160, 86, 0.35);
  color: var(--bronze-hi);
  font-family: var(--font-ui);
}

.status-icon {
  border-radius: 2px;
  border: 1px solid rgba(196, 160, 86, 0.4);
  background: radial-gradient(circle at 35% 30%, rgba(60, 32, 16, 0.95), rgba(8, 4, 4, 0.96));
}

.status-icon.buff {
  border-color: rgba(120, 180, 90, 0.7);
}

.status-icon.debuff {
  border-color: rgba(200, 60, 50, 0.75);
}

.status-icon.cast {
  border-color: rgba(232, 200, 90, 0.8);
}

.status-icon .st-timer {
  color: var(--bronze-hi);
}

/* Stamina — bone/gold diamonds, not ice-blue */
.stam-pip {
  border: none;
  background: url("/assets/hud/stam-pip-off.jpg") center / contain no-repeat;
}

.stam-pip.filled {
  background: url("/assets/hud/stam-pip-on.jpg") center / contain no-repeat;
  box-shadow: 0 0 10px rgba(196, 160, 86, 0.35);
}

.hud-xp-strip .xp-bar {
  height: 7px;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(196, 160, 86, 0.4);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.55);
}

.hud-xp-strip #xp-fill {
  background: linear-gradient(90deg, #6a4818, #e8d090 55%, #c4a056);
  box-shadow: 0 0 8px rgba(196, 160, 86, 0.35);
}

.hud-xp-strip #xp-text {
  font-family: var(--font-ui);
  color: rgba(232, 208, 144, 0.85);
  letter-spacing: 0.08em;
}

/* Potion + portal sit on the same socket language */
.potion-hud-slot {
  border-radius: 2px;
  border: none;
  background-color: #080303;
  background-image: var(--ui-skill-socket);
  background-size: 100% 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.potion-key {
  border-color: rgba(196, 160, 86, 0.4);
  color: var(--bronze-hi);
}

.hud-portal-btn {
  border-radius: 2px;
  border: none;
  background-color: #080303;
  background-image: var(--ui-skill-socket);
  background-size: 100% 100%;
}

.hud-portal-btn:hover {
  border: none;
  filter: brightness(1.12);
  box-shadow: 0 0 14px rgba(196, 160, 86, 0.35);
}

.hud-portal-btn .portal-key {
  color: var(--bronze-hi);
  border-color: rgba(196, 160, 86, 0.4);
}

/* Orbs — glass + bronze lip, keep iron ring art */
.orb-glass {
  box-shadow:
    inset 0 0 0 2px rgba(196, 160, 86, 0.28),
    inset 0 0 16px rgba(0, 0, 0, 0.9),
    inset 0 -8px 18px rgba(0, 0, 0, 0.55);
}

.orb-val {
  font-family: var(--font-ui);
}

.orb-lbl {
  font-family: var(--font-ui);
  color: var(--bronze-hi);
}

/* ═══════════════════════════════════════════════
   Party — mid left
   ═══════════════════════════════════════════════ */
.party-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.45rem 0.36rem;
  background: linear-gradient(180deg, rgba(22, 12, 8, 0.88), rgba(8, 4, 4, 0.86));
  border: 1px solid rgba(196, 160, 86, 0.28);
  box-shadow: inset 0 1px 0 rgba(232, 208, 144, 0.08);
}

.party-meta {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
  min-width: 0;
}

.party-row .pname {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--bone);
}

.mini-hp {
  height: 7px;
  width: 100%;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(196, 160, 86, 0.22);
}

.mini-hp > div {
  background: linear-gradient(180deg, #7ad45e, #2d8a38);
}

/* ═══════════════════════════════════════════════
   Chat — bottom left
   ═══════════════════════════════════════════════ */
.chat-log {
  border-radius: 0;
  max-height: none;
  background: linear-gradient(to top, rgba(8, 4, 4, 0.72), rgba(8, 4, 4, 0.18));
  border: 1px solid rgba(196, 160, 86, 0.16);
}

.chat-line.system,
.chat-line.npc {
  color: #ff9a3c;
  font-style: italic;
}

.chat-form input {
  border-radius: 0;
  background: rgba(8, 4, 4, 0.78);
  border: 1px solid rgba(196, 160, 86, 0.32);
  color: var(--bone);
}

.chat-form input:focus {
  border-color: var(--bronze);
  box-shadow: 0 0 0 1px rgba(196, 160, 86, 0.28);
}

/* ═══════════════════════════════════════════════
   Char / inv sheets + dual dock
   ═══════════════════════════════════════════════ */
.char-panel {
  background: transparent;
}

.char-stats > div,
.char-attrs .attr-row,
.char-attrs .attr-points {
  border-radius: 0;
  background: rgba(8, 3, 3, 0.55);
  border: 1px solid rgba(138, 98, 48, 0.28);
}

.eq-doll {
  border-radius: 0;
  border: 1px solid rgba(196, 160, 86, 0.28);
  background:
    radial-gradient(ellipse at 50% 42%, rgba(70, 36, 18, 0.28), transparent 65%),
    linear-gradient(180deg, rgba(18, 8, 8, 0.82), rgba(6, 2, 2, 0.9));
}

.eq-preview-wrap,
.sheet-preview {
  border-radius: 0;
  border-color: rgba(196, 160, 86, 0.28);
}

.eq-slot,
.eq-doll .doll-slot,
.eq-doll .char-potion-slot.area-potion {
  border-radius: 2px;
  border: none;
  background-color: #080303;
  background-image: var(--ui-slot-well);
  background-size: 100% 100%;
  background-position: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.inv-slot {
  border-radius: 2px;
  border: 1px solid rgba(42, 28, 22, 0.85);
  background-color: #090505;
  background-image: none;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.72);
}

.eq-slot.filled,
.eq-doll .doll-slot.filled,
.eq-doll .char-potion-slot.filled {
  background-image: var(--ui-slot-well);
  background-size: 100% 100%;
}

.inv-slot.filled {
  background-image: none;
  background-color: #100808;
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.55);
}

.eq-doll .doll-slot .item-ico-img,
.eq-doll .char-potion-slot .item-ico-img,
.inv-slot .item-ico-img {
  width: 68%;
  height: 68%;
  max-width: 68%;
  max-height: 68%;
}

/*
 * Dual dock: matched tall ledgers.
 * Char = stats (inv already has the paper doll).
 * Inv = doll on top, bag fills the rest.
 * World stays clickable in the gap.
 */
body.char-inv-dual #char-panel:not(.hidden),
body.char-inv-dual #inv-panel:not(.hidden) {
  align-items: stretch !important;
  justify-content: stretch !important;
  pointer-events: none;
  background: none !important;
  padding-top: 0.7rem !important;
  padding-bottom: 11.25rem !important;
}

body.char-inv-dual #char-panel:not(.hidden) {
  width: min(400px, 34vw) !important;
  max-width: min(400px, 34vw) !important;
  padding-left: 0.7rem !important;
  padding-right: 0.25rem !important;
}

body.char-inv-dual #inv-panel:not(.hidden) {
  width: min(620px, 46vw) !important;
  max-width: min(620px, 46vw) !important;
  padding-right: 0.7rem !important;
  padding-left: 0.25rem !important;
}

body.char-inv-dual #char-panel .char-inner,
body.char-inv-dual #char-panel .sheet-inner,
body.char-inv-dual #inv-panel .char-inner,
body.char-inv-dual #inv-panel .inv-inner {
  pointer-events: auto;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.95rem 0.9rem;
  background-color: #100808;
  background-image:
    linear-gradient(165deg, rgba(18, 8, 6, 0.94), rgba(8, 3, 3, 0.97)),
    var(--ui-parchment);
}

body.char-inv-dual #char-panel .char-header,
body.char-inv-dual #inv-panel .char-header {
  flex-shrink: 0;
  margin-bottom: 0.55rem;
  padding-bottom: 0.5rem;
}

body.char-inv-dual #char-panel .sheet-body,
body.char-inv-dual #inv-panel .char-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Char: drop the second 3D preview — inv owns the doll */
body.char-inv-dual #char-panel .sheet-body {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 0.55rem;
}

body.char-inv-dual #char-panel .sheet-preview,
body.char-inv-dual #char-panel .eq-preview-wrap.sheet-preview {
  display: none !important;
}

body.char-inv-dual #char-panel .sheet-preview-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

body.char-inv-dual #char-panel .char-class-line {
  text-align: left;
  font-family: var(--font-ui);
  color: var(--bronze-hi);
  letter-spacing: 0.08em;
  margin: 0;
}

body.char-inv-dual #char-panel .char-attrs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

body.char-inv-dual #char-panel .char-attrs .attr-points,
body.char-inv-dual #char-panel .char-attrs .attr-hint {
  grid-column: 1 / -1;
}

body.char-inv-dual #char-panel .char-attrs .attr-row,
body.char-inv-dual #char-panel .char-attrs .attr-points {
  padding: 0.32rem 0.45rem;
  font-size: 0.82rem;
}

body.char-inv-dual #char-panel .sheet-stats-col {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.char-inv-dual #char-panel .char-stats {
  flex: 1 1 auto;
  max-height: none !important;
  margin-bottom: 0;
  overflow-y: auto;
  font-size: 0.82rem;
  gap: 0.32rem;
  padding-bottom: 0.45rem;
}

body.char-inv-dual #char-panel .char-stats > div {
  padding: 0.36rem 0.48rem;
  font-size: 0.82rem;
}

body.char-inv-dual #char-panel .char-stats > div.stats-section-title {
  background: transparent;
  border: none;
  border-top: 1px solid rgba(196, 160, 86, 0.28);
  padding: 0.45rem 0.15rem 0.1rem;
  color: var(--bronze);
}

body.char-inv-dual #char-panel .char-stats > div.stats-wide {
  background: rgba(0, 0, 0, 0.28);
}

body.char-inv-dual .party-bars {
  display: none !important;
}

/* Inv: doll stays put, bag uses the leftover height */
body.char-inv-dual #inv-panel .char-body {
  display: flex !important;
  flex-direction: column;
  grid-template-columns: none !important;
  gap: 0.55rem;
}

body.char-inv-dual #inv-panel .char-left,
body.char-inv-dual #inv-panel .char-right {
  min-width: 0;
}

body.char-inv-dual #inv-panel .char-left {
  flex: 0 0 auto;
}

body.char-inv-dual #inv-panel .char-right {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

body.char-inv-dual #inv-panel .char-left h3,
body.char-inv-dual #inv-panel .char-right h3 {
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
}

body.char-inv-dual #inv-panel .inv-hint {
  display: none;
}

body.char-inv-dual #inv-panel .eq-doll {
  width: 100%;
  max-width: none !important;
  margin: 0;
  grid-template-columns: 70px minmax(120px, 1fr) 70px;
  grid-template-rows: 70px minmax(150px, 190px) 70px 70px;
  gap: 0.4rem 0.45rem;
  padding: 0.5rem;
}

body.char-inv-dual #inv-panel .eq-doll .doll-slot,
body.char-inv-dual #inv-panel .eq-doll .char-potion-slot.area-potion {
  width: 70px !important;
  height: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
  min-height: 70px !important;
  max-height: 70px !important;
}

body.char-inv-dual #inv-panel .inv-doll-center,
body.char-inv-dual #inv-panel .eq-preview-inv {
  min-height: 150px;
  height: 100%;
  max-height: none;
  max-width: none;
}

body.char-inv-dual #inv-panel .inv-grid {
  display: grid;
  grid-template-columns: repeat(6, 64px) !important;
  justify-content: start;
  max-width: none !important;
  margin: 0 !important;
  gap: 0.4rem;
}

body.char-inv-dual #inv-panel .inv-slot {
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
}

body.char-inv-dual::before {
  display: none;
}

@media (max-height: 860px) {
  body.char-inv-dual #char-panel:not(.hidden),
  body.char-inv-dual #inv-panel:not(.hidden) {
    padding-bottom: 11.75rem !important;
  }
  body.char-inv-dual #inv-panel .eq-doll {
    grid-template-columns: 54px minmax(88px, 1fr) 54px;
    grid-template-rows: 54px minmax(96px, 118px) 54px 54px;
    gap: 0.25rem 0.3rem;
    padding: 0.32rem;
  }
  body.char-inv-dual #inv-panel .eq-doll .doll-slot,
  body.char-inv-dual #inv-panel .eq-doll .char-potion-slot.area-potion {
    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
  }
  body.char-inv-dual #inv-panel .inv-grid {
    grid-template-columns: repeat(6, 56px) !important;
  }
  body.char-inv-dual #inv-panel .inv-slot {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
  }
}

@media (max-width: 1100px) {
  body.char-inv-dual #char-panel:not(.hidden) {
    width: min(360px, 38vw) !important;
    max-width: min(360px, 38vw) !important;
  }
  body.char-inv-dual #inv-panel:not(.hidden) {
    width: min(520px, 50vw) !important;
    max-width: min(520px, 50vw) !important;
  }
  body.char-inv-dual #inv-panel .eq-doll {
    grid-template-columns: 62px minmax(100px, 1fr) 62px;
    grid-template-rows: 62px minmax(130px, 160px) 62px 62px;
  }
  body.char-inv-dual #inv-panel .eq-doll .doll-slot,
  body.char-inv-dual #inv-panel .eq-doll .char-potion-slot.area-potion {
    width: 62px !important;
    height: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
    min-height: 62px !important;
    max-height: 62px !important;
  }
}

@media (max-width: 820px) {
  body.char-inv-dual #char-panel:not(.hidden),
  body.char-inv-dual #inv-panel:not(.hidden) {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 50vh !important;
    max-height: 50vh !important;
    pointer-events: none;
    padding: 0.3rem !important;
  }
  body.char-inv-dual #char-panel:not(.hidden) {
    top: 0 !important;
    bottom: auto !important;
  }
  body.char-inv-dual #inv-panel:not(.hidden) {
    top: auto !important;
    bottom: 0 !important;
  }
  body.char-inv-dual #char-panel .char-inner,
  body.char-inv-dual #char-panel .sheet-inner,
  body.char-inv-dual #inv-panel .char-inner,
  body.char-inv-dual #inv-panel .inv-inner {
    max-height: 100% !important;
    height: 100% !important;
    padding: 0.65rem 0.7rem;
  }
  body.char-inv-dual .char-header h2 {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
  }
  body.char-inv-dual #btn-close-char,
  body.char-inv-dual #btn-close-inv {
    min-width: 2.1rem;
    padding: 0.12rem 0.4rem;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
  }
  body.char-inv-dual #inv-panel .inv-grid {
    grid-template-columns: repeat(auto-fill, 56px) !important;
  }
  body.char-inv-dual #inv-panel .inv-slot {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
  }
}

/* ═══════════════════════════════════════════════
   Skills / quests / shop / stash / trade / options
   ═══════════════════════════════════════════════ */
.skill-panel {
  background: rgba(4, 1, 1, 0.72);
}

.skill-bar-edit {
  border-radius: 0;
  border: 1px solid rgba(196, 160, 86, 0.28);
  background: rgba(0, 0, 0, 0.38);
}

.skill-bar-edit-slot {
  border-radius: 2px;
  border: none;
  background-color: #080303;
  background-image: var(--ui-skill-socket);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.skill-node {
  border-radius: 0;
  border-color: rgba(138, 98, 48, 0.45);
  background: linear-gradient(165deg, rgba(28, 14, 10, 0.94), rgba(10, 4, 4, 0.96));
}

.skill-node:hover:not(:disabled) {
  border-color: var(--bronze);
}

.quest-panel,
.shop-panel,
.trade-panel {
  background: rgba(4, 1, 1, 0.58);
}

.quest-empty {
  color: var(--bone);
}

.quest-empty-ico {
  border-radius: 2px;
  border: 1px solid rgba(196, 160, 86, 0.4);
}

.quest-empty .muted {
  color: rgba(180, 160, 130, 0.75);
}

.shop-row,
.trade-item,
.ach-row,
.title-row {
  border-radius: 0;
  border: 1px solid rgba(138, 98, 48, 0.32);
  background: rgba(8, 3, 3, 0.5);
}

.shop-row:hover:not(:disabled),
.title-row:hover:not(:disabled) {
  border-color: var(--bronze);
}

.options-section {
  border-bottom: 1px solid rgba(138, 98, 48, 0.32);
}

.options-section h3 {
  color: var(--bronze);
  font-family: var(--font-ui);
}

.opt-row select {
  border-radius: 0;
  border-color: rgba(138, 98, 48, 0.45);
}

.controls-list kbd {
  border-radius: 1px;
  border-color: rgba(196, 160, 86, 0.35);
  color: var(--bronze-hi);
}

/* Toast / loot / hint / trade invite */
#toast,
.loot-note,
.trade-invite {
  border-radius: 0;
  background: rgba(14, 8, 6, 0.94);
  border: 1px solid rgba(196, 160, 86, 0.4);
}

.hint-bar {
  border-radius: 0;
  background: rgba(16, 10, 6, 0.9);
  border: 1px solid rgba(196, 160, 86, 0.45);
  color: var(--bone);
}

/* Game windows: no world dim; empty chrome lets HUD buttons receive the second click */
.char-panel,
.skill-panel,
.quest-panel,
.shop-panel,
.trade-panel,
.options-panel,
.achievements-panel,
.social-panel,
.report-panel {
  background: transparent !important;
  pointer-events: none !important;
}
.char-inner,
.sheet-inner,
.inv-inner,
.skill-panel-inner,
.quest-inner,
.shop-inner,
.trade-inner,
.options-inner,
.achievements-inner,
.social-inner {
  pointer-events: auto;
}
.achievements-panel:not(.hidden),
.social-panel:not(.hidden) {
  pointer-events: none !important;
}
body.char-inv-dual #char-panel:not(.hidden),
body.char-inv-dual #inv-panel:not(.hidden) {
  background: transparent !important;
  pointer-events: none !important;
}

.item-tooltip {
  background-color: #120808;
  background-image:
    linear-gradient(165deg, rgba(22, 10, 8, 0.92), rgba(8, 3, 3, 0.96)),
    var(--ui-parchment);
  background-size: auto, cover;
  background-blend-mode: multiply, normal;
}
