* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #07090a; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #dde4ea;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
#stage { position: fixed; inset: 0; }
#game { width: 100%; height: 100%; display: block; }

/* damage numbers */
#dmglayer { position: fixed; inset: 0; pointer-events: none; z-index: 15; overflow: hidden; }
.dmgnum {
  position: absolute; font-weight: 800; font-size: 15px; color: #ffd890;
  text-shadow: 0 1px 3px #000; transform: translate(-50%, -50%);
  animation: dmgfloat 0.8s forwards; pointer-events: none;
}
.dmgnum.crit { font-size: 21px; color: #ff5a4a; }
.dmgnum.ap { color: #b090f0; }
.dmgnum.heal { color: #7dffb0; }
@keyframes dmgfloat { 0% { opacity: 0; margin-top: 0; } 12% { opacity: 1; } 100% { opacity: 0; margin-top: -44px; } }

/* HUD */
#minimap {
  position: fixed; top: 8px; left: 8px; z-index: 20;
  background: rgba(8, 12, 10, 0.85); border: 1px solid #2c3630;
  border-radius: 4px; cursor: pointer;
}
#topbar {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 16px; align-items: center;
  background: rgba(8, 12, 10, 0.8); border: 1px solid #2c3630; border-radius: 6px;
  padding: 5px 18px; font-size: 15px; font-weight: 800;
}
.tscore.blue { color: #5aa0ff; }
.tscore.red { color: #ff5a5a; }
#tb-time { color: #c8d0c0; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13.5px; }
#killfeed {
  position: fixed; top: 52px; right: 10px; z-index: 20; display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px; text-align: right;
}
#killfeed .kf { background: rgba(8, 12, 10, 0.75); padding: 3px 10px; border-radius: 4px; animation: kffade 6s forwards; }
#killfeed .b { color: #5aa0ff; font-weight: 700; }
#killfeed .r { color: #ff5a5a; font-weight: 700; }
@keyframes kffade { 0% { opacity: 0; } 5% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
#announce {
  position: fixed; top: 17%; left: 50%; transform: translateX(-50%); z-index: 25;
  font-size: clamp(22px, 4.5vw, 36px); font-weight: 900; letter-spacing: 0.1em;
  color: #ffd257; text-shadow: 0 0 22px rgba(255, 180, 40, 0.5), 0 2px 6px #000;
  animation: annpop 2.6s forwards; pointer-events: none; white-space: nowrap;
}
@keyframes annpop { 0% { opacity: 0; transform: translateX(-50%) scale(1.6); } 12% { opacity: 1; transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#mystats {
  position: fixed; top: 186px; left: 8px; z-index: 20; display: flex; flex-direction: column; gap: 3px;
  background: rgba(8, 12, 10, 0.75); border: 1px solid #2c3630; border-radius: 4px;
  padding: 6px 10px; font-size: 12.5px;
}
#ms-gold { color: #ffd257; font-weight: 700; }
#ms-lvl { color: #8ae8c8; font-weight: 700; }
#objhud { position: fixed; top: 264px; left: 8px; z-index: 20; font-size: 11.5px; color: #9aa896; line-height: 1.7; }

/* joystick */
#joyzone { position: fixed; left: 0; bottom: 0; width: 42%; height: 46%; z-index: 22; }
#joybase {
  position: absolute; left: 60px; bottom: 60px; width: 120px; height: 120px;
  border: 2px solid rgba(150, 180, 160, 0.35); border-radius: 50%;
  background: rgba(20, 28, 24, 0.35);
}
#joyknob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: rgba(140, 200, 170, 0.5); border: 2px solid rgba(180, 230, 200, 0.6);
}

/* skill pad */
#skillpad { position: fixed; right: 14px; bottom: 14px; z-index: 22; width: 220px; height: 200px; }
.sbtn {
  position: absolute; border-radius: 50%; border: 2px solid #3c4a42;
  background: rgba(18, 26, 22, 0.85); color: #dde4ea; font-size: 17px; font-weight: 800;
  display: grid; place-items: center; cursor: pointer; overflow: hidden;
  font-family: inherit;
}
.sbtn:active { border-color: #8ae8c8; }
.sbtn.attack { width: 78px; height: 78px; right: 0; bottom: 0; font-size: 30px; border-color: #6a5a3c; }
.sbtn.skill { width: 58px; height: 58px; }
#sk0 { right: 96px; bottom: 6px; }
#sk1 { right: 84px; bottom: 76px; }
#sk2 { right: 22px; bottom: 96px; }
.sbtn.ult { border-color: #8a5ac0; }
.sbtn.small { width: 42px; height: 42px; font-size: 15px; }
#btn-recall { right: 168px; bottom: 0; }
#btn-summoner { right: 152px; bottom: 56px; }
.sbtn .cd {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); display: grid; place-items: center;
  font-size: 14px; color: #ffd257; border-radius: 50%; visibility: hidden;
}
.sbtn.ready-ult { box-shadow: 0 0 14px rgba(160, 90, 220, 0.8); }
.hudtool {
  position: fixed; right: 14px; bottom: 226px; z-index: 22;
  background: rgba(18, 26, 22, 0.85); border: 1px solid #3c4a42; color: #dde4ea;
  padding: 7px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit;
}

/* hp bars bottom center */
#hpbars { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(360px, 44vw); z-index: 21; }
#hpbars .bar { height: 15px; background: #101816; border: 1px solid #2c3630; border-radius: 3px; position: relative; overflow: hidden; margin-top: 3px; }
#hpbars .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #2ecf6a, #7dffb0); transition: width 0.15s; }
#hpbars .bar.mp { height: 7px; }
#hpbars .bar.mp i { background: linear-gradient(90deg, #2a6ad0, #6ab0ff); }
#hpbars .bar span { position: absolute; inset: 0; text-align: center; font-size: 10.5px; line-height: 15px; color: #eaf2ea; text-shadow: 0 1px 2px #000; }
#respawn-overlay {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 30;
  font-size: 24px; font-weight: 800; color: #ff8a7a; text-shadow: 0 2px 8px #000;
  background: rgba(10, 8, 8, 0.7); padding: 14px 30px; border-radius: 8px;
}

/* overlays */
.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(8, 18, 14, 0.85), rgba(4, 6, 5, 0.96));
  overflow-y: auto; padding: 16px;
}
.panel {
  width: min(620px, 96vw); background: #0e1410; border: 1px solid #2c3a30;
  border-top: 3px solid #38b078; padding: 22px 26px; border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7); max-height: 92vh; overflow-y: auto;
}
.game-logo {
  font-size: clamp(26px, 6vw, 40px); font-weight: 900; letter-spacing: 0.08em;
  background: linear-gradient(90deg, #5aa0ff, #8ae8c8, #ff5a5a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.game-sub { color: #8a9a8e; margin: 4px 0 16px; letter-spacing: 0.1em; font-size: 13px; }
#mode-list { display: flex; flex-direction: column; gap: 8px; }
.mode-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  background: #141c16; border: 1px solid #2c3a30; border-radius: 6px; cursor: pointer;
  color: inherit; font: inherit; text-align: left; width: 100%;
}
.mode-row:hover { border-color: #38b078; }
.mode-row .ico { font-size: 24px; }
.mode-row b { display: block; font-size: 15px; }
.mode-row span { font-size: 12px; color: #8a9a8e; }
.menu-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  padding: 10px 22px; font-size: 14px; font-weight: 700;
  background: #1c2a20; color: #dde4ea; border: 1px solid #3c5a48; border-radius: 6px;
  cursor: pointer; text-decoration: none; display: inline-block; font-family: inherit;
}
.btn:hover { border-color: #58c890; }
.btn.primary { background: #1d8a56; border-color: #38b078; color: #fff; }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; }

/* hero select */
.select-panel { width: min(780px, 97vw); }
.sel-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
#role-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
#role-tabs button {
  padding: 5px 12px; font-size: 12.5px; background: #141c16; color: #8a9a8e;
  border: 1px solid #2c3a30; border-radius: 20px; cursor: pointer; font-family: inherit;
}
#role-tabs button.on { background: #1d8a56; color: #fff; border-color: #38b078; }
#hero-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 7px;
  max-height: 300px; overflow-y: auto; padding: 2px;
}
.hcard {
  background: #141c16; border: 2px solid #2c3a30; border-radius: 8px; padding: 8px 4px;
  text-align: center; cursor: pointer; font-family: inherit; color: inherit;
}
.hcard:hover { border-color: #58c890; }
.hcard.picked { border-color: #ffd257; background: #1d2a1a; }
.hcard .avatar {
  width: 44px; height: 44px; margin: 0 auto 5px; border-radius: 50%;
  display: grid; place-items: center; font-size: 21px; font-weight: 900; color: #0a0f0a;
}
.hcard b { display: block; font-size: 12.5px; }
.hcard span { font-size: 10px; color: #8a9a8e; }
#hero-info { margin-top: 10px; background: #141c16; border: 1px solid #2c3a30; border-radius: 6px; padding: 10px 14px; }
.hi-name b { font-size: 16px; margin-right: 8px; }
.hi-name span { font-size: 12px; color: #8ae8c8; }
#hi-skills { font-size: 12px; color: #a8b4a8; line-height: 1.7; margin-top: 4px; }
#hi-skills b { color: #dde4ea; }
.sel-foot { margin-top: 12px; }
#spell-row { display: flex; gap: 6px; flex-wrap: wrap; }
#spell-row button {
  padding: 6px 10px; font-size: 12px; background: #141c16; color: #a8b4a8;
  border: 1px solid #2c3a30; border-radius: 6px; cursor: pointer; font-family: inherit;
}
#spell-row button.on { border-color: #ffd257; color: #ffd257; }

/* shop */
.shop-panel { width: min(680px, 97vw); }
.shop-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
#shop-gold { color: #ffd257; font-weight: 800; }
.autobuy { font-size: 12.5px; color: #a8b4a8; margin-left: auto; }
#shop-cats { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
#shop-cats button {
  padding: 5px 14px; font-size: 12.5px; background: #141c16; color: #8a9a8e;
  border: 1px solid #2c3a30; border-radius: 16px; cursor: pointer; font-family: inherit;
}
#shop-cats button.on { background: #1d8a56; color: #fff; }
#shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 7px; max-height: 260px; overflow-y: auto; }
.sitem {
  display: flex; gap: 8px; align-items: center; background: #141c16; border: 1px solid #2c3a30;
  border-radius: 6px; padding: 7px 9px; cursor: pointer; font-family: inherit; color: inherit; text-align: left;
}
.sitem:hover { border-color: #58c890; }
.sitem.noafford { opacity: 0.45; }
.sitem .si { font-size: 20px; }
.sitem b { display: block; font-size: 12.5px; }
.sitem span { font-size: 11px; color: #ffd257; }
.sitem em { display: block; font-style: normal; font-size: 10.5px; color: #8a9a8e; }
.shop-own { margin-top: 10px; font-size: 12.5px; color: #a8b4a8; }
#shop-slots { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
#shop-slots button {
  width: 44px; height: 44px; font-size: 19px; background: #141c16;
  border: 1px solid #3c5a48; border-radius: 6px; cursor: pointer;
}

/* board */
.board-panel { width: min(640px, 97vw); }
#board-body { margin-top: 10px; font-size: 12.5px; }
#board-body table { width: 100%; border-collapse: collapse; }
#board-body td, #board-body th { padding: 5px 8px; text-align: left; border-bottom: 1px solid #1c2a20; }
#board-body .tm1 { color: #5aa0ff; }
#board-body .tm2 { color: #ff5a5a; }
#board-body .me { background: rgba(255, 210, 87, 0.08); }

/* debrief */
.over-title { font-size: 30px; font-weight: 900; margin-bottom: 10px; }
.over-title.win { color: #7dffb0; }
.over-title.lose { color: #ff5a4a; }
.over-stats { font-size: 14px; line-height: 2; margin-bottom: 8px; }
.over-stats b { color: #ffd257; font-size: 20px; }
.board { margin: 8px 0; max-height: 170px; overflow-y: auto; }
.board-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px; font-size: 12.5px; border-bottom: 1px solid #1c2a20; }
.board-rank { color: #38b078; font-weight: 800; width: 28px; }
.board-name { color: #dde4ea; }
.board-meta { color: #6a755f; font-size: 11px; }
.board-score { margin-left: auto; color: #ffd257; font-weight: 700; }
.board-empty { color: #6a755f; font-size: 12.5px; padding: 8px; }
.submit-row { display: flex; gap: 8px; margin: 10px 0 4px; }
#player-name {
  flex: 1; padding: 10px 12px; font-size: 14px; background: #141c16;
  border: 1px solid #2c3a30; border-radius: 6px; color: #dde4ea; font-family: inherit; min-width: 0;
}
#submit-status { font-size: 12.5px; color: #8a9a8e; min-height: 18px; }
.help-body { font-size: 13.5px; line-height: 1.9; color: #a8b4a8; }
.help-body p { margin-bottom: 8px; }
.help-body b { color: #8ae8c8; }

@media (max-width: 720px) {
  #minimap { width: 118px; height: 118px; }
  #mystats { top: 134px; }
  #objhud { top: 206px; }
  #skillpad { transform: scale(0.88); transform-origin: bottom right; }
  #hpbars { width: 40vw; }
}
