/* ===== Play Game lobby (redesign) =====
   Reuses the app tokens from base.css. Fonts: "Fredoka"/"Nunito" are used if installed, otherwise the
   app's rounded system stack (no external font requests, to keep children's privacy). */
:root {
  --font-display: "Fredoka", "Fredoka One", "Nunito", "Trebuchet MS", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
  --sky-1: #bfe3ff; --sky-2: #e8f5ff; --sun: #ffd45c;
  --ease-pop: cubic-bezier(.3, 1.4, .5, 1);
  --card-radius: 32px;
}

/* ---------- navigation polish (applies app-wide, keeps the same markup) ---------- */
.nav a, .nav button.link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; transition: transform .15s var(--ease-pop), background-color .15s, box-shadow .15s; position: relative; }
.nav a:hover, .nav button.link:hover { transform: translateY(-2px); background: var(--blue-l); box-shadow: 0 4px 10px rgba(38, 48, 77, .12); }
.nav a.on, .nav a[aria-current="page"] { background: var(--yellow); color: #3d2c00; box-shadow: 0 3px 0 var(--yellow-d); }
.nav a.on::after, .nav a[aria-current="page"]::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 26px; height: 4px; margin-left: -13px; border-radius: 4px; background: var(--yellow-d); }
@media (max-width: 760px) { .nav a.on::after { display: none; } .nav a, .nav button.link { min-height: 48px; font-size: 1.05rem; } }

/* ---------- scene (page background) ---------- */
.lobby-scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(120% 60% at 50% 0, var(--sky-1) 0, transparent 70%), radial-gradient(60% 40% at 90% 100%, #ffe7a6 0, transparent 70%),
    radial-gradient(50% 40% at 0 100%, #d6f5e9 0, transparent 70%), linear-gradient(#eaf6ff, #fff8ec 60%); }
.lobby-scene.has-art { background-size: cover; background-position: center; }
.lobby-scene.has-art::after { content: ""; position: absolute; inset: 0; background: rgba(255, 248, 236, .55); } /* keeps the cards readable over artwork */
.cloud { position: absolute; width: 190px; height: 58px; background: #fff; border-radius: 99px; opacity: .85; filter: drop-shadow(0 8px 10px rgba(63, 124, 255, .12)); animation: drift 70s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 80px; height: 80px; left: 28px; top: -38px; } .cloud::after { width: 62px; height: 62px; right: 30px; top: -28px; }
.cloud.c1 { top: 12%; left: -220px; } .cloud.c2 { top: 38%; left: -220px; transform: scale(.7); animation-duration: 95s; animation-delay: -40s; opacity: .6; } .cloud.c3 { top: 70%; left: -220px; transform: scale(1.1); animation-duration: 120s; animation-delay: -70s; opacity: .5; }
@keyframes drift { to { translate: calc(100vw + 460px) 0; } }
.star { position: absolute; color: #ffc533; font-size: 1.5rem; font-style: normal; animation: twinkle 3.4s ease-in-out infinite; text-shadow: 0 0 12px rgba(255, 197, 51, .7); }
.star.s1 { top: 14%; left: 8%; } .star.s2 { top: 22%; right: 10%; animation-delay: -1s; font-size: 1.1rem; } .star.s3 { top: 56%; left: 3%; animation-delay: -2s; font-size: 1rem; }
.star.s4 { top: 80%; right: 6%; animation-delay: -.5s; } .star.s5 { top: 46%; right: 3%; animation-delay: -1.6s; font-size: 1.2rem; }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.85) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(12deg); } }

/* ---------- page + entrance ---------- */
.lobby { max-width: 1240px; font-family: var(--font-display); padding-top: 14px; }
.lobby p, .lobby small, .lobby label, .lobby li, .lobby select, .lobby input { font-family: "Nunito", var(--font); }
.lobby > * { animation: rise .55s both var(--ease-pop); }
.lobby > *:nth-child(2) { animation-delay: .05s; } .lobby > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.resume { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: var(--yellow-l); border: 3px solid var(--yellow); border-radius: 20px; padding: 10px 16px; font-weight: 800; margin-bottom: 12px; }

/* ---------- hero ---------- */
.lhero { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; min-height: 290px; padding: 28px clamp(20px, 4vw, 48px); margin-bottom: 26px;
  border-radius: 40px; overflow: hidden; isolation: isolate; border: 4px solid #fff; box-shadow: 0 14px 40px rgba(63, 124, 255, .22);
  background: linear-gradient(120deg, #a9d8ff 0%, #d4ecff 48%, #fff0bd 100%); }
.lhero-bg { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; }
.lhero.has-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(255, 255, 255, .88) 0, rgba(255, 255, 255, .6) 45%, transparent 80%); }
.orb { position: absolute; border-radius: 50%; }
.orb.o1 { width: 340px; height: 340px; right: -60px; top: -110px; background: radial-gradient(circle at 35% 35%, #fff6c9, var(--sun) 60%, transparent 72%); opacity: .8; }
.orb.o2 { width: 200px; height: 200px; left: 38%; bottom: -120px; background: rgba(255, 255, 255, .6); }
.orb.o3 { width: 90px; height: 90px; left: -30px; top: 24px; background: rgba(139, 108, 240, .25); }
.lhero-text { max-width: 640px; }
.eyebrow { display: inline-block; margin: 0 0 8px; padding: 4px 14px; border-radius: 99px; background: #fff; color: var(--purple-d); font-weight: 900; font-size: .9rem; letter-spacing: .03em; box-shadow: var(--shadow-s); }
.lhero h1 { font-family: var(--font-display); font-size: clamp(2.1rem, 5.6vw, 4rem); line-height: 1.02; margin: 0 0 12px; color: #1f3a8a; letter-spacing: .01em;
  text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(63, 124, 255, .25); text-wrap: balance; }
.lhero h1 span { color: #e8590c; }
.lhero .lead { font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 900; color: var(--ink); margin: 0 0 6px; }
.lhero .sub { font-size: 1.05rem; color: #3b4770; margin: 0; font-weight: 700; }
.lhero-mascot { display: grid; place-items: center; min-width: 150px; }
.lhero-mascot .art-img { width: clamp(150px, 22vw, 270px); height: auto; filter: drop-shadow(0 14px 14px rgba(38, 48, 77, .25)); animation: floaty 5s ease-in-out infinite; }
.floaty { animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-10px) rotate(1.5deg); } }
@media (max-width: 760px) { .lhero { grid-template-columns: 1fr; text-align: center; min-height: 0; padding: 22px 18px; border-radius: 30px; } .lhero-mascot { order: -1; } .lhero-mascot .art-img { width: 130px; } .lhero-text { margin: 0 auto; } }

/* ---------- mode cards ---------- */
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: start; }
.mode { --mc: var(--blue); --mc-soft: var(--blue-l); --mc-glow: rgba(63, 124, 255, .45); position: relative; display: flex; flex-direction: column; background: #fffdf7; border-radius: var(--card-radius);
  border: 4px solid #fff; box-shadow: 0 10px 28px rgba(38, 48, 77, .16); overflow: hidden; transition: transform .25s var(--ease-pop), box-shadow .25s; }
.mode:hover, .mode:focus-within { transform: translateY(-8px); box-shadow: 0 18px 38px rgba(38, 48, 77, .2), 0 0 0 4px var(--mc-glow); }
.m-computer { --mc: #3f7cff; --mc-soft: #e3edff; --mc-glow: rgba(63, 124, 255, .45); }
.m-friends { --mc: #14b8a6; --mc-soft: #d6f7f1; --mc-glow: rgba(20, 184, 166, .45); }
.m-tutorial { --mc: #8b6cf0; --mc-soft: #efe9ff; --mc-glow: rgba(139, 108, 240, .45); }
.mode-art { position: relative; height: 190px; overflow: hidden; background: linear-gradient(160deg, var(--a1), var(--a2)); }
.m-computer .mode-art { --a1: #3f7cff; --a2: #8cc3ff; } .m-friends .mode-art { --a1: #14b8a6; --a2: #5fe0d0; } .m-tutorial .mode-art { --a1: #8b6cf0; --a2: #f5a9d8; }
.mode-art .art-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease-pop); }
.mode:hover .mode-art .art-img { transform: scale(1.05) translateY(-3px); }
.mode-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 22px; }
.mode h3 { font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 1.85rem); margin: 0; color: #1f2a4d; letter-spacing: .02em; }
.mode h3::after { content: ""; display: block; width: 54px; height: 6px; border-radius: 6px; background: var(--mc); margin-top: 6px; }
.mode-sub { font-weight: 900; font-size: 1.1rem; color: #3b4770; margin: 0; }
.mode-text { margin: 0; color: #3b4770; font-weight: 700; }

/* CSS illustrations used when artwork is missing */
.fa { position: absolute; inset: 0; display: grid; place-items: center; }
.fa .big { font-size: 5.6rem; line-height: 1; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .22)); transition: transform .4s var(--ease-pop); animation: floaty 4.5s ease-in-out infinite; }
.mode:hover .fa .big { transform: translateY(-8px) rotate(-5deg) scale(1.06); }
.fa .sp { position: absolute; font-style: normal; color: #fff7c2; font-size: 1.5rem; animation: twinkle 3s ease-in-out infinite; text-shadow: 0 0 10px rgba(255, 255, 255, .8); }
.fa .sp.s1 { top: 16%; left: 14%; } .fa .sp.s2 { top: 24%; right: 15%; animation-delay: -1s; } .fa .sp.s3 { bottom: 16%; left: 24%; animation-delay: -2s; font-size: 1.1rem; }
.fa .mini { position: absolute; font-size: 2rem; bottom: 12px; right: 18px; transform: rotate(14deg); filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .2)); }
.fa .sun { position: absolute; width: 150px; height: 150px; border-radius: 50%; right: -30px; top: -40px; background: radial-gradient(circle at 35% 35%, #fff6c9, #ffd45c 65%, transparent 70%); opacity: .9; }
.fa .kid { position: absolute; font-size: 4.2rem; bottom: 18px; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .22)); transition: transform .4s var(--ease-pop); }
.fa .kid.k1 { left: 22%; transform: rotate(-6deg); } .fa .kid.k2 { right: 22%; transform: rotate(6deg); }
.mode:hover .fa .kid.k1 { transform: translateY(-8px) rotate(-12deg); } .mode:hover .fa .kid.k2 { transform: translateY(-8px) rotate(12deg); }
.fa .mini.c1 { left: 42%; top: 22%; bottom: auto; right: auto; transform: rotate(-12deg); } .fa .mini.c2 { left: 50%; top: 30%; bottom: auto; right: auto; transform: rotate(10deg); }
.fa .fb { position: absolute; font-size: 2.2rem; animation: floaty 5s ease-in-out infinite; } .fa .fb.f1 { left: 12%; top: 18%; } .fa .fb.f2 { right: 12%; bottom: 16%; animation-delay: -2s; }
.fa .big svg { display: block; }

/* difficulty picker */
.diff { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.diff legend { font-weight: 900; margin-bottom: 8px; padding: 0; color: #1f2a4d; float: left; width: 100%; } .diff legend + * { clear: both; }
.diffopt { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 8px; align-items: center; min-height: 76px; padding: 10px 12px; border-radius: 20px; cursor: pointer; background: #fff; border: 4px solid var(--line);
  transition: transform .15s var(--ease-pop), border-color .15s, background-color .15s, box-shadow .15s; margin: 0; }
.diffopt:hover { transform: translateY(-3px); box-shadow: var(--shadow-s); }
.diffopt:focus-within { outline: 4px solid var(--purple); outline-offset: 2px; }
.diffopt:active { transform: translateY(1px) scale(.98); }
.di-ico { grid-row: 1 / 3; font-size: 1.9rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--mint-l); }
.di-txt { display: grid; line-height: 1.15; } .di-txt b { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .03em; } .di-txt small { font-weight: 700; color: #3b4770; font-size: .85rem; }
.d-normal .di-ico { background: #ffe3c4; }
.di-tick { position: absolute; top: -10px; right: -6px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; background: transparent; transform: scale(0); transition: transform .2s var(--ease-pop); }
.diffopt.on { border-color: #159a7b; background: #e6faf3; box-shadow: 0 4px 0 #159a7b; } .diffopt.d-normal.on { border-color: #e8750c; background: #fff1de; box-shadow: 0 4px 0 #e8750c; }
.diffopt.on .di-tick { background: #159a7b; transform: scale(1); } .diffopt.d-normal.on .di-tick { background: #e8750c; }
@media (max-width: 420px) { .diff { grid-template-columns: 1fr; } }

/* deck picker */
.deckbox label { font-weight: 900; color: #1f2a4d; display: block; margin-bottom: 6px; }
.deckrow { display: flex; gap: 12px; align-items: center; }
.deckthumb { flex: none; width: 52px; height: 72px; border-radius: 10px; background: var(--mc-soft); display: grid; place-items: center; overflow: hidden; border: 3px solid #fff; box-shadow: var(--shadow-s); font-size: 1.6rem; }
.deckthumb img { width: 100%; height: 100%; object-fit: cover; }
.deckpick { flex: 1; min-width: 0; display: grid; gap: 4px; }
.deckpick select { min-height: 50px; border-color: var(--mc); font-weight: 800; }
.deckpick small { font-weight: 800; color: #0f6b57; }
.deckbox .hint { margin: 6px 0 0; }

/* buttons */
.lobbybtn { width: 100%; min-height: 62px; font-family: var(--font-display); font-size: 1.3rem; letter-spacing: .04em; border-radius: 20px; margin-top: 4px; text-align: center; }
.lobbybtn .ico { font-size: 1.5rem; transition: transform .2s var(--ease-pop); }
.lobbybtn:hover .ico { transform: rotate(-12deg) scale(1.15); }
.lobbybtn.second { min-height: 52px; font-size: 1.1rem; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 4px solid rgba(0, 0, 0, .18); border-top-color: currentColor; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* friends */
.or { display: flex; align-items: center; gap: 10px; color: #3b4770; font-weight: 900; font-size: .9rem; margin: 2px 0; } .or::before, .or::after { content: ""; flex: 1; border-top: 3px dashed var(--line); }
.joinrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; } .joinrow .lobbybtn { width: auto; margin: 0; padding-left: 16px; padding-right: 16px; }
.joinrow label { font-weight: 900; color: #1f2a4d; display: block; margin-bottom: 6px; }
.joinrow input { text-transform: uppercase; letter-spacing: .3em; font-weight: 900; font-size: 1.3rem; text-align: center; min-height: 62px; border-color: var(--mc); }
.guestcta { background: var(--mc-soft); border-radius: 20px; padding: 14px 16px; } .guestcta p { margin: 0 0 4px; color: #1f2a4d; } .guestcta .hint { color: #3b4770; font-weight: 700; }

/* tutorial */
.perks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; } .perks li { background: var(--mc-soft); color: #4a2fb0; font-weight: 900; border-radius: 99px; padding: 4px 12px; font-size: .9rem; }

/* ---------- responsive layout ---------- */
@media (max-width: 1099px) {
  .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-tutorial { grid-column: 1 / -1; flex-direction: row; } .m-tutorial .mode-art { flex: 0 0 42%; height: auto; min-height: 220px; } .m-tutorial .mode-body { justify-content: center; }
}
@media (max-width: 699px) {
  .modes { grid-template-columns: 1fr; gap: 18px; }
  .m-tutorial { flex-direction: column; } .m-tutorial .mode-art { flex: none; height: 190px; min-height: 0; }
  .lobby { padding-left: 12px; padding-right: 12px; }
  .mode:hover, .mode:focus-within { transform: none; }
}
@media (max-width: 380px) { .joinrow { grid-template-columns: 1fr; } .joinrow .lobbybtn { width: 100%; } .lhero h1 { font-size: 1.9rem; } }

@media (prefers-reduced-motion: reduce) { .cloud, .star, .floaty, .fa .big, .fa .sp, .fa .fb, .lhero-mascot .art-img { animation: none !important; } .lobby > * { animation: none; } .mode:hover { transform: none; } }
html.reduce-motion .cloud, html.reduce-motion .star, html.reduce-motion .floaty, html.reduce-motion .fa .big, html.reduce-motion .fa .sp, html.reduce-motion .fa .fb, html.reduce-motion .lhero-mascot .art-img, html.reduce-motion .lobby > * { animation: none !important; }

/* the mobile Menu button must stay hidden on wide screens (".btn" used to override ".menu-btn") */
.topbar .menu-btn { display: none; }
@media (max-width: 760px) { .topbar .menu-btn { display: inline-flex; } }

/* phone refinements */
.lhero-mascot svg { width: clamp(110px, 18vw, 210px); height: auto; }
.topbar .menu-btn { min-height: 44px; min-width: 44px; }
@media (max-width: 760px) { .lhero-mascot svg { width: 112px; } .lhero h1 { font-size: clamp(1.9rem, 9vw, 2.6rem); } .lhero .lead { font-size: 1.1rem; } .mode-art { height: 168px; } .fa .big { font-size: 4.6rem; } }

/* ---------- "Coming to mobile" page (shown instead of the game on phones) ---------- */
.soon { max-width: 640px; font-family: var(--font-display); padding-top: 18px; }
.soon-card { text-align: center; background: #fffdf7; border: 4px solid #fff; border-radius: 36px; box-shadow: 0 14px 40px rgba(63, 124, 255, .22); padding: 22px 20px 26px; animation: rise .55s both var(--ease-pop); overflow: hidden; position: relative; }
.soon-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 190px; background: linear-gradient(160deg, #a9d8ff, #e7dcff 60%, #fff0bd); z-index: 0; }
.soon-art { position: relative; z-index: 1; display: grid; place-items: center; min-height: 170px; margin-bottom: 8px; }
.soon-art .art-img { width: min(260px, 70%); height: auto; border-radius: 24px; filter: drop-shadow(0 12px 12px rgba(38, 48, 77, .25)); }
.soon-card > * { position: relative; z-index: 1; }
.soon h1 { font-size: clamp(1.6rem, 7vw, 2.3rem); line-height: 1.05; margin: 8px 0; color: #1f3a8a; text-shadow: 0 3px 0 #fff, 0 5px 0 rgba(63, 124, 255, .22); text-wrap: balance; }
.soon .lead { font-size: 1.25rem; font-weight: 900; color: #6a4bd0; margin: 0 0 8px; }
.soon .msg { font-family: "Nunito", var(--font); font-weight: 700; color: #3b4770; font-size: 1.05rem; margin: 0 auto 14px; max-width: 46ch; }
.stores-title { font-size: 1.1rem; letter-spacing: .06em; color: #1f2a4d; margin: 12px 0 10px; }
.stores { list-style: none; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 0 0 16px; padding: 0; }
.storebadge { display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 20px 8px 14px; border-radius: 16px; background: #1f2a4d; color: #fff; text-decoration: none; font-family: "Nunito", var(--font); }
.storebadge .si { font-size: 1.9rem; } .storebadge small { display: block; font-size: .72rem; font-weight: 800; opacity: .85; line-height: 1; text-align: left; } .storebadge b { display: block; font-size: 1.1rem; line-height: 1.15; text-align: left; }
.storebadge.off { background: #e7e9f2; color: #4a557f; border: 3px dashed #b9bfd8; cursor: not-allowed; } .storebadge.off .si { filter: grayscale(1); opacity: .7; }
.soon .lobbybtn { max-width: 340px; margin: 4px auto 0; }
.soon .desk { font-family: "Nunito", var(--font); font-weight: 800; color: #3b4770; margin: 14px 0 4px; } .soon .desk2 { font-family: "Nunito", var(--font); font-size: .9rem; color: #4a557f; margin: 0; }
