/* Lion Cricket Lobby — match reference home UI (no Store) */
body.on-home{
  display:block;
  height:100dvh;min-height:100dvh;height:100svh;min-height:100svh;
  place-items:unset;overflow:hidden;background:#020b18;
  font-family:"Manrope",Arial,Helvetica,sans-serif;
}
body.on-home:after{display:none!important;content:none!important}
body.on-home #game,
#game[hidden],
#home-screen[hidden]{display:none!important}

.lobby.home-screen{
  position:relative;
  height:100dvh;max-height:100dvh;height:100svh;max-height:100svh;
  padding:10px 14px 12px;
  display:grid;
  grid-template-columns:76px minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr) auto;
  grid-template-areas:
    "header header"
    "rail stage"
    "rail modes";
  gap:10px 12px;
  overflow:hidden;
  color:#eef7ff;
}

.lobby-bg{
  position:fixed;inset:0;z-index:0;pointer-events:none;
  background:
    linear-gradient(160deg,#010913e8 0%,#05315ccc 38%,#02111ff2 100%),
    url('stadium-clean.png') center/cover no-repeat;
  filter:saturate(1.15) contrast(1.05);
  transform:scale(1.04);
}
.lobby-bg-glow{
  position:fixed;inset:0;z-index:1;pointer-events:none;
  background:
    radial-gradient(ellipse 48% 42% at 42% 48%,#ffd04c33 0%,transparent 58%),
    radial-gradient(ellipse 40% 36% at 78% 30%,#3b82f633 0%,transparent 60%),
    radial-gradient(ellipse 30% 28% at 12% 70%,#22c55e22 0%,transparent 55%);
}
.lobby-vignette{
  position:fixed;inset:0;z-index:1;pointer-events:none;
  background:radial-gradient(ellipse 85% 80% at 50% 45%,transparent 30%,#01070fee 100%);
}

.lobby-header,
.lobby-rail,
.lobby-stage,
.lobby-modes,
.lobby-stamp,
.lobby-panel{position:relative;z-index:2}

.lobby-header{
  grid-area:header;
  display:grid;
  grid-template-columns:auto minmax(180px,1.1fr) auto auto;
  align-items:center;gap:12px;
  padding:8px 12px;
  border-radius:18px;
  background:linear-gradient(90deg,#04233fd9,#0a3d66d0);
  border:1px solid #7eb7df66;
  box-shadow:0 10px 28px #0007, inset 0 1px 0 #ffffff18;
  backdrop-filter:blur(14px);
}
.lobby-brand{display:flex;align-items:center;gap:10px;min-width:0}
.lobby-brand img{
  width:44px;height:44px;border-radius:12px;object-fit:cover;
  box-shadow:0 0 0 2px #ffd04c88,0 8px 16px #0008;
}
.lobby-brand-text{display:flex;flex-direction:column;line-height:1.05}
.lobby-brand-text strong{
  font-family:"Bebas Neue",Impact,sans-serif;
  letter-spacing:.08em;font-size:22px;color:#ffd04c;font-weight:400;
}
.lobby-brand-text span{font-size:10px;color:#9ec8e4;font-weight:700;letter-spacing:.12em;text-transform:uppercase}

.lobby-user{
  display:flex;align-items:center;gap:10px;min-width:0;
  padding:6px 10px;border-radius:999px;
  background:#02152699;border:1px solid #2f628a88;
}
.lobby-avatar-btn{
  position:relative;border:0;padding:0;background:transparent;cursor:pointer;
}
.lobby-avatar{
  width:42px;height:42px;border-radius:50%;display:grid;place-items:center;
  background:linear-gradient(145deg,#134a78,#0a2744);border:2px solid #ffd04c;
  font-weight:900;color:#ffd04c;overflow:hidden;
  box-shadow:0 0 12px #ffd04c44;
}
.lobby-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.lobby-online-dot{
  position:absolute;right:0;bottom:0;width:11px;height:11px;border-radius:50%;
  background:#22c55e;border:2px solid #04233f;box-shadow:0 0 8px #22c55eaa;
}
.lobby-user-meta{min-width:0;flex:1}
.lobby-user-name strong{
  display:block;font-size:13px;color:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.lobby-level-row{
  display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:6px;margin-top:3px;
}
.lobby-level-row span{font-size:10px;font-weight:800;color:#ffd04c;white-space:nowrap}
.lobby-level-row small{font-size:9px;color:#9ec8e4;white-space:nowrap}
.lobby-xp-track{
  height:7px;border-radius:999px;background:#03101f;border:1px solid #2f628a;overflow:hidden;
}
.lobby-xp-track i{
  display:block;height:100%;border-radius:inherit;
  background:linear-gradient(90deg,#ffd04c,#ff9f1a);
  box-shadow:0 0 10px #ffd04c88;
}

.lobby-currencies{display:flex;gap:8px;flex-wrap:wrap}
.lobby-currency{
  display:flex;align-items:center;gap:6px;
  padding:6px 8px 6px 10px;border-radius:999px;
  background:#021526cc;border:1px solid #4f90b8;min-height:36px;
}
.lobby-currency.gold{border-color:#ffd04c88;box-shadow:inset 0 0 12px #ffd04c22}
.lobby-currency.gem{border-color:#c084fc88;box-shadow:inset 0 0 12px #a855f722}
.lobby-currency-ico{
  width:18px;height:18px;border-radius:50%;display:grid;place-items:center;
  background:radial-gradient(circle at 35% 30%,#fff7,#ffd04c 45%,#b8860b);
  color:transparent;font-size:1px;
}
.lobby-currency-ico.gem{
  border-radius:4px;transform:rotate(45deg);
  background:radial-gradient(circle at 35% 30%,#f5d0fe,#a855f7 50%,#6b21a8);
}
.lobby-currency b{font-size:13px;font-weight:900;color:#fff;min-width:2.5ch}
.lobby-currency-add{
  width:22px;height:22px;border-radius:50%;border:0;cursor:pointer;
  background:linear-gradient(#4dff8f,#18a34a);color:#062814;font-weight:900;font-size:14px;line-height:1;
  box-shadow:0 2px 0 #0d6b32;
}

.lobby-tools{display:flex;align-items:center;gap:8px;justify-content:flex-end}
.lobby-icon-btn{
  position:relative;width:38px;height:38px;border-radius:12px;border:1px solid #4f90b8;
  background:#031f38cc;color:#e8f6ff;display:grid;place-items:center;cursor:pointer;
}
.lobby-icon-btn svg{width:18px;height:18px}
.lobby-badge{
  position:absolute;top:-4px;right:-4px;min-width:16px;height:16px;padding:0 4px;
  border-radius:999px;background:#ef4444;color:#fff;font-size:9px;font-weight:900;
  display:grid;place-items:center;border:1px solid #fff4;
}
.lobby-login-btn{
  border:0;border-radius:999px;padding:9px 16px;cursor:pointer;font-weight:900;font-size:12px;
  background:linear-gradient(#ffda52,#ffaa24);color:#153253;
  box-shadow:0 4px 0 #b16a16,0 8px 18px #ffaa2444;
}
body.authed .lobby-login-btn{display:none}

.lobby-rail{
  grid-area:rail;
  display:flex;flex-direction:column;gap:8px;
  padding:8px 6px;
  border-radius:22px;
  background:linear-gradient(180deg,#04233fd9,#021526e8);
  border:1px solid #5ec8ff55;
  box-shadow:0 12px 28px #0007, inset 0 1px 0 #ffffff14;
  backdrop-filter:blur(12px);
  align-self:stretch;
}
.lobby-rail-btn{
  border:0;border-radius:16px;padding:10px 6px;cursor:pointer;
  background:linear-gradient(180deg,#0d4f86,#0a3358);
  color:#d7ecff;display:flex;flex-direction:column;align-items:center;gap:4px;
  font-size:9px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;
  box-shadow:0 4px 0 #062844, inset 0 1px 0 #ffffff22;
  transition:transform .12s ease, filter .12s ease;
}
.lobby-rail-btn .rail-ico{font-size:16px;line-height:1}
.lobby-rail-btn:hover{filter:brightness(1.08)}
.lobby-rail-btn.active{
  background:linear-gradient(#ffe27a,#ffb000);
  color:#153253;
  box-shadow:0 4px 0 #b16a16,0 0 18px #ffd04c55;
}

.lobby-stage{
  grid-area:stage;
  min-height:0;
  display:grid;
  grid-template-columns:minmax(0,1.45fr) minmax(220px,.72fr);
  gap:12px;
  align-items:stretch;
}

.lobby-hero{
  position:relative;min-height:0;overflow:hidden;
  display:grid;grid-template-columns:minmax(140px,.9fr) minmax(0,1fr);
  align-items:end;gap:4px;
  border-radius:24px;
  background:
    linear-gradient(145deg,#0b3d6e55 0%,#02152688 55%,#010b14aa 100%);
  border:1px solid #7eb7df55;
  box-shadow:0 16px 36px #0008, inset 0 1px 0 #ffffff22;
}
.lobby-mascot-wrap{
  margin:0;align-self:end;justify-self:start;
  width:100%;max-width:340px;height:100%;
  display:flex;align-items:flex-end;justify-content:center;
  pointer-events:none;
}
.lobby-mascot{
  width:100%;height:auto;max-height:min(52vh,460px);
  object-fit:contain;object-position:bottom center;
  filter:drop-shadow(0 18px 28px #000c);
  transform:translateY(4%);
}
.lobby-hero-copy{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;padding:16px 18px 20px;gap:8px;min-width:0;
}
.lobby-title-mark{
  width:min(100%,220px);height:auto;
  filter:drop-shadow(0 12px 20px #000a);
  animation:lobbyFloat 4.8s ease-in-out infinite;
}
.lobby-tagline{
  margin:0;font-size:12px;font-weight:800;letter-spacing:.18em;color:#b7d7ec;
  text-transform:uppercase;
}
.lobby .home-load{width:min(100%,220px);margin:0}
.lobby .home-load #load-progress{width:100%;height:8px;accent-color:#ffd04c}
.lobby-cta{display:flex;flex-direction:column;align-items:center;gap:8px;width:100%;max-width:280px}
.lobby-play-btn{
  width:100%;min-height:54px;border:0;border-radius:999px;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;gap:10px;
  background:linear-gradient(#ffe56a,#ffb000);color:#14233a;
  font-family:"Bebas Neue",Impact,sans-serif;font-size:28px;letter-spacing:.12em;
  box-shadow:0 6px 0 #b16a16,0 14px 28px #ffaa2466,0 0 24px #ffd04c44;
  animation:lobbyPulse 2.4s ease-in-out infinite;
}
.lobby-play-btn[hidden]{display:none!important}
.lobby-play-ball{
  width:22px;height:22px;border-radius:50%;
  background:
    radial-gradient(circle at 30% 28%,#fff,#f5f5f5 40%,#cfcfcf),
    linear-gradient(#fff,#ddd);
  box-shadow:inset 0 0 0 1px #9998;
  position:relative;
}
.lobby-play-ball:before{
  content:'';position:absolute;inset:4px 9px;border-left:2px solid #c0392b88;border-right:2px solid #c0392b88;
}
.lobby-secondary-btn{
  width:100%;min-height:42px;border-radius:999px;cursor:pointer;
  border:1px solid #7eb7df99;background:linear-gradient(180deg,#0d4f86ee,#0a3358f0);
  color:#e8f6ff;font-weight:800;font-size:13px;letter-spacing:.04em;
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  box-shadow:0 4px 0 #062844;
}
.lobby-guest-btn{
  width:100%;min-height:36px;border-radius:999px;cursor:pointer;
  border:1px dashed #5baee4;background:transparent;color:#9ec8e4;
  font-weight:800;font-size:11px;letter-spacing:.08em;text-transform:uppercase;
}
body.authed .lobby-guest-btn{display:none!important}
.lobby-auth-hint{margin:0;font-size:11px;color:#9ec8e4cc;max-width:28ch;line-height:1.35}
body.authed .lobby-auth-hint{display:none}

.lobby-widgets{
  display:flex;flex-direction:column;gap:10px;min-height:0;
}
.lobby-widget{
  flex:1;min-height:0;
  border-radius:18px;padding:12px;
  background:linear-gradient(165deg,#0c4a86ee 0%,#06325cf5 50%,#021526f8 100%);
  border:1px solid #8fd0ff88;
  box-shadow:0 14px 28px #0007, inset 0 1px 0 #ffffff28;
  display:flex;flex-direction:column;gap:8px;
}
.lobby-widget.rewards{flex:0 0 auto;flex-direction:row;align-items:center;gap:12px}
.lobby-widget-ico{
  width:54px;height:54px;border-radius:16px;display:grid;place-items:center;
  font-size:28px;background:linear-gradient(160deg,#1d4ed8,#0f172a);border:1px solid #93c5fd66;
  box-shadow:0 8px 16px #0006;
}
.lobby-widget-body{min-width:0;flex:1}
.lobby-widget h2{
  margin:0;font-family:"Bebas Neue",Impact,sans-serif;letter-spacing:.1em;
  font-size:18px;color:#ffd04c;font-weight:400;
}
.lobby-widget h2 span{color:#9ec8e4;font-size:.85em}
.lobby-widget p{margin:4px 0 8px;font-size:12px;color:#c5e0ee;line-height:1.35}
.lobby-claim-btn{
  border:0;border-radius:999px;padding:8px 14px;cursor:pointer;font-weight:900;font-size:11px;
  letter-spacing:.08em;text-transform:uppercase;
  background:linear-gradient(#ffe56a,#ffb000);color:#153253;
  box-shadow:0 3px 0 #b16a16;
}
.lobby-widget-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.lobby-trophy{font-size:18px}
.lobby-top-ranks{
  list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;
  overflow:auto;min-height:0;flex:1;
}
.lobby-top-ranks li{
  display:grid;grid-template-columns:28px 28px minmax(0,1fr) auto;
  align-items:center;gap:8px;padding:7px 8px;border-radius:12px;
  background:#031f38cc;border:1px solid #2f628a;cursor:pointer;
}
.lobby-top-ranks .r{font-weight:900;color:#ffd04c;font-size:12px}
.lobby-top-ranks .av{
  width:28px;height:28px;border-radius:50%;display:grid;place-items:center;
  background:#0a3354;border:1px solid #7eb7df;overflow:hidden;font-size:11px;font-weight:900;color:#ffd04c;
}
.lobby-top-ranks .av img{width:100%;height:100%;object-fit:cover}
.lobby-top-ranks .nm{font-size:12px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lobby-top-ranks .pts{font-size:12px;font-weight:900;color:#ffd04c}
.lobby-link-btn{
  border:0;background:transparent;color:#9ad4ff;font-size:11px;font-weight:800;
  cursor:pointer;text-align:left;padding:0;text-decoration:underline;
}

.lobby-modes{
  grid-area:modes;
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;
}
.lobby-mode-card{
  border:0;border-radius:16px;padding:12px 12px;cursor:pointer;text-align:left;
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;
  color:#fff;min-height:72px;
  box-shadow:0 10px 22px #0007, inset 0 1px 0 #ffffff33;
  transition:transform .12s ease, filter .12s ease;
}
.lobby-mode-card:hover{transform:translateY(-2px);filter:brightness(1.06)}
.lobby-mode-card.blue{background:linear-gradient(135deg,#1d4ed8,#0ea5e9)}
.lobby-mode-card.purple{background:linear-gradient(135deg,#7c3aed,#a855f7)}
.lobby-mode-card.green{background:linear-gradient(135deg,#15803d,#22c55e)}
.lobby-mode-card.red{background:linear-gradient(135deg,#b91c1c,#f97316)}
.mode-ico{
  width:40px;height:40px;border-radius:12px;display:grid;place-items:center;
  background:#0004;font-size:20px;
}
.mode-copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.mode-copy strong{font-size:14px;font-weight:900;letter-spacing:.02em}
.mode-copy small{font-size:11px;opacity:.9}
.mode-arrow{font-size:22px;font-weight:900;opacity:.85}

.lobby-stamp{
  position:absolute;right:18px;bottom:92px;z-index:3;pointer-events:none;
  display:flex;align-items:center;gap:6px;
  padding:8px 12px;border-radius:12px;transform:rotate(-8deg);
  background:linear-gradient(135deg,#0b3a6ecc,#021526ee);
  border:1px solid #ffd04c66;box-shadow:0 10px 20px #0008;
  font-family:"Bebas Neue",Impact,sans-serif;letter-spacing:.08em;color:#ffd04c;
  font-size:16px;
}

.lobby-panel{
  position:fixed;inset:0;z-index:40;
  display:grid;place-items:center;padding:16px;
  background:#01070fcc;backdrop-filter:blur(8px);
}
.lobby-panel[hidden]{display:none!important}
.lobby-panel-card{
  width:min(520px,96vw);max-height:min(82dvh,720px);
  display:flex;flex-direction:column;overflow:hidden;
  border-radius:22px;
  background:linear-gradient(165deg,#0c4a86ee 0%,#06325cf8 42%,#021526fc 100%);
  border:1px solid #8fd0ff99;
  box-shadow:0 24px 60px #000c;
}
.lobby-panel-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:14px 16px 10px;border-bottom:1px solid #5ec8ff33;flex-shrink:0;
}
.lobby-panel-head h2{
  margin:0;font-family:"Bebas Neue",Impact,sans-serif;letter-spacing:.12em;
  color:#ffd04c;font-size:22px;font-weight:400;
}
.lobby-panel-close{
  width:34px;height:34px;border-radius:10px;border:1px solid #4f90b8;
  background:#031f38;color:#fff;font-size:20px;cursor:pointer;
}
.lobby-panel-body{padding:12px 14px 16px;min-height:0;overflow:auto;flex:1}
.lobby-pane{min-height:0;display:flex;flex-direction:column;gap:8px}
.lobby-pane[hidden]{display:none!important}
.lobby-help p{margin:0 0 10px;color:#c5e0ee;line-height:1.45;font-size:14px}
.lobby-help a{color:#ffd04c;font-weight:800}
.lobby-menu-list{display:flex;flex-direction:column;gap:8px}
.lobby-menu-item{
  border:1px solid #4f90b8;background:#0a3354;color:#e8f6ff;border-radius:14px;
  padding:12px 14px;font-weight:800;text-align:left;cursor:pointer;
}
.lobby-menu-item.danger{border-color:#f87171;color:#fecaca}

@keyframes lobbyFloat{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-6px)}
}
@keyframes lobbyPulse{
  0%,100%{box-shadow:0 6px 0 #b16a16,0 14px 28px #ffaa2466,0 0 18px #ffd04c33}
  50%{box-shadow:0 6px 0 #b16a16,0 16px 34px #ffaa2488,0 0 28px #ffd04c66}
}

/* Tablet */
@media(max-width:980px){
  .lobby.home-screen{
    grid-template-columns:68px minmax(0,1fr);
    padding:8px;gap:8px;
  }
  .lobby-header{grid-template-columns:auto minmax(0,1fr) auto;gap:8px}
  .lobby-currencies{display:none}
  .lobby-brand-text span{display:none}
  .lobby-stage{grid-template-columns:1fr;grid-template-rows:auto auto}
  .lobby-hero{grid-template-columns:minmax(120px,.7fr) minmax(0,1fr);min-height:280px}
  .lobby-widgets{flex-direction:row}
  .lobby-widget.rewards{flex:1}
  .lobby-widget.ranks{flex:1.2}
  .lobby-modes{grid-template-columns:1fr 1fr}
  .lobby-stamp{display:none}
}

/* Phone portrait */
@media(max-width:700px){
  .lobby.home-screen{
    grid-template-columns:1fr;
    grid-template-rows:auto minmax(0,1fr) auto auto;
    grid-template-areas:
      "header"
      "stage"
      "modes"
      "rail";
    padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px));
    gap:8px;
  }
  .lobby-header{
    grid-template-columns:1fr auto;
    border-radius:14px;padding:6px 8px;
  }
  .lobby-brand-text strong{font-size:16px}
  .lobby-brand img{width:34px;height:34px}
  .lobby-user{grid-column:1/-1;order:3}
  .lobby-tools{gap:6px}
  .lobby-icon-btn{width:34px;height:34px;border-radius:10px}
  .lobby-login-btn{padding:7px 12px;font-size:11px}
  .lobby-rail{
    flex-direction:row;overflow:auto;gap:6px;padding:6px;
    border-radius:16px;
  }
  .lobby-rail-btn{
    flex:1 0 auto;min-width:64px;padding:8px 6px;border-radius:12px;font-size:8px;
  }
  .lobby-stage{display:flex;flex-direction:column;gap:8px;overflow:auto;min-height:0}
  .lobby-hero{
    grid-template-columns:1fr;
    grid-template-rows:auto auto;
    min-height:0;
  }
  .lobby-mascot-wrap{
    max-width:none;height:auto;justify-content:center;
    order:1;
  }
  .lobby-mascot{max-height:min(28vh,210px);transform:none}
  .lobby-hero-copy{order:2;padding:8px 12px 14px}
  .lobby-title-mark{width:min(56vw,180px)}
  .lobby-play-btn{min-height:48px;font-size:24px}
  .lobby-widgets{flex-direction:column}
  .lobby-modes{grid-template-columns:1fr 1fr;gap:8px}
  .lobby-mode-card{min-height:64px;padding:10px;border-radius:14px}
  .mode-copy strong{font-size:12px}
  .mode-copy small{font-size:10px}
  .lobby-stamp{display:none}
}

@media(max-width:700px) and (orientation:landscape){
  .lobby.home-screen{
    grid-template-columns:58px minmax(0,1fr);
    grid-template-rows:auto minmax(0,1fr) auto;
    grid-template-areas:
      "header header"
      "rail stage"
      "rail modes";
  }
  .lobby-rail{flex-direction:column}
  .lobby-header{grid-template-columns:auto minmax(0,1fr) auto}
  .lobby-user{grid-column:auto;order:0}
  .lobby-stage{display:grid;grid-template-columns:1.2fr .8fr;overflow:hidden}
  .lobby-hero{grid-template-columns:.7fr 1fr;min-height:0}
  .lobby-mascot{max-height:min(42vh,220px)}
  .lobby-modes{grid-template-columns:repeat(4,minmax(0,1fr))}
  .lobby-widgets{flex-direction:column}
}

.lobby-panel-body .friend-list,
.lobby-panel-body .duel-board,
.lobby-panel-body #leaderboard-list{
  max-height:min(52dvh,480px);overflow:auto;
}
.lobby-panel-body .home-stats-body{overflow:auto}
.lobby-panel-body .stat-grid.home-stat-grid{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;
}
.lobby-panel-body .home-stat-grid div{
  text-align:center;padding:10px 6px;border-radius:12px;
  background:#031f38;border:1px solid #2f628a;
}
.lobby-panel-body .home-stat-grid b{display:block;font-size:18px;color:#ffd04c}
.lobby-panel-body .home-stat-grid span{font-size:10px;color:#9ec8e4;font-weight:700}
.lobby-panel-body .avatar-row{display:flex;gap:10px;align-items:center;margin-bottom:10px}
.lobby-panel-body .xp-bar{height:8px;border-radius:999px;background:#03101f;overflow:hidden;border:1px solid #2f628a}
.lobby-panel-body .xp-bar i{display:block;height:100%;background:linear-gradient(90deg,#ffd04c,#ff9f1a)}
