/* Jello Shop (/jelloshop): the page around the shop, and the shop's own frame.
   Consumes the site's jelly tokens so it reads as part of the same site; the
   game itself is a single canvas that scales to fit whatever screen it gets. */

.js-page {
  max-width: 1120px;
}

/* ---- breadcrumbs + heading, matching the other /more pages ---- */
.js-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
  font-size: var(--text-sm, 0.875rem);
  color: var(--color-text-tertiary);
}
.js-crumbs li + li::before {
  content: "/";
  margin-right: var(--space-2);
  color: var(--color-text-disabled);
}
.js-crumbs a {
  color: var(--color-text-secondary);
  text-decoration: none;
}
.js-crumbs a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.js-head {
  max-width: 68ch;
  margin-bottom: var(--space-8);
}
.js-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--color-text-primary);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
.js-lead {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: 0;
}

/* ---- the shop frame ---- */
.js-stage {
  position: relative;
  margin: 0 0 var(--space-10);
  border-radius: 28px;
  overflow: hidden;
  background: #1b2140;
  box-shadow:
    0 0 0 4px var(--color-bg-card),
    0 18px 40px -18px rgba(27, 33, 64, 0.55);
}

.js-canvas-wrap {
  position: relative;
  display: block;
  width: 100%;
  /* The room is 960x600. Height is pinned to that ratio so the canvas is
     never cropped: on a narrow phone the whole shop simply gets smaller. */
  aspect-ratio: 960 / 600;
  background: #2a1c10;
}

.js-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Taps walk the jell-o; they must not scroll or zoom the page. */
  touch-action: manipulation;
  cursor: crosshair;
}

/* The bean counter, pinned to the corner of the shop. */
.js-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  background: rgba(27, 33, 64, 0.72);
  color: var(--color-text-inverse);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  user-select: none;
}
.js-bean-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Sound toggle, top right. */
.js-sound {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(27, 33, 64, 0.72);
  color: var(--color-text-inverse);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color 160ms ease, transform 160ms ease;
}
.js-sound:hover {
  background: rgba(38, 46, 77, 0.86);
}
.js-sound:active {
  transform: scale(0.96);
}
.js-sound-icon {
  width: 15px;
  height: 15px;
  flex: none;
}
.js-sound[aria-pressed="false"] .js-sound-icon {
  opacity: 0.55;
}

/* Start card. The shop is silent until the visitor taps, which is also what
   browsers require before audio can play. */
.js-start {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(27, 33, 64, 0.34);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 420ms ease, visibility 420ms ease;
}
.js-stage.is-playing .js-start {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.js-start-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 22rem;
  padding: 22px 26px;
  border-radius: 22px;
  background: rgba(251, 248, 244, 0.95);
  color: var(--color-navy, #262e4d);
  text-align: center;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  border: 0;
  font: inherit;
}
.js-start-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}
.js-start-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--color-ink-slate, #3d4770);
}
.js-start-hint {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  color: var(--color-jelly, #db1816);
  font-weight: 600;
}

/* ---- text sections ---- */
.js-section {
  margin-bottom: var(--space-10);
  max-width: 68ch;
}
.js-section h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.375rem, 2.6vw, 1.875rem);
  margin: 0 0 var(--space-4);
  color: var(--color-text-primary);
}
.js-section p {
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-4);
}
.js-section ul {
  line-height: 1.65;
  color: var(--color-text-secondary);
  padding-left: 1.25rem;
  margin: 0 0 var(--space-4);
}
.js-section li + li {
  margin-top: var(--space-2);
}
.js-credits {
  list-style: none;
  padding: 0;
  font-size: 0.9375rem;
}
.js-noscript {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md, 16px);
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Small screens: the shop keeps its aspect ratio and the frame tightens. */
@media (max-width: 640px) {
  .js-stage {
    border-radius: 20px;
    box-shadow:
      0 0 0 3px var(--color-bg-card),
      0 12px 28px -16px rgba(27, 33, 64, 0.5);
  }
  .js-hud {
    top: 8px;
    left: 8px;
    padding: 6px 11px 6px 8px;
    font-size: 0.9375rem;
  }
  .js-sound {
    top: 8px;
    right: 8px;
    padding: 7px 11px;
  }
  /* On a phone the room itself is small, so the button gives up its label and
     keeps just the icon rather than covering a quarter of the shop. */
  .js-sound-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .js-sound-icon {
    width: 17px;
    height: 17px;
  }
  .js-start-card {
    padding: 18px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js-start,
  .js-sound {
    transition: none;
  }
}
