* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a0f; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e8e8f0;
}
#game {
  display: block; width: 100vw; height: 100vh;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34'%3E%3Cg fill='none' stroke='%23ffd33d' stroke-width='2'%3E%3Ccircle cx='17' cy='17' r='9'/%3E%3Cpath d='M17 2v6M17 26v6M2 17h6M26 17h6' stroke-linecap='round'/%3E%3C/g%3E%3Ccircle cx='17' cy='17' r='2.5' fill='%23ffd33d'/%3E%3Ccircle cx='17' cy='17' r='10' fill='none' stroke='%23000' stroke-opacity='0.5' stroke-width='1'/%3E%3C/svg%3E") 17 17, crosshair;
}
/* clickable UI gets a pointer */
.spell, #itembar .item, button, select, #readyBtn, .buyrow button { cursor: pointer; }

/* Spell bar */
#spellbar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: flex-end; z-index: 5;
}
#spellbar .grid { display: flex; flex-direction: column; gap: 7px; }
#spellbar .row { display: flex; gap: 7px; justify-content: center; }
.spell {
  position: relative; width: 56px; height: 62px; border-radius: 10px;
  background: linear-gradient(160deg, #2a2a3a, #16161f);
  border: 2px solid #3a3a4f; display: flex; flex-direction: column;
  align-items: center; justify-content: center; overflow: hidden;
  padding-bottom: 12px;
}
.spell.ult {
  width: 74px; height: 80px; padding-bottom: 14px;
  border-color: #6b5a2a; background: linear-gradient(160deg, #3a3320, #1a1710);
  box-shadow: 0 0 14px rgba(255,211,61,0.25);
}
.spell.armed { border-color: #ffd33d; box-shadow: 0 0 16px #ffd33d99; }
.spell.cooling { opacity: 0.5; }
.spell .ic { width: 26px; height: 26px; display: block; }
.spell .ic svg { width: 100%; height: 100%; display: block; }
.spell.ult .ic { width: 34px; height: 34px; }
.spell .key { position: absolute; top: 1px; left: 4px; font-weight: 700; font-size: 11px; color: #ffd33d; }
.spell .name { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font-size: 9px; color: #b9b9cc; }
.spell.ult .key { font-size: 13px; }
.spell.ult .name { font-size: 10px; color: #ffe08a; }

/* Pause overlay (above everything incl. shop) */
#pausedOverlay { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(6,6,10,0.72); }
#pausedOverlay.hidden { display: none; }
#pausedBig { font-weight: 800; font-size: 50px; color: #fff; text-shadow: 0 4px 18px #000; }
#pausedSub { margin-top: 10px; font-size: 16px; color: #b9b9cc; }
#pausedOverlay.resume #pausedBig { font-size: 130px; color: #ffd33d; }

/* Top-left control cluster */
#topleft { position: fixed; top: 12px; left: 12px; z-index: 40; display: flex; gap: 8px; }
#topleft button {
  width: 38px; height: 38px; border-radius: 8px; cursor: pointer;
  background: rgba(12,12,20,0.75); border: 1px solid #3a3a4f; color: #cfd2e0;
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
#topleft button:hover { border-color: #ffd33d; color: #fff; }
#pauseBtn { display: none; }
#hostBtn { display: none; }
#hostBtn.on { background: rgba(255,211,61,0.18); border-color: #ffd33d; color: #fff; }

/* In-game host menu */
#hostMenu {
  position: fixed; top: 58px; left: 12px; z-index: 41; width: 220px;
  background: rgba(14,12,22,0.96); border: 1px solid #34304a; border-radius: 10px; padding: 12px 14px;
  font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
#hostMenu.hidden { display: none; }
#hostMenu .hmhead { font-weight: 800; color: #ffd33d; letter-spacing: 1px; margin-bottom: 10px; }
#hostMenu .hmlabel { color: #8a8a9c; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 12px 0 6px; }
.hmbtn {
  width: 100%; padding: 8px; border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 13px;
  background: #1b1b28; border: 1px solid #34304a; color: #d8d8e6;
}
.hmbtn:hover { border-color: #ffd33d; color: #fff; }
.hmbtn.danger { background: #3a1e1e; border-color: #6a2f2f; color: #ff9a9a; }
.hmbtn.danger:hover { border-color: #ff5b5b; color: #fff; }
#kickList { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-height: 220px; overflow-y: auto; }
#kickList .hmempty { color: #6a6a7c; font-size: 12px; padding: 4px 0; }
#kickList .krow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#kickList .krow span { display: flex; align-items: center; gap: 6px; color: #d8d8e6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#kickList .krow .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kbtn {
  flex: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 700;
  background: #3a1e1e; border: 1px solid #6a2f2f; color: #ff9a9a;
}
.kbtn:hover { border-color: #ff5b5b; color: #fff; }

/* Confirmation dialog */
#confirmModal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(6,6,10,0.7); }
#confirmModal.hidden { display: none; }
.confirmbox { width: 340px; max-width: 86vw; background: rgba(16,14,24,0.98); border: 1px solid #3a3650; border-radius: 12px; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
#confirmMsg { color: #e8e8f0; font-size: 15px; line-height: 1.45; margin-bottom: 18px; text-align: center; }
.confirmbtns { display: flex; gap: 10px; justify-content: center; }
.confirmbtns button { padding: 9px 18px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 14px; background: #1b1b28; border: 1px solid #34304a; color: #d8d8e6; }
.confirmbtns button:hover { border-color: #ffd33d; color: #fff; }
.confirmbtns button.danger { background: #3a1e1e; border-color: #6a2f2f; color: #ff9a9a; }
.confirmbtns button.danger:hover { border-color: #ff5b5b; color: #fff; }

/* Kicked notice */
#kickedOverlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(6,6,10,0.9); }
#kickedOverlay.hidden { display: none; }
#kickedOverlay .kmsg { color: #ff9a9a; font-size: 22px; font-weight: 700; text-align: center; padding: 0 24px; }

/* Draft / pick screen */
#pickOverlay { position: fixed; inset: 0; z-index: 36; display: flex; align-items: center; justify-content: center; background: rgba(6,6,12,0.86); }
#pickOverlay.hidden { display: none; }
.pickinner { width: min(1040px, 95vw); max-height: 92vh; overflow-y: auto; background: rgba(14,12,22,0.96); border: 1px solid #34304a; border-radius: 14px; padding: 18px 20px; }
.pickhead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.pickhead .ptitle { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: #ffd33d; }
#pickTimer { font-size: 20px; font-weight: 800; color: #fff; }
#pickCols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.pickcol { display: flex; flex-direction: column; gap: 8px; }
.pcslot { text-align: center; font-weight: 800; color: #8a8a9c; letter-spacing: 1px; padding-bottom: 2px; border-bottom: 1px solid #2a2a3a; margin-bottom: 2px; }
.pickcard { display: flex; gap: 9px; padding: 9px; border-radius: 9px; cursor: pointer; background: #16151f; border: 1.5px solid #2c2a3c; transition: border-color .12s, background .12s; }
.pickcard:hover { border-color: var(--c); background: #1b1a26; }
.pickcard.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, #16151f); box-shadow: 0 0 0 1px var(--c) inset; }
.pcic { flex: none; width: 30px; height: 30px; }
.pcic svg { width: 100%; height: 100%; }
.pcbody { min-width: 0; }
.pcname { font-weight: 700; color: #ececf4; font-size: 14px; }
.pcname .pccd { font-weight: 600; color: #8a8a9c; font-size: 11px; }
.pcdesc { color: #aeaec2; font-size: 11.5px; line-height: 1.35; margin-top: 3px; }
.pickfoot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 16px; }
#pickReadyCount { color: #8a8a9c; font-size: 13px; }
#pickReadyBtn { padding: 9px 26px; border-radius: 8px; cursor: pointer; font-weight: 800; font-size: 15px; background: #ffd33d; border: none; color: #2a2410; }
#pickReadyBtn:hover { background: #ffe06a; }
#pickReadyBtn.isready { background: #2a3a2c; color: #8fdf9f; }

@media (max-width: 720px) { #pickCols { grid-template-columns: repeat(2, 1fr); } }

/* In-shop spell chooser */
#shopLoadout { margin-top: 14px; }
#shopLoadout .slhead { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: #8a8a9c; text-transform: uppercase; margin-bottom: 8px; }
#shopLoadout .slrows { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.slrow { display: flex; flex-direction: column; gap: 5px; }
.slkey { font-weight: 800; color: #cfcfe0; text-align: center; }
.slopts { display: flex; flex-direction: column; gap: 5px; }
.slopt { display: flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 7px; cursor: pointer;
  background: #16151f; border: 1.5px solid #2c2a3c; font-size: 12px; font-weight: 600; }
.slopt svg { width: 18px; height: 18px; flex: none; }
.slopt span { color: #d2d2e0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slopt:hover { border-color: currentColor; }
.slopt.sel { border-color: currentColor; background: rgba(255,255,255,0.06); box-shadow: 0 0 0 1px currentColor inset; }
@media (max-width: 720px) { #shopLoadout .slrows { grid-template-columns: repeat(2, 1fr); } }

#audioPanel {
  position: fixed; top: 58px; left: 12px; z-index: 41; width: 200px;
  background: rgba(12,12,20,0.92); border: 1px solid #34304a; border-radius: 10px; padding: 12px 14px; font-size: 12px;
}
#audioPanel.hidden { display: none; }
#audioPanel .ahead { font-weight: 700; color: #ffd33d; margin-bottom: 8px; }
#audioPanel label { display: block; color: #b9b9cc; margin: 8px 0 3px; }
#audioPanel span { color: #fff; font-weight: 600; }
#audioPanel .arow { display: flex; gap: 8px; align-items: center; }
#audioPanel input[type=range] { flex: 1; accent-color: #ffd33d; }
#audioPanel .arow button { width: 30px; height: 26px; border-radius: 6px; cursor: pointer; background: #23232f; border: 1px solid #44445a; }
#audioPanel .arow button.off { opacity: 0.5; }
#shopStats { font-size: 12px; color: #9fd6a0; margin-bottom: 12px; }

/* Big dramatic centre message / countdown */
#bigmsg {
  position: fixed; top: 38%; left: 50%; transform: translate(-50%, -50%);
  z-index: 5; pointer-events: none; text-align: center;
  font-weight: 800; color: #fff; letter-spacing: 2px;
  text-shadow: 0 0 24px rgba(255,140,40,0.7), 0 4px 18px #000;
  will-change: transform, opacity;
}
#bigmsg.count { animation: countpop 0.85s ease-out forwards; }
@keyframes countpop {
  0%   { transform: translate(-50%, -50%) scale(2.1); opacity: 0; }
  18%  { opacity: 1; }
  35%  { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.86); opacity: 0.25; }
}
#hostpanel .title .sub { font-weight: 400; color: #8a8a9c; font-size: 10px; }
#hostpanel hr { border: none; border-top: 1px solid #2a2a3a; margin: 10px 0 4px; }
#hostpanel select {
  width: 100%; padding: 6px; border-radius: 6px; background: #12121c;
  color: #fff; border: 1px solid #44445a; font-size: 12px;
}
#startBtn {
  width: 100%; margin-top: 12px; padding: 10px; font-size: 15px; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer; color: #1a1006;
  background: linear-gradient(160deg, #ffd33d, #ff9f2d);
}
#startBtn:hover { filter: brightness(1.08); }
#scoreboard .sbhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12px; color: #8a8a9c; margin-bottom: 4px; border-bottom: 1px solid #2a2a3a; padding-bottom: 3px; }
#scoreboard .kwh, #scoreboard .kw { color: #ffe08a; font-weight: 700; font-variant-numeric: tabular-nums; display: inline-flex; gap: 14px; flex: 0 0 auto; }
#scoreboard .kaw { min-width: 62px; text-align: right; font-weight: 700; }
#scoreboard .dmg { min-width: 46px; text-align: right; font-weight: 700; }
#scoreboard .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Active item bar */
#itembar { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 5; }
#itembar .item {
  position: relative; width: 46px; height: 46px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(160deg, #2a2438, #16131f); border: 2px solid #45406a;
  display: flex; align-items: center; justify-content: center;
}
#itembar .item.locked { opacity: 0.28; }
#itembar .item .key { position: absolute; top: 1px; left: 4px; font-size: 11px; font-weight: 700; color: #b6a6ff; }
#itembar .item .nm { display: none; }
#itembar .item .emoji { font-size: 22px; }
#itembar .item .cd { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.62); }

/* Shop */
#shop { position: fixed; inset: 0; z-index: 30; background: rgba(8,6,12,0.82); display: flex; align-items: center; justify-content: center; }
#shop.hidden { display: none; }
.shopinner { width: min(1000px, 94vw); background: #14121d; border: 1px solid #34304a; border-radius: 14px; padding: 18px 22px; }
.shopcol.loadout { flex: 0.95; background: #1a1726; border: 1px solid #2c2840; border-radius: 10px; padding: 12px; }
#avatar { display: flex; justify-content: center; margin: 4px 0 6px; }
#avatar svg { width: 76px; height: 88px; }
#avatarName { text-align: center; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
#loadoutItems { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; }
#loadoutItems .loi { font-size: 24px; }
#loadoutItems .loi.off { opacity: 0.25; filter: grayscale(1); }
#statList .statrow { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 2px; border-bottom: 1px solid #241f32; color: #c0bdd0; }
#statList .statrow b { color: #ffe08a; }
.shophead { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.shophead .stitle { font-size: 24px; font-weight: 800; letter-spacing: 3px; color: #ffd33d; }
#shopGold { font-size: 18px; font-weight: 700; color: #ffe08a; }
#shopTimer { margin-left: auto; font-size: 15px; color: #b9b9cc; }
.shopcols { display: flex; gap: 18px; }
.shopcol { flex: 1; }
.shopcol h3 { font-size: 13px; color: #9a9aac; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.buyrow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; background: #1d1a28; margin-bottom: 7px; }
.buyrow .bi { font-size: 20px; width: 26px; text-align: center; }
.buyrow .bn { flex: 1; font-size: 13px; }
.buyrow .bn small { display: block; color: #8a8a9c; font-size: 11px; }
.buyrow .pips { font-size: 10px; color: #ffd33d; letter-spacing: 1px; }
.buyrow button { padding: 6px 10px; border: none; border-radius: 6px; font-weight: 700; font-size: 12px; cursor: pointer; background: linear-gradient(160deg, #ffd33d, #ff9f2d); color: #1a1006; }
.buyrow button:disabled { background: #33303f; color: #6a6a7c; cursor: default; }
.buyrow.owned { opacity: 0.7; }
#readyBtn { margin-top: 14px; width: 100%; padding: 11px; font-size: 15px; font-weight: 700; border: none; border-radius: 8px; cursor: pointer; color: #06140a; background: linear-gradient(160deg, #54d96a, #2bb24a); }
#readyBtn.isready { background: #2a3a2c; color: #8fdf9f; }
#hostpanel input[type=range]#stSlider { accent-color: #54d96a; }
.spell .cd {
  position: absolute; bottom: 0; left: 0; right: 0; height: 0%;
  background: rgba(0,0,0,0.62);
}
.cdtext {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff; text-shadow: 0 1px 4px #000; pointer-events: none;
}
#hostpanel .chk { display: flex; align-items: center; gap: 6px; color: #b9b9cc; margin-top: 8px; }
#hostpanel .chk input { accent-color: #ffd33d; }

/* Host controls */
#hostpanel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 32;
  background: rgba(14,12,22,0.96); border: 1px solid #34304a;
  border-radius: 14px; padding: 22px 26px; width: min(440px, 92vw);
  max-height: 88vh; overflow-y: auto; font-size: 13px; box-shadow: 0 24px 60px #000a;
}
#hostpanel.hidden { display: none; }
#hostpanel .title { font-weight: 800; font-size: 18px; letter-spacing: 1px; color: #ffd33d; margin-bottom: 12px; text-align: center; }
#hostpanel label { display: block; color: #b9b9cc; margin: 8px 0 3px; }
#hostpanel input[type=range] { width: 100%; accent-color: #ffd33d; }
#hostpanel span { color: #fff; font-weight: 600; }

/* HUD */
#ping {
  display: flex; align-items: center; height: 38px; padding: 0 10px; border-radius: 8px;
  font-size: 12px; font-weight: 700; color: #54d96a; pointer-events: none;
  background: rgba(12,12,20,0.55); border: 1px solid #2a2a3a;
}
#gameClock {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 4;
  font-size: 30px; font-weight: 800; letter-spacing: 2px; color: rgba(235,235,245,0.9);
  font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(0,0,0,0.7); pointer-events: none; user-select: none;
}
#gameClock.soon { color: #ffe14d; }   /* glow yellow as a rune approaches */
#status {
  position: fixed; top: 58px; left: 50%; transform: translateX(-50%);
  font-size: 20px; font-weight: 600; text-align: center; z-index: 5;
  text-shadow: 0 2px 8px #000; pointer-events: none;
}
#scoreboard {
  position: fixed; top: 14px; right: 16px; z-index: 5;
  background: rgba(12,12,20,0.72); border: 1px solid #2a2a3a;
  border-radius: 10px; padding: 11px 14px; min-width: 190px; font-size: 16px;
}
#scoreboard .row { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
#scoreboard .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px; }
#scoreboard .dead { opacity: 0.45; }
#hint {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: #8a8a9c; z-index: 5; pointer-events: none;
}

/* Overlay */
#overlay {
  position: fixed; inset: 0; z-index: 20;
  background: radial-gradient(circle at 50% 40%, #1a1020, #050507);
  display: flex; align-items: center; justify-content: center;
}
#overlay.hidden { display: none; }
.panel {
  text-align: center; background: rgba(15,15,25,0.9);
  border: 1px solid #33334a; border-radius: 16px; padding: 34px 40px;
  box-shadow: 0 20px 60px #000a; width: min(560px, 92vw);
}
.panel h1 { font-size: 46px; letter-spacing: 6px; color: #ff7b3d;
  text-shadow: 0 0 24px #ff5b2d88; }
.panel .sub { color: #b9b9cc; margin: 6px 0 22px; }
#nameInput {
  width: 100%; padding: 12px 14px; font-size: 16px; border-radius: 8px;
  border: 1px solid #44445a; background: #12121c; color: #fff; text-align: center;
}
#nameInput:focus { outline: none; border-color: #ffd33d; }
#playBtn {
  margin-top: 14px; width: 100%; padding: 12px; font-size: 16px; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer; color: #1a1006;
  background: linear-gradient(160deg, #ffd33d, #ff9f2d);
}
#playBtn:hover { filter: brightness(1.08); }
.controls { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.controls span { background: #1c1c28; border: 1px solid #2f2f40; border-radius: 6px; padding: 5px 9px; font-size: 12px; color: #b6b6c6; }
.controls b { color: #ffd33d; }
.legend {
  margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px;
  text-align: left; font-size: 12px; color: #c0c0cc;
}
.legend span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend b { display: inline-block; width: 17px; height: 17px; line-height: 17px; text-align: center;
  border-radius: 4px; background: #23232f; margin-right: 6px; font-size: 11px; }
.legend b.q { color: #cfd2ff; } .legend b.w { color: #ff8a3d; } .legend b.e { color: #54d9ff; }
.legend b.r { color: #ffd33d; } .legend b.a { color: #c46bff; } .legend b.s { color: #bfefff; }
.legend b.d { color: #ff5b5b; } .legend b.f { color: #c8884a; }
.tip { margin-top: 18px; font-size: 12px; color: #7a7a8c; line-height: 1.5; }
