/* ======================================================================
   jellyball.io home ("/"): the 3D city backdrop (client-src/04g-jellyhome.js jhMountCity) with the UI over it: the big
   jelly at the top, Explore / Play / Create stacked in the middle, the tagline at the bottom.
   (The old 2D photo stage's rules are archived in public/jellyball/archive/home-2d-preview.css.)
   html:has(#view-jellyball:not(.hidden) > .jh-home) is set while the home page is showing.
   ====================================================================== */
html:has(#view-jellyball:not(.hidden) > .jh-home), html:has(#view-jellyball:not(.hidden) > .jh-home) body { background: #0b1020; overscroll-behavior: none; }
html:has(#view-jellyball:not(.hidden) > .jh-home) body { overflow: hidden; }

/* the bar floats over the photo */
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar {
  position: fixed !important; left: 0; right: 0; top: 0;
  background: transparent !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  border-bottom: 0 !important; box-shadow: none !important;
  padding: 0 clamp(16px, 3vw, 36px) !important;
  height: 72px;
}
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar .brand-word,
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar .jb-wordmark { color: #fff !important; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45); }
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar .brand-mark { filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.4)); }
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar .icon-btn { color: #fff; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.2); }
/* "Create account" and the account button: the cartoony skin in jellyball-site.css */

html:has(#view-jellyball:not(.hidden) > .jh-home) .layout { max-width: none !important; padding: 0 !important; }
html:has(#view-jellyball:not(.hidden) > .jh-home) .center { padding: 0 !important; min-height: 0 !important; }

/* ---------- the stage ---------- */
.jh-home {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  color: #fff; background: #0b1020;
  font-family: Inter, var(--font-sys, system-ui), sans-serif;
}
.jh-stage { position: absolute; inset: 0; }
/* the 3D city: a cartoon poster of a city street in the game's own sky colours (an SVG, a few KB: it scales to any
   screen, anchored at the street) until the live city draws, then the live canvas fades in over it. Phones, reduced
   motion and data saver keep the poster. */
.jh-stage.jh-city { background: #8fd0ff url('/jellyball/home/city-poster.svg') center bottom / cover no-repeat; }
.jh-city-live { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease; }
.jh-stage.is-live .jh-city-live { opacity: 1; }
/* legibility over a bright daytime city: a light darkening at the top (the bar) and a soft vignette behind the middle */
.jh-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 22, 40, 0.34) 0%, rgba(10, 22, 40, 0.08) 18%, rgba(10, 22, 40, 0) 30%, rgba(10, 22, 40, 0) 76%, rgba(10, 22, 40, 0.22) 100%),
    radial-gradient(38% 44% at 50% 54%, rgba(10, 22, 40, 0.2) 0%, rgba(10, 22, 40, 0) 100%),
    radial-gradient(130% 100% at 50% 50%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, 0.22) 100%);
}

/* ---------- the UI over it ---------- */
.jh-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(72px + 1.5vh) clamp(16px, 4vw, 48px) max(18px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.jh-content > * { pointer-events: auto; }
.jh-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.jh-ball {
  --size: clamp(92px, 17vh, 176px);
  width: var(--size); height: var(--size);
  position: relative; touch-action: none; cursor: grab;
}
.jh-ball.is-held { cursor: grabbing; }
/* the canvas is bigger than the ball so a stretch isn't clipped */
.jh-ball canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.jh-title {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.jh-tagline {
  margin: clamp(10px, 1.6vh, 18px) 0 0; max-width: 40ch; text-align: center; flex: none;
  padding: 7px 16px; border-radius: 14px;
  background: rgba(8, 11, 24, 0.34); border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  font-size: clamp(0.98rem, 1.9vh, 1.18rem); line-height: 1.45; font-weight: 500;
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 2px 18px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.005em;
}

/* the three ways in, stacked in the middle of the space between the jelly and the tagline */
.jh-actions {
  margin: auto auto;
  width: 100%; max-width: 260px;
  display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.4vh, 12px);
}
.jh-action {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 54px; padding: 6px 20px 4px 16px;
  border-radius: 16px; text-align: center; cursor: pointer;
  color: #fff;
  background: rgba(14, 18, 34, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  transition: transform 0.18s cubic-bezier(.2, .8, .2, 1.2), background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.jh-action:hover { transform: translateY(-3px); background: rgba(22, 28, 52, 0.58); border-color: rgba(255, 255, 255, 0.3); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.jh-action:active { transform: translateY(0) scale(0.985); }
.jh-action:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, #fff); outline-offset: 3px; }
.jh-action-ic {
  flex: none; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.14);
}
.jh-action-ic svg { width: 24px; height: 24px; }
.jh-action-text { display: flex; flex-direction: column; min-width: 0; }
.jh-action-label { font-size: 1.22rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.jh-action-sub { font-size: 0.86rem; color: rgba(255, 255, 255, 0.72); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jh-action-primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, transparent), rgba(98, 70, 230, 0.92));
  border-color: rgba(214, 200, 255, 0.55);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--brand-2) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.jh-action-primary:hover { background: linear-gradient(135deg, rgba(152, 117, 255, 0.96), rgba(110, 82, 240, 0.96)); border-color: rgba(230, 220, 255, 0.75); box-shadow: 0 18px 46px color-mix(in srgb, var(--brand-2) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.jh-action-primary .jh-action-ic { background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.3); }
.jh-action-primary .jh-action-sub { color: rgba(255, 255, 255, 0.86); }


/* the skinned buttons: compact, centered icon and label tightly surrounded with margins */
html[data-brand="jellyball"] .jh-home .jh-actions {
  max-width: 260px;
  margin: auto auto;
  gap: clamp(8px, 1.3vh, 12px);
  align-items: center;
}
html[data-brand="jellyball"] .jh-home .jh-action {
  --s: 1.0;
  width: 100%; min-height: 54px;
  flex-direction: row; justify-content: center; align-items: center; text-align: center;
  padding: 4px 18px 4px 14px !important; gap: 12px;
}
html[data-brand="jellyball"] .jh-home .jh-action-ic { width: 40px; height: 40px; }
html[data-brand="jellyball"] .jh-home .jh-action-ic .jx-pi { width: 24px; height: 24px; }
html[data-brand="jellyball"] .jh-home .jh-action-text { display: flex; align-items: center; justify-content: center; text-align: center; }
html[data-brand="jellyball"] .jh-home .jh-action-label { font-size: clamp(1.3rem, 2.4vh, 1.45rem); text-align: center; }
html[data-brand="jellyball"] .jh-home .jh-action-sub { display: none; }

/* phones: the same rows, a little smaller */
@media (max-width: 680px) {
  html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar { height: 60px; }
  .jh-content { padding-top: calc(60px + 1vh); }
  html[data-brand="jellyball"] .jh-home .jh-actions { max-width: 400px; gap: 10px; }
  html[data-brand="jellyball"] .jh-home .jh-action { --s: 1.1; min-height: 76px; padding: 6px 16px 2px 10px !important; gap: 12px; }
  html[data-brand="jellyball"] .jh-home .jh-action-ic { width: 52px; height: 52px; }
  html[data-brand="jellyball"] .jh-home .jh-action-label { font-size: 1.3rem; }
  html[data-brand="jellyball"] .jh-home .jh-action-sub { font-size: 0.85rem; }
}
/* short screens (landscape laptops with a small window, phones on their side): smaller jelly and rows */
@media (max-height: 640px) {
  html[data-brand="jellyball"] .jh-home .jh-actions { gap: 8px; }
  html[data-brand="jellyball"] .jh-home .jh-action { --s: 1; min-height: 60px; padding: 4px 16px 0 10px !important; }
  html[data-brand="jellyball"] .jh-home .jh-action-ic { width: 44px; height: 44px; border-width: 2px; }
  html[data-brand="jellyball"] .jh-home .jh-action-label { font-size: 1.15rem; }
  html[data-brand="jellyball"] .jh-home .jh-action-sub { display: none; }
}
@media (max-height: 560px) and (min-width: 681px) {
  .jh-ball { --size: clamp(72px, 15vh, 120px); }
  .jh-tagline { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .jh-action { transition: none; }
  .jh-city-live { transition: none; }
}
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar .jb-name .jb-jelly { color: color-mix(in srgb, var(--brand) 45%, #fff); }
html:has(#view-jellyball:not(.hidden) > .jh-home) .topbar .jb-name .jb-ball { color: #fff; }

/* ======================================================================
   Play, Create, Explore: the same photo world, quieter. The city sits blurred behind everything; the bar is glass.
   ====================================================================== */
/* Follows the site theme: light by default (a bright jelly-pattern wallpaper), the blurred night city in dark mode.
   Accents (buttons, tabs, focus rings) use the app's accent colour (--brand: red by default on the Jelly Ball site,
   or the colour someone picked for their logo), never a fixed violet. */
html:has(#view-jellyball:not(.hidden) > .jx-page), html:has(#view-jellyball:not(.hidden) > .jx-page) body { background: #f4f1ff; }
html:has(#view-jellyball:not(.hidden) > .jx-page) .topbar {
  background: rgba(255, 255, 255, 0.66) !important; border-bottom: 1px solid rgba(80, 60, 160, 0.1) !important; box-shadow: none !important;
  backdrop-filter: blur(18px) saturate(1.3) !important; -webkit-backdrop-filter: blur(18px) saturate(1.3) !important;
}
html[data-theme="dark"]:has(#view-jellyball:not(.hidden) > .jx-page), html[data-theme="dark"]:has(#view-jellyball:not(.hidden) > .jx-page) body { background: #0c1122; }
html[data-theme="dark"]:has(#view-jellyball:not(.hidden) > .jx-page) .topbar { background: rgba(10, 13, 26, 0.55) !important; border-bottom-color: rgba(255, 255, 255, 0.08) !important; }
html[data-theme="dark"]:has(#view-jellyball:not(.hidden) > .jx-page) .topbar .jb-name .jb-jelly { color: color-mix(in srgb, var(--brand) 45%, #fff); }
html[data-theme="dark"]:has(#view-jellyball:not(.hidden) > .jx-page) .topbar .jb-name .jb-ball { color: #fff; }
html[data-theme="dark"]:has(#view-jellyball:not(.hidden) > .jx-page) .topbar .icon-btn { color: #fff; }
html:has(#view-jellyball:not(.hidden) > .jx-page) .layout { max-width: 1180px !important; }

.jx-page {
  --jx-text: #1d1838; --jx-strong: #15112e; --jx-dim: rgba(45, 38, 84, 0.72); --jx-line: rgba(90, 64, 200, 0.14);
  --jx-glass: rgba(255, 255, 255, 0.72); --jx-glass-2: rgba(255, 255, 255, 0.9); --jx-hover: color-mix(in srgb, var(--brand) 8%, transparent);
  --jx-accent: var(--brand-text); --jx-empty: rgba(255, 255, 255, 0.55); --jx-shadow: rgba(60, 40, 140, 0.14);
  position: relative; color: var(--jx-text); padding: 18px 0 56px;
  font-family: Inter, var(--font-sys, system-ui), sans-serif;
}
:root[data-theme="dark"] .jx-page {
  --jx-text: #f4f2ff; --jx-strong: #fff; --jx-dim: rgba(232, 228, 255, 0.68); --jx-line: rgba(255, 255, 255, 0.12);
  --jx-glass: rgba(18, 22, 42, 0.62); --jx-glass-2: rgba(28, 33, 60, 0.7); --jx-hover: rgba(255, 255, 255, 0.08);
  --jx-accent: color-mix(in srgb, var(--brand) 45%, #fff); --jx-empty: rgba(18, 22, 42, 0.45); --jx-shadow: rgba(0, 0, 0, 0.3);
}
/* light: soft colour blobs + a drifting pattern of little jelly balls and sparkles (the stage uses the same tile) */
.jx-backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(42% 38% at 8% 6%, color-mix(in srgb, var(--brand) 34%, transparent), transparent 70%),
    radial-gradient(38% 34% at 96% 22%, rgba(80, 200, 255, 0.26), transparent 70%),
    radial-gradient(46% 40% at 78% 100%, rgba(255, 150, 190, 0.24), transparent 70%),
    radial-gradient(30% 30% at 14% 92%, rgba(255, 210, 90, 0.22), transparent 70%),
    linear-gradient(180deg, #f8f5ff 0%, #f1f6ff 55%, #fbf4ff 100%);
}
.jx-backdrop::before {
  content: ''; position: absolute; inset: -200px; background: var(--jl-tile) 0 0 / 200px 200px repeat;
  animation: jx-drift 60s linear infinite;
}
.jx-backdrop::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--brand) 3.5%, transparent) 0 2px, transparent 2px 22px);
}
@keyframes jx-drift { to { transform: translate(200px, 200px); } }
@media (prefers-reduced-motion: reduce) { .jx-backdrop::before { animation: none; } }
:root[data-theme="dark"] .jx-backdrop {
  background:
    linear-gradient(180deg, rgba(10, 13, 28, 0.38), rgba(10, 13, 28, 0.8) 50%, #0c1122 100%),
    url('/jellyball/panoramas/hong-kong-sm.jpg') 38% 30% / cover no-repeat;
  filter: saturate(1.1);
}
:root[data-theme="dark"] .jx-backdrop::before { opacity: 0.5; }
:root[data-theme="dark"] .jx-backdrop::after { background: none; backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); z-index: -1; }

.jx-tabs {
  display: flex; gap: 4px; width: fit-content; max-width: 100%; margin: 0 auto 26px; padding: 5px;
  border-radius: 999px; background: var(--jx-glass); border: 1px solid var(--jx-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.jx-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px; border: 0;
  background: transparent; color: var(--jx-dim); font: 650 0.95rem/1 inherit; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.jx-tab:hover { color: var(--jx-strong); background: var(--jx-hover); }
.jx-tab.is-on { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand-2) 40%, transparent); }
.jx-tab-ic svg { width: 17px; height: 17px; display: block; }
.jx-tab:focus-visible, .jx-btn:focus-visible, .jx-card:focus-visible, .jx-level-hit:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, #fff); outline-offset: 2px; }

.jx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.jx-h1 { margin: 0; font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; color: var(--jx-strong); }
.jx-sub { margin: 8px 0 0; color: var(--jx-dim); font-size: 1rem; max-width: 72ch; line-height: 1.5; }
.jx-head-cta { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.jx-head-cta svg, .btn svg { width: 18px; height: 18px; }

.jx-progress {
  flex: none; min-width: 210px; padding: 12px 16px; border-radius: 16px;
  background: var(--jx-glass); border: 1px solid var(--jx-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; row-gap: 8px;
}
.jx-progress-text { color: var(--jx-dim); font-size: 0.9rem; }
.jx-progress-text b { color: var(--jx-strong); font-size: 1.05rem; }
.jx-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--jx-line); overflow: hidden; }
.jx-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffd23f, #ff9f1a); }

.jx-stars { display: inline-flex; gap: 2px; }
.jx-star svg { width: 18px; height: 18px; display: block; fill: var(--jx-line); }
.jx-level-stars .jx-star:not(.is-on) svg { fill: rgba(255, 255, 255, 0.3); }
.jx-star.is-on svg { fill: #ffd23f; filter: drop-shadow(0 1px 4px rgba(255, 190, 0, 0.55)); }

/* level cards: the photo is the card */
.jx-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.jx-level {
  position: relative; border-radius: 20px; overflow: hidden;
  background: var(--jx-glass); border: 1px solid var(--jx-line);
  box-shadow: 0 14px 40px var(--jx-shadow);
  transition: transform 0.2s cubic-bezier(.2, .8, .2, 1.2), box-shadow 0.2s, border-color 0.2s;
}
.jx-level:hover { transform: translateY(-3px); box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4); border-color: color-mix(in srgb, color-mix(in srgb, var(--brand) 45%, #fff) 40%, transparent); }
.jx-level-hit { position: absolute; inset: 0; z-index: 2; border: 0; background: transparent; cursor: pointer; border-radius: inherit; }
.jx-level-art { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #141a30; }
.jx-level-art img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(.2, .8, .2, 1); }
.jx-level:hover .jx-level-art img { transform: scale(1.04); }
.jx-level-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 60%, rgba(10, 13, 28, 0.55) 100%); }
.jx-level-num { position: absolute; z-index: 1; left: 14px; top: 12px; padding: 5px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; color: #fff; background: rgba(10, 13, 28, 0.55); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.jx-level-stars { position: absolute; z-index: 1; right: 12px; top: 10px; padding: 5px 8px; border-radius: 99px; background: rgba(10, 13, 28, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.jx-level-play {
  position: absolute; z-index: 1; right: 16px; bottom: 14px; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 24px color-mix(in srgb, var(--brand-2) 55%, transparent);
  transition: transform 0.2s cubic-bezier(.2, .8, .2, 1.4);
}
.jx-level-play svg { width: 22px; height: 22px; margin-left: 3px; }
.jx-level:hover .jx-level-play { transform: scale(1.08); }
.jx-level-body { padding: 16px 18px 16px; }
.jx-level-title { margin: 0; font-size: 1.22rem; font-weight: 800; letter-spacing: -0.01em; color: var(--jx-strong); }
.jx-level-place { font-weight: 500; color: var(--jx-dim); font-size: 0.98rem; margin-left: 6px; }
.jx-level-blurb { margin: 6px 0 12px; color: var(--jx-dim); font-size: 0.93rem; line-height: 1.5; }
.jx-level-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 0.86rem; color: var(--jx-dim); }
.jx-level-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.jx-level-meta b { color: var(--jx-strong); font-weight: 700; }
.jx-level-meta svg { width: 16px; height: 16px; }
.jx-level-meta .jx-star svg, .jx-level-meta > span:nth-child(2) svg { fill: #ffd23f; stroke: none; }
.jx-credit { position: relative; z-index: 3; margin-left: auto; color: var(--jx-dim); font-size: 0.76rem; text-decoration: none; }
.jx-credit:hover { color: var(--jx-strong); text-decoration: underline; }
.jx-foot-note { margin: 26px 0 0; color: var(--jx-dim); font-size: 0.92rem; text-align: center; }
.jx-link { border: 0; background: none; padding: 0; color: var(--jx-accent); font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.jx-link:hover { color: var(--jx-strong); }

/* a level being played */
.jx-run { display: flex; flex-direction: column; gap: 12px; }
.jx-run-bar {
  display: flex; align-items: center; gap: 14px; padding: 8px 10px 8px 8px; border-radius: 16px;
  background: var(--jx-glass); border: 1px solid var(--jx-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.jx-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px 9px 10px; border-radius: 12px; border: 1px solid var(--jx-line); background: var(--jx-hover); color: var(--jx-strong); font: 650 0.92rem/1 inherit; cursor: pointer; }
.jx-btn:hover { background: var(--jx-glass-2); }
.jx-btn svg { width: 18px; height: 18px; }
.jx-run-title { display: flex; flex-direction: column; min-width: 0; }
.jx-run-title b { font-size: 1.05rem; color: var(--jx-strong); }
.jx-run-title span { font-size: 0.84rem; color: var(--jx-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jx-run-stage { position: relative; height: min(72vh, calc(100dvh - 230px)); min-height: 340px; border-radius: 18px; overflow: hidden; background: var(--jl-backdrop); border: 1px solid var(--jx-line); box-shadow: 0 18px 50px var(--jx-shadow); }
.jx-run-stage > .jl-stage { height: 100%; }
.jx-loading { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--jx-dim); }
.jx-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--jx-line); border-top-color: var(--jx-accent); animation: jx-spin 0.8s linear infinite; }
@keyframes jx-spin { to { transform: rotate(360deg); } }

/* the finish card */
.jx-win { text-align: center; max-width: 380px; }
.jx-win-stars { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.jx-win-star svg { width: 44px; height: 44px; fill: rgba(127, 127, 140, 0.35); }
.jx-win-star.is-on svg { fill: #ffc21a; filter: drop-shadow(0 3px 10px rgba(255, 180, 0, 0.55)); animation: jx-pop 0.5s cubic-bezier(.2, .8, .2, 1.5) both; animation-delay: calc(var(--i) * 0.16s); }
.jx-win-star:nth-child(2) svg { width: 54px; height: 54px; margin-top: -8px; }
@keyframes jx-pop { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
.jx-win-title { margin: 4px 0 2px; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.jx-win-time { margin: 0 0 12px; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; display: flex; align-items: center; justify-content: center; gap: 10px; }
.jx-badge { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 8px; border-radius: 99px; background: #ffd23f; color: #3a2600; }
.jx-goals { list-style: none; margin: 0 auto 10px; padding: 0; text-align: left; display: grid; gap: 8px; width: fit-content; }
.jx-goals li { display: flex; align-items: center; gap: 10px; color: var(--text-2, #667); font-size: 0.95rem; }
.jx-goals li.is-met { color: var(--text, #111); font-weight: 600; }
.jx-goal-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid currentColor; opacity: 0.5; flex: none; }
.jx-goals li.is-met .jx-goal-ic { background: #22c55e; border-color: #22c55e; color: #fff; opacity: 1; }
.jx-goal-ic svg { width: 14px; height: 14px; }
.jx-win-meta { margin: 0 0 14px; font-size: 0.86rem; color: var(--text-2, #667); }
.jx-win-btns .btn { display: inline-flex; align-items: center; gap: 6px; }

/* create */
.jx-create { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.jx-card-stack { display: grid; gap: 14px; }
.jx-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 20px 22px; border-radius: 20px; cursor: pointer; color: var(--jx-strong); font: inherit;
  background: var(--jx-glass); border: 1px solid var(--jx-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform 0.18s cubic-bezier(.2, .8, .2, 1.2), border-color 0.18s, background 0.18s;
}
.jx-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, color-mix(in srgb, var(--brand) 45%, #fff) 40%, transparent); background: var(--jx-glass-2); }
.jx-card-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 22%, transparent); border: 1px solid color-mix(in srgb, color-mix(in srgb, var(--brand) 45%, #fff) 30%, transparent); color: var(--jx-accent); margin-bottom: 6px; }
.jx-card-ic svg { width: 22px; height: 22px; }
.jx-card-title { font-size: 1.12rem; font-weight: 800; letter-spacing: -0.01em; }
.jx-card-text { color: var(--jx-dim); font-size: 0.93rem; line-height: 1.5; }
.jx-card-main {
  justify-content: center; padding: 34px 32px; min-height: 100%;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--brand) 28%, transparent), var(--jx-glass) 60%),
    var(--jx-glass);
  border: 1.5px dashed color-mix(in srgb, color-mix(in srgb, var(--brand) 45%, #fff) 45%, transparent);
}
.jx-card-main .jx-card-ic { width: 56px; height: 56px; border-radius: 16px; }
.jx-card-main .jx-card-title { font-size: 1.5rem; }
.jx-card-cta { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; pointer-events: none; }
.jx-card-hint { color: var(--jx-dim); font-size: 0.8rem; margin-top: 4px; }
.jx-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.jx-drop:focus-within { outline: 3px solid color-mix(in srgb, var(--brand) 45%, #fff); outline-offset: 3px; }

/* explore */
.jx-section { margin-top: 26px; }
.jx-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.jx-section-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; color: var(--jx-strong); }
.jx-section-head span { color: var(--jx-dim); font-size: 0.86rem; }
.jx-empty { margin: 0; padding: 18px 20px; border-radius: 16px; color: var(--jx-dim); background: var(--jx-empty); border: 1px dashed var(--jx-line); }
.jx-community { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

@media (max-width: 840px) {
  .jx-levels, .jx-create { grid-template-columns: 1fr; }
  .jx-head { flex-direction: column; align-items: stretch; }
  .jx-progress { min-width: 0; }
  .jx-run-credit { display: none; }
}
@media (max-width: 520px) {
  .jx-page { padding-top: 12px; }
  .jx-tabs { width: 100%; justify-content: space-between; }
  .jx-tab { flex: 1; justify-content: center; padding: 9px 8px; font-size: 0.9rem; }
  .jx-tab-ic { display: none; }
  .jx-card-main { padding: 26px 22px; }
  .jx-run-stage { height: calc(100dvh - 200px); border-radius: 14px; }
}

/* ======================================================================
   "Post a level" (client-src/04h-levelpost.js): playjellyball.com's create-post dialog
   ====================================================================== */
.lp { display: flex; flex-direction: column; gap: 14px; }
.lp-intro { margin: 0; color: var(--text-2, var(--muted)); font-size: 0.92rem; }
.lp-list { display: flex; flex-direction: column; gap: 8px; max-height: min(52vh, 460px); overflow-y: auto; padding: 2px; }
.lp-h { margin: 6px 0 0; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lp-note { margin: 4px 0; color: var(--muted); font-size: 0.9rem; }
.lp-bad { color: var(--danger, #e5484d); }
.lp-card {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px 8px 8px; text-align: left;
  border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text); cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.lp-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.lp-card:focus-visible { outline: 3px solid #a78bfa; outline-offset: 2px; }
.lp-card.is-on { border-color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 12%, var(--surface-2)); box-shadow: 0 0 0 3px color-mix(in srgb, #8b5cf6 22%, transparent); }
.lp-thumb { width: 120px; height: 50px; border-radius: 9px; object-fit: cover; object-position: left center; flex: none; background: var(--surface-3, var(--border)); }
.lp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.lp-info strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-status { display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; color: var(--muted); }
.lp-status.is-ok { color: var(--ok, #2fb67c); }
.lp-status .ic, .lp-go .ic { width: 13px; height: 13px; }
.lp-meta { font-size: 0.74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-radio { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; }
.lp-radio .ic { width: 14px; height: 14px; }
.lp-card.is-on .lp-radio { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }
.lp-card.is-draft { opacity: 0.92; }
.lp-go { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid var(--border-strong); }
.lp-new { border-style: dashed; background: transparent; }
.lp-new-ic { display: grid; place-items: center; color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 12%, transparent); }
.lp-new-ic .ic { width: 22px; height: 22px; }
.lp-caption { margin: 0; }
.lp-caption textarea { resize: vertical; min-height: 56px; }
@media (max-width: 560px) {
  .lp-thumb { width: 78px; height: 40px; }
  .lp-card { gap: 10px; padding-right: 10px; }
}
.lp-thumb:not(.lp-new-ic) { display: block; overflow: hidden; position: relative; }
.lp-thumb > img, .lp-thumb > canvas, .lp-thumb > .jl-strip-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; object-fit: cover; object-position: left center; }
.lp-preview { display: flex; flex-direction: column; gap: 6px; }
.lp-pv-stage { position: relative; height: clamp(150px, 26vh, 230px); border-radius: 14px; overflow: hidden; background: #0b1014; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22); }
.lp-pv-main { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.lp-pv-main:active { cursor: grabbing; }
.lp-pv-load { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.75); font-size: 0.86rem; }
.lp-pv-tag { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 4px 10px 4px 6px; border-radius: 999px; background: rgba(11, 16, 32, 0.62); color: #fff; font-size: 0.8rem; font-weight: 600; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none; }
.lp-pv-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-pv-tag img { width: 16px; height: 16px; }
.lp-pv-over { width: 100%; height: 34px; display: block; border-radius: 8px; background: #0b1014; cursor: pointer; touch-action: none; }

/* the big jelly (logo-sheet.js mountHero): always bigger than the header logo's jelly when it peeks out (about 110px) */
.jh-ball.lg-hero { --size: clamp(150px, 22vh, 210px); cursor: grab; }
.jh-ball.lg-hero.is-empty { cursor: default; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14); background: radial-gradient(circle, rgba(255, 255, 255, 0.05), transparent 70%); }
@media (max-height: 560px) and (min-width: 681px) { .jh-ball.lg-hero { --size: 140px; } }

/* ======================================================================
   Levels: the HUD's buttons sit over the "Play" card (so full screen works before a run starts), and immersive levels
   (client-src/04f-jellylevels.js jlImmersiveMount): just the level until the menus are asked for
   ====================================================================== */
.jl-stage .jl-hud { z-index: 4; }
html.jl-immersive:not(.jl-chrome) .jl-stage.is-immersive {
  position: fixed; inset: 0; z-index: 200; height: auto !important; min-height: 0;
  border: 0; border-radius: 0; box-shadow: none;
}
html.jl-immersive:not(.jl-chrome), html.jl-immersive:not(.jl-chrome) body { overflow: hidden; overscroll-behavior: none; }
/* with the menus put away, the player's own buttons go too (they come back with the menus) */
html.jl-immersive:not(.jl-chrome) .jl-stage.is-immersive .jl-hud-btns { opacity: 0; pointer-events: none; }
.jl-hud-btns { transition: opacity 0.18s ease; }
/* the hot corner: only while the menus are away; a faint hint that brightens when the pointer is near */
.jl-chrome-hot { display: none; }
html.jl-immersive:not(.jl-chrome) .jl-stage.is-immersive .jl-chrome-hot {
  display: flex; align-items: flex-start; justify-content: flex-end; gap: 3px;
  position: absolute; top: 0; right: 0; width: 110px; height: 84px; z-index: 5;
  padding: 14px 16px 0 0; border: 0; background: transparent; cursor: pointer;
}
.jl-chrome-hot i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 4px rgba(0, 0, 0, 0.5); opacity: 0.45; transition: opacity 0.2s ease, transform 0.2s ease; }
.jl-chrome-hot:hover i, .jl-chrome-hot:focus-visible i { opacity: 1; transform: scale(1.25); }
.jl-chrome-hot:focus-visible { outline: none; }
/* browser full screen: the stage is already the whole screen */
.jl-stage.is-immersive:fullscreen, .jl-stage.is-immersive:-webkit-full-screen { position: fixed; inset: 0; height: 100vh !important; }

/* Jelly Ball's ad box (client-src/04l-jellyads.js): one under Explore, Create, Play and a finished match, never on the
   home screen or during a game. It sits just after #view-jellyball, so it lines up with the page above it. */
.jx-ad { max-width: 980px; margin: 0 auto 48px; position: relative; }
.jx-ad[hidden] { display: none !important; }
:root[data-theme="dark"] .jx-ad { background: rgba(18, 22, 42, 0.62); border-color: rgba(255, 255, 255, 0.14); }
@media (max-width: 640px) { .jx-ad { margin: 0 12px 32px; } }
