:root {
  --cream: #fff6e3; --cyan: #29e7ff; --pink: #ff3ea5; --lime: #b6ff3c; --violet: #8b5cff; --gold: #ffd23d; --ink: #140a24;
  --font: ui-rounded, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; background: #05040c; color: var(--cream); font-family: var(--font); user-select: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* Liquid glass: blurred backdrop, bright rim on top, soft shadow underneath. */
.glass {
  background: linear-gradient(160deg, rgba(255,255,255,.17), rgba(255,255,255,.05) 45%, rgba(255,255,255,.09));
  backdrop-filter: blur(26px) saturate(190%);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.5), inset 0 -1px 0 rgba(255,255,255,.1), 0 26px 70px rgba(0,0,0,.55);
  border-radius: 30px;
}
.glass-s {
  background: rgba(20,12,44,.5);
  backdrop-filter: blur(10px) saturate(170%);
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 22px rgba(0,0,0,.4);
  border-radius: 16px;
}

/* Screen effects */
#heatFx, #ocFx { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
#heatFx { background: radial-gradient(ellipse at center, transparent 42%, rgba(255,80,20,.42) 78%, rgba(255,40,10,.8) 100%); }
#ocFx {
  border: 6px solid transparent;
  border-image: conic-gradient(from var(--a, 0deg), #ff3ea5, #ffd23d, #b6ff3c, #29e7ff, #8b5cff, #ff3ea5) 1;
  transition: opacity .12s;
}

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#xpWrap { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; background: rgba(10,6,24,.65); border-top: 1px solid rgba(255,255,255,.2); }
#xpBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--lime)); box-shadow: 0 0 14px var(--cyan); }
#lvl { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); font-weight: 900; font-size: 19px; text-shadow: 0 2px 0 var(--ink), 0 0 12px rgba(0,0,0,.8); }

