/* Membership themes cover the entire HUD card while keeping live stats readable. */
#game-shell #player-card{
  --card-accent:#9eb68e;--card-glow:#9eb68e44;--card-ink:#eef3df;
  position:absolute;isolation:isolate;overflow:hidden;width:320px;padding:17px 18px 15px;
  color:var(--card-ink);border:1px solid var(--card-accent);border-top:3px solid var(--card-accent);
  border-radius:14px;background:#13221c;box-shadow:0 16px 36px #020d0bc9,0 0 22px var(--card-glow);
}
#game-shell #player-card::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(180deg,#0a1916b0 0%,#101c19d8 46%,#0d1715f5 100%);}
#game-shell #player-card[data-tier="premium"]{--card-accent:#f2cc78;--card-ink:#fff1ce;--card-surface:#292210;--card-art:url('/assets/premium-background-v1/premium-v2.png');}
#game-shell #player-card[data-tier="diamond"]{--card-accent:#9deaff;--card-ink:#e6faff;--card-surface:#0d2a3b;--card-art:url('/assets/premium-background-v1/diamond-v2-crop.png');}
#game-shell #player-card[data-tier="creator"]{--card-accent:#f2cb78;--card-ink:#fff0c4;--card-surface:#142d3c;--card-art:url('/assets/creator-brand-motion-v1/creator-brand.png');}
#game-shell #player-card[data-tier="survivor"][data-arena-ranked]{--card-accent:var(--arena-rank-color,#bec9a6);--card-surface:#18251e;}
/* Use the same tier treatment in compact, expanded and desktop HUDs. */
#game-shell:has(#world) #player-card:is([data-tier="premium"],[data-tier="diamond"],[data-tier="creator"],[data-arena-ranked]){
  border:1px solid color-mix(in srgb,var(--card-accent) 55%,transparent);
  border-top:2px solid var(--card-accent);border-radius:10px;
  background:linear-gradient(180deg,#07131550,#081515e6 85%),var(--card-art,none) center/cover no-repeat,var(--card-surface);
}
#game-shell #player-card:is([data-tier="premium"],[data-tier="diamond"],[data-tier="creator"],[data-arena-ranked])::before{content:none}
#game-shell #player-card .player-heading{min-height:78px;gap:13px;padding:0 31px 13px 0;border:0;border-bottom:1px solid color-mix(in srgb,var(--card-accent) 54%,transparent);border-radius:0;background:none;box-shadow:none;}
#game-shell #player-card .player-heading>div:nth-child(2){min-width:0;flex:1;}
#game-shell #player-card .player-labels{display:flex;flex-wrap:wrap;gap:4px;min-width:0}
#game-shell #player-card .player-tier{display:block;width:max-content;max-width:100%;padding:2px 6px;
  border:1px solid currentColor;border-radius:5px;background:#0c1918e8;color:var(--card-accent);
  font-size:11px;font-weight:700;letter-spacing:.15px;line-height:1.3;overflow-wrap:anywhere}
