:root {
  --bg: #0a0708;
  --panel: rgba(18, 14, 18, 0.92);
  --panel-2: rgba(28, 22, 28, 0.9);
  --line: rgba(255, 168, 92, 0.22);
  --line-strong: rgba(255, 168, 92, 0.55);
  --gold: #ffb648;
  --ember: #ff6a2c;
  --arcane: #a97bff;
  --text: #f2e6dc;
  --muted: #a2938c;
  --good: #7fe08a;
  --bad: #ff5d5d;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='30'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ffe2a0'/%3E%3Cstop offset='.55' stop-color='%23c58cff'/%3E%3Cstop offset='1' stop-color='%237a3cff'/%3E%3C/linearGradient%3E%3Cfilter id='b' x='-50%' y='-50%' width='200%' height='200%'%3E%3CfeGaussianBlur stdDeviation='1.1'/%3E%3C/filter%3E%3C/defs%3E%3Cpath d='M2 2v20l5.5-5.5 4 9 3.4-1.5-4-8.8H18Z' fill='%239b5cff' filter='url(%23b)'/%3E%3Cpath d='M2 2v20l5.5-5.5 4 9 3.4-1.5-4-8.8H18Z' fill='url(%23g)' stroke='%2314081f' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M4 6v11l3-3' fill='none' stroke='%23fff' stroke-opacity='.8' stroke-width='1.1' stroke-linecap='round'/%3E%3Cpath d='M22 2l.9 2.6 2.6.9-2.6.9-.9 2.6-.9-2.6-2.6-.9 2.6-.9Z' fill='%23ffd27a' stroke='%2314081f' stroke-width='.6'/%3E%3C/svg%3E") 2 2, default;
}

/* The WebGL world and the crisp 2D overlay stack on top of each other. */
#game, #overlay { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#game { z-index: 0;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cdefs%3E%3Cfilter id='b' x='-50%' y='-50%' width='200%' height='200%'%3E%3CfeGaussianBlur stdDeviation='1.3'/%3E%3C/filter%3E%3C/defs%3E%3Ccircle cx='16' cy='16' r='11' fill='none' stroke='%238a4dff' stroke-width='3' filter='url(%23b)'/%3E%3Ccircle cx='16' cy='16' r='11' fill='none' stroke='%23000' stroke-opacity='.6' stroke-width='3'/%3E%3Ccircle cx='16' cy='16' r='11' fill='none' stroke='%23b98cff' stroke-width='1.4'/%3E%3Ccircle cx='16' cy='16' r='8.6' fill='none' stroke='%23e2d0ff' stroke-width='1' stroke-dasharray='.8 2.2' stroke-opacity='.85'/%3E%3Cpath d='M16 8.5 22.5 19.75H9.5ZM16 23.5 9.5 12.25H22.5Z' fill='none' stroke='%23000' stroke-opacity='.5' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M16 8.5 22.5 19.75H9.5ZM16 23.5 9.5 12.25H22.5Z' fill='none' stroke='%23ffb648' stroke-width='.9' stroke-linejoin='round'/%3E%3Cpath d='M16 .5l1.1 3L16 6.5l-1.1-3ZM16 25.5l1.1 3L16 31.5l-1.1-3ZM.5 16l3-1.1L6.5 16l-3 1.1ZM25.5 16l3-1.1 3 1.1-3 1.1Z' fill='%23ffd27a' stroke='%23000' stroke-opacity='.6' stroke-width='.7'/%3E%3Ccircle cx='16' cy='16' r='2.6' fill='%23c9a2ff' filter='url(%23b)'/%3E%3Ccircle cx='16' cy='16' r='1.3' fill='%23fff'/%3E%3C/svg%3E") 16 16, crosshair; }
#overlay { z-index: 1; pointer-events: none; }

.hidden { display: none !important; }

/* ---------------------------------------------------------------- screens */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 40;
}

.menu-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 92, 20, 0.35), transparent 60%),
    radial-gradient(ellipse at 20% 0%, rgba(120, 60, 200, 0.20), transparent 55%),
    linear-gradient(180deg, #0b0709, #150c0a 60%, #200e08);
}
.menu-bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 50% 50%, rgba(255,140,60,0.08) 0 1px, transparent 1px);
  background-size: 42px 42px;
  animation: drift 30s linear infinite;
  opacity: .6;
}
@keyframes drift { to { background-position: 200px -320px; } }

