/* ===== Jaro Spark — Login page (same design, upgraded look) =====
   Your own button images still work: they replace the CSS versions automatically. */
:root {
  /* ---- Button image shapes (width / height of YOUR images) ----
     Change these if your exported images have a different shape. */
  --ratio-tab: 190 / 56;       /* LOGIN heading            e.g. 380 × 112 px */
  --ratio-social: 118 / 62;    /* Google / Apple / Facebook e.g. 236 × 124 px */
  --ratio-guest: 400 / 62;     /* PLAY AS GUEST            e.g. 800 × 124 px */

  --bg-1: #0b0626;
  --bg-2: #24106b;
  --bg-3: #3a1b9e;
  --panel: #140f3f;
  --panel-border: #3a2a8f;
  --line: #6a3df0;
  --text: #ffffff;
  --text-soft: #cfc4ff;
  --pink: #e04cf0;
  --pink-dark: #8f1fa8;
  --green-dark: #00801e;
  --error-bg: rgba(255, 82, 110, 0.15);
  --error-border: #ff526e;
  --info-bg: rgba(124, 243, 196, 0.12);
  --info-border: #7cf3c4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body.lg-page {
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--bg-3) 0%, var(--bg-2) 40%, var(--bg-1) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- night sky ---------- */
.lg-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

