/* In-match HUD. Every corner has one owner; the battlefield centre stays clear. Tokens only. */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud [data-hud], #hud button, #hud input, #hud canvas { pointer-events: auto; }

/* Top centre: all six champions, score, clock, towers */
.topbar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  zoom: var(--ui-scale);
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  padding: var(--s2) var(--s4) var(--s3);
  background: var(--panel);
  border: 2px solid var(--line);
  border-top: none;
}
.tb-team { gap: var(--s2); align-items: flex-start; }
.tm { display: flex; flex-direction: column; gap: 3px; width: 64px; }
.tm .portrait { --size: 64px; }
.inspect-portrait { border: none; padding: 0; background: transparent; }
.inspect-portrait:focus-visible { outline: 2px solid var(--you); }
.tm-note { text-align: center; }
.score { display: flex; flex-direction: column; align-items: center; min-width: 170px; }
.score .big { font-size: var(--t-xl); display: flex; align-items: center; gap: var(--s2); }
.score .clock { font-size: var(--t-l); color: var(--text-dim); }
.tb-towers { gap: var(--s1); }

/* Top right: your score and quick toggles */
.mystats {
  position: absolute;
  top: var(--s3);
  right: var(--s4);
  zoom: var(--ui-scale);
  display: flex;
  gap: var(--s3);
  align-items: center;
  padding: var(--s2) var(--s3);
  background: var(--panel);
  border: 2px solid var(--line);
}

/* One left dock: inspection and death recap stack, never cover each other. */
.inspection-dock {
  position: absolute;
  top: var(--s3);
  left: var(--s4);
  bottom: 210px;
  zoom: var(--ui-scale);
  width: 380px;
  max-width: calc(100vw / var(--ui-scale) - 32px);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  overflow-y: visible;
  pointer-events: none;
}
.inspection-dock > .panel { flex-shrink: 0; }
#hud .inspection-dock, #hud .inspection-dock .target { pointer-events: none; }
#hud.is-dead .inspection-dock { overflow-y: auto; }
.target { width: 280px; max-width: 100%; padding: var(--s2); font-size: var(--t-xs); }
.target > .row { gap: var(--s2); }
.target .portrait { --size: 36px; border-width: 1px; }
.target .portrait .lvl { min-width: 16px; line-height: 14px; right: -2px; bottom: -2px; }
.target-kind { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); flex: none; }
.target .grow { min-width: 0; }
.target .sm { font-size: var(--t-xs); }
.target .bar { height: 14px; }
.target .bar .val { font-size: calc(var(--t-xs) - 4px); line-height: 1; }
.target .bar.thin { height: 4px; }
.target .btn.small { padding: 2px var(--s2); font-size: var(--t-xs); align-self: flex-start; }
.target-stats { gap: var(--s2); margin-top: var(--s1); justify-content: space-between; }
.target-stats .stat { gap: 3px; font-size: var(--t-xs); }
.target-stats .stat svg { width: 14px; height: 14px; }
.target-items { gap: 3px; margin-top: var(--s1); }
.target-buffs { gap: 3px; margin-top: var(--s1); flex-wrap: wrap; }
.target-buffs .buff { width: 24px; height: 24px; background-size: auto 24px; background-position: calc(var(--i) * -24px) 0; }

/* Right: game feed, a quiet chat-style log; newest last, each line fades out on its own */
.feed { position: absolute; top: 76px; right: var(--s4); zoom: var(--ui-scale); width: 380px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.feed .k { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 var(--s1); padding: 2px var(--s2); font-size: var(--t-xs); line-height: 1.35; background: linear-gradient(90deg, transparent, var(--scrim) 35%); text-shadow: 0 1px 2px var(--shadow); animation: feed-line 14s linear forwards; }
.feed .k .t { color: var(--text-faint); margin-right: var(--s1); font-variant-numeric: tabular-nums; }
.feed .k .gold { color: var(--you); font-weight: 700; }
@keyframes feed-line { 0% { opacity: 0; transform: translateY(-3px); } 3% { opacity: 1; transform: none; } 70% { opacity: 0.85; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .feed .k { animation: none; } }

/* Banner: major events only, below the top bar */
.notifications {
  position: absolute;
  top: 128px;
  left: 50%;
  transform: translateX(-50%);
  zoom: var(--ui-scale);
  width: 500px;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.banner {
  text-align: center;
  padding: var(--s3) var(--s7);
  background: linear-gradient(90deg, transparent, var(--scrim-strong) 15%, var(--scrim-strong) 85%, transparent);
  pointer-events: none;
  z-index: var(--z-banner);
}
.banner.good h3 { color: var(--ally); }
.banner.bad h3 { color: var(--enemy); }

/* Above the combat cluster: status, recall, hint */
.status, .hint, .recall { position: absolute; left: 50%; transform: translateX(-50%); zoom: var(--ui-scale); }
.status {
  bottom: 236px;
  padding: var(--s2) var(--s4);
  background: var(--panel);
  border: 2px solid var(--you);
  font-weight: 700;
}
.recall { bottom: 290px; width: 360px; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s1); }
.hint { bottom: 200px; color: var(--text-dim); background: var(--panel-soft); padding: var(--s1) var(--s3); white-space: nowrap; }
.respawn { text-align: center; text-shadow: 0 2px 8px var(--bg-0); }
.respawn .t { font-size: var(--t-hero); line-height: 1; }

/* Bottom left: compact stats */
.statspanel {
  position: absolute;
  bottom: 0;
  left: 0;
  zoom: var(--ui-scale);
  width: 290px;
  padding: var(--s3) var(--s4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2) var(--s3);
  background: var(--panel);
  border: 2px solid var(--line);
  border-left: none;
  border-bottom: none;
}
.statspanel .all-stats { grid-column: 1 / -1; }
.allstats {
  position: absolute;
  top: 128px;
  left: var(--s4);
  zoom: var(--ui-scale);
  width: 720px;
  max-width: calc(100vw / var(--ui-scale) - 32px);
  max-height: calc(100vh / var(--ui-scale) - 148px);
  overflow-y: auto;
  z-index: var(--z-overlay);
}
.allstats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s5); padding: var(--s4); }
.allstat { display: flex; flex-direction: column; gap: 2px; }

/* Bottom centre: the combat cluster */
.combat {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  zoom: var(--ui-scale);
  display: flex;
  align-items: flex-end;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  background: var(--panel);
  border: 2px solid var(--line);
  border-bottom: none;
}
.combat .me { align-items: center; gap: var(--s1); width: 108px; }
.combat .me .bar { width: 104px; }
.combat .points { font-weight: 700; }
.abil { display: flex; flex-direction: column; gap: var(--s2); position: relative; }
.buffs { position: absolute; bottom: 100%; left: 0; margin-bottom: var(--s2); display: flex; gap: var(--s1); flex-wrap: wrap; max-width: 520px; }
.buff { position: relative; width: 32px; height: 32px; background: url(../content/3af6603e81fa736042efcbcf89da16ccb94c131c68eeaac23a6203724cc46f0b.png) calc(var(--i) * -32px) 0 / auto 32px no-repeat; image-rendering: pixelated; cursor: help; }
.buff b { position: absolute; right: 1px; bottom: 0; z-index: 1; font-size: var(--t-xs); line-height: 1; color: var(--text); text-shadow: 0 0 2px var(--bg-0), 1px 1px 0 var(--bg-0); }
.buff.bad { filter: drop-shadow(0 0 3px var(--enemy)); }
.buff.starter { background: none; border: 1px solid var(--line); }
.buff.starter img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.buff.starter.mastered { border-color: var(--you); }
.slots { display: flex; gap: var(--s3); align-items: flex-end; padding-top: var(--s5); }
.slotcol { align-items: center; gap: 0; }
.slot.passive { margin-bottom: 17px; }
.bars { display: flex; flex-direction: column; gap: 3px; width: 470px; }
.bars .bar { height: 22px; }
.bars .bar.mana { height: 16px; }
.econ { gap: var(--s2); }
.inv { display: grid; grid-template-columns: repeat(3, 54px); gap: var(--s2); }
.goldbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  background: var(--bg-1);
  border: 2px solid var(--line-strong);
  padding: var(--s1) var(--s3);
  color: var(--text);
}
.goldbox:is(:hover, .virtual-hover) { border-color: var(--you); }

/* Bottom right: minimap */
.minimap-frame {
  position: absolute;
  right: 0;
  bottom: 0;
  zoom: var(--ui-scale);
  width: 452px;
  height: 222px;
  background: var(--bg-0);
  border: 2px solid var(--line);
  border-right: none;
  border-bottom: none;
}
#minimap { width: 448px; height: 216px; display: block; image-rendering: pixelated; }

/* Camp leash warning (camp-feedback.ts) */
.camp-warning {
  position: fixed;
  top: 200px;
  left: 50%;
  transform: translateX(-50%);
  zoom: var(--ui-scale);
  z-index: var(--z-banner);
  padding: var(--s2) var(--s4);
  background: var(--panel);
  border: 2px solid var(--line-strong);
  font-weight: 700;
  font-size: var(--t-s);
  max-width: 640px;
  text-align: center;
  pointer-events: none;
}
.camp-warning[data-state='warning'] { border-color: var(--physical); color: var(--physical); }
.camp-warning[data-state='returning'] { border-color: var(--text-dim); color: var(--text-dim); }

/* Out of mana: a soft blue glow at the screen edge while no learned spell is affordable; a hard flash when a cast is refused. */
#mana-edge { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s;
  box-shadow: inset 0 0 90px 24px var(--mana-tint); }
#mana-edge.on { opacity: 0.75; animation: mana-pulse 1.6s ease-in-out infinite; }
#mana-edge.flash { animation: mana-flash 0.6s ease-out; }
@keyframes mana-pulse { 50% { opacity: 0.4; } }
@keyframes mana-flash { 0% { opacity: 1; box-shadow: inset 0 0 140px 44px var(--mana); } 100% { opacity: 0.75; } }

.core-alert {
  z-index: var(--z-banner);
  position: absolute;
  top: calc(124px * var(--ui-scale));
  left: 50%;
  transform: translateX(-50%);
  color: var(--enemy);
  border-color: var(--enemy);
  padding: var(--s2) var(--s3);
  font-weight: 700;
  pointer-events: none;
}