.menu-panel, .lobby-panel, .end-panel, .help-panel, .custom-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 38px;
  box-shadow: 0 30px 90px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter: blur(6px);
}

.logo {
  font-family: 'Cinzel', serif;
  font-size: 62px; letter-spacing: .16em;
  text-align: center;
  background: linear-gradient(180deg, #ffd9a0, var(--ember) 60%, #a3341a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px rgba(255,110,40,.45);
}
.tagline { text-align: center; color: var(--muted); letter-spacing: .28em; font-size: 12px; margin: 4px 0 26px; text-transform: uppercase; }

.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

input, select {
  width: 100%;
  background: rgba(0,0,0,.45);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-family: inherit; font-size: 16px; font-weight: 600;
  outline: none;
}
input:focus, select:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(255,150,60,.12); }

.btn {
  background: linear-gradient(180deg, rgba(70,50,45,.9), rgba(40,28,26,.9));
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 18px; border-radius: var(--radius);
  font-family: inherit; font-weight: 700; font-size: 15px; letter-spacing: .06em;
  cursor: pointer; transition: .14s;
}
.btn:hover { border-color: var(--line-strong); transform: translateY(-1px); background: linear-gradient(180deg, rgba(95,66,56,.95), rgba(52,34,30,.95)); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(180deg, #ff8a3c, #d1401a); border-color: #ffb060; color: #180a06; }
.btn-primary:hover { background: linear-gradient(180deg, #ffa055, #e04b1f); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-big { width: 100%; padding: 16px; font-size: 19px; margin-top: 8px; }

.menu-actions { display: grid; gap: 12px; }
.auth-row { display: flex; gap: 10px; margin: -6px 0 16px; }
.auth-row input { flex: 1; min-width: 0; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.join-row input { text-transform: uppercase; text-align: center; letter-spacing: .3em; }

.menu-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; font-family: inherit; font-size: 14px; text-decoration: underline; }
.link:hover { color: var(--gold); }
.conn { font-size: 12px; color: var(--muted); }
.conn.on { color: var(--good); }

/* ---------------------------------------------------------------- lobby */
.lobby-panel { width: min(920px, 94vw); }
.lobby-head { display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 18px; }
.lobby-head .label { font-size: 11px; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); }
.room-code { font-family: 'Cinzel', serif; font-size: 34px; letter-spacing: .3em; color: var(--gold); }
.lobby-head .btn { margin-left: auto; }
.lobby-head .btn + .btn { margin-left: 0; }

.lobby-body { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; }
.lobby-body h3 { font-family: 'Cinzel', serif; font-size: 15px; letter-spacing: .16em; color: var(--gold); margin-bottom: 12px; }
#lobbyList { list-style: none; display: grid; gap: 8px; min-height: 220px; align-content: start; }
#lobbyList li {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid rgba(255,255,255,.06);
  padding: 9px 12px; border-radius: 8px; font-weight: 600;
}
#lobbyList .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
#lobbyList .tagme { font-size: 11px; color: var(--gold); border: 1px solid var(--line); padding: 1px 6px; border-radius: 20px; }
#lobbyList .tagbot { font-size: 11px; color: var(--arcane); border: 1px solid rgba(169,123,255,.4); padding: 1px 6px; border-radius: 20px; }
#lobbyList .kick { margin-left: auto; background: none; border: none; color: var(--bad); cursor: pointer; font-size: 18px; }
.bot-add { margin-top: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; text-align: center; }

/* ---------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; font-weight: 600; }

#topBar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
#phaseBox {
  background: rgba(10,6,8,.72); border: 1px solid var(--line);
  display: inline-block; border-radius: 12px; padding: 6px 26px; min-width: 200px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
#phaseName { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
#phaseTimer { font-family: 'Cinzel', serif; font-size: 30px; line-height: 1.05; color: var(--gold); }
#phaseTimer.urgent { color: var(--bad); animation: pulse .6s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
#roundBox { margin-top: 6px; font-size: 13px; letter-spacing: .12em; color: var(--muted); }

#scoreboard {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%); width: max-content;
  display: grid; grid-template-columns: 1fr var(--mid) 1fr; --mid: 380px;   /* left half | phase, round, objective | right half; equal 1fr keeps the gap centred */
}
#scoreboard .side { display: flex; gap: 12px; justify-content: flex-end; }
#scoreboard .side + .side { grid-column: 3; justify-content: flex-start; }
#scoreboard .row { display: flex; flex-direction: column; align-items: center; width: 94px; padding-top: 26px; }
#scoreboard .face {
  position: relative; width: 80px; height: 80px; border-radius: 50%;
  border: 3px solid var(--pc); box-shadow: 0 0 10px var(--pc), inset 0 0 12px rgba(0,0,0,.8);
  background: radial-gradient(#3a2a1e, #120b08); display: grid; place-items: center; color: var(--pc);
}
#scoreboard .face .gi { width: 34px; height: 34px; }
/* the head rises over the ring, but below the ring's centre the picture is cut to the circle, so collars stay inside */
#scoreboard .face img { position: absolute; left: -12px; bottom: 0; width: 104px; height: 104px; z-index: 1; pointer-events: none;
  --m: linear-gradient(#000 0 0) top / 100% 64px no-repeat, radial-gradient(circle 40px at 52px 64px, #000 97%, transparent);
  -webkit-mask: var(--m); mask: var(--m); }
#scoreboard .face:has(img) .gi { display: none; }
/* hurt (--hurt > 0): the head throbs and bleeds a red glow, still when healthy */
#scoreboard .row:not(.dead) .face img { transform-origin: 50% 100%; filter: drop-shadow(0 0 calc(7px * var(--hurt)) rgba(255,30,20,calc(var(--hurt) * .8))); animation: faceThrob .7s ease-in-out infinite; }
@keyframes faceThrob { 50% { transform: scale(calc(1 + .07 * var(--hurt))); filter: drop-shadow(0 0 calc(12px * var(--hurt)) rgba(255,30,20,calc(var(--hurt) * .85))); } }
#scoreboard .face img.hurt { opacity: var(--hurt, 0); transition: opacity .3s; }
#scoreboard .row { --hurt: 0; }
#scoreboard .face::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 18px rgba(255,30,20,calc(var(--hurt) * .9)); }
#scoreboard .row:not(.dead) .face { box-shadow: 0 0 10px var(--pc), 0 0 calc(4px + 16px * var(--hurt)) calc(6px * var(--hurt)) rgba(255,40,25,calc(var(--hurt) * .85)), inset 0 0 12px rgba(0,0,0,.8); }
#scoreboard .hp { width: 80px; height: 6px; margin-top: 2px; border-radius: 3px; background: rgba(0,0,0,.7); border: 1px solid rgba(0,0,0,.9); overflow: hidden; }
#scoreboard .hp i { display: block; height: 100%; transition: width .15s; }
#scoreboard .row.me .face { outline: 2px solid var(--gold); outline-offset: 2px; }
#scoreboard .row.dead { opacity: .45; filter: grayscale(1); }
#scoreboard .nm {
  font-family: 'Grenze Gotisch', 'Cinzel', serif; font-size: 17px; line-height: 1.1; margin-top: 3px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #f3e6c8; text-shadow: 0 1px 0 #000, 0 0 6px rgba(0,0,0,.9);
}
#scoreboard .kd { color: var(--muted); font-size: 11px; }
#scoreboard .kd b { color: var(--gold); font-size: 13px; }
@media (max-height: 900px) { #scoreboard { zoom: .62; --mid: 610px; } }

#killFeed { position: absolute; top: 14px; right: 14px; display: grid; gap: 5px; justify-items: end; }
#pingBox { position: absolute; top: 14px; left: 14px; padding: 3px 8px; border-radius: 6px; background: rgba(6,4,6,.55); font-size: 13px; font-variant-numeric: tabular-nums; }
.kf {
  background: rgba(10,6,8,.7); border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; padding: 5px 10px; font-size: 13px;
  animation: kfIn .25s ease-out;
}
@keyframes kfIn { from { transform: translateX(30px); opacity: 0; } }

#bottomBar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 18px;
}

