/* Only explicitly customized live pieces enter the viewport overlay. */
.custom-hud-layer{
  position:fixed;
  inset:8px;
  z-index:8;
  pointer-events:none;
  text-shadow:0 2px 6px #000b;
}
.custom-hud-layer .hud-widget,.hud-layout-map .hud-layout-marker{
  position:absolute;
  left:var(--hud-x,50%);
  top:var(--hud-y,50%);
  transform:translate(var(--hud-tx,-50%),var(--hud-ty,-50%));
  max-width:100%;
}
.custom-hud-layer .hud-widget:has(>[hidden]),
.custom-hud-layer .hud-widget:has(>#combo:empty,>#judgment:empty,>#holdStatus:empty){display:none}
.custom-hud-layer .hud-widget:has(>small){
  display:grid;
  gap:4px;
  width:max-content;
  max-width:100%;
  padding:7px 10px;
  background:#101725e6;
  border:1px solid #53617b84;
  border-radius:8px;
}
.custom-hud-layer .hud-widget>small{font-size:10px;color:#c1cfe2;letter-spacing:1px}
.custom-hud-layer .hud-widget>strong{font-size:clamp(20px,3vw,30px);line-height:1.1;font-variant-numeric:tabular-nums}
#game.themed .custom-hud-layer .hud-widget[data-hud-item="score"]>small{display:none}
#game.themed .custom-hud-layer .hud-widget[data-hud-item="judgment"]>.judgment:not(:empty){
  width:min(230px,calc(100vw - 18px));
  margin:0;
}
.custom-hud-layer .hud-widget>.game-time{
  width:min(280px,calc(100vw - 28px));
  padding:6px 9px;
  background:#101725dd;
  border-radius:8px;
}
.custom-hud-layer .hud-widget>.keylegend,
.custom-hud-layer .hud-widget>.input-overlay:not([hidden]){margin:0}
.custom-hud-layer .hud-widget:has(>#judges){
  width:min(170px,calc(100vw - 18px));
  padding:6px 8px;
  background:#101725e6;
  border:1px solid #53617b84;
  border-radius:8px;
}
.custom-hud-layer .hud-widget>#judges{width:100%;margin:0}
.custom-hud-layer .hud-widget>#holdStatus{margin:0;max-width:100%}

.hud-layout-editor{min-width:0;display:grid;align-content:start;gap:8px}
.hud-layout-editor :is(.hud-layout-help,.hud-layout-status){margin:0;line-height:1.4;font-size:12px}
.hud-layout-map{
  position:relative;
  isolation:isolate;
  overflow:hidden;
  width:100%;
  min-height:160px;
  aspect-ratio:16/8.2;
  border:1px solid #465975;
  border-radius:9px;
  background:
    repeating-linear-gradient(90deg,transparent 0 calc(10% - 1px),#b5c6e012 calc(10% - 1px) 10%),
    repeating-linear-gradient(0deg,transparent 0 calc(20% - 1px),#b5c6e018 calc(20% - 1px) 20%),
    radial-gradient(ellipse at center,#1b3148,#121c2c 80%);
}
.hud-layout-stage{
  position:absolute;
  left:36%;
  top:0;
  bottom:0;
  width:28%;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  border-inline:1px solid #78bcdf44;
  pointer-events:none;
}
.hud-layout-stage i:not(:last-of-type){border-right:1px solid #78bcdf2f}
.hud-layout-stage b{position:absolute;inset:auto 0 16%;height:2px;background:#a5d6e58f}
.hud-layout-map .hud-layout-marker{
  z-index:1;
  width:max-content;
  min-height:22px;
  max-width:31%;
  padding:2px 5px;
  border:1px dashed #7990ad;
  border-radius:5px;
  font:650 clamp(8px,2.1vw,11px)/1.1 system-ui,sans-serif;
  color:#e4eefa;
  background:#1e2c43f2;
  cursor:grab;
  touch-action:none;
  user-select:none;
  white-space:nowrap;
  text-shadow:none;
}
.hud-layout-map .hud-layout-marker[data-custom="true"]{border-style:solid;border-color:#94bad0}
.hud-layout-map .hud-layout-marker[aria-pressed="true"]{
  z-index:2;
  border-color:#aff4df;
  border-style:solid;
  background:#336056;
  color:#f1fff9;
}
.hud-layout-map .hud-layout-marker:focus-visible{outline-offset:-2px}
.hud-layout-map .hud-layout-marker:active{cursor:grabbing}
.hud-layout-controls{
  display:grid;
  align-items:end;
  grid-template-columns:minmax(0,1.8fr) minmax(0,.8fr) minmax(0,.8fr);
  gap:6px;
}
.hud-layout-controls label{display:grid;gap:4px;min-width:0;color:#d3ddec;font-size:11px}
.hud-layout-controls input,.hud-layout-controls select{width:100%;min-width:0;min-height:34px;padding:4px 6px;font-size:12px}
.hud-layout-actions{display:flex;gap:6px;flex-wrap:wrap}
.hud-layout-actions button{width:auto;padding:6px 9px;min-height:36px;font-size:11px}
@media(max-width:420px){
  .hud-layout-map{min-height:174px}
  .hud-layout-map .hud-layout-marker{padding-inline:3px}
  .hud-layout-controls{grid-template-columns:repeat(2,minmax(0,1fr))}
  .hud-layout-choice{grid-column:1/-1}
}

#game [data-hud-config-hidden],
#game .hud-widget:has(>[data-hud-config-hidden]){display:none!important}

.hud-studio-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:6px 0 0}
.hud-studio-heading small{font-size:.64rem;letter-spacing:.13em;color:#9be7d0;font-weight:750}
.hud-studio-heading h4{margin:0;color:#e8f4ff;font-size:1.04rem;line-height:1.25}
.hud-studio-heading button{font-size:.75rem;min-height:36px;padding:5px 8px;flex-shrink:0}
.hud-layout-map{
 min-height:225px;aspect-ratio:16/8.5;
 background:radial-gradient(ellipse at 50% 20%,#2d4260,#0e1726 77%);
}
.hud-layout-map::before{
 content:"";position:absolute;inset:0;pointer-events:none;z-index:-1;
 background:linear-gradient(180deg,#0b172b80,#0e162a95),url("../assets/playfield/copper-highway-597.webp") center center/cover;
}
.hud-layout-map[data-sim-hallway="off"]::before{display:none}
.hud-layout-map[data-sim-hallway="dim"]::before{opacity:.42}
.hud-layout-map::after{
 content:"";position:absolute;inset:0;pointer-events:none;z-index:-1;opacity:.38;
 background:repeating-linear-gradient(90deg,transparent 0 calc(10% - 1px),#b5c6e012 calc(10% - 1px) 10%),
  repeating-linear-gradient(0deg,transparent 0 calc(20% - 1px),#b5c6e018 calc(20% - 1px) 20%);
}
.hud-layout-stage{
 left:34%;width:32%;border-inline:1px solid #78bcdf66;display:block;
 background:repeating-linear-gradient(to right,#071327a6 0 calc(25% - 1px),#58759662 calc(25% - 1px) 25%);
}
.hud-sim-notes,.hud-sim-receptors{position:absolute;inset:0}
.hud-sim-notes>i,.hud-sim-receptors>b{
 position:absolute;left:var(--lane-x);width:15%;border-radius:4px;
 transform:translateX(-50%);background:var(--lane-color);
}
.hud-layout-stage [data-lane="0"]{--lane-x:12.5%;--lane-color:#f18cb7;--note-skin:var(--sim-sprite-0,none)}
.hud-layout-stage [data-lane="1"]{--lane-x:37.5%;--lane-color:#75e3fc;--note-skin:var(--sim-sprite-1,none)}
.hud-layout-stage [data-lane="2"]{--lane-x:62.5%;--lane-color:#a6f1af;--note-skin:var(--sim-sprite-2,none)}
.hud-layout-stage [data-lane="3"]{--lane-x:87.5%;--lane-color:#f8bc82;--note-skin:var(--sim-sprite-3,none)}
.hud-sim-notes>i{top:var(--note-y);height:6px;background:transparent;overflow:visible}
.hud-sim-notes>i::after{
 content:"";position:absolute;inset:0;border-radius:4px;background:var(--lane-color);box-shadow:0 0 9px color-mix(in srgb,var(--lane-color),transparent 30%);
}
.hud-sim-notes:has(i)[data-sim-skinned]>i::after{inset:-9px -2px;background:var(--note-skin) center/contain no-repeat;box-shadow:none}
.hud-sim-notes>i[data-hold]::before{
 content:"";position:absolute;bottom:2px;left:22%;width:56%;
 height:var(--hold-length);border-radius:5px;background:linear-gradient(180deg,transparent,var(--lane-color));
}
.hud-sim-notes>i[data-hold]{height:100%;margin-top:0}
.hud-sim-notes>i[data-hold]::before{bottom:100%}
.hud-sim-notes>i[data-hold]::after{bottom:auto;height:6px}
.hud-sim-receptors>b{
 top:77%;bottom:auto;left:var(--lane-x);right:auto;height:7px;
 box-sizing:border-box;border:1px solid var(--lane-color);background:#10182b;
}
.hud-sim-receptors>b.is-held{background:var(--lane-color);box-shadow:0 0 13px var(--lane-color)}
.hud-layout-map .hud-layout-marker{
 min-height:24px;padding:3px 6px;max-width:38%;display:grid;place-items:start;gap:2px;
 border:1px solid #5b779377;background:#101b2cdd;
}
.hud-layout-map .hud-layout-marker[hidden]{display:none}
.hud-layout-map .hud-layout-marker small{font:650 .58rem/1.05 system-ui;letter-spacing:.045em;color:#c3d6e8}
.hud-layout-map .hud-layout-marker strong{font:750 clamp(.75rem,2.4vw,1.05rem)/1.02 system-ui;color:#e8f6ff}
.hud-layout-map .hud-layout-marker[data-hud-layout-marker="combo"] strong{font-size:clamp(1.05rem,3vw,1.55rem);text-shadow:0 0 12px #9adcff6b}
.hud-layout-map .hud-layout-marker[data-hud-layout-marker="judgment"] strong{color:#f4d2a2;font-size:clamp(.65rem,1.8vw,.9rem)}
.hud-layout-map .hud-layout-marker:is([data-hud-layout-marker="hold"],[data-hud-layout-marker="judgment"]):not([data-sim-active]):not([aria-pressed="true"]){opacity:.42}
.hud-sim-bar{display:block;width:60px;height:3px;border-radius:8px;background:#546981;overflow:hidden}
.hud-sim-bar>i{display:block;width:var(--sim-progress,25%);height:100%;background:#a0efd7}
.hud-sim-keys{display:flex;gap:2px}
.hud-sim-keys kbd{display:grid;place-items:center;min-width:16px;min-height:16px;padding:1px 3px;border:1px solid #597795;border-radius:3px;background:#111b2c;color:#dcecff;font-size:.57rem}
.hud-sim-keys kbd.is-held{background:#a4f3d9;color:#10243e;border-color:#defbf3}
.hud-layout-controls .hud-layout-visible{grid-column:1/-1;display:flex;align-items:center;gap:7px;font-size:.76rem}
.hud-layout-visible input[type="checkbox"]{width:auto;min-height:auto;accent-color:#83dfc8}
@media(max-width:420px){
 .hud-layout-map{min-height:205px}
 .hud-layout-map .hud-layout-marker{padding:3px;white-space:normal}
 .hud-layout-map .hud-layout-marker small{font-size:.45rem}
 .hud-layout-map .hud-layout-marker strong{font-size:.67rem}
}
.hud-visibility{
 border:1px solid #394f66;border-radius:7px;padding:7px 9px;
 background:#122134;color:#d9e8f4;font-size:.75rem;
}
.hud-visibility summary{cursor:pointer;min-height:24px;padding-top:2px}
.hud-visibility summary span{float:right;color:#9bb6cb;font-size:.69rem}
.hud-visibility>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 10px;padding-block:6px}
.hud-visibility label{display:flex;align-items:center;gap:6px;min-width:0;line-height:1.2}
.hud-visibility input{margin:0;accent-color:#83dfc8}