/* twinkling stars */
.lg-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 30% 70%, #fff, transparent),
    radial-gradient(2px 2px at 55% 15%, #fff, transparent),
    radial-gradient(1px 1px at 70% 55%, #fff, transparent),
    radial-gradient(2px 2px at 85% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 92% 80%, #fff, transparent),
    radial-gradient(1px 1px at 20% 90%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 45% 45%, #fff, transparent);
  opacity: .7;
  animation: lg-twinkle 4s ease-in-out infinite alternate;
}
@keyframes lg-twinkle { from { opacity: .4; } to { opacity: .9; } }
.lg-stars--2 {
  background-image:
    radial-gradient(1.5px 1.5px at 5% 50%, #ffe3a8, transparent),
    radial-gradient(1px 1px at 38% 28%, #fff, transparent),
    radial-gradient(2px 2px at 64% 82%, #dcc8ff, transparent),
    radial-gradient(1px 1px at 78% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 96% 48%, #fff, transparent);
  animation-duration: 6s;
  animation-direction: alternate-reverse;
}

/* shooting stars */
.lg-shoot {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px #fff, 0 0 22px rgba(141, 225, 255, .9);
  opacity: 0;
  animation: lg-shoot 8s ease-in infinite;
}
.lg-shoot::before {
  content: "";
  position: absolute;
  right: 2px; top: 1px;
  width: 120px; height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9));
}
.lg-shoot--1 { top: 10%; left: -5%; animation-delay: 1.5s; }
.lg-shoot--2 { top: 26%; left: -5%; animation-delay: 5s; animation-duration: 10s; }
@keyframes lg-shoot {
  0% { transform: translate(0, 0); opacity: 0; }
  5% { opacity: 1; }
  30% { transform: translate(70vw, 24vh); opacity: 0; }
  100% { opacity: 0; }
}

/* soft glow behind the panel */
.lg-glow {
  position: absolute;
  left: 50%; top: 50%;
  width: min(900px, 150vw); height: min(760px, 130vw);
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(147, 112, 219, .38), rgba(224, 76, 240, .12) 55%, transparent);
  animation: lg-breathe 7s ease-in-out infinite alternate;
}
@keyframes lg-breathe { to { transform: translate(-50%, -50%) scale(1.08); } }

/* purple clouds along the bottom */
.lg-clouds {
  position: absolute;
  left: -5%; right: -5%;
  bottom: -2px;
  height: 22vh;
  min-height: 120px;
  background:
    radial-gradient(60px 50px at 4% 70%, var(--c) 98%, transparent),
    radial-gradient(110px 80px at 12% 85%, var(--c) 98%, transparent),
    radial-gradient(90px 70px at 22% 75%, var(--c) 98%, transparent),
    radial-gradient(130px 90px at 33% 92%, var(--c) 98%, transparent),
    radial-gradient(100px 70px at 45% 82%, var(--c) 98%, transparent),
    radial-gradient(140px 90px at 57% 95%, var(--c) 98%, transparent),
    radial-gradient(100px 75px at 69% 80%, var(--c) 98%, transparent),
    radial-gradient(130px 90px at 81% 92%, var(--c) 98%, transparent),
    radial-gradient(90px 70px at 91% 76%, var(--c) 98%, transparent),
    radial-gradient(80px 60px at 99% 88%, var(--c) 98%, transparent),
    linear-gradient(transparent 80%, var(--c) 80%);
}
.lg-clouds--back { --c: #4a24a8; opacity: .6; transform: translateY(-14px) scaleX(-1); animation: lg-drift 30s ease-in-out infinite alternate; }
.lg-clouds--front { --c: #6a35cf; opacity: .9; animation: lg-drift 24s ease-in-out infinite alternate-reverse; }
@keyframes lg-drift { from { translate: -2% 0; } to { translate: 2% 0; } }

.lg-back {
  position: fixed;
  top: 18px;
  left: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px 9px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background .2s ease;
}
.lg-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lg-back:hover { background: rgba(255, 255, 255, .16); }

.lg-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 48px;
}

/* Jaro Spark logo above the panel */
.lg-logo { display: block; margin: 0 auto clamp(56px, 10vw, 74px); animation: lg-float 4s ease-in-out infinite; }
.lg-logo img {
  display: block;
  width: min(300px, 72vw);
  height: auto;
  filter: drop-shadow(0 8px 26px rgba(147, 112, 219, .6)) drop-shadow(0 0 18px rgba(224, 76, 240, .3));
}
@keyframes lg-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Oso peeking over the top of the panel */
.lg-peek {
  position: absolute;
  left: 50%;
  top: 0;
  width: 116px;
  height: auto;
  transform: translate(-50%, -80%);
  filter: drop-shadow(0 10px 18px rgba(10, 3, 34, .55));
  animation: lg-peek 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes lg-peek {
  0%, 100% { transform: translate(-50%, -80%) rotate(-2deg); }
  50% { transform: translate(-50%, -86%) rotate(2deg); }
}

/* ---------- the panel ---------- */
.lg-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: clamp(20px, 5vw, 30px);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(30, 20, 92, .92) 0%, rgba(20, 15, 63, .94) 100%);
  border: 2px solid var(--panel-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 0 0 4px rgba(20, 15, 63, .6),
    0 30px 70px rgba(0, 0, 0, .55),
    0 0 60px rgba(147, 112, 219, .3),
    inset 0 1px 0 rgba(255, 255, 255, .12);
  animation: lg-rise .7s cubic-bezier(.2, .8, .3, 1.15) both;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 3.5vw, 18px);
}

/* glowing edge around the panel */
.lg-panel::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(140deg, rgba(224, 76, 240, .8), transparent 35%, transparent 65%, rgba(124, 243, 196, .6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.lg-panel > * { position: relative; z-index: 1; }
.lg-panel > .lg-peek { position: absolute; z-index: 0; }
@keyframes lg-rise { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- image slots (shared) ---------- */
.lg-tab,
.lg-btn {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
}

/* your image fills its slot exactly; if it's missing it removes itself and the CSS version shows */
.lg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.lg-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  z-index: 1;
}

/* "Log in" heading — a clean title (your own image, if added, still replaces it) */
.lg-tab { max-width: 300px; margin: 6px auto 0; }
.lg-tab.has-img { aspect-ratio: var(--ratio-tab); }
.lg-fallback--tab {
  position: static;
  font-family: "Fredoka", "Outfit", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 7vw, 34px);
  letter-spacing: .5px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 18px rgba(179, 136, 255, .55);
}
.lg-fallback--tab::after { display: none; }   /* no gloss on the title */

/* glossy shine on the CSS buttons */
.lg-fallback { overflow: hidden; }
.lg-fallback::after {
  content: "";
  position: absolute;
  left: 6%; right: 6%; top: 6%;
  height: 34%;
  border-radius: 10px 10px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0));
  pointer-events: none;
}

/* when your image has loaded, the CSS version underneath is hidden completely */
.has-img > .lg-fallback { display: none; }

/* screen-reader-only text */
.lg-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- divider ---------- */
.lg-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 600;
  font-size: clamp(13px, 3.6vw, 15px);
}
.lg-divider::before,
.lg-divider::after {
  content: "";
  flex: 1;
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--line));
}
.lg-divider::after { background: linear-gradient(90deg, var(--line), transparent); }