#statusPanel { width: 280px; position: relative; }
.hp-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.hp-bar {
  position: relative; flex: 1; height: 34px;
  background: rgba(0,0,0,.7); border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px; overflow: hidden; transform: skewX(-8deg);
}
#hpFill, #hpLag { position: absolute; inset: 0 auto 0 0; width: 100%; }
#hpFill {
  background: var(--hpc, #5fd35f); transition: width .12s, background-color .3s;
  box-shadow: inset 0 -8px 12px rgba(0,0,0,.3), inset 0 2px 0 rgba(255,255,255,.3);
}
/* --hurt: throbbing red glow + a crackling flicker, faint on yellow, strong on red */
.hp-bar { --hurt: 0; animation: hpThrob .8s ease-in-out infinite; }
@keyframes hpThrob { 50% { box-shadow: 0 0 calc(18px * var(--hurt)) calc(3px * var(--hurt)) rgba(255,40,25,calc(var(--hurt) * .9)); filter: brightness(calc(1 + .35 * var(--hurt))); } }
#hpFill { animation: hpCrackle 1.7s steps(1) infinite; }
@keyframes hpCrackle {
  0%, 11%, 45%, 76%, 100% { filter: brightness(1); }
  7%  { filter: brightness(calc(1 + 1.1 * var(--hurt))); }
  9%  { filter: brightness(calc(1 - .35 * var(--hurt))); }
  43% { filter: brightness(calc(1 + .7 * var(--hurt))); }
  71% { filter: brightness(calc(1 + 1.4 * var(--hurt))); }
  73% { filter: brightness(calc(1 - .4 * var(--hurt))); }
}
#hpShield {   /* Ballad: extra HP laid on the end of the bar */
  position: absolute; inset: 0 auto 0 0; width: 0; transition: left .12s, width .12s;
  background: repeating-linear-gradient(-45deg, #d9dde3 0 6px, #aeb4bd 6px 12px);
  box-shadow: inset 0 -8px 12px rgba(0,0,0,.3), inset 0 2px 0 rgba(255,255,255,.6);
}
#hpText i { color: #d9dde3; font-style: normal; }
#hpLag { background: #fff; opacity: .55; transition: width .5s .35s ease-in; }   /* the chunk just lost, drains late */
.hp-bar::after {   /* segment ticks, --seg = 100 HP as a fraction of max */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(var(--seg, 25%) - 2px), rgba(0,0,0,.45) 0 var(--seg, 25%));
}
#hpText {
  position: absolute; z-index: 1; inset: 0 10px; display: flex; align-items: baseline; justify-content: flex-end; gap: 2px;
  transform: skewX(8deg); text-shadow: 0 1px 3px #000, 0 0 6px #000; line-height: 34px;
}
#hpText b { font-size: 24px; font-weight: 800; }
#hpText small { font-size: 12px; opacity: .75; }
#hpPops { position: absolute; left: 0; right: 40px; bottom: 100%; height: 0; }
#hpPops i {
  position: absolute; right: 0; bottom: 2px; font-style: normal; font-size: 22px; font-weight: 800;
  text-shadow: 0 1px 3px #000, 0 0 6px #000; animation: hpPop 1s ease-out forwards;
}
#hpPops i.dmg { color: #ff4a3d; }
#hpPops i.heal { color: #7fe08a; }
@keyframes hpPop { from { transform: translateY(8px) scale(1.3); } 60% { opacity: 1; } to { transform: translateY(-26px); opacity: 0; } }
#debuffBar { position: absolute; right: 100%; bottom: 0; margin-right: 12px; display: flex; flex-direction: row-reverse; gap: 8px; }
#debuffBar .fx { width: 56px; height: 56px; border-radius: 11px; }
#debuffBar .fx .gi { width: 34px; height: 34px; }
#debuffBar .fx .t { font-size: 15px; }
.knock-tag { font-size: 13px; color: var(--ember); background: rgba(0,0,0,.55); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; }
#itemRow { display: flex; gap: 6px; margin-top: 8px; }
#itemRow .it {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.08);
  border-radius: 7px; font-size: 17px; position: relative;
}
#itemRow .it .tier { position: absolute; bottom: -3px; right: 2px; font-size: 10px; color: var(--gold); }
.sub-row { display: flex; align-items: flex-end; justify-content: space-between; }
#goldTag {
  position: relative; display: flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,.5); border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 9px; font-size: 18px; font-weight: 700; color: var(--gold);
}
#goldTag .gi { width: 20px; height: 20px; }
#goldTag .gain {
  position: absolute; right: 6px; bottom: 100%; font-style: normal; font-size: 15px;
  color: var(--good); text-shadow: 0 1px 3px #000; animation: goldUp 1.2s ease-out forwards;
}
@keyframes goldUp { from { transform: translateY(6px); } to { transform: translateY(-22px); opacity: 0; } }