#game-shell #player-card .player-tier[hidden]{display:none!important}
#game-shell #player-card [data-player-label="rank"]{color:var(--arena-rank-color,#d4ddc6)}
#game-shell #player-card [data-player-label="title"]{color:#d0dec9;border-color:#a3b89970}
#game-shell #player-card .player-heading h2{margin:6px 0 3px;font-size:18px;line-height:1.2;overflow-wrap:anywhere;}
#game-shell #player-card .portrait{flex:none;width:54px;height:66px;border:1px solid var(--card-accent);border-radius:8px;background:#0d1c1dc4;box-shadow:0 0 0 3px #07121270,0 0 14px var(--card-glow);}
#game-shell #player-card .portrait canvas{width:54px;height:66px;}
#game-shell #player-card .status-label{color:#d2ddce;}
#game-shell #player-card .hp-label{margin:13px 0 7px;color:#c9d8c5;font-size:11px;}
#game-shell #player-card .hp-label strong{color:var(--card-ink);font-size:17px;font-weight:800;font-variant-numeric:tabular-nums;}
#game-shell #player-card .bar.hp{height:9px;border-radius:99px;background:#0a1415c9;border:1px solid #ffffff26;}
#game-shell #player-card .bar.hp span{background:linear-gradient(90deg,#b95347,#fa9180);box-shadow:0 0 12px #e36b5b80;}
#game-shell #player-card .vitals{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:13px;padding-top:12px;border-top:1px solid color-mix(in srgb,var(--card-accent) 38%,transparent);}
#game-shell #player-card .vitals>div{min-width:0;gap:5px;padding:7px 4px;border:1px solid color-mix(in srgb,var(--card-accent) 32%,transparent);border-radius:7px;background:#081513a8;}
#game-shell #player-card .vital-symbol{font-size:20px;color:var(--card-accent);}
#game-shell #player-card .vitals label{min-width:0;color:#b5c8b9;font-size:8px;line-height:1.2;}
#game-shell #player-card .vitals strong{color:var(--card-ink);font-size:12px;font-weight:700;}
#game-shell #player-card .xp-label{color:#c3d0bb;font-size:10px;}
#game-shell #player-card .bar.xp{height:5px;border-radius:8px;}
#game-shell #player-card .bar.xp span{background:var(--card-accent);}
#game-shell:has(#world) #player-card .hud-details-toggle{
  top:28px;right:28px;width:28px;height:28px;padding:0;
  border:1px solid var(--card-accent);border-radius:5px;
  background:#091615d9;color:var(--card-accent);
}
#game-shell:has(#world) #player-card .hud-details-toggle span{font-size:20px;line-height:1;}
#game-shell:has(#world) #player-card .hud-details-toggle:focus-visible{outline-color:var(--card-accent);outline-offset:-3px;}
#game-shell #player-card[data-tier="diamond"] .player-heading h2.premium-name{filter:drop-shadow(0 1px 3px #123447);}
#game-shell #player-card[data-tier="creator"] .player-heading h2{color:#ffdf94;text-shadow:0 1px 8px #56d5e177;}
@media(max-width:760px), (max-width:1100px) and (max-height:500px) and (pointer:coarse){
  #game-shell:has(#world) #player-card{width:calc(100% - var(--mobile-map-width) - var(--mobile-edge) - max(8px,env(safe-area-inset-right,0px)) - 8px);max-width:224px;padding:9px 10px;}
  #game-shell:has(#world) #player-card.hud-expanded{width:min(350px,calc(100vw - 16px));max-width:none;padding:14px 15px;}
  #game-shell:has(#world) #player-card .hud-details-toggle{top:10px;right:10px;width:28px;height:28px;}
  #game-shell:has(#world) #player-card.hud-expanded .hud-details-toggle{top:20px;right:22px;}
  #game-shell:has(#world) #player-card:not(.hud-expanded) .player-heading{min-height:34px;padding:0 38px 5px 0;}
  #game-shell:has(#world) #player-card:not(.hud-expanded) .player-tier{font-size:10px;padding:1px 4px;letter-spacing:0;}
  #game-shell:has(#world) #player-card:not(.hud-expanded) .player-heading h2{font-size:12px;margin:3px 0 0;}
  #game-shell:has(#world) #player-card:not(.hud-expanded) .hp-label strong{font-size:13px;}
  #game-shell:has(#world) #player-card.hud-expanded .portrait{display:block;width:48px;height:58px;}
  #game-shell:has(#world) #player-card.hud-expanded .portrait canvas{width:48px;height:58px;}
  #game-shell:has(#world) #player-card.hud-expanded .player-heading{gap:10px;padding:0 38px 10px 0;}
  #game-shell:has(#world) #player-card.hud-expanded .player-tier{font-size:11px;}
  #game-shell:has(#world) #player-card.hud-expanded .status-label{display:block;font-size:10px;}
  #game-shell:has(#world) #player-card.hud-expanded .vitals{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;}
  #game-shell:has(#world) #player-card.hud-expanded .vitals>div{padding:7px 5px;}
  /* Expanded mobile HUD: keep the framed membership banner, let the live stats sit on the world. */
  #game-shell:has(#world) #player-card.hud-expanded{
    overflow:visible;border:1px solid color-mix(in srgb,var(--card-accent) 62%,transparent);
    border-top:2px solid color-mix(in srgb,var(--card-accent) 72%,transparent);
    border-radius:10px;background:linear-gradient(180deg,#07131550,#081515e6 85%),var(--card-art,none) center/cover no-repeat,var(--card-surface,#14241b);
    box-shadow:none;backdrop-filter:none;
  }
  #game-shell:has(#world) #player-card.hud-expanded::before{display:none;}
  #game-shell:has(#world) #player-card.hud-expanded .vitals>div{
    padding:4px 2px;border:0;border-radius:0;background:transparent;
  }
}
@media(prefers-reduced-motion:reduce){#game-shell #player-card .bar span{transition:none;}}

/* The collapse affordance belongs to the card frame, not the portrait. */
#game-shell:has(#world) .hud-details-toggle{
 position:absolute;top:calc(var(--mobile-hud-top,72px) + 27px);left:calc(var(--mobile-edge,8px) + min(224px, calc(100vw - var(--mobile-map-width,96px) - var(--mobile-edge,8px) - max(8px,env(safe-area-inset-right,0px)) - 8px)) - 52px);z-index:9;
 width:26px;height:26px;padding:0;
 border:0;border-radius:4px;background:rgba(8,20,19,.48)!important;background-color:rgba(8,20,19,.48)!important;background-image:none!important;
 appearance:none;-webkit-appearance:none;
 backdrop-filter:blur(3px)!important;-webkit-backdrop-filter:blur(3px)!important;
 color:color-mix(in srgb,var(--card-accent) 78%,#e4e7d7);
 box-shadow:none!important;outline:0!important;opacity:.92;display:grid;place-items:center;
}
#game-shell:has(#world) .hud-details-toggle::before,
#game-shell:has(#world) .hud-details-toggle::after{content:none!important;display:none!important;}
#game-shell:has(#world) .hud-details-toggle span{font-size:15px;line-height:1;}
#game-shell:has(#world) .hud-details-toggle:hover,
#game-shell:has(#world) .hud-details-toggle:active{opacity:1;background:rgba(8,20,19,.58)!important;background-color:rgba(8,20,19,.58)!important;background-image:none!important;box-shadow:none!important;}
@media(max-width:760px), (max-width:1100px) and (max-height:500px) and (pointer:coarse){
 /* Leave only a 2px inset from the card right edge. */
 #game-shell:has(#world) .hud-details-toggle{top:calc(var(--mobile-hud-top) + 27px);left:calc(var(--mobile-edge) + min(224px, calc(100vw - var(--mobile-map-width) - var(--mobile-edge) - max(8px,env(safe-area-inset-right,0px)) - 8px)) - 28px);width:26px;height:26px;}
 #game-shell:has(#world):has(#player-card.hud-expanded) .hud-details-toggle{left:calc(var(--mobile-edge) + min(350px, calc(100vw - 16px)) - 28px);}
 #game-shell:has(#world) #player-card:not(.hud-expanded) .player-heading{padding-right:27px;}
 #game-shell:has(#world) #player-card.hud-expanded .player-heading{padding-right:27px;}
}
#game-shell:has(#world) .hud-details-toggle:focus-visible{outline:0!important;outline-offset:0!important;}