/* ---------- social buttons ---------- */
.lg-social {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 3vw, 16px);
}
.lg-btn { cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.lg-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.lg-btn:active:not(:disabled) { transform: translateY(1px); }
.lg-btn:disabled { cursor: not-allowed; opacity: .6; }
.lg-btn:focus-visible { outline: 3px solid #7cf3c4; outline-offset: 3px; border-radius: 16px; }

.lg-btn--social { aspect-ratio: var(--ratio-social); }
.lg-btn--social .lg-fallback svg { width: 34%; height: 44%; margin-bottom: 16%; }
.lg-btn--social:hover:not(:disabled) .lg-fallback { box-shadow: 0 0 22px currentColor; }
.lg-btn--google { color: rgba(110, 140, 255, .8); }
.lg-btn--apple { color: rgba(190, 80, 255, .85); }
.lg-btn--facebook { color: rgba(70, 140, 255, .85); }

/* small name under each icon */
.lg-tile-label {
  position: absolute;
  z-index: 3;
  left: 0; right: 0;
  bottom: 11%;
  font-family: "Fredoka", "Outfit", sans-serif;
  font-weight: 700;
  font-size: clamp(11px, 3vw, 13px);
  letter-spacing: .3px;
  color: #fff;
  pointer-events: none;
}
.lg-btn--google .lg-tile-label { color: #2a2a4a; }
.has-img > .lg-tile-label { display: none; }     /* your image already has its own text */

.lg-btn--google .lg-fallback {
  background: linear-gradient(180deg, #ffffff, #e7e6f3);
  border: 3px solid #4a6cf7;
  box-shadow: 0 0 14px rgba(110, 140, 255, .45);
}
.lg-btn--apple .lg-fallback {
  background: linear-gradient(180deg, #2a1660, #13093a);
  border: 3px solid #b44cf0;
  box-shadow: 0 0 14px rgba(190, 80, 255, .5);
}
.lg-btn--facebook .lg-fallback {
  background: linear-gradient(180deg, #3d8bff, #1460e6);
  border: 3px solid #6aa8ff;
  box-shadow: 0 0 14px rgba(70, 140, 255, .5);
}

/* ---------- play as guest ---------- */
.lg-btn--guest { height: 56px; }
.lg-btn--guest.has-img { height: auto; aspect-ratio: var(--ratio-guest); }
.lg-btn--guest { margin-top: 4px; }
.lg-fallback--guest {
  isolation: isolate;
  gap: 10px;
  border-radius: 16px;
  font-family: "Fredoka", "Outfit", sans-serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .3px;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6 0%, #b04cf0 55%, #e04cf0 100%);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 10px 26px rgba(176, 76, 240, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: box-shadow .2s ease;
}
.lg-fallback--guest::after { display: none; }        /* no cartoon gloss on this one */
.lg-btn--guest:hover:not(:disabled) .lg-fallback--guest { box-shadow: 0 14px 34px rgba(176, 76, 240, .6), inset 0 1px 0 rgba(255, 255, 255, .3); }
.lg-guest-star { width: 20px; height: 20px; color: #ffe08a; flex-shrink: 0; }
/* light sweep across PLAY AS GUEST */
.lg-fallback--guest::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: skewX(-20deg);
  animation: lg-sweep 3.6s ease-in-out infinite;
  z-index: -1;
}
@keyframes lg-sweep { 0%, 70% { left: -40%; } 100% { left: 120%; } }

/* loading spinner on the clicked button (login.js adds the "loading" class) */
.lg-btn.loading::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .9);
  border-right-color: transparent;
  animation: lg-spin .7s linear infinite;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, .6));
}
.lg-btn.loading .lg-img,
.lg-btn.loading .lg-fallback { filter: brightness(.7); }
@keyframes lg-spin { to { transform: rotate(360deg); } }

/* ---------- messages ---------- */
.lg-msg {
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid;
}
.lg-msg.error { background: var(--error-bg); border-color: var(--error-border); }
.lg-msg.info,
.lg-msg.success { background: var(--info-bg); border-color: var(--info-border); }

.lg-note,
.lg-legal {
  margin: 0;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}
.lg-note { margin-top: -4px; }
.lg-legal { font-size: 12px; }
.lg-legal a { color: #fff; }

/* ---------- phones ---------- */
@media (max-width: 420px) {
  .lg-wrap { padding: 70px 14px 40px; }
  .lg-peek { width: 96px; }
  .lg-back { top: 14px; left: 12px; }
}
@media (max-height: 700px) and (min-width: 600px) {
  .lg-logo { margin-bottom: 20px; }
  .lg-logo img { width: 220px; }
  .lg-peek { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-stars, .lg-shoot, .lg-glow, .lg-clouds, .lg-panel, .lg-peek, .lg-logo, .lg-fallback--guest::before { animation: none !important; }
  .lg-btn { transition: none; }
}