* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #04040b; color: #e6ecff; font: 15px/1.4 system-ui, -apple-system, Segoe UI, sans-serif; overflow: hidden; }
button, input, select { font: inherit; }
button { background: rgba(0,234,255,.06); color: #dff9ff; border: 1px solid rgba(0,234,255,.45); border-radius: 8px; padding: 9px 16px; cursor: pointer; transition: .15s; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; font-size: 13px; }
button:hover { background: rgba(0,234,255,.16); box-shadow: 0 0 14px rgba(0,234,255,.45); color: #fff; }
button.primary { background: linear-gradient(90deg, #ff2e88, #b45cff); color: #fff; border-color: #ff7cc0; font-weight: 800; box-shadow: 0 0 18px rgba(255,46,136,.55); }
button.primary:hover { filter: brightness(1.15); box-shadow: 0 0 28px rgba(255,46,136,.85); }
button.small { padding: 5px 10px; font-size: 13px; }
button.ghost { background: transparent; border-color: rgba(140,150,255,.3); color: #aab4ff; }
button:disabled { opacity: .45; cursor: default; }
input, select { background: rgba(10,12,40,.8); color: #fff; border: 1px solid rgba(110,130,255,.35); border-radius: 8px; padding: 8px 10px; width: 100%; }
label { display: block; margin: 10px 0; font-size: 12px; color: #8f9ae0; text-transform: uppercase; letter-spacing: 1px; }
input:focus, select:focus { outline: none; border-color: #00eaff; box-shadow: 0 0 10px rgba(0,234,255,.4); }
label input, label select { margin-top: 4px; }
.muted { color: #7d86c4; font-size: 13px; }
.hidden { display: none !important; }

.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; align-items: center; justify-content: center; }
#menu, #lobby { background: radial-gradient(circle at 30% 20%, #1b1250, #04040b 65%), #04040b; }
#menu::before, #lobby::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(110,130,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(110,130,255,.07) 1px, transparent 1px); background-size: 40px 40px; animation: gridmove 8s linear infinite; pointer-events: none; }
@keyframes gridmove { to { background-position: 40px 40px; } }
.card { position: relative; background: rgba(8,8,28,.88); border: 1px solid rgba(0,234,255,.35); border-radius: 16px; padding: 28px; width: min(420px, 94vw); box-shadow: 0 0 40px rgba(0,234,255,.15), inset 0 0 30px rgba(180,92,255,.08); backdrop-filter: blur(6px); }
.card.wide { width: min(900px, 96vw); max-height: 94vh; overflow: auto; }
.hero > button, .hero > .row { width: 100%; margin-top: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.code { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 700; }
.logo { font-size: 56px; margin: 0; letter-spacing: 4px; font-weight: 900; font-style: italic; text-align: center; color: #fff; text-shadow: 0 0 8px #00eaff, 0 0 24px #00eaff, 0 0 48px #0090ff; animation: flicker 4s infinite; }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .55; } 95% { opacity: 1; } 96% { opacity: .7; } }
.logo span { color: #ff2e88; text-shadow: 0 0 8px #ff2e88, 0 0 24px #ff2e88, 0 0 48px #b45cff; }
.slogan { text-align: center; margin: 2px 0 0; font-size: 18px; font-style: italic; letter-spacing: 3px; color: rgba(200,210,255,.35); text-shadow: 0 0 10px rgba(0,234,255,.15); }
.sub { text-align: center; margin-top: 10px; color: #8f9ae0; letter-spacing: 2px; text-transform: uppercase; font-size: 12px; }
.link { display: block; text-align: center; margin-top: 16px; color: #ffe03a; text-shadow: 0 0 10px rgba(255,224,58,.6); text-decoration: none; }
.help { margin-top: 16px; font-size: 12px; color: #7d86c4; border-top: 1px solid rgba(110,130,255,.2); padding-top: 12px; }

.lobbyhead { display: flex; gap: 10px; align-items: center; }
.lobbyhead h2 { flex: 1; margin: 0; }
.codebadge { color: #00eaff; border: 1px solid #00eaff; border-radius: 8px; padding: 2px 12px; letter-spacing: 6px; text-shadow: 0 0 10px #00eaff; box-shadow: 0 0 14px rgba(0,234,255,.4); }
.cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; margin-top: 10px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(20,22,60,.7); margin-bottom: 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 8px currentColor, 0 0 2px #fff inset; }
.crown { margin-left: auto; }
.maplist { max-height: 46vh; overflow: auto; border: 1px solid rgba(110,130,255,.25); border-radius: 10px; padding: 6px; margin-bottom: 8px; }
.mapitem { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; user-select: none; }
.mapitem:hover { background: rgba(0,234,255,.07); }
.mapitem.sel { background: rgba(255,46,136,.12); box-shadow: inset 0 0 0 1px rgba(255,46,136,.5); }
.mapitem .num { width: 24px; height: 24px; border-radius: 6px; background: rgba(20,22,60,.9); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.mapitem.sel .num { background: #ff2e88; color: #fff; box-shadow: 0 0 10px #ff2e88; }
.mapitem .meta { margin-left: auto; font-size: 12px; color: #7d86c4; text-align: right; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: rgba(255,224,58,.15); color: #ffe03a; margin-left: 6px; }
.mapitem.locked { cursor: default; }

#game { display: none; background: #04040b; }
#game.active { display: block; }
#cv { position: absolute; top: 48px; left: 0; right: 230px; bottom: 0; width: calc(100% - 230px); height: calc(100% - 48px); cursor: crosshair; touch-action: none; }
#hud { position: absolute; top: 0; left: 0; right: 0; height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: rgba(6,6,20,.95); border-bottom: 1px solid rgba(0,234,255,.3); box-shadow: 0 0 20px rgba(0,234,255,.15); gap: 12px; }
.hudleft, .hudright { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
#hudHole { font-weight: 900; color: #ff2e88; text-shadow: 0 0 10px #ff2e88; letter-spacing: 1px; text-transform: uppercase; }
#hudMap { font-weight: 700; color: #00eaff; text-shadow: 0 0 10px rgba(0,234,255,.7); text-transform: uppercase; letter-spacing: 1px; }
#hudPar, #hudPower { color: #8f9ae0; font-size: 13px; font-variant-numeric: tabular-nums; }
#shotDots { display: flex; gap: 6px; }
#shotDots i { width: 12px; height: 12px; border-radius: 50%; background: #fff; display: block; box-shadow: 0 0 8px #00eaff, 0 0 14px #00eaff; transition: .3s; }
#shotDots i.used { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(140,150,255,.35); }
#board { position: absolute; top: 48px; right: 0; width: 230px; bottom: 0; background: rgba(6,6,20,.95); border-left: 1px solid rgba(0,234,255,.25); padding: 10px; overflow: auto; font-size: 13px; }
#board h4 { margin: 4px 0 8px; color: #00eaff; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 0 8px rgba(0,234,255,.6); }
.bp { padding: 7px 8px; border-radius: 8px; background: rgba(20,22,60,.6); margin-bottom: 5px; }
.bp.me { box-shadow: inset 0 0 0 1px rgba(255,46,136,.6), 0 0 12px rgba(255,46,136,.2); }
.bp .top { display: flex; align-items: center; gap: 6px; }
.bp .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp .tot { margin-left: auto; font-weight: 800; }
.bp .st { font-size: 12px; color: #7d86c4; margin-top: 2px; }
.bp .st b { color: #e8f3ea; }
#toasts { position: absolute; top: 60px; left: calc(50% - 115px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(6,6,24,.85); border: 1px solid rgba(0,234,255,.4); box-shadow: 0 0 16px rgba(0,234,255,.3); padding: 8px 16px; border-radius: 20px; animation: tin .25s ease-out; font-weight: 600; }
.toast.big { font-size: 26px; padding: 10px 26px; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: 2px; color: #fff; border-color: #ff2e88; text-shadow: 0 0 12px #ff2e88; box-shadow: 0 0 30px rgba(255,46,136,.5); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px) scale(1.3); } }
#overlay { position: absolute; top: 48px; left: 0; right: 230px; bottom: 0; display: flex; align-items: center; justify-content: center; background: rgba(2,2,10,.55); backdrop-filter: blur(3px); }
#overlay .card { width: min(720px, 94%); max-height: 86%; overflow: auto; }
table.score { width: 100%; border-collapse: collapse; font-size: 13px; }
table.score th, table.score td { padding: 5px 6px; text-align: center; border-bottom: 1px solid rgba(110,130,255,.18); }
table.score td:first-child, table.score th:first-child { text-align: left; }
table.score .under { color: #39ff8a; font-weight: 700; text-shadow: 0 0 8px #39ff8a; }
table.score .over { color: #ff3860; }
table.score tr.win td { background: rgba(255,224,58,.12); color: #ffe03a; }
#chat { position: absolute; left: 10px; bottom: 10px; width: 300px; }
#chatlog { max-height: 140px; overflow: hidden; font-size: 13px; display: flex; flex-direction: column; justify-content: flex-end; text-shadow: 0 1px 2px #000; pointer-events: none; }
#chatIn { background: rgba(6,6,24,.7); padding: 5px 8px; font-size: 13px; opacity: .6; }
#chatIn:focus { opacity: 1; }
@media (max-width: 800px) { #board { display: none; } #cv { width: 100%; right: 0; } #overlay { right: 0; } #chat { display: none; } }

.avrow { display: flex; gap: 12px; align-items: center; margin: 6px 0 4px; }
.avbtns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.avatar { width: 18px; height: 18px; border-radius: 50%; background: rgba(20,22,60,.9) center/cover no-repeat; flex: none; box-shadow: 0 0 0 2px currentColor, 0 0 10px currentColor; display: inline-block; }
.avatar.big { width: 64px; height: 64px; color: #00eaff; display: grid; place-items: center; font-size: 26px; }

#shotDots i.ult { box-shadow: 0 0 8px #ff2e88, 0 0 16px #b45cff; background: #ff2e88; }
#shotDots i.ult.used { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255,46,136,.5); }
#ultBadge { font-weight: 900; font-style: italic; letter-spacing: 2px; color: #fff; padding: 3px 12px; border-radius: 14px; border: 1px solid #ff2e88; text-shadow: 0 0 10px #ff2e88; box-shadow: 0 0 16px rgba(255,46,136,.6); animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 28px rgba(180,92,255,.9); transform: scale(1.06); } }
#ultBanner { position: absolute; top: 48px; left: 0; right: 230px; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; opacity: 0; }
#ultBanner small { font-size: 38px; font-weight: 800; font-style: italic; letter-spacing: 6px; color: #fff; text-shadow: 0 0 12px #00eaff, 0 0 30px #00eaff; }
#ultBanner b { font-size: 92px; font-weight: 900; font-style: italic; letter-spacing: 6px; line-height: 1; background: linear-gradient(90deg, #ff2e88, #ffe03a, #b45cff, #ff2e88); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px #ff2e88) drop-shadow(0 0 40px #b45cff); animation: ultgrad 1.2s linear infinite; }
#ultBanner.show { animation: ultin 3.2s ease-out forwards; }
@keyframes ultin { 0% { opacity: 0; transform: scale(2.4) rotate(-4deg); } 10% { opacity: 1; transform: scale(0.95) rotate(1deg); } 16% { transform: scale(1.05); } 22% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes ultgrad { to { background-position: 300% 0; } }
@media (max-width: 800px) { #ultBanner { right: 0; } #ultBanner b { font-size: 48px; } #ultBanner small { font-size: 22px; } }
.legend { margin-top: 14px; border-top: 1px solid rgba(110,130,255,.2); padding-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; margin-right: 10px; font-size: 12px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid; box-shadow: 0 0 8px currentColor; display: inline-block; }
.legend p { font-size: 11px; margin: 8px 0 0; }

#shotDots i.sling { box-shadow: 0 0 8px #00eaff, 0 0 16px #3dff7a; background: #00eaff; }
#shotDots i.sling.used { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(0,234,255,.5); }
#ultBadge.sling { border-color: #00eaff; text-shadow: 0 0 10px #00eaff; box-shadow: 0 0 16px rgba(0,234,255,.6); animation: none; }
#ultBanner.sling b { font-size: 64px; background-image: linear-gradient(90deg, #00eaff, #3dff7a, #00eaff); filter: drop-shadow(0 0 14px #00eaff); }
#ultBanner.sling small { font-size: 28px; }

#hudTurn { font-size: 13px; color: #8f9ae0; }
#hudTurn b.you { color: #fff; text-shadow: 0 0 10px #00eaff; letter-spacing: 1px; }
#hudTimer { font-variant-numeric: tabular-nums; font-weight: 800; color: #00eaff; min-width: 38px; }
#hudTimer.low { color: #ff3860; text-shadow: 0 0 10px #ff3860; animation: pulse 0.5s ease-in-out infinite alternate; }
.bp.turn { box-shadow: inset 0 0 0 2px #00eaff, 0 0 16px rgba(0,234,255,.35); }
#ultBanner.turn b { font-size: 84px; background-image: linear-gradient(90deg, #00eaff, #ffffff, #00eaff); filter: drop-shadow(0 0 16px #00eaff); }
#btnMagnet { position: absolute; bottom: 26px; left: calc(50% - 115px); transform: translateX(-50%); padding: 14px 30px; font-size: 18px; font-weight: 900; letter-spacing: 3px; border-radius: 40px;
  background: linear-gradient(90deg, rgba(255,224,58,.2), rgba(0,234,255,.2)); border: 2px solid #ffe03a; color: #fff; text-shadow: 0 0 10px #ffe03a; box-shadow: 0 0 24px rgba(255,224,58,.45); }
#btnMagnet:hover:not(:disabled) { box-shadow: 0 0 40px rgba(255,224,58,.9); transform: translateX(-50%) scale(1.05); }
#btnMagnet small { font-size: 13px; opacity: .8; margin-left: 6px; }
#btnMagnet.active { border-color: #00eaff; text-shadow: 0 0 12px #00eaff; animation: magpulse 0.6s ease-in-out infinite alternate; }
@keyframes magpulse { to { box-shadow: 0 0 44px rgba(0,234,255,.9); } }
#btnMagnet:disabled { opacity: .55; cursor: default; }
@media (max-width: 800px) { #btnMagnet { left: 50%; } }

.diffhead { font-size: 12px; font-weight: 800; letter-spacing: 3px; padding: 10px 8px 4px; color: #8f9ae0; }
.diffhead small { opacity: .6; font-weight: 400; }
.diffhead.easy { color: #39ff8a; } .diffhead.medium { color: #ffe03a; }
.diffhead.hard { color: #ff3860; text-shadow: 0 0 10px rgba(255,56,96,.7); border-top: 1px solid rgba(255,56,96,.35); margin-top: 6px; }
.dtag { font-size: 9px; font-weight: 800; letter-spacing: 1px; padding: 1px 6px; border-radius: 6px; margin-left: 6px; vertical-align: middle; border: 1px solid; }
.dtag.easy { color: #39ff8a; border-color: rgba(57,255,138,.5); }
.dtag.medium { color: #ffe03a; border-color: rgba(255,224,58,.5); }
.dtag.hard { color: #fff; background: #ff3860; border-color: #ff3860; box-shadow: 0 0 10px rgba(255,56,96,.7); }
.hardbtn { border-color: rgba(255,56,96,.6); color: #ff8aa0; }
table.score th.hardcol { color: #ff3860; }
