:root {
	--font-body: "JetBrains Mono", ui-monospace, monospace;
	--font-head: "Cinzel", "Times New Roman", serif;
	--bg: #07090f;
	--panel: rgba(10, 14, 26, 0.92);
	--panel-line: rgba(255, 255, 255, 0.12);
	--text: #e6e9f2;
	--text-muted: #9aa3b8;
	--gold: #f2c94c;
	--blue: #5aa9ff;
	--red: #ff5f6d;
	--green: #4ade80;
	--mana: #60a5fa;
	--radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; }
button:hover { border-color: rgba(255, 255, 255, 0.4); }
button:disabled { opacity: 0.4; cursor: default; }
h1, h2 { font-family: var(--font-head); font-weight: 700; margin: 0; }
.num { font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.gold { color: var(--gold); }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; display: block; cursor: default; }
#map.hoverEnemy { cursor: crosshair; }
#map.casting { cursor: cell; }

/* ------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 30%, #131a2e 0%, var(--bg) 70%); z-index: 20; padding: 24px; }
.selectHead { text-align: center; margin-bottom: 20px; }
.connectTitle { font-size: clamp(28px, 5vw, 48px); color: #fff; letter-spacing: 0.06em; margin-bottom: 8px; }
.connectTitle span { color: var(--blue); font-weight: 600; font-size: 0.6em; vertical-align: middle; }
#connect .lockIn { margin-top: 20px; text-decoration: none; }
.selectHead h1 { font-size: clamp(32px, 6vw, 64px); letter-spacing: 0.06em; color: #fff; text-shadow: 0 0 30px rgba(90, 169, 255, 0.4); }
.selectHead h1 span { color: var(--blue); font-weight: 600; font-size: 0.6em; vertical-align: middle; }
.strap { color: var(--text-muted); margin: 4px 0 0; }
.selectBody { display: flex; gap: 20px; width: min(1360px, 100%); align-items: stretch; }
.pickCol { display: flex; gap: 20px; flex: 1; min-width: 0; }
.champGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; flex: 1; }
.champCard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.08); }
.champCard.active { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 24px color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 8%, transparent); }
.champGlyph { font-size: 40px; line-height: 1; color: var(--c); font-weight: 700; }
.champName { font-family: var(--font-head); font-size: 16px; color: #fff; }
.champTitle { color: var(--text-muted); font-size: 11px; }
.champRole { font-size: 11px; color: var(--c); }
.pickDetail { width: 340px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 16px; border-top: 3px solid var(--c); }
.pickName { font-size: 20px; color: #fff; }
.pickRole { color: var(--c); margin: 2px 0 10px; }
.pickAbilities { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pickAbilities li { display: grid; grid-template-columns: 24px 1fr; gap: 2px 8px; }
.pickAbilities b { color: var(--c); font-family: var(--font-head); }
.abName { color: #fff; }
.abDesc { grid-column: 2; color: var(--text-muted); font-size: 12px; line-height: 1.35; }
.selectFoot { display: flex; align-items: center; gap: 24px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }
.diff { display: flex; gap: 6px; align-items: center; }
.diff span { color: var(--text-muted); margin-right: 4px; }
.diff button.active { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.5); }
.lockIn { background: var(--blue); color: #061020; border-color: transparent; font-family: var(--font-head); font-weight: 700; font-size: 18px; padding: 10px 36px; letter-spacing: 0.05em; }
.lockIn:hover { background: #7dbcff; }
.tip { width: 100%; text-align: center; color: var(--text-muted); font-size: 12px; margin: 0; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 22px; align-items: center; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 6px 16px; }
#timer { font-size: 18px; font-weight: 700; }
.stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.stat i { font-style: normal; color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat b { font-size: 14px; }
#announcer { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); font-family: var(--font-head); font-size: 34px; font-weight: 700; letter-spacing: 0.08em; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9); animation: announce 3s ease-out forwards; white-space: nowrap; pointer-events: none; }
#announcer.tone-good { color: var(--green); }
#announcer.tone-bad { color: var(--red); }
#announcer.tone-neutral { color: #fff; }
@keyframes announce { 0% { opacity: 0; transform: translateX(-50%) scale(1.15); } 10% { opacity: 1; transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#lobbyToast { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); color: var(--gold); background: rgba(0, 0, 0, 0.7); padding: 6px 14px; border-radius: var(--radius); z-index: 30; }
#toast { position: absolute; top: 150px; left: 50%; transform: translateX(-50%); color: var(--red); background: rgba(0, 0, 0, 0.7); padding: 4px 12px; border-radius: var(--radius); pointer-events: none; }
#tooltip { position: absolute; z-index: 30; max-width: 320px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 10px 12px; font-size: 12px; line-height: 1.45; pointer-events: none; }
#tooltip b { color: #fff; }
#tooltip i { color: var(--text-muted); }
#recallBar { position: absolute; bottom: 190px; left: 50%; transform: translateX(-50%); width: 220px; height: 16px; background: rgba(0, 0, 0, 0.7); border: 1px solid var(--panel-line); border-radius: 3px; overflow: hidden; }
#recallFill { height: 100%; background: #9ff; width: 0; }
#recallBar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 16px; color: #061020; mix-blend-mode: difference; color: #fff; }
#death { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); text-align: center; background: rgba(0, 0, 0, 0.75); padding: 16px 28px; border-radius: var(--radius); border: 1px solid var(--red); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#death b { font-family: var(--font-head); font-size: 22px; color: var(--red); }
#death span:last-child { color: var(--text-muted); }

#chat { position: absolute; left: 12px; bottom: 190px; width: 380px; max-width: 45vw; pointer-events: none; }
#chatInput { pointer-events: auto; width: 100%; margin-top: 6px; background: rgba(0, 0, 0, 0.7); border: 1px solid var(--panel-line); border-radius: var(--radius); color: var(--text); font: inherit; padding: 6px 8px; }
.chatLine { display: flex; gap: 8px; font-size: 12px; line-height: 1.4; text-shadow: 0 1px 3px #000; }
.chatTime { color: var(--text-muted); }
.chatLine.team0 .chatText { color: #bcd9ff; }
.chatLine.team1 .chatText { color: #ffb8be; }
.chatLine.team-1 .chatText { color: var(--gold); }

#bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 170px; display: flex; align-items: flex-end; gap: 12px; padding: 0 12px 10px; background: linear-gradient(to top, rgba(7, 9, 15, 0.95), rgba(7, 9, 15, 0.6) 70%, transparent); }
#portraitBox { position: relative; width: 84px; height: 84px; }
#hudPortrait { width: 84px; height: 84px; border: 2px solid var(--c); border-radius: var(--radius); display: grid; place-items: center; font-size: 42px; font-weight: 700; color: var(--c); background: rgba(0, 0, 0, 0.6); }
#hudLevel { position: absolute; right: -6px; bottom: -6px; background: #000; border: 1px solid var(--gold); color: var(--gold); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font-size: 12px; }
#hudLevel.pop { animation: pop 0.5s ease-out; }
@keyframes pop { 0% { transform: scale(1.8); } 100% { transform: scale(1); } }
#hudName { position: absolute; left: 0; right: 0; top: -18px; text-align: center; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
#centre { display: flex; flex-direction: column; gap: 8px; }
#abilities, #summoners { display: flex; gap: 6px; }
.ability { position: relative; width: 62px; height: 62px; border: 1px solid var(--panel-line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.06); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; padding: 4px; }
.ability.summoner { width: 46px; height: 46px; }
.ability .abKey { position: absolute; top: 3px; left: 5px; font-family: var(--font-head); font-weight: 700; font-size: 14px; color: #fff; }
.ability .abLabel { font-size: 9px; line-height: 1.1; color: var(--text-muted); z-index: 1; }
.ability::after { content: attr(data-rank); position: absolute; right: 4px; top: 2px; color: var(--gold); font-size: 8px; letter-spacing: -1px; }
.ability .abCd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.75); height: 0; }
.ability .abCdText { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-weight: 700; color: #fff; }
.ability.unlearned { opacity: 0.45; }
.ability.noMana { box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.5); }
.abUp { position: absolute; top: -1px; right: -1px; width: 20px; height: 20px; padding: 0; background: var(--gold); color: #000; border: none; border-radius: 0 var(--radius) 0 var(--radius); font-weight: 700; line-height: 1; animation: glow 1s ease-in-out infinite alternate; z-index: 2; }
@keyframes glow { from { box-shadow: 0 0 2px var(--gold); } to { box-shadow: 0 0 12px var(--gold); } }
#bars { display: flex; flex-direction: column; gap: 3px; width: 266px; }
.bar { position: relative; height: 16px; background: rgba(0, 0, 0, 0.6); border: 1px solid var(--panel-line); border-radius: 3px; overflow: hidden; }
.bar.xp { height: 5px; }
.bar > div { height: 100%; transition: width 0.1s linear; }
.bar.hp > div { background: var(--green); }
.bar.mana > div { background: var(--mana); }
.bar.xp > div { background: var(--gold); }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 15px; color: #fff; text-shadow: 0 0 3px #000; }
#stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; align-self: center; }
#stats span { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
#stats i { font-style: normal; color: var(--text-muted); }
#itemsBox { display: flex; flex-direction: column; gap: 6px; }
#items { display: grid; grid-template-columns: repeat(3, 40px); gap: 4px; }
.slot { width: 40px; height: 40px; border: 1px solid var(--panel-line); border-radius: 4px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--c); background: rgba(255, 255, 255, 0.05); cursor: pointer; }
.slot.empty { background: rgba(0, 0, 0, 0.4); }
.itemBtns { display: flex; gap: 4px; }
.itemBtns button { padding: 3px 8px; font-size: 11px; }
#potionBtn.empty { opacity: 0.5; }
#potionBtn.active { border-color: var(--green); color: var(--green); }
#minimap { margin-left: auto; width: min(420px, 30vw); height: 44px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); cursor: pointer; }

/* ------------------------------------------------------------ panels */
.panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 16px 20px; min-width: 320px; max-width: min(720px, 94vw); max-height: 80vh; overflow: auto; z-index: 15; }
.panel header { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.panel h2 { font-size: 20px; flex: 1; }
#shopClose { padding: 0 8px; font-size: 18px; }
#shopWhere { color: var(--text-muted); margin: 0 0 10px; }
#shopList { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.shopItem { display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px; }
.shopItem.cant { opacity: 0.45; }
.shopItem.tier3 { border-color: rgba(242, 201, 76, 0.4); }
.shopGlyph { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--c); color: var(--c); border-radius: 4px; font-weight: 700; }
.shopBody { display: flex; flex-direction: column; flex: 1; gap: 1px; }
.shopName { color: #fff; }
.shopStats { font-size: 11px; color: var(--blue); }
.shopTip { font-size: 11px; color: var(--text-muted); }
.shopCost { color: var(--gold); font-weight: 700; }
.hint { color: var(--text-muted); font-size: 12px; margin: 10px 0 0; }
#scoreboard table { border-collapse: collapse; width: 100%; }
#scoreboard th, #scoreboard td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--panel-line); }
#scoreboard th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
#scoreboard tr.team0 td:first-child { color: var(--blue); }
#scoreboard tr.team1 td:first-child { color: var(--red); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 16px; }
.keys dt { color: #fff; }
.keys dd { margin: 0; color: var(--text-muted); }
.menuBtns { display: flex; gap: 8px; justify-content: flex-end; }
.danger { border-color: var(--red); color: var(--red); }

#end { z-index: 25; background: rgba(4, 6, 12, 0.9); }
#end h1 { font-size: clamp(48px, 10vw, 110px); letter-spacing: 0.1em; }
#end.won h1 { color: var(--green); text-shadow: 0 0 40px rgba(74, 222, 128, 0.5); }
#end.lost h1 { color: var(--red); text-shadow: 0 0 40px rgba(255, 95, 109, 0.5); }
#endSub { color: var(--text-muted); margin: 4px 0 24px; }
#endStats { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 32px; min-width: 320px; }
#endStats li { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--panel-line); padding: 4px 0; }
#endStats span { color: var(--text-muted); }

/* ------------------------------------------------------------ lobby */
.lobby { width: 300px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; max-height: 70vh; overflow: auto; }
.lobby h2 { font-size: 18px; color: #fff; }
.lobby h3 { font-family: var(--font-body); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin: 10px 0 0; font-weight: 500; }
.lobby p { margin: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 11px; }
.lobbyHead { display: flex; align-items: baseline; gap: 10px; }
.lobbyName { color: #fff; font-family: var(--font-head); font-size: 18px; text-decoration: none; flex: 1; }
.lobbyHead a.muted { color: var(--text-muted); }
.lobbyStatus::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--red); }
.lobbyStatus.on::before { background: var(--green); }
.lobbyBtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lobby .lockIn { font-size: 14px; padding: 8px 14px; width: 100%; }
.lobby .lockIn.small, .lobbyBtns .lockIn { width: auto; }
.lobby .lockIn.queued { background: var(--gold); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.75; } to { opacity: 1; } }
.lobby a.ghost { color: var(--text); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 6px 12px; text-decoration: none; }
.challengeBox { border: 1px solid var(--gold); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.challengeBox b { color: var(--gold); }
.lobbyList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.lobbyList li { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.lobbyList li.muted { border: none; }
.lobbyWho { flex: 1; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex: none; }
.dot.online { background: var(--green); }
.dot.queue { background: var(--gold); }
.dot.game { background: var(--blue); }
.dot.offline { background: rgba(255, 255, 255, 0.2); }
button.tiny { padding: 2px 7px; font-size: 11px; }
button.tiny.ghost { border-color: transparent; color: var(--text-muted); }
.addFriend { display: flex; gap: 6px; margin-top: 4px; }
.addFriend input { flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--panel-line); border-radius: var(--radius); color: var(--text); font: inherit; padding: 4px 8px; }

@media (max-width: 1100px) {
	.selectBody { flex-direction: column; }
	.lobby { width: 100%; max-height: none; }
}
@media (max-width: 900px) {
	.pickCol { flex-direction: column; }
	.pickDetail { width: 100%; }
	#chat { display: none; }
	#stats { display: none; }
	#minimap { width: 120px; }
}