#castCol { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#effectBar { display: flex; gap: 6px; }
#effectBar:empty { display: none; }
.fx {
  position: relative; width: 40px; height: 40px; border-radius: 9px;
  display: grid; place-items: center; overflow: hidden;
  background: rgba(12,8,10,.85); border: 2px solid;
  animation: fxIn .2s ease-out;
}
.fx.good { border-color: rgba(127,224,138,.85); box-shadow: 0 0 10px rgba(127,224,138,.35); }
.fx.bad { border-color: rgba(255,93,93,.9); box-shadow: 0 0 10px rgba(255,93,93,.45); }
.fx .gi { width: 24px; height: 24px; }
.fx::after {   /* darkens clockwise as the effect runs out */
  content: ''; position: absolute; inset: 0;
  background: conic-gradient(rgba(0,0,0,.62) calc(var(--p, 0) * 1turn), transparent 0);
}
.fx .t {
  position: absolute; z-index: 1; bottom: 0; right: 3px;
  font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 0 4px #000, 0 1px 2px #000;
}
.fx.ending { animation: fxBlink .3s infinite alternate; }
@keyframes fxIn { from { transform: scale(.5); opacity: 0; } }
@keyframes fxBlink { to { opacity: .4; } }

#tip {
  position: fixed; z-index: 60; max-width: 290px; transform: translateX(-50%);
  background: rgba(14,10,12,.96); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; font-weight: 500; line-height: 1.35; color: #d9c9bd;
  box-shadow: 0 12px 30px rgba(0,0,0,.6);
}
#tip .tt { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; font-size: 16px; font-weight: 700; margin-bottom: 3px; }
#tip .tt small { font-size: 12px; color: var(--gold); white-space: nowrap; }
#tip .card-stats { margin: 7px 0 0; }

#spellBar, #utilBar { display: flex; gap: 10px; }
.slot {
  position: relative; width: 62px; height: 62px;
  background: linear-gradient(180deg, rgba(40,30,32,.9), rgba(18,12,14,.95));
  border: 1px solid var(--line); border-radius: 12px;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.slot .ic { font-size: 26px; filter: drop-shadow(0 0 8px currentColor); }
.slot .key {
  position: absolute; top: 3px; left: 5px; font-size: 11px;
  color: var(--muted); letter-spacing: .06em;
}
.slot .lvl { position: absolute; bottom: 3px; right: 5px; font-size: 11px; color: var(--gold); }
.slot .key, .slot .lvl { z-index: 1; }
/* Radial sweep: --p is the recovered fraction, a bright hand marks the edge. */
.slot .cd {
  position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 21px; font-weight: 700; color: #fff;
  text-shadow: 0 0 6px #000, 0 1px 2px #000;
  background:
    conic-gradient(from calc(var(--p, 0) * 1turn - 1deg), rgba(255,200,120,.9) 0 2deg, transparent 0),
    conic-gradient(transparent calc(var(--p, 0) * 1turn), rgba(4,2,4,.74) 0);
}
.slot:not(.ready) .ic { filter: grayscale(.85) brightness(.6); }
.slot.ready .ic { animation: readyPop .45s ease-out; }
@keyframes readyPop { from { transform: scale(1.35); filter: brightness(2.4) drop-shadow(0 0 14px currentColor); } }
.slot.ready { border-color: var(--line-strong); }
.slot.empty { opacity: .35; }
#spellBar.locked .slot, .slot.locked { opacity: .45; }
#spellBar.locked .slot .ic, .slot.locked .ic { filter: grayscale(1) brightness(.5); animation: none; }
.slot.flash { animation: slotFlash .25s; }
#spellBar .slot { width: 74px; height: 74px; pointer-events: auto; cursor: grab; }   /* grabbable: drag one onto another to swap */
#spellBar .slot .ic .gi { width: 38px; height: 38px; }
#spellBar .slot .key { font-size: 13px; }
#spellBar .slot.over { border-color: var(--gold); box-shadow: 0 0 14px var(--gold); }
@keyframes slotFlash { from { box-shadow: 0 0 0 3px rgba(255,180,80,.8); } }

#centerMsg {
  position: absolute; top: 32%; left: 50%; transform: translate(-50%,-50%);
  font-family: 'Cinzel', serif; font-size: 46px; text-align: center;
  text-shadow: 0 4px 30px rgba(0,0,0,.9); opacity: 0; transition: opacity .3s;
}
#centerMsg.show { opacity: 1; }
#centerMsg small { display: block; font-family: 'Rajdhani'; font-size: 17px; color: var(--muted); letter-spacing: .2em; }

#chatBox { position: absolute; bottom: 110px; left: 16px; width: 380px; }
#chatLog { display: grid; gap: 3px; font-size: 13px; max-height: 160px; overflow: hidden; }
#chatLog div { background: rgba(6,4,6,.55); padding: 3px 8px; border-radius: 6px; width: fit-content; max-width: 100%; }
#chatLog .sys { color: var(--muted); font-style: italic; }
#chatInput { pointer-events: auto; margin-top: 6px; }

#toast {
  position: fixed; z-index: 70; pointer-events: none; bottom: 150px; left: 50%; transform: translateX(-50%);
  background: rgba(14,10,12,.94); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 18px;
  opacity: 0; transition: opacity .25s; font-size: 14px; font-weight: 600;
}
#toast.err { background: rgba(180,40,30,.92); }
#toast.show { opacity: 1; }

#admin {
  position: absolute; top: 90px; right: 16px; width: 330px; pointer-events: auto;
  background: rgba(14,10,12,.94); border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px;
}
#admin h3 { margin: 0 0 10px; }
.adm-row { display: flex; gap: 6px; margin-bottom: 10px; }
.adm-row select { flex: 1; min-width: 0; padding: 6px; }

/* ---------------------------------------------------------------- augments */
#augPick { z-index: 31; }
.aug-inner { width: min(900px, 96vw); text-align: center; }
.aug-inner h2 { font-family: 'Cinzel', serif; letter-spacing: .2em; font-size: 26px; color: var(--gold); margin-bottom: 6px; }
.aug-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 22px; }
.aug-card { text-align: center; padding: 22px 18px; border: 2px solid var(--tier); box-shadow: 0 0 24px -8px var(--tier); font: inherit; color: inherit; }
.aug-card:hover, .aug-card:focus-visible { box-shadow: 0 0 32px -4px var(--tier); outline: none; }
.aug-card .gi { width: 64px; height: 64px; color: var(--tier); }
.aug-card .card-name { margin: 12px 0 4px; font-size: 18px; }
.aug-card .card-sub { color: var(--tier); margin-bottom: 10px; }
#itemRow .it.aug { border-color: var(--tier); color: var(--tier); }

/* ---------------------------------------------------------------- shop */
#shop, #augPick {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(6,4,6,.86); backdrop-filter: blur(8px);
  display: grid; place-items: center;
}
.shop-inner { width: min(1180px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.shop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.shop-head h2 { font-family: 'Cinzel', serif; letter-spacing: .2em; font-size: 24px; color: var(--gold); }
.shop-meta { display: flex; align-items: center; gap: 18px; }
.shop-meta .gold { font-size: 22px; color: var(--gold); font-weight: 700; }
.shop-timer { color: var(--muted); font-size: 14px; }

.shop-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  background: rgba(30,22,24,.8); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 20px; border-radius: 8px 8px 0 0; cursor: pointer;
  font-family: inherit; font-weight: 700; letter-spacing: .08em;
}
.tab.active { color: var(--gold); border-color: var(--line-strong); background: rgba(60,40,30,.85); }

.shop-loadout {
  display: flex; gap: 20px; align-items: center;
  background: rgba(20,14,16,.8); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
}
.loadout-slots, .loadout-items { display: flex; gap: 8px; }
.lslot {
  width: 52px; height: 52px; border-radius: 9px; position: relative;
  background: rgba(0,0,0,.5); border: 1px dashed rgba(255,255,255,.15);
  display: grid; place-items: center; font-size: 22px; cursor: pointer;
}
.lslot.filled { border-style: solid; border-color: var(--line-strong); }
.lslot .k { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--muted); }
.lslot .l { position: absolute; bottom: 2px; right: 4px; font-size: 10px; color: var(--gold); }
.lslot .x { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; width: 18px; height: 18px; border-radius: 50%; font-size: 12px; display: none; place-items: center; }
.lslot.filled:hover .x { display: grid; }
.lslot.arm { border-color: var(--bad); box-shadow: 0 0 12px var(--bad); }
.lslot.arm .x { display: grid; }

.shop-tier {
  grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 2px 2px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 13px; color: var(--muted);
}
.shop-tier b { font-family: 'Cinzel', serif; font-size: 17px; letter-spacing: .06em; }
.shop-tier small { margin-left: auto; color: var(--gold); }
.lslot.locked, .slot.locked { opacity: .3; border-style: dashed; }
.shop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 12px; overflow-y: auto; padding: 4px 6px 20px 0;
  align-items: start;            /* cards size to their own content, never stretch-and-clip */
  grid-auto-rows: min-content;
}
.card {
  background: linear-gradient(180deg, rgba(36,26,30,.95), rgba(18,12,15,.95));
  border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; transition: .14s; position: relative;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.card.owned { border-color: rgba(127,224,138,.45); }
.card.maxed { opacity: .6; cursor: default; }
.card.poor { opacity: .5; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.card-ic { font-size: 26px; filter: drop-shadow(0 0 10px currentColor); }
.card-name { font-weight: 700; font-size: 16px; }
.card-sub { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.card-desc { font-size: 13px; color: #c9bbb2; line-height: 1.35; }
.card-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; font-size: 12px; }
.card-stats span { background: rgba(0,0,0,.4); border-radius: 5px; padding: 2px 7px; color: #d9c9bd; }
.card-stats b { color: var(--good); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price { color: var(--gold); font-weight: 700; }
.lvl-pips { display: flex; gap: 3px; }
.lvl-pips i { width: 14px; height: 5px; border-radius: 3px; background: #3a2c2c; }
.lvl-pips i.on { background: var(--gold); }

/* ---------------------------------------------------------------- end / help */
.end-panel { width: min(640px, 94vw); text-align: center; }
.end-panel h2 { font-family: 'Cinzel', serif; font-size: 32px; color: var(--gold); margin-bottom: 18px; }
#endTable { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
#endTable th { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); padding: 6px; text-align: left; }
#endTable td { padding: 8px 6px; border-top: 1px solid rgba(255,255,255,.07); }
#endTable tr.win td { color: var(--gold); font-weight: 700; }
.end-actions { display: flex; gap: 12px; justify-content: center; }

.help-panel { width: min(760px, 94vw); max-height: calc(100vh - 24px); overflow-y: auto; }
.help-panel h2 { font-family: 'Cinzel', serif; color: var(--gold); margin-bottom: 16px; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-bottom: 20px; }
.help-cols h3 { color: var(--ember); font-size: 15px; margin-bottom: 8px; }
.help-cols ul { list-style: none; display: grid; gap: 6px; font-size: 14px; color: #cdbfb6; }
.help-cols b { color: var(--text); }

@media (max-width: 860px) {
  .lobby-body, .help-cols { grid-template-columns: 1fr; }
  .logo { font-size: 42px; }
  #scoreboard { display: none; }
}

/* ---------------------------------------------------------------- customise */
.custom-panel { width: min(1200px, 96vw); max-height: 92vh; overflow-y: auto; }
.custom-panel h2 {
  font-family: 'Cinzel', serif; color: var(--gold);
  letter-spacing: .16em; margin-bottom: 20px; text-align: center;
}
.custom-body { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.custom-preview { text-align: center; }
#lookPreview {
  display: block; margin: 0 auto;
  width: 260px; height: 260px;
  background: radial-gradient(circle at 50% 45%, #2a2126, #120c10 70%);
  border: 1px solid var(--line); border-radius: 14px;
}

.custom-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-bottom: 20px; }
.custom-options .hero { display: flex; gap: 6px; align-items: center; padding: 6px 8px; }
.custom-options .hero b { font-size: 13px; margin: 0; }
.custom-options .hero .gi { flex: none; width: 20px; height: 20px; }
#lookInfo { margin-top: 10px; text-align: left; cursor: default; }
.hero {
  text-align: left; background: rgba(30,22,26,.85); border: 1px solid rgba(255,255,255,.08);
  color: #c9bbb2; padding: 10px 14px; border-radius: 10px;
  font-family: inherit; cursor: pointer; transition: .12s;
}
.hero b { display: block; font-size: 15px; color: var(--text); margin-bottom: 2px; }
.hero span { font-size: 12px; color: var(--muted); }
.hero em { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; font-style: normal; color: #ffb648; }
.hero em .gi { flex: none; width: 24px; height: 24px; }
.hero em strong { display: block; font-size: 13px; color: #ffb648; }
#perkSlot .ic, #passiveSlot .ic { color: var(--gold); position: relative; }
#rageBar {   /* Amon: rage meter + staff ignite cooldown, over the spell slots */
  position: relative; align-self: stretch; height: 18px; overflow: hidden;
  background: rgba(0,0,0,.7); border: 1px solid rgba(255,90,40,.45); border-radius: 4px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 8px;
  font-size: 12px; font-weight: 700; text-shadow: 0 1px 3px #000;
}
#rageFill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(255,58,26,.85), rgba(255,140,48,.85)); transition: width .2s; }
#rageText, #igniteTag { position: relative; }
#igniteTag { color: #ffb070; }
#igniteTag.ready { color: #ffd84a; }
#offerDbg { align-self: center; padding: 2px 8px; background: rgba(0,0,0,.7); border-radius: 4px; font-size: 12px; color: #ffb648; }
.hero:hover { border-color: var(--line-strong); }
.hero.on { background: linear-gradient(180deg, #ff8a3c, #d1401a); border-color: #ffb060; }
.hero.on b, .hero.on span, .hero.on em, .hero.on em strong { color: #180a06; }

/* ---------------------------------------------------------------- objectives */
#objectiveBar {
  margin-top: 8px; display: flex; align-items: center; justify-content: center;
  gap: 10px; background: rgba(10,6,8,.7); border: 1px solid var(--line);
  border-radius: 10px; padding: 5px 16px; font-size: 13px;
}
#objectiveBar .ic { font-size: 15px; }
#objectiveBar .lbl { color: var(--gold); letter-spacing: .08em; }
#objectiveBar .bar {
  width: 90px; height: 6px; background: rgba(0,0,0,.6);
  border-radius: 4px; overflow: hidden;
}
#objectiveBar .bar i { display: block; height: 100%; background: var(--good); width: 0; transition: width .12s; }
#objectiveBar.contested .lbl { color: #ff8a6a; }
#objectiveBar.contested .bar i { background: #ff6a4a; }

@media (max-width: 860px) {
  .custom-body { grid-template-columns: 1fr; }
  #lookPreview { width: 200px; height: 200px; }
}

/* ---------------------------------------------------------------- icons */
/* game-icons.net sprite, coloured from CSS via fill: currentColor */
.gi {
  width: 1.15em; height: 1.15em;
  fill: currentColor;
  vertical-align: -0.18em;
  filter: drop-shadow(0 0 6px currentColor);
}
.gi-lg { width: 30px; height: 30px; }
.slot .ic .gi { width: 30px; height: 30px; }
#itemRow .it .gi { width: 21px; height: 21px; }
.lslot .gi { width: 26px; height: 26px; }
.card-ic { display: inline-flex; align-items: center; }

/* ---------------------------------------------------------------- teams */
.toggle {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px; cursor: pointer; user-select: none;
  font-size: 14px; color: #c9bbb2;
}
.toggle input { width: 18px; height: 18px; accent-color: var(--ember); cursor: pointer; }
.toggle.locked { opacity: .5; cursor: not-allowed; }

#teamPick { display: flex; gap: 8px; flex-wrap: wrap; }
#teamPick button {
  flex: 1; min-width: 92px;
  background: rgba(30,22,26,.85); border: 2px solid rgba(255,255,255,.1);
  color: #c9bbb2; padding: 9px 12px; border-radius: 9px;
  font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; transition: .12s;
}
#teamPick button:hover { border-color: currentColor; }
#teamPick button.on { color: #120a0c; }

#lobbyList .team-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 20px;
  border: 1px solid currentColor; font-weight: 700;
}
/* ---------------------------------------------------------------- settings / pause */
#settings { z-index: 50; background: rgba(6,3,4,.78); }
#settings input[type=range] { padding: 0; height: 8px; accent-color: var(--ember); }
.bind-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; font-size: 14px; color: #c9bbb2; }
.bind-row .btn { min-width: 96px; }
.bind-row .btn.listen { border-color: var(--gold); color: var(--gold); }
#pauseBanner {
  position: absolute; top: 32%; left: 50%; transform: translate(-50%,-50%);
  font-family: 'Cinzel', serif; font-size: 56px; color: var(--gold); text-align: center;
  text-shadow: 0 4px 30px rgba(0,0,0,.9);
}
#pauseBanner small { display: block; font-family: 'Rajdhani'; font-size: 17px; color: var(--muted); letter-spacing: .2em; }
@media (prefers-reduced-motion: reduce) { .menu-bg::after, .hp-bar, #hpFill, #phaseTimer.urgent, #scoreboard .row:not(.dead) .face img, .fx.ending { animation: none !important; } }
