/* With the clock on the field, economy and build pills share the whole row. */
#app .battle-dock .resources{
  grid-template-columns:minmax(78px,1.18fr) minmax(53px,.94fr) minmax(76px,1.12fr) minmax(54px,1fr) minmax(54px,1fr);
  gap:3px;height:44px;min-height:44px;padding:0;
}
#app .battle-dock .resources .resource{gap:2px;min-width:0}
#app .battle-dock .resources .resource b{font-size:19px;font-variant-numeric:tabular-nums}
#app .battle-dock .resources .resource>[data-icon],#app .battle-dock .resources .resource .icon{width:12px;height:17px}
#app .battle-dock .resources .population{justify-content:center;gap:3px;margin:0;padding-inline-end:6px;white-space:nowrap}
#app .battle-dock .resources #population{font-size:clamp(16px,4.7vw,19px);line-height:1;font-weight:750}
#app .battle-dock .resources #population.wide-population{font-size:clamp(13px,3.8vw,16px)}
#app .battle-dock .resources #population em{font-size:inherit;font-style:normal;vertical-align:baseline;color:#c5d2be}
#app .battle-dock .resources #resource-population>[data-icon],#app .battle-dock .resources #resource-population .icon{
  display:inline-flex;flex:none;width:17px;height:20px;color:#cde4b6;
}
#app .battle-dock .resources .tier-button,#app .battle-dock .resources .command-button{
  position:relative;display:flex;flex-direction:row;align-items:center;justify-content:center;
  width:100%;min-width:44px;height:44px;min-height:44px;max-height:44px;
  margin:0;padding:0 3px;gap:3px;clip-path:none;border-radius:9px;
  white-space:nowrap;overflow:hidden;touch-action:manipulation;
}
#app .battle-dock .resources .tier-button{border-color:#d4bc7a88;background:linear-gradient(145deg,#514d32,#293c30)}
#app .battle-dock .resources .tier-button>.dock-tier-copy,#app .battle-dock .resources .command-button>.dock-build-copy{
  position:static;display:inline-flex;flex-direction:row;align-items:center;justify-content:center;
  width:auto;height:auto;min-width:0;margin:0;padding:0;gap:3px;clip:auto;overflow:visible;border:0;
}
#app .battle-dock .resources .dock-tier-label{display:inline-flex;align-items:center;gap:2px}
#app .battle-dock .resources .dock-tier-label>[data-icon],#app .battle-dock .resources .dock-tier-label .icon{display:block;width:12px;height:13px}
#app .battle-dock .resources #tier-cost[hidden]{display:none}
#app .battle-dock .resources #tier-name{display:inline;font-size:clamp(10px,2.7vw,12px);line-height:1;letter-spacing:-.2px}
#app .battle-dock .resources #tier-cost,#app .battle-dock .resources #camp-cost,#app .battle-dock .resources #sanctum-cost{
  position:static;display:inline-flex;align-items:center;justify-content:center;gap:1px;
  width:auto;height:auto;margin:0;padding:0;clip:auto;overflow:visible;
  font-size:clamp(11px,2.7vw,13px);font-weight:750;line-height:1;color:#c6e9ff;font-variant-numeric:tabular-nums;
}
#app .battle-dock .resources .dock-pill-mana{display:inline;font-size:12px;line-height:1;color:#9fd5ef}
#app .battle-dock .resources .dock-build-art{display:block;width:29px;height:35px;object-fit:contain;flex:none}
#app .battle-dock .resources .dock-build-name{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#app .battle-dock .resources .tier-progress{position:absolute;width:1px;height:1px;margin:-1px;clip-path:inset(50%);overflow:hidden}
#app .battle-dock .resources .tier-button:focus-visible,#app .battle-dock .resources .command-button:focus-visible{outline:2px solid #bbdef3;outline-offset:1px}
@media(max-width:350px){
  #app .battle-dock .resources{grid-template-columns:minmax(67px,1.14fr) minmax(47px,.9fr) minmax(69px,1.12fr) minmax(51px,1fr) minmax(51px,1fr)}
  #app .battle-dock .resources .resource b{font-size:17px}
  #app .battle-dock .resources .resource>[data-icon],#app .battle-dock .resources .resource .icon{width:10px;height:15px}
  #app .battle-dock .resources .command-button{padding:0 2px;gap:2px}
  #app .battle-dock .resources .dock-build-art{width:23px;height:32px}
}

#app .battle-utilities .ability-utility{padding:2px 3px;gap:2px}
#app .battle-utilities .ability-utility:disabled{opacity:1;color:#c6bb94;background:#353527}
#app .battle-utilities .ability-utility>[data-icon]>.icon{width:15px;height:15px}
#app .battle-utilities #hero-ability-name{
  display:block;max-width:100%;font-size:clamp(10px,3vw,12px);line-height:1;white-space:normal;text-align:center;
}
#app .battle-utilities .ability-utility .utility-cooldown{top:2px;right:2px;bottom:auto;font-size:9px;line-height:13px}

@property --research-elapsed{
  syntax:'<angle>';inherits:true;initial-value:0turn;
}
@property --tier-shine-angle{
  syntax:'<angle>';inherits:false;initial-value:-40deg;
}

/* Research uses the same clockwise face for training and castle upgrades. */
#app .battle-dock .research-clock{
  --clock-size:28px;
  --research-elapsed:calc(clamp(0,var(--research-progress,0),1) * 1turn);
  position:relative;display:block;flex:none;inline-size:var(--clock-size);block-size:var(--clock-size);
  color:#effaff;border:1px solid #9bd7ff;border-radius:50%;pointer-events:none;
  background:#22436c;
  background:conic-gradient(#71b5ee 0 var(--research-elapsed),#22436c var(--research-elapsed) 1turn);
  box-shadow:inset 0 0 0 1px #16314f,0 0 6px #298be78a;
  transition:--research-elapsed 100ms linear;
}
#app .battle-dock .research-clock::after{
  content:'';position:absolute;left:50%;top:50%;width:4px;height:4px;border-radius:50%;
  background:currentColor;transform:translate(-50%,-50%);
}
#app .battle-dock .research-clock-hand{
  position:absolute;left:50%;top:0;width:2px;height:50%;border-radius:2px;
  background:currentColor;box-shadow:0 0 2px #173653;
  transform-origin:center bottom;transform:translateX(-50%) rotate(var(--research-elapsed));
}
#app .battle-dock .card-ready-timer{
  gap:2px;padding:4px 1px;background:#122b4bd1;pointer-events:none;
  color:#eef8ff;font-size:15px;line-height:1;font-variant-numeric:tabular-nums;
}
#app .battle-dock .card-ready-timer b{font-size:15px;line-height:1.05}
#app .battle-dock .card-ready-timer small{font-size:7px;line-height:1.2;letter-spacing:.1px;font-weight:650}
#app .battle-dock .card-ready-timer[hidden],#app .battle-dock .research-clock[hidden],
#app .battle-dock .tier-button:not(.researching)>.research-clock{display:none}
#app .battle-dock .resources .tier-button.researching{
  gap:4px;opacity:1;color:#deefff;border-color:#77b4e5;background:linear-gradient(145deg,#284e78,#182d47);
}
#app .battle-dock .resources .tier-button.researching>.research-clock{order:-1;--clock-size:24px}
#app .battle-dock .resources .tier-button.researching>.dock-tier-copy{flex-direction:column;gap:2px}

#app .battle-dock .unit-card.research-just-ready{
  border-color:#abddff;
  box-shadow:inset 0 0 0 1px rgba(209,239,255,var(--research-ready-level,1)),0 0 9px rgba(137,205,255,var(--research-ready-level,1));
}
#app .battle-dock .research-ready-label{
  display:none;position:absolute;z-index:3;left:50%;top:50%;transform:translate(-50%,-50%);
  max-width:calc(100% - 2px);padding:3px 3px;border:1px solid #a3d9ff;border-radius:4px;
  background:#173955;color:#effaff;pointer-events:none;white-space:nowrap;
  font-size:clamp(7px,2.2vw,10px);font-weight:850;line-height:1;letter-spacing:.025em;
  opacity:clamp(0,calc(var(--research-ready-level,1) * 1.8),1);
}
#app .battle-dock .research-just-ready>.research-ready-label{display:block}
#app .battle-dock .research-sr-status{
  position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}