#players { position: absolute; left: 18px; top: 16px; display: flex; flex-direction: column; gap: 10px; }
.pcard { width: 330px; padding: 11px 15px 13px; }
.pcard .row { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; }
.pcard .temp { font-size: 27px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pcard .bonus { font-size: 15px; color: var(--gold); }
.gauge { position: relative; height: 15px; border-radius: 9px; background: rgba(255,255,255,.14); margin-top: 6px; overflow: hidden; }
.gauge i { display: block; height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, #29e7ff, #ffb02e 52%, #ff3d1f 86%, #fff); background-size: 330px 100%; }
.pcard .oc { margin-top: 6px; font-size: 13px; font-weight: 800; opacity: .65; letter-spacing: .3px; }
.pcard.oc-on .oc { opacity: 1; color: var(--lime); }
.pcard.oc-lock .oc { opacity: 1; color: #ff6a45; }
.pcard.danger { animation: danger .35s infinite alternate; }
@keyframes danger { to { box-shadow: 0 0 26px #ff3d1f, inset 0 0 18px rgba(255,61,31,.5); } }

#topMid { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
#timer { font-size: 31px; font-weight: 900; padding: 5px 20px; font-variant-numeric: tabular-nums; }
#bossWrap { width: min(780px, 56vw); text-align: center; }
#bossName { font-weight: 900; font-size: 20px; letter-spacing: 2px; text-shadow: 0 2px 0 var(--ink), 0 0 16px #ff3ea5; margin-bottom: 5px; }
#bossBar { height: 20px; border-radius: 11px; background: rgba(10,6,24,.75); border: 2px solid rgba(255,255,255,.6); overflow: hidden; }
#bossFill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3ea5, #ff8a1f); box-shadow: 0 0 18px #ff3ea5; }
#stats { position: absolute; right: 18px; top: 16px; padding: 9px 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
#stats .sep { margin: 0 8px; opacity: .5; }
#inv { position: absolute; right: 18px; top: 66px; width: 230px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.slot { position: relative; width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px; border-radius: 12px; background: rgba(20,12,44,.5); border: 1px solid rgba(255,255,255,.2); }
.slot.evo { border-color: var(--gold); box-shadow: 0 0 12px var(--gold); }
.slot b { position: absolute; right: -2px; bottom: -3px; font-size: 11px; font-weight: 900; background: var(--ink); border-radius: 7px; padding: 0 4px; }
#hint { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); font-weight: 800; font-size: 19px; padding: 8px 18px; border-radius: 16px; background: rgba(20,12,44,.55); animation: hint 1s infinite alternate; }
@keyframes hint { to { transform: translateX(-50%) translateY(-5px); } }
kbd { font-family: inherit; font-weight: 800; font-size: .86em; background: rgba(255,255,255,.17); border: 1px solid rgba(255,255,255,.35); border-bottom-width: 3px; border-radius: 7px; padding: 0 7px; }

/* Announcer */
#banner { position: fixed; left: 50%; top: 23%; transform: translateX(-50%); text-align: center; pointer-events: none; width: 92vw; animation: bannerIn .32s cubic-bezier(.2,1.5,.5,1); }
#bannerText { font-size: clamp(36px, 6.3vw, 92px); font-weight: 900; letter-spacing: 3px; color: var(--cream); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink), 0 0 42px var(--pink); }
#bannerSub { margin-top: 4px; font-size: clamp(16px, 1.9vw, 26px); font-weight: 800; text-shadow: 0 2px 0 var(--ink), 0 0 12px var(--ink); }
#banner.warn #bannerText { text-shadow: 0 6px 0 var(--ink), 0 0 42px #ff3d1f; color: #ffd9b0; }
#banner.good #bannerText { text-shadow: 0 6px 0 var(--ink), 0 0 42px var(--gold); color: #fff0ad; }
#banner.boss #bannerText { text-shadow: 0 6px 0 var(--ink), 0 0 60px #ff1f5a; color: #ffc7d6; }
@keyframes bannerIn { from { transform: translateX(-50%) scale(1.7); opacity: 0; } }

/* Screens */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; overflow: auto; }
.screen.dim { background: rgba(6,3,18,.5); }
.panel { padding: 30px 38px; max-width: 560px; width: 100%; text-align: center; animation: pop .28s cubic-bezier(.2,1.4,.5,1); }
.panel.wide { max-width: 980px; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
h1 { font-size: clamp(50px, 7vw, 88px); line-height: .94; font-weight: 900; letter-spacing: 1px; }
h1 span { display: block; }
h1 span:first-child { background: linear-gradient(90deg, var(--cyan), #d0fbff); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1 span:last-child { background: linear-gradient(90deg, #ffd23d, #ff8a1f 50%, #ff3d1f); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 22px rgba(255,80,20,.65)); }
h2 { font-size: 40px; font-weight: 900; margin-bottom: 14px; }
h3 { font-size: 19px; font-weight: 800; margin: 18px 0 9px; opacity: .85; text-align: left; }
.tag { margin: 14px 0 22px; font-size: 18px; line-height: 1.4; font-weight: 600; }
.tag b { color: var(--gold); }
.best { margin-top: 16px; font-weight: 700; opacity: .75; min-height: 20px; }
.btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btns.small { margin-top: 12px; }
.btns.column { flex-direction: column; }
button {
  font-family: inherit; font-weight: 800; font-size: 16px; color: var(--cream); cursor: pointer; padding: 10px 19px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.34); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 16px rgba(0,0,0,.35);
  transition: transform .09s, filter .09s;
}
button:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.2); }
button:active { transform: translateY(1px) scale(.98); }
button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
button.big { font-size: 22px; padding: 14px 30px; border-radius: 20px; }
button.primary { background: linear-gradient(180deg, #ff8fd0, var(--pink) 55%, #d81f80); border-color: rgba(255,255,255,.55); }
.pill { background: rgba(255,210,61,.22); color: var(--gold); padding: 1px 9px; border-radius: 10px; font-weight: 900; }
.big-pill { font-size: 24px; vertical-align: middle; }
.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; text-align: left; margin-bottom: 16px; font-size: 16px; line-height: 1.34; font-weight: 600; }
.how-grid > div { background: rgba(255,255,255,.07); padding: 11px 14px; border-radius: 16px; }
.keys { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-weight: 600; text-align: left; }
.keys td, .keys th { padding: 6px 9px; border-top: 1px solid rgba(255,255,255,.13); }
.keys th { border-top: 0; opacity: .7; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.tile { text-align: left; padding: 12px 14px; border-radius: 18px; font-weight: 600; font-size: 14px; line-height: 1.28; display: block; width: 100%; }
.tile .nm { display: block; font-size: 17px; font-weight: 900; margin-bottom: 3px; }
.tile .sub { display: block; opacity: .85; min-height: 36px; }
.tile .act { display: block; margin-top: 6px; font-weight: 900; color: var(--gold); }
.tile.on { border-color: var(--lime); box-shadow: 0 0 18px rgba(182,255,60,.55), inset 0 1px 0 rgba(255,255,255,.5); }
.tile.on .act { color: var(--lime); }
.pips { color: var(--lime); letter-spacing: 2px; }

/* Level-up cards */
.lvl-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.lu-title { font-size: clamp(38px, 5vw, 64px); font-weight: 900; letter-spacing: 2px; text-shadow: 0 5px 0 var(--ink), 0 0 34px var(--cyan); animation: pop .25s; }
#cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; width: 100%; }
.card {
  position: relative; width: min(290px, 28vw); min-width: 215px; min-height: 238px; padding: 22px 19px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 7px;
  border-radius: 28px; color: var(--cream); font-weight: 600;
  background: linear-gradient(160deg, rgba(255,255,255,.2), rgba(255,255,255,.05) 45%, rgba(255,255,255,.1));
  backdrop-filter: blur(24px) saturate(190%);
  animation: cardIn .3s cubic-bezier(.2,1.5,.5,1) backwards;
}
.card:nth-child(2) { animation-delay: .05s; } .card:nth-child(3) { animation-delay: .1s; } .card:nth-child(4) { animation-delay: .15s; }
@keyframes cardIn { from { transform: translateY(40px) scale(.85); opacity: 0; } }
.card:hover { transform: translateY(-9px) scale(1.04); filter: brightness(1.14); }
.card .num { position: absolute; left: 13px; top: 11px; }
.card .icon { font-size: 62px; line-height: 1.1; filter: drop-shadow(0 7px 12px rgba(0,0,0,.5)); }
.card .tagline { font-size: 13px; font-weight: 900; letter-spacing: 1.2px; padding: 2px 11px; border-radius: 10px; background: rgba(255,255,255,.16); }
.card .name { font-size: 23px; font-weight: 900; line-height: 1.12; }
.card .text { font-size: 16px; line-height: 1.32; }
.card.evolved { border: 2px solid var(--gold); box-shadow: 0 0 42px rgba(255,210,61,.75), inset 0 1px 0 #fff; }
.card.evolved .tagline { background: var(--gold); color: var(--ink); }

/* End screen */
#pauseBuild { margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.end-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-bottom: 14px; }
.end-stats > div { background: rgba(255,255,255,.08); border-radius: 16px; padding: 9px 4px; font-weight: 700; font-size: 14px; }
.end-stats b { display: block; font-size: 25px; font-weight: 900; }
.end-stats .new { color: var(--lime); }
#endDmg { margin-bottom: 18px; }
.dmg-row { display: grid; grid-template-columns: 170px 1fr 74px; gap: 9px; align-items: center; font-weight: 700; font-size: 14px; padding: 2.5px 0; text-align: left; }
.dmg-row .bar { height: 11px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.dmg-row .bar i { display: block; height: 100%; border-radius: 6px; }
.dmg-row .v { text-align: right; font-variant-numeric: tabular-nums; }

/* Online */
button.online { background: linear-gradient(180deg, #7df9ff, var(--cyan) 55%, #0aa9c7); color: var(--ink); border-color: rgba(255,255,255,.6); }
.link-row { display: flex; gap: 8px; margin: 0 0 16px; }
.link-row input { flex: 1; min-width: 0; font-family: inherit; font-weight: 700; font-size: 15px; color: var(--cream); padding: 10px 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,.3); background: rgba(10,6,24,.55); outline: none; }
.link-row input:focus { border-color: var(--cyan); }
.plist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-height: 48px; }
.plist .pl { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 14px; background: rgba(255,255,255,.08); font-weight: 800; text-align: left; }
.plist .pl .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.plist .pl.off .dot { background: #777; box-shadow: none; }
.plist .pl.off { opacity: .6; }
.plist .pl .you { margin-left: auto; font-size: 12px; color: var(--cyan); }
.plist .empty { padding: 10px; font-weight: 700; opacity: .7; }
.name-row { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; font-weight: 800; }
.name-row input { width: 170px; font-family: inherit; font-weight: 800; font-size: 16px; color: var(--cream); padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.3); background: rgba(10,6,24,.55); outline: none; text-align: center; }
.name-row input:focus { border-color: var(--cyan); }
#netPill { position: absolute; right: 18px; bottom: 28px; padding: 5px 11px; font-size: 12px; font-weight: 800; opacity: .8; }
#netPill.bad { color: #ff8a65; opacity: 1; animation: danger .4s infinite alternate; }
.lu-sub { font-size: 18px; font-weight: 800; opacity: .85; text-shadow: 0 2px 0 var(--ink); margin-top: -8px; }
.pcard .nm { font-size: 13px; font-weight: 800; opacity: .8; margin-bottom: 2px; letter-spacing: .4px; }
#toast { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); padding: 10px 18px; border-radius: 14px; background: var(--lime); color: var(--ink); font-weight: 900; font-size: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: pop .2s; z-index: 5; }

@media (max-width: 900px) {
  .grid, .how-grid { grid-template-columns: 1fr; }
  .end-stats { grid-template-columns: repeat(3, 1fr); }
  .pcard { width: 220px; }
}