/* The match clock drives the shine around a border-only mask. */
#app .battle-dock[data-tier-celebration="2"]{--tier-accent:#8fd5ff;--tier-badge-surface:#172e51}
#app .battle-dock[data-tier-celebration="3"]{--tier-accent:#f6cb79;--tier-badge-surface:#302719}
#app .battle-dock[data-tier-celebration]::after{
  content:'';position:absolute;inset:0;z-index:5;border-radius:inherit;pointer-events:none;
  opacity:var(--tier-shine-intensity,0);box-shadow:inset 0 0 0 2px var(--tier-accent,#8fd5ff);
}
@supports (mask-composite:exclude) or (-webkit-mask-composite:xor){
  #app .battle-dock[data-tier-celebration]::after{
    --tier-shine-angle:calc(var(--tier-shine-progress,0) * 1turn - 40deg);
    padding:2px;box-shadow:none;
    background:conic-gradient(from var(--tier-shine-angle),
      transparent 0deg,var(--tier-accent,#8fd5ff) 26deg,#fff 37deg,transparent 46deg 1turn);
    -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
    -webkit-mask-composite:xor;
    mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
    mask-composite:exclude;
    transition:--tier-shine-angle 100ms linear;
  }
}
#app .battle-dock .tier-celebration{
  display:none;position:absolute;z-index:6;left:50%;bottom:calc(100% + 7px);transform:translateX(-50%);
  min-width:104px;padding:4px 14px;border:1px solid var(--tier-accent,#8fd5ff);border-radius:7px;
  background:var(--tier-badge-surface,#172e51);color:var(--tier-accent,#8fd5ff);
  box-shadow:0 0 16px rgba(10,20,26,.65);pointer-events:none;white-space:nowrap;
  text-align:center;font-size:clamp(18px,5vw,26px);line-height:1.12;font-weight:850;letter-spacing:.07em;
  opacity:var(--tier-shine-intensity,0);
}
#app .battle-dock[data-tier-celebration] .tier-celebration{display:block}
#app .battle-dock .resources .tier-button.tier-ready{
  color:#f5faff;opacity:1;border-color:var(--tier-accent,#8fd5ff);
  box-shadow:inset 0 0 0 1px rgba(204,235,255,var(--research-ready-level,1));
}
#app .battle-dock .resources .tier-button.tier-ready #tier-name{font-weight:900;text-shadow:0 0 6px var(--tier-accent,#8fd5ff)}

@media(prefers-reduced-motion:reduce){
  #app .battle-dock .research-clock{--research-elapsed:0turn;transition:none}
  #app .battle-dock .research-clock-hand{transform:translateX(-50%)}
  #app .battle-dock .research-just-ready>.research-ready-label{opacity:1}
  #app .battle-dock[data-tier-celebration]::after{background:var(--tier-accent,#8fd5ff);opacity:.85;transition:none}
  #app .battle-dock[data-tier-celebration] .tier-celebration{opacity:1}
}
#app #battle-clock.sudden-death{border-color:#f9a256;color:#ffead0;background:#571f16;box-shadow:inset 0 0 0 1px #f8944c7a,0 0 16px #f16d3570}
#app #battle-clock.sudden-death-rise{animation:burn-clock-flare 850ms ease-out 3}
@keyframes burn-clock-flare{0%{box-shadow:inset 0 0 0 1px #fff0c2,0 0 19px 4px #ff9a49c0}100%{box-shadow:inset 0 0 0 1px #f8944c7a,0 0 16px #f16d3530}}
.battle-phase{position:absolute;z-index:7;top:17%;left:50%;transform:translateX(-50%);width:max-content;max-width:92%;padding:8px 20px;text-align:center;border:1px solid #ffba72;border-radius:9px;background:#592419f5;color:#ffe8c4;box-shadow:0 0 24px #fa702b70,inset 0 0 0 1px #ffb67366;pointer-events:none}
.battle-phase[hidden],.opening-aim[hidden]{display:none}
.battle-phase strong,.battle-phase small{display:block}
.battle-phase strong{font:800 clamp(19px,6vw,30px)/1.1 Georgia,serif}
.battle-phase small{margin-top:3px;font-size:12px;font-weight:650;line-height:1.25}
.battle-phase[data-phase="opening"]{border-color:#cbd59b;color:#f0ecc9;background:#1e3529ef;box-shadow:0 0 18px #a2b79436}
.opening-aim{position:absolute;z-index:4;display:grid;place-items:center;width:32px;height:32px;transform:translate(-50%,-50%);border:1px solid #fff3ae;border-radius:50%;background:#24503ac7;color:#fff4bc;box-shadow:0 0 0 4px #eee69c33;pointer-events:none}
.opening-aim>.icon{width:20px;height:20px}
@media(prefers-reduced-motion:reduce){#app #battle-clock.sudden-death-rise{animation:none}}
