/*
 * Jamboree Jewels - standalone styles, no framework, no build step.
 *
 * Built for a phone either way up. Portrait stacks the top bar, the goals,
 * the board and Aroha; landscape puts everything but the board in a column
 * down the left and gives the board the full height. Everything at an edge
 * keeps clear of the notch and the home indicator; the scene runs under them.
 */

:root {
  --jj-navy: #1d2b4a;
  --jj-ink: #22201c;
  --jj-paper: #fffaf0;
  --jj-paper-edge: #d9c9a0;
  --jj-gold: #f2c12e;
  --jj-purple: #622599;
  --jj-green: #1f7a3a;
  --jj-red: #c8321e;
  --jj-glass: rgba(255, 250, 240, 0.9);
  --jj-safe-top: env(safe-area-inset-top, 0px);
  --jj-safe-right: env(safe-area-inset-right, 0px);
  --jj-safe-bottom: env(safe-area-inset-bottom, 0px);
  --jj-safe-left: env(safe-area-inset-left, 0px);
  --jj-vh: 100vh;
}

@supports (height: 100dvh) {
  :root {
    --jj-vh: 100dvh;
  }
}

* {
  box-sizing: border-box;
}

/* Scrollbars: a slim rounded navy thumb on a clear track, with no arrow
   buttons, so scrollers sit inside the rounded paper cards instead of
   showing the grey system bar. Chromium/Safari take the ::-webkit rules
   (setting scrollbar-width/colour there would switch them off), Firefox
   takes the standard properties. Rules that hide a bar still win. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(29, 43, 74, 0.4);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(29, 43, 74, 0.6);
}
::-webkit-scrollbar-button,
::-webkit-scrollbar-corner {
  display: none;
  background: transparent;
}
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 43, 74, 0.4) transparent;
  }
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--jj-navy);
  color: var(--jj-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

[hidden] {
  display: none !important;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.jj-screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  padding: var(--jj-safe-top) var(--jj-safe-right) var(--jj-safe-bottom) var(--jj-safe-left);
}

/* -------------------------------------------------------------- buttons */

.jj-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 4px;
  min-width: 0;
}

.jj-spacer {
  flex: 1;
}

.jj-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(29, 43, 74, 0.5);
  background: var(--jj-glass);
  color: var(--jj-navy);
  font: 700 18px/1 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 0 rgba(29, 43, 74, 0.35);
}

/* A finger wants 44px; the buttons stay drawn at their size and reach a
   little further than they look, so nothing in the bar moves. The inset is
   from inside the 2px border: -4px takes a 40px button to 44, and -10px a
   28px neckerchief to 44 tall. */
.jj-btn,
.jj-turn {
  position: relative;
}

.jj-btn::after,
.jj-turn::after {
  content: "";
  position: absolute;
  inset: -4px;
}

.jj-turn::after {
  inset: -10px -4px;
}

.jj-btn:active,
.jj-cta:active,
.jj-ghost:active {
  transform: translateY(1px);
}

.jj-btn[aria-pressed="false"] {
  opacity: 0.55;
  text-decoration: line-through;
}

/* The chevron is drawn, not typed: a "‹" sits wherever its font puts it,
   which was never the middle of the circle. */
.jj-back svg {
  width: 18px;
  height: 18px;
  margin-right: 2px;
}

.jj-btn:focus-visible,
.jj-cta:focus-visible,
.jj-ghost:focus-visible,
.jj-stop button:focus-visible,
.jj-turn:focus-visible {
  outline: 3px solid var(--jj-gold);
  outline-offset: 2px;
}

.jj-cta,
.jj-ghost {
  border-radius: 999px;
  padding: 11px 20px;
  font: 800 16px/1 system-ui, sans-serif;
  cursor: pointer;
  border: 2px solid var(--jj-navy);
}

.jj-cta {
  background: linear-gradient(#ffd54a, #f2a71e);
  color: var(--jj-navy);
  box-shadow: 0 3px 0 #9a6a10;
}

.jj-ghost {
  background: #fff;
  color: var(--jj-navy);
  box-shadow: 0 3px 0 rgba(29, 43, 74, 0.35);
}

.jj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

/* --------------------------------------------------------------- guide */

.jj-guide-face {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff6dc, #f2d48a);
  border: 2px solid var(--jj-navy);
}

.jj-bubble {
  position: relative;
  margin: 0;
  background: var(--jj-paper);
  border: 2px solid var(--jj-navy);
  border-radius: 14px;
  padding: 7px 11px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--jj-ink);
  box-shadow: 0 2px 0 rgba(29, 43, 74, 0.3);
}

.jj-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 14px;
  border: 7px solid transparent;
  border-right-color: var(--jj-navy);
  border-left: 0;
}

.jj-say-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  text-align: left;
}

/* ------------------------------------------------------------- passport */

.jj-map {
  display: flex;
  flex-direction: column;
}

.jj-logo {
  margin: 0 0 0 4px;
  font: 900 22px/1 system-ui, sans-serif;
  color: #fff;
  text-shadow: 0 2px 0 var(--jj-navy), 2px 0 0 var(--jj-navy), -2px 0 0 var(--jj-navy), 0 -2px 0 var(--jj-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.jj-logo span {
  color: var(--jj-gold);
}

.jj-map-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 12px 12px;
}

.jj-passport-head {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

/* The two journeys, as tabs over the passport: round the world, and the
   Founder's Trail. Hidden until the trail has a stop. */
.jj-journeys {
  display: flex;
  gap: 8px;
  justify-content: center;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.jj-journey {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 20, 40, 0.45);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jj-journey[hidden] {
  display: none;
}

/* Three tabs share a phone's width: "Round the" goes first. */
@media (max-width: 480px) {
  .jj-tab-long {
    display: none;
  }

  .jj-journey {
    padding: 8px 6px;
    font-size: 0.85rem;
  }
}

.jj-journey.is-locked {
  opacity: 0.6;
  border-style: dashed;
}

.jj-journey[aria-selected='true'] {
  background: var(--jj-gold);
  border-color: var(--jj-gold);
  color: #2a1a00;
}

.jj-route {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  /* Ten stops are more than a phone is tall, so the passport scrolls. The
     padding is room for a stop's glow and focus ring, which a scroller clips. */
  overflow: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}

/* Stops grow to fill a tall screen and never shrink below a thumb's height;
   what does not fit scrolls. Centred with auto margins, not justify-content,
   which would push the first stops off the top where a scroll cannot reach. */
.jj-stop {
  position: relative;
  flex: 1 0 58px;
  max-height: 92px;
}

.jj-stop:first-child {
  margin-top: auto;
}

.jj-stop:last-child {
  margin-bottom: auto;
}

/* The dotted flight path between stops. */
.jj-stop + .jj-stop::before {
  content: "";
  position: absolute;
  left: 38px;
  top: -10px;
  height: 12px;
  border-left: 3px dashed rgba(255, 255, 255, 0.85);
  z-index: 0;
}

.jj-stop button {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 16px;
  border: 2px solid var(--jj-navy);
  background: var(--jj-paper);
  color: var(--jj-ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(29, 43, 74, 0.4);
  overflow: hidden;
}

.jj-stop.is-locked button {
  background: rgba(255, 250, 240, 0.55);
  cursor: default;
  color: rgba(34, 32, 28, 0.6);
}

.jj-stop.is-next button {
  border-color: var(--jj-gold);
  box-shadow: 0 0 0 3px rgba(242, 193, 46, 0.6), 0 3px 0 rgba(29, 43, 74, 0.4);
  animation: jj-glow 1.6s ease-in-out infinite;
}

.jj-stop.is-paused button {
  border-color: #2f8f5b;
  border-style: dashed;
}

.jj-stop.is-paused .jj-stop-name small {
  color: #2f6f4b;
  font-weight: 700;
}

@keyframes jj-glow {
  50% {
    box-shadow: 0 0 0 6px rgba(242, 193, 46, 0.35), 0 3px 0 rgba(29, 43, 74, 0.4);
  }
}

.jj-stop-emoji {
  font-size: 34px;
  line-height: 1;
  text-align: center;
}

.jj-stop.is-locked .jj-stop-emoji {
  filter: grayscale(1);
  opacity: 0.6;
}

.jj-stop-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.jj-stop-name strong {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jj-stop-name small {
  font-size: 12.5px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jj-stop-stars {
  font-size: 17px;
  letter-spacing: 1px;
  color: #c9b68a;
  white-space: nowrap;
}

.jj-stop-stars b {
  color: #f2a71e;
  font-weight: inherit;
}

.jj-stop-stamp {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%) rotate(-12deg);
  font: 900 11px/1 system-ui, sans-serif;
  letter-spacing: 1px;
  color: rgba(200, 50, 30, 0.75);
  border: 2px solid rgba(200, 50, 30, 0.6);
  border-radius: 6px;
  padding: 3px 5px;
  pointer-events: none;
  text-transform: uppercase;
  z-index: 2;
  opacity: 0.85;
}

.jj-stop.is-done .jj-stop-stars {
  margin-right: 74px;
}

.jj-map-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  background: var(--jj-glass);
  border: 2px solid var(--jj-navy);
  border-radius: 14px;
  padding: 8px 12px;
}

.jj-total span {
  font-size: 13px;
  opacity: 0.8;
}

.jj-total strong {
  font-size: 18px;
}

.jj-spirit-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 160px;
}

.jj-spirit-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.jj-meter {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(29, 43, 74, 0.15);
  border: 2px solid var(--jj-navy);
  overflow: hidden;
  min-width: 60px;
}

.jj-meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, #8a4fd6, #f2c12e);
  transition: width 0.4s ease;
}

/* Flex, not grid: the handshake is a ::before, and a grid put it and the
   count in two rows, the count hanging out of the bottom of the pill. */
.jj-turns {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex: none;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 2px solid var(--jj-navy);
  background: var(--jj-purple);
  color: #fff;
  font: 800 14px/1 system-ui, sans-serif;
}

/* The journey's own reward (game.js sets data-icon: 🤝, 📯 or 🧣). */
.jj-turns::before {
  content: attr(data-icon);
  font-size: 14px;
  line-height: 1;
}

/* The reward is at its cap and the Spirit has stood down (game.js
   addSpirit): the bar turns to gold with a light running along it and two
   stars twinkling on it, and the reward glows - a nudge to use it, since
   nothing more is earned until it is. */
.is-full .jj-meter {
  border-color: #b8860b;
  box-shadow: 0 0 0 2px rgba(242, 193, 46, 0.35), 0 0 10px rgba(242, 193, 46, 0.6);
}

.is-full .jj-meter span {
  width: 100% !important;
  background:
    linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.85) 45%, transparent 60%) -150% 0 / 60% 100% no-repeat,
    linear-gradient(90deg, #f2a71e, #ffe27a 50%, #f2a71e);
  animation: jj-shine 2.4s ease-in-out infinite;
}

.is-full .jj-meter {
  height: 16px;
}

.is-full .jj-meter span::after {
  content: 'FULL';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 900 10px/1 system-ui, sans-serif;
  letter-spacing: 2px;
  color: #6b3d00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.is-full .jj-meter::before,
.is-full .jj-meter::after {
  content: '';
  position: absolute;
  z-index: 1;
  top: 50%;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  background: #fff;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: jj-twinkle 1.6s ease-in-out infinite;
}

.is-full .jj-meter::before {
  left: 12%;
}

.is-full .jj-meter::after {
  right: 12%;
  animation-delay: 0.8s;
}

.is-full .jj-turn:not(:disabled):not(.is-armed),
.is-full .jj-turns {
  background: radial-gradient(circle at 35% 30%, #a86ef0, var(--jj-purple) 70%);
  border-color: #b8860b;
  animation: jj-ready 1.8s ease-in-out infinite;
}

@keyframes jj-shine {
  60%,
  100% {
    background-position: 250% 0, 0 0;
  }
}

@keyframes jj-twinkle {
  0%,
  100% {
    transform: scale(0.3) rotate(0deg);
    opacity: 0.2;
  }
  50% {
    transform: scale(1) rotate(45deg);
    opacity: 1;
  }
}

@keyframes jj-ready {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(242, 193, 46, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(242, 193, 46, 0);
    transform: scale(1.07);
  }
}

.jj-plane {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6;
  font-size: 36px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35));
}

/* The Founder's Trail's boot prints, walked from stamp to stamp. A print is
   drawn, not an emoji: a sole and a heel, the right one mirrored. */
.jj-tracks {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}

.jj-print {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 14px;
  opacity: 0;
  background:
    radial-gradient(ellipse 3.5px 3px at 5px 11.3px, #4a3220 95%, transparent 100%),
    radial-gradient(ellipse 4.3px 5.2px at 5px 4.6px, #4a3220 95%, transparent 100%);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5));
}

.jj-print-r {
  scale: -1 1;
}

/* Landscape passport: rows of five, every stop whole. Nothing scrolls
   here - a sideways scroller cut the end cards in half and put a scrollbar
   under them. --jj-rows (set by game.js) is how many rows there are, so the
   cards share the height out between them; a phone on its side has no
   height for rows at all, and is the one place that still scrolls. */
@media (orientation: landscape) {
  /* The head, the tabs and the foot stay put and the stops scroll between
     them: with two hundred stops, a wrapped row of everything centred on
     the screen pushed the head off the top, out of reach. */
  .jj-map-body {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
  }

  .jj-passport-head,
  .jj-journeys {
    max-width: 980px;
  }

  .jj-route {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
    min-height: 0;
    max-width: 980px;
    align-items: stretch;
    align-content: flex-start;
    overflow: auto;
    padding: 8px;
  }

  .jj-stop {
    flex: 0 0 calc((100% - 32px) / 5);
    height: clamp(96px, calc((var(--jj-vh) - 250px) / var(--jj-rows, 2) - 10px), 160px);
    max-height: none;
  }

  .jj-stop:first-child,
  .jj-stop:last-child {
    margin: 0;
  }

  /* No flight path into the first stop of a row. */
  .jj-stop:nth-child(5n + 1)::before {
    display: none;
  }

  .jj-stop + .jj-stop::before {
    left: -10px;
    top: 50%;
    width: 12px;
    height: 0;
    border-left: 0;
    border-top: 3px dashed rgba(255, 255, 255, 0.85);
  }

  /* The card's height is fixed by the grid (as little as 96px), so the
     emoji is sized to what the name and stars leave: at full size the
     three stood 120px tall and the stars were cut off the bottom of the card. */
  .jj-stop button {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    justify-items: center;
    text-align: center;
    padding: 6px;
    gap: 3px;
    container-type: size;
  }

  .jj-stop-emoji {
    font-size: clamp(20px, calc(100cqh - 56px), 34px);
  }

  .jj-stop-stars {
    line-height: 1;
  }

  .jj-stop-name {
    align-items: center;
    max-width: 100%;
  }

  .jj-stop-name strong {
    font-size: 14px;
  }

  .jj-stop-name small {
    font-size: 11.5px;
  }

  .jj-stop.is-done .jj-stop-stars {
    margin-right: 0;
  }

  .jj-stop-stamp {
    top: 8px;
    right: 4px;
    transform: rotate(-12deg);
    font-size: 9px;
  }

  .jj-map-foot {
    max-width: 980px;
  }
}

/* A wide screen: still rows of five - one line of fifteen made every card a
   sliver and cut the names off - just bigger cards. */
@media (orientation: landscape) and (min-width: 1300px) {
  .jj-passport-head,
  .jj-route,
  .jj-map-foot {
    max-width: 1100px;
  }

  .jj-stop {
    height: clamp(104px, calc((var(--jj-vh) - 250px) / var(--jj-rows, 2) - 10px), 190px);
  }

  .jj-stop-name strong {
    font-size: 15px;
  }
}

/* A phone on its side: one row, scrolled by touch, so no scrollbar to draw. */
@media (orientation: landscape) and (max-height: 520px) {
  .jj-route {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    scrollbar-width: none;
    height: min(190px, calc(var(--jj-vh) - 210px));
    min-height: 120px;
  }

  .jj-route::-webkit-scrollbar {
    display: none;
  }

  .jj-stop {
    flex: 1 0 104px;
    height: auto;
    min-height: 0;
    max-width: 150px;
  }

  .jj-stop:first-child {
    margin-left: auto;
  }

  .jj-stop:last-child {
    margin-right: auto;
  }

  .jj-stop + .jj-stop:nth-child(5n + 1)::before {
    display: block;
  }

  .jj-stop-stamp {
    top: 5px;
    right: 3px;
    font-size: 8px;
    padding: 2px 3px;
    letter-spacing: 0.5px;
  }
}

@media (orientation: landscape) and (max-height: 430px) {
  .jj-passport-head .jj-guide-face {
    width: 40px;
    height: 40px;
  }

  .jj-passport-head .jj-bubble {
    font-size: 13px;
    padding: 5px 9px;
  }

  .jj-map-body {
    gap: 8px;
    padding-top: 0;
  }

  .jj-stop-emoji {
    font-size: 28px;
  }

  .jj-map-foot {
    padding: 5px 12px;
  }

  .jj-journey {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
}

/* ----------------------------------------------------------------- play */

.jj-play {
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "bar" "hud" "board" "guide";
}

.jj-side {
  display: contents;
}

.jj-play .jj-bar {
  grid-area: bar;
}

.jj-hud {
  grid-area: hud;
  display: grid;
  /* Every digit the same width, so a count ticking down never jiggles. */
  font-variant-numeric: tabular-nums;
  grid-template-columns: auto 1fr;
  grid-template-areas: "moves goals" "score spirit";
  gap: 6px 8px;
  margin: 2px 10px 0;
  padding: 8px 10px;
  background: var(--jj-glass);
  border: 2px solid var(--jj-navy);
  border-radius: 16px;
  box-shadow: 0 3px 0 rgba(29, 43, 74, 0.35);
}

.jj-board-wrap {
  grid-area: board;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
  padding: 8px;
}

#board {
  display: block;
  touch-action: none;
  border-radius: 16px;
  cursor: pointer;
}

/* Effects, sparks and scores, on a canvas a few squares bigger than the
   board all round (game.js, FX_MARGIN), so nothing is cut off at its edge.
   It takes no taps: they go through to the board under it. */
#boardFx {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 2;
}

.jj-guide {
  grid-area: guide;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 10px;
  min-height: 62px;
}

.jj-guide .jj-bubble {
  flex: 1;
  min-width: 0;
  /* Three lines, always: a bubble that grew with each line moved the board
     below it. game.js (Guide.paginate) says anything longer a bubbleful at
     a time. Sideways it grows instead, below everything (landscape rule). */
  height: 73px;
  overflow: hidden;
  transition: transform 0.2s ease;
}

/* More to come: a small arrow in the corner, and a tap moves on. */
.jj-guide .jj-bubble.has-more {
  cursor: pointer;
}

.jj-guide .jj-bubble.has-more::after {
  content: "\25B8";
  position: absolute;
  right: 5px;
  bottom: 1px;
  font-size: 11px;
  color: var(--jj-navy);
  opacity: 0.6;
  animation: jj-more 1s ease-in-out infinite;
}

@keyframes jj-more {
  50% {
    transform: translateX(2px);
  }
}

.jj-guide .jj-bubble.is-pop {
  transform: scale(1.04);
}

.jj-where {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: var(--jj-glass);
  border: 2px solid var(--jj-navy);
  border-radius: 999px;
  padding: 3px 12px 3px 6px;
  box-shadow: 0 2px 0 rgba(29, 43, 74, 0.35);
}

.jj-where-emoji {
  font-size: 22px;
}

.jj-where-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.jj-where-text strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jj-where-text small {
  font-size: 11px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jj-moves {
  grid-area: moves;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  border-radius: 12px;
  background: var(--jj-navy);
  color: #fff;
  padding: 4px 6px;
}

.jj-moves strong {
  font-size: 26px;
  line-height: 1;
}

.jj-moves span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

.jj-moves.is-low {
  background: var(--jj-red);
  animation: jj-pulse 0.9s ease-in-out infinite;
}

@keyframes jj-pulse {
  50% {
    transform: scale(1.06);
  }
}

/* The virus has just taken a move: the counter shudders green. */
.jj-moves.is-sick {
  animation: jj-sick 0.6s ease-in-out;
}

/* A camp tuned while it is being played: the moves counter swells gold for
   more, and dips red for fewer. */
.jj-moves.is-tuned-up {
  animation: jj-tuned-up 0.8s ease-out;
}

.jj-moves.is-tuned-down {
  animation: jj-tuned-down 0.8s ease-out;
}

@keyframes jj-tuned-up {
  30% {
    transform: scale(1.18);
    background: #e0a81e;
  }
  100% {
    transform: none;
  }
}

@keyframes jj-tuned-down {
  30% {
    transform: scale(0.9);
    background: #b8322a;
  }
  100% {
    transform: none;
  }
}

@keyframes jj-sick {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateX(-4px) rotate(-3deg);
    background: #5f9e2a;
  }
  45% {
    transform: translateX(4px) rotate(3deg);
    background: #5f9e2a;
  }
  70% {
    transform: translateX(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .jj-moves.is-sick {
    animation: none;
    background: #5f9e2a;
  }

  .jj-moves.is-tuned-up {
    animation: none;
    background: #e0a81e;
  }

  .jj-moves.is-tuned-down {
    animation: none;
    background: #b8322a;
  }
}

.jj-goals {
  grid-area: goals;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: center;
  align-items: center;
}

/* A board rule (diagonal swaps, diagonal matches), not a goal: dashed and blue. */
.jj-goal.jj-rule {
  background: #e6f2ff;
  border: 2px dashed #2f7de8;
  color: #1d4a8a;
}

.jj-goal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(29, 43, 74, 0.35);
  font-weight: 800;
  font-size: 15px;
  transition: transform 0.15s ease;
}

.jj-goal canvas {
  width: 26px;
  height: 26px;
}

.jj-goal.is-done {
  background: #d9f5d0;
  border-color: #3a9a4a;
}

.jj-goal b {
  display: inline-block;
  text-align: center;
}

.jj-goal.is-done b::after {
  content: "\2713";
  color: #1f7a3a;
}

.jj-goal.is-bump {
  transform: scale(1.15);
}

/* A gem joining the kit bag, on a country's intro card. */
.jj-goal-new {
  background: #fff6d6;
  border-style: dashed;
  border-color: #c8932a;
}

/* A night stop, on its intro card. */
.jj-goal-night {
  background: #1d2346;
  border-color: #6a74c8;
  color: #f2f0ff;
}

.jj-goal-old {
  background: #eef0f2;
  border-style: dashed;
  border-color: #8a96a2;
  opacity: 0.85;
}
.jj-goal-old canvas {
  filter: grayscale(0.7);
}

.jj-score {
  grid-area: score;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 58px;
}

.jj-score-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.jj-score-row strong {
  font-size: 16px;
  letter-spacing: 0;
}

.jj-starbar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(29, 43, 74, 0.15);
  border: 2px solid var(--jj-navy);
  min-width: 80px;
}

.jj-starbar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2a71e, #f2c12e);
  transition: width 0.3s ease;
}

.jj-starbar i {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: #c9b68a;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.jj-starbar i.is-lit {
  background: #f2a71e;
}

.jj-spirit {
  grid-area: spirit;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.jj-spirit .jj-spirit-label {
  font-size: 10px;
}

.jj-turn {
  flex: none;
  border-radius: 999px;
  border: 2px solid var(--jj-navy);
  background: var(--jj-purple);
  color: #fff;
  font: 800 14px/1 system-ui, sans-serif;
  padding: 5px 9px;
  cursor: pointer;
}

.jj-turn:disabled {
  background: rgba(98, 37, 153, 0.35);
  cursor: default;
}

.jj-turn.is-armed {
  background: var(--jj-gold);
  color: var(--jj-navy);
  animation: jj-pulse 0.8s ease-in-out infinite;
}

.jj-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font: 900 clamp(26px, 8vmin, 54px)/1.05 system-ui, sans-serif;
  color: #fff;
  text-align: center;
  text-shadow: 0 3px 0 var(--jj-navy), 0 0 18px rgba(98, 37, 153, 0.9);
  white-space: nowrap;
  animation: jj-banner 1.3s ease forwards;
}

@keyframes jj-banner {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
  18% {
    transform: translate(-50%, -50%) scale(1.12);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -60%) scale(1);
    opacity: 0;
  }
}

/* Narrow phones: "Spirit" alone, so the Good Turn button keeps its room. */
@media (max-width: 380px) {
  .jj-long {
    display: none;
  }
}

/* Short portrait (an SE, or a browser with its bars showing): tighter. */
@media (orientation: portrait) and (max-height: 640px) {
  .jj-guide-face {
    width: 40px;
    height: 40px;
  }

  .jj-guide {
    min-height: 48px;
    padding-bottom: 6px;
  }

  .jj-guide .jj-bubble {
    font-size: 13px;
    padding: 5px 9px;
    height: 65px;
  }

  .jj-hud {
    padding: 6px 8px;
  }

  .jj-moves strong {
    font-size: 22px;
  }
}

/* Landscape: the column on the left, the board as tall as the screen. */
@media (orientation: landscape) {
  .jj-play {
    grid-template-columns: minmax(0, 1fr) min(calc(var(--jj-vh) - var(--jj-safe-top) - var(--jj-safe-bottom)), calc(100vw - 230px));
    /* Top-down, the guide under the HUD: it was at the foot of the column
       with the HUD centred above it, so every longer line Aroha said lifted
       the HUD. Here the bubble grows down into empty space. */
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas: "bar board" "hud board" "guide board" ". board";
  }

  .jj-hud {
    align-self: start;
    grid-template-columns: auto 1fr;
    grid-template-areas: "moves goals" "score score" "spirit spirit";
    margin-right: 0;
  }

  .jj-guide {
    align-self: start;
    padding-right: 0;
    padding-top: 8px;
  }

  .jj-guide .jj-bubble {
    height: auto;
    max-height: calc(var(--jj-vh) * 0.45);
  }

  .jj-board-wrap {
    padding: 6px;
  }
}

/* A computer: the board as big as the screen allows but never edge to edge,
   the column beside it rather than across the rest of the width, and the
   pair centred. Left to the landscape rule above, the board sat jammed into
   the top right corner and the score floated halfway down an empty column. */
@media (orientation: landscape) and (min-width: 1000px) and (min-height: 600px) {
  .jj-play {
    grid-template-columns: minmax(300px, 360px) min(calc(var(--jj-vh) - var(--jj-safe-top) - var(--jj-safe-bottom) - 40px), calc(100vw - 440px), 880px);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas: "bar board" "hud board" "guide board" ". board";
    justify-content: center;
    align-content: center;
    column-gap: 28px;
    padding-top: calc(20px + var(--jj-safe-top));
    padding-bottom: calc(20px + var(--jj-safe-bottom));
  }

  .jj-hud {
    align-self: start;
    margin: 10px 0 0;
  }

  .jj-guide {
    align-self: start;
    margin-top: 12px;
  }

  /* Nothing sits under it here, so it can take the lines it needs. */
  .jj-guide .jj-bubble {
    height: auto;
  }

  .jj-board-wrap {
    padding: 0;
  }
}

@media (orientation: landscape) and (max-height: 430px) {
  .jj-bar {
    padding-top: 6px;
  }

  .jj-where {
    padding-right: 10px;
  }

  .jj-where-emoji {
    display: none;
  }

  .jj-where {
    padding-left: 12px;
  }

  .jj-where-text small {
    display: none;
  }

  .jj-btn {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .jj-hud {
    gap: 5px 8px;
    padding: 6px 8px;
  }

  .jj-moves strong {
    font-size: 22px;
  }

  .jj-goal {
    font-size: 13px;
  }

  .jj-goal canvas {
    width: 22px;
    height: 22px;
  }

  .jj-guide-face {
    width: 38px;
    height: 38px;
  }

  .jj-guide {
    min-height: 0;
    padding-bottom: 6px;
  }

  .jj-guide .jj-bubble {
    font-size: 12.5px;
    padding: 4px 8px;
  }
}

/* Very short landscape: Aroha steps aside, the bubble keeps talking. */
@media (orientation: landscape) and (max-height: 340px) {
  .jj-guide .jj-guide-face {
    display: none;
  }

  .jj-guide .jj-bubble::before {
    display: none;
  }
}

/* ------------------------------------------------------------- overlays */

.jj-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: calc(10px + var(--jj-safe-top)) calc(10px + var(--jj-safe-right)) calc(10px + var(--jj-safe-bottom))
    calc(10px + var(--jj-safe-left));
  background: rgba(16, 22, 40, 0.45);
  animation: jj-fade 0.2s ease;
}

@keyframes jj-fade {
  from {
    opacity: 0;
  }
}

.jj-card {
  position: relative;
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--jj-paper);
  border: 3px solid var(--jj-navy);
  border-radius: 20px;
  padding: 16px 18px;
  text-align: center;
  box-shadow: 0 6px 0 rgba(29, 43, 74, 0.45);
  animation: jj-rise 0.28s cubic-bezier(0.2, 1.4, 0.4, 1);
  user-select: text;
  -webkit-user-select: text;
}

@keyframes jj-rise {
  from {
    transform: translateY(24px) scale(0.96);
    opacity: 0;
  }
}

.jj-card h2 {
  margin: 2px 0;
  font-size: 24px;
  color: var(--jj-navy);
}

/* The airmail stripes are the border and the paper is the padding box, so
   the paper is under everything on the card however far it scrolls. (It
   was a ::before the size of the card's box, which stayed where it was
   when the card scrolled and left the buttons sitting on the stripes.) */
.jj-postcard {
  background:
    linear-gradient(var(--jj-paper), var(--jj-paper)) padding-box,
    repeating-linear-gradient(45deg, var(--jj-red) 0 10px, var(--jj-paper) 10px 20px, #2f5fb3 20px 30px, var(--jj-paper) 30px 40px)
      border-box;
  border: 6px solid transparent;
}

.jj-stopno {
  display: inline-block;
  vertical-align: 2px;
  margin-right: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 2px dashed rgba(98, 37, 153, 0.6);
  color: var(--jj-purple);
  font: 800 11px/1 system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.jj-hello {
  margin: 4px 0 0;
  text-wrap: balance;
  font: 800 16px/1 system-ui, sans-serif;
  color: var(--jj-red);
}

.jj-place {
  margin: 2px 0 0;
  font-size: 14px;
  opacity: 0.8;
}

/* Each half of the hello line stays whole: if they cannot share a line,
   the greeting goes under the stop number rather than breaking. */
.jj-stopno,
#introHello {
  white-space: nowrap;
}

.jj-postcard h2,
.jj-goal b {
  text-wrap: balance;
}

/* "Name - what it does": the what is the quieter half. */
.jj-goal-more {
  font-weight: 600;
  font-size: 0.88em;
}

#introEmoji {
  font-size: 30px;
  vertical-align: -4px;
}

.jj-goal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.jj-fact {
  font-size: 13px;
  line-height: 1.4;
  margin: 10px 0 0;
  padding: 8px 10px;
  background: rgba(242, 193, 46, 0.18);
  border-radius: 10px;
  text-align: left;
}

/* A phone held upright: Aroha is a small face at the top of her bubble,
   so the story gets the card's width rather than a narrow column. */
@media (max-width: 480px) {
  .jj-postcard {
    padding: 12px 12px;
  }

  .jj-postcard .jj-say-row {
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
  }

  .jj-postcard .jj-guide-face {
    width: 38px;
    height: 38px;
  }

  /* Short enough for one line each: the passport tab already says which
     journey this is, and a place's name fits at 20px. */
  .jj-stopno-journey {
    display: none;
  }

  .jj-postcard h2 {
    font-size: min(20px, 5vw);
  }

  .jj-postcard #introEmoji {
    font-size: 1.2em;
  }

  /* Something met before is named, not explained again (? has the
     explanation); only what is new keeps its "- what it does". */
  .jj-postcard .jj-goal:not(.jj-goal-new) .jj-goal-more {
    display: none;
  }

  .jj-postcard .jj-goal {
    font-size: 14px;
  }

  .jj-postcard .jj-goal canvas {
    width: 24px;
    height: 24px;
  }
}

/* Steps a postcard takes when it would otherwise scroll (fitIntro). */
.jj-fit-1 .jj-goal:not(.jj-goal-new) .jj-goal-more,
.jj-fit-3 .jj-goal-more {
  display: none;
}

.jj-fit-2 .jj-bubble {
  font-size: 13px;
  line-height: 1.25;
}

.jj-fit-2 .jj-goal {
  font-size: 13px;
}

.jj-fit-2 .jj-goal canvas {
  width: 22px;
  height: 22px;
}

.jj-fit-2 .jj-fact {
  font-size: 12px;
  line-height: 1.3;
  margin-top: 6px;
  padding: 6px 8px;
}

.jj-fit-2 h2 {
  font-size: 21px;
}

.jj-fit-2 .jj-say-row {
  margin: 6px 0;
}

.jj-fit-2 .jj-actions {
  margin-top: 8px;
}

.jj-fit-2 .jj-cta,
.jj-fit-2 .jj-ghost {
  padding: 9px 16px;
}

/* Last step: the type a size smaller again, and no subtitle line. */
.jj-fit-4 .jj-bubble {
  font-size: 12px;
}

.jj-fit-4 .jj-place {
  display: none;
}

.jj-fit-4 .jj-goal {
  font-size: 12px;
  padding: 2px 8px 2px 3px;
}

.jj-fit-4 .jj-goal-list {
  gap: 4px;
}

.jj-fit-4 .jj-fact {
  font-size: 11.5px;
}

/* A postcard on a landscape phone is laid out in two columns. */
@media (orientation: landscape) and (max-height: 500px) {
  .jj-postcard {
    width: min(720px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* The story runs down the left, the goals, fact and buttons down the
       right; the 1fr row soaks up whichever side is taller, so neither
       column's rows are stretched apart. */
    grid-template-areas:
      "hello goals"
      "title goals"
      "place goals"
      "say goals"
      "say fact"
      "say tools"
      "say actions";
    grid-template-rows: auto auto auto 1fr auto auto auto;
    gap: 0 16px;
    align-items: start;
    padding: 12px 16px;
  }

  .jj-postcard .jj-hello {
    grid-area: hello;
  }

  .jj-postcard h2 {
    grid-area: title;
  }

  .jj-postcard .jj-place {
    grid-area: place;
  }

  .jj-postcard .jj-say-row {
    grid-area: say;
    margin: 6px 0 0;
  }

  .jj-postcard .jj-book-tools {
    grid-area: tools;
  }

  .jj-postcard .jj-goal-list {
    grid-area: goals;
    margin-top: 6px;
  }

  .jj-postcard .jj-fact {
    grid-area: fact;
    margin-top: 8px;
  }

  .jj-postcard .jj-actions {
    grid-area: actions;
    align-self: end;
    margin-top: 8px;
  }

  .jj-postcard h2 {
    font-size: 20px;
  }

  .jj-result {
    width: min(640px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "title say"
      "stars say"
      "scores actions"
      "badges actions";
    gap: 0 16px;
    align-items: center;
    padding: 12px 16px;
  }

  .jj-result h2 {
    grid-area: title;
  }

  .jj-result .jj-stars {
    grid-area: stars;
  }

  .jj-result .jj-scores {
    grid-area: scores;
  }

  .jj-result .jj-result-badges {
    grid-area: badges;
  }

  .jj-result .jj-say-row {
    grid-area: say;
  }

  .jj-result .jj-actions {
    grid-area: actions;
  }
}

.jj-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

.jj-stars i {
  width: 48px;
  height: 48px;
  background: #d9cdb0;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.jj-stars i:nth-child(2) {
  transform: translateY(-8px) scale(1.15);
}

.jj-stars i.is-lit {
  background: linear-gradient(#ffe066, #f2a71e);
  animation: jj-star 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.jj-stars i:nth-child(2).is-lit {
  animation-name: jj-star-mid;
}

@keyframes jj-star {
  from {
    transform: scale(2.2) rotate(-40deg);
    opacity: 0;
  }
}

@keyframes jj-star-mid {
  from {
    transform: translateY(-8px) scale(2.4) rotate(-40deg);
    opacity: 0;
  }
}

.jj-scores {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 6px 0;
}

.jj-scores div {
  display: flex;
  flex-direction: column;
}

.jj-scores dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
}

.jj-scores dd {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  color: var(--jj-navy);
}

.jj-newbest {
  margin: 0;
  color: var(--jj-red);
  font-weight: 900;
}

.jj-result-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.jj-stamp {
  display: inline-block;
  border: 3px solid rgba(200, 50, 30, 0.8);
  color: rgba(200, 50, 30, 0.85);
  border-radius: 10px;
  padding: 5px 9px;
  margin: 4px 0;
  font: 900 13px/1.1 system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  transform: rotate(-8deg);
  animation: jj-stamp 0.35s cubic-bezier(0.3, 1.5, 0.5, 1) both;
  animation-delay: 0.2s;
}

@keyframes jj-stamp {
  from {
    transform: rotate(-8deg) scale(3);
    opacity: 0;
  }
}

.jj-panel .jj-card {
  text-align: left;
}

.jj-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.jj-help-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jj-help-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.3;
}

.jj-help-list canvas {
  flex: none;
  width: 40px;
  height: 40px;
}

.jj-leaders {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.jj-leaders li {
  display: flex;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--jj-paper-edge);
}

.jj-leaders li.is-me {
  background: rgba(242, 193, 46, 0.2);
  font-weight: 700;
}

.jj-leaders .jj-rank {
  width: 26px;
  text-align: right;
  opacity: 0.7;
}

.jj-leaders .jj-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jj-panel-note {
  margin: 4px 0;
  font-size: 13px;
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================ free play */

.jj-free {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  padding: 8px;
  overflow: auto;
}

.jj-free[hidden] {
  display: none;
}

/* Centred with auto margins, not align-items, which would push the top of
   the card out of reach of the scroll on a short screen. */
.jj-free-card {
  margin: auto 0;
  width: 100%;
  max-width: 420px;
  padding: 16px 18px 18px;
  border-radius: 18px;
  border: 2px solid var(--jj-navy);
  background: var(--jj-paper);
  color: var(--jj-ink);
  box-shadow: 0 4px 0 rgba(29, 43, 74, 0.4);
  text-align: center;
}

.jj-free-card h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  color: var(--jj-navy);
}

.jj-free-note {
  margin: 0 0 12px;
  font-size: 0.95rem;
  opacity: 0.8;
}

.jj-free-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.jj-free-name strong {
  font-size: 1.25rem;
  color: var(--jj-purple);
}

.jj-free-name small {
  font-weight: 700;
  opacity: 0.7;
}

.jj-free-pick input {
  width: 100%;
  accent-color: var(--jj-purple);
  height: 28px;
}

.jj-free-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.65;
}

.jj-free-best {
  margin: 4px 0 12px;
  min-height: 1.2em;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--jj-green);
}

.jj-free-progress {
  height: 10px;
  margin: 0 0 12px;
  border-radius: 999px;
  border: 2px solid var(--jj-navy);
  background: #fff;
  overflow: hidden;
}

.jj-free-progress[hidden] {
  display: none;
}

.jj-free-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--jj-gold), #f2a71e);
  transition: width 0.15s linear;
}

.jj-cta:disabled {
  opacity: 0.6;
  cursor: progress;
}

@media (orientation: landscape) and (max-height: 520px) {
  .jj-free-card {
    padding: 10px 16px 12px;
  }

  .jj-free-card h2,
  .jj-free-note {
    display: none;
  }

  .jj-free-best {
    margin: 2px 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Still and gold: the stars stay lit, the glow stays on. */
  .is-full .jj-meter::before,
  .is-full .jj-meter::after,
  .is-full .jj-turn:not(:disabled):not(.is-armed),
  .is-full .jj-turns {
    animation: none;
  }

  .is-full .jj-turn:not(:disabled):not(.is-armed),
  .is-full .jj-turns {
    box-shadow: 0 0 0 3px rgba(242, 193, 46, 0.6);
  }
}

/* ============================================================ camp book */

/*
 * A superuser's workshop, all on the passport page: the trails as chips,
 * the open trail's card, its stops (played from here), and a bar along the
 * bottom that makes more. The form is a sheet over it, never a page of its own.
 */
.jj-book-make {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
}

.jj-book-make[hidden],
.jj-book-tools[hidden],
.jj-book-head[hidden],
.jj-book-dock[hidden] {
  display: none;
}

.jj-book-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}

.jj-book-bar::-webkit-scrollbar {
  display: none;
}

.jj-book-chip {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 20, 40, 0.45);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.jj-book-chip.is-draft {
  border-style: dashed;
}

.jj-book-chip[aria-selected='true'] {
  background: var(--jj-paper);
  border-color: var(--jj-paper);
  color: var(--jj-navy);
}

.jj-book-chip.is-new {
  background: rgba(98, 37, 153, 0.8);
  border-color: rgba(255, 255, 255, 0.5);
}

.jj-book-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: 14px;
  border: 2px solid var(--jj-navy);
  background: var(--jj-paper);
  color: var(--jj-ink);
  box-shadow: 0 3px 0 rgba(29, 43, 74, 0.35);
}

.jj-book-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.jj-book-head-text strong {
  font-size: 1.05rem;
  color: var(--jj-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jj-book-head-text small {
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0.75;
}

.jj-book-head-acts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.jj-book-btn {
  padding: 6px 11px;
  border-radius: 999px;
  border: 2px solid rgba(29, 43, 74, 0.35);
  background: #fff;
  color: var(--jj-navy);
  font: 700 0.8rem/1.1 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}

.jj-book-btn.is-go {
  border-color: var(--jj-green);
  background: var(--jj-green);
  color: #fff;
}

.jj-book-btn.is-danger {
  border-color: rgba(200, 50, 30, 0.45);
  color: var(--jj-red);
}

.jj-book-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* A narrow phone: the trail's buttons go under its name. */
@media (max-width: 420px) {
  .jj-book-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .jj-book-head-acts {
    justify-content: flex-start;
  }
}

/* The open trail's passport. A camp being made holds its place, and new ones glow. */
.jj-stop.is-making button {
  border-style: dashed;
  border-color: var(--jj-purple);
  background: rgba(255, 250, 240, 0.7);
  cursor: progress;
  opacity: 1;
}

.jj-stop.is-making .jj-stop-emoji {
  animation: jj-making 1.2s ease-in-out infinite;
}

@keyframes jj-making {
  50% {
    transform: scale(1.2) rotate(12deg);
    opacity: 0.6;
  }
}

.jj-stop.is-new button {
  animation: jj-new-camp 1.1s ease-out 3;
}

@keyframes jj-new-camp {
  0% {
    box-shadow: 0 0 0 0 rgba(242, 193, 46, 0.95);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(242, 193, 46, 0);
  }
}

.jj-book-empty {
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  border-radius: 16px;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  background: rgba(10, 20, 40, 0.35);
  color: #fff;
  text-align: center;
}

.jj-book-empty p {
  margin: 0;
  font-weight: 700;
}

/* The bar that makes more: what it will make, in a line (tap to change it), and Make. */
.jj-book-dock {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 4px;
  border-radius: 16px;
  border: 2px solid var(--jj-navy);
  background: var(--jj-paper);
  box-shadow: 0 3px 0 rgba(29, 43, 74, 0.35);
  flex: none;
}

.jj-book-dock-sum {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 4px 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--jj-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.jj-book-dock-sum:hover,
.jj-book-dock-sum:focus-visible {
  background: rgba(98, 37, 153, 0.08);
  outline: none;
}

.jj-book-dock-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--jj-navy);
}

.jj-book-dock-edit {
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(98, 37, 153, 0.12);
  color: var(--jj-purple);
  font-size: 0.72rem;
  vertical-align: 1px;
}

.jj-book-dock-sum small {
  max-width: 100%;
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jj-book-dock .jj-cta {
  flex: none;
  min-width: 92px;
  padding: 10px 16px;
  font-size: 1rem;
}

.jj-book-dock.is-empty .jj-book-dock-edit,
.jj-book-dock.is-making .jj-book-dock-edit {
  display: none;
}

.jj-book-dock-sum:disabled {
  cursor: progress;
}

@media (orientation: landscape) {
  .jj-book-make,
  .jj-book-dock {
    max-width: 980px;
  }

  .jj-route.is-book .jj-stop {
    height: clamp(90px, calc((var(--jj-vh) - 390px) / var(--jj-rows, 2) - 10px), 150px);
  }
}

@media (orientation: landscape) and (min-width: 1300px) {
  .jj-book-make,
  .jj-book-dock {
    max-width: 1100px;
  }
}

/* A phone on its side has no height to spare: the card and the bar go slim. */
@media (orientation: landscape) and (max-height: 520px) {
  .jj-book-make {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .jj-book-bar {
    flex: 1;
    min-width: 0;
  }

  .jj-book-head {
    flex: 0 1 auto;
    padding: 4px 6px 4px 10px;
  }

  .jj-book-head-text small {
    display: none;
  }

  .jj-book-dock {
    padding: 3px 4px;
  }

  .jj-book-dock .jj-cta {
    padding: 6px 14px;
  }

  .jj-route.is-book .jj-stop {
    height: auto;
  }

  /* The score and Spirit bar make way for the bar that makes camps. */
  .is-book-editor .jj-map-foot {
    display: none;
  }
}

/* The sheet: what goes in the camps. Up from the bottom on a phone, a card in the middle on a bigger screen. */
.jj-book-sheet {
  place-items: end center;
}

.jj-book-form {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: calc(var(--jj-vh) - 20px - var(--jj-safe-top) - var(--jj-safe-bottom));
  border-radius: 20px;
  border: 2px solid var(--jj-navy);
  background: var(--jj-paper);
  color: var(--jj-ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: jj-sheet-up 0.22s ease-out;
}

@keyframes jj-sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@media (min-height: 700px) and (min-width: 700px) {
  .jj-book-sheet {
    place-items: center;
  }
}

.jj-book-sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px 18px;
  border-bottom: 2px solid var(--jj-paper-edge);
}

.jj-book-sheet-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.1rem;
  color: var(--jj-navy);
}

.jj-book-x {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--jj-paper-edge);
  background: #fff;
  color: var(--jj-navy);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.jj-book-sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 14px;
  -webkit-overflow-scrolling: touch;
}

.jj-book-sheet-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px calc(10px + var(--jj-safe-bottom)) 16px;
  border-top: 2px solid var(--jj-paper-edge);
  background: #fff8e6;
}

.jj-book-sheet-foot .jj-book-status {
  flex: 1;
  margin: 0;
  text-align: left;
}

.jj-book-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.jj-book-form label,
.jj-book-count {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 700;
  font-size: 0.9rem;
}

.jj-stepper {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--jj-paper-edge);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.jj-stepper button {
  width: 38px;
  height: 36px;
  border: 0;
  background: none;
  color: var(--jj-purple);
  font: 800 1.2rem/1 system-ui, sans-serif;
  cursor: pointer;
}

.jj-stepper button:disabled {
  opacity: 0.3;
  cursor: default;
}

.jj-stepper output {
  min-width: 2.2ch;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
}

.jj-book-form .jj-book-hard {
  flex: 1;
  min-width: 180px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
}

.jj-book-hard small {
  font-weight: 600;
  opacity: 0.6;
}

.jj-book-hard strong {
  color: var(--jj-purple);
}

.jj-book-hard input {
  flex: 1 0 100%;
  width: 100%;
  accent-color: var(--jj-purple);
}

.jj-book-vary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 12px;
}

.jj-book-vary small {
  flex: 1 1 200px;
  font-size: 0.76rem;
  opacity: 0.75;
}

.jj-seg {
  display: inline-flex;
  border: 2px solid var(--jj-purple);
  border-radius: 999px;
  overflow: hidden;
}

.jj-seg button {
  padding: 6px 12px;
  border: 0;
  background: #fff;
  color: var(--jj-purple);
  font: 700 0.82rem/1.1 system-ui, sans-serif;
  cursor: pointer;
}

.jj-seg button[aria-pressed='true'] {
  background: var(--jj-purple);
  color: #fff;
}

.jj-book-form select,
.jj-book-form input[type='text'],
.jj-book-edit input,
.jj-book-edit textarea {
  font: inherit;
  font-weight: 400;
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid var(--jj-paper-edge);
  background: #fff;
  color: var(--jj-ink);
}

.jj-book-theme {
  margin-top: 12px;
}

.jj-book-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--jj-red);
}

/* A draft in the book: dashed, so a superuser can tell it from a published camp at a glance. */
.jj-stop.is-draft button {
  border-style: dashed;
}

.jj-book-tools {
  margin: 8px 0 0;
  padding: 6px 8px;
  border-radius: 10px;
  border: 2px dashed var(--jj-purple);
  background: rgba(98, 37, 153, 0.06);
}

.jj-book-meta {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--jj-purple);
  text-align: left;
}

.jj-book-tools .jj-actions {
  margin-top: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.jj-book-tools .jj-ghost {
  font-size: 13px;
  padding: 5px 10px;
}

.jj-book-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(520px, 100%);
  max-height: calc(var(--jj-vh) - 32px);
  overflow: auto;
}

.jj-book-edit label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: left;
}

.jj-book-edit textarea {
  resize: vertical;
}

/* Tune level: a row per number, each a box that is Auto while empty. */
.jj-book-tune-note {
  margin: 0;
  font-size: 0.8rem;
  text-align: left;
  color: var(--jj-purple);
}

.jj-tune-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0;
}

.jj-tune-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 0.85rem;
}

.jj-tune-row .jj-tune-label:first-child {
  flex: 0 0 8.5em;
}

.jj-tune-row canvas {
  width: 24px;
  height: 24px;
}

.jj-book-tune input[type='number'] {
  flex: 1 1 7em;
  min-width: 0;
  max-width: 10em;
}

.jj-book-tune .jj-tune-auto {
  font-size: 12px;
  padding: 4px 8px;
}

/* The request form's picture picker: four sections, each a surprise until something in it is picked. */
.jj-pick-section {
  margin: 12px 0 0;
  padding: 8px 10px 10px;
  border: 2px solid var(--jj-paper-edge);
  border-radius: 12px;
}

.jj-pick-section legend {
  padding: 0 4px;
  font-size: 0.95rem;
}

.jj-pick-section legend small {
  font-weight: 400;
  opacity: 0.7;
}

.jj-pick-modes {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.jj-pick-mode {
  font: 700 0.8rem/1 system-ui, sans-serif;
  padding: 5px 10px;
  border-radius: 999px;
  border: 2px solid var(--jj-paper-edge);
  background: #fff;
  color: var(--jj-ink);
  cursor: pointer;
}

.jj-pick-mode[aria-pressed='true'] {
  border-color: var(--jj-purple);
  background: var(--jj-purple);
  color: #fff;
}

.jj-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

.jj-pick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px 5px;
  border-radius: 12px;
  border: 2px solid var(--jj-paper-edge);
  background: #fff;
  color: var(--jj-ink);
  cursor: pointer;
  font: inherit;
}

.jj-pick canvas {
  width: 44px;
  height: 44px;
}

.jj-pick-name {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}

.jj-pick[aria-pressed='true'] {
  border-color: var(--jj-purple);
  background: rgba(98, 37, 153, 0.12);
}

.jj-pick.is-collect {
  border-color: var(--jj-green);
  background: rgba(31, 122, 58, 0.14);
}

.jj-pick-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--jj-purple);
}

.jj-pick.is-collect .jj-pick-badge {
  color: var(--jj-green);
}

/* How much of each thing picked: a row each under the section's pictures. */
.jj-amounts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--jj-paper-edge);
}

.jj-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.jj-amount canvas {
  width: 24px;
  height: 24px;
  flex: none;
}

.jj-amount span {
  flex: 1;
  min-width: 0;
}

.jj-seg-small button {
  padding: 4px 10px;
  font-size: 0.76rem;
}

/* A special switched off: struck through, in red. */
.jj-pick.is-off {
  border-color: var(--jj-red);
  background: rgba(200, 50, 30, 0.07);
}

.jj-pick.is-off canvas {
  opacity: 0.4;
}

.jj-pick.is-off::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  top: 32%;
  border-top: 3px solid var(--jj-red);
  transform: rotate(-30deg);
}

.jj-pick.is-off .jj-pick-badge {
  color: var(--jj-red);
}

/* Many trails: the tab row scrolls sideways, each tab its full name. */
.jj-journeys.is-many {
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
}

.jj-journeys.is-many::-webkit-scrollbar {
  display: none;
}

.jj-journeys.is-many .jj-journey {
  flex: 0 0 auto;
  max-width: 220px;
}

.jj-journey.is-draft {
  border-style: dashed;
}

/* The Camp Book tab is a superuser's tool, not a journey: set apart. */
.jj-journey-tool {
  background: rgba(98, 37, 153, 0.75);
}

/* The trail's emoji picker (after Fundraiser's icon picker): a button, and a panel under it. */
.jj-emoji-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: left;
}

.jj-emoji-trigger {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--jj-paper-edge);
  border-radius: 12px;
  background: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.jj-emoji-trigger:hover,
.jj-emoji-trigger[aria-expanded='true'],
.jj-emoji-trigger:focus-visible {
  border-color: var(--jj-purple);
  box-shadow: 0 0 0 3px rgba(98, 37, 153, 0.15);
  outline: none;
}

.jj-emoji-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--jj-paper-edge);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(29, 43, 74, 0.18);
}

.jj-emoji-panel[hidden] {
  display: none;
}

.jj-emoji-search {
  font: inherit;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid var(--jj-paper-edge);
  color: var(--jj-ink);
}

.jj-emoji-search:focus {
  border-color: var(--jj-purple);
  outline: none;
}

.jj-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 4px;
  max-height: 210px;
  overflow-y: auto;
}

.jj-emoji-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--jj-paper-edge);
  border-radius: 8px;
  background: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.jj-emoji-cell:hover {
  border-color: var(--jj-purple);
  background: rgba(98, 37, 153, 0.06);
}

.jj-emoji-cell.on {
  border: 2px solid var(--jj-purple);
  background: rgba(98, 37, 153, 0.12);
}

.jj-emoji-empty {
  grid-column: 1 / -1;
  margin: 8px 0;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.7;
}

/* The game's own question box: above every other card, the postcard and the trail dialog included. */
.jj-ask-overlay {
  z-index: 8;
}

.jj-ask-overlay[hidden] {
  display: none;
}

.jj-ask {
  width: min(400px, 100%);
  text-align: center;
}

.jj-ask h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
  color: var(--jj-navy);
}

.jj-ask p {
  margin: 0;
  line-height: 1.4;
}

.jj-cta.is-danger {
  background: linear-gradient(#e2553f, var(--jj-red));
  color: #fff;
  box-shadow: 0 3px 0 #7c1d10;
}

/* The trail dialog's Jamboree Spirit choice: the three rewards as tiles. */
.jj-spirit-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.jj-spirit-pick legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 0.85rem;
}

.jj-spirit-pick legend small {
  display: block;
  font-weight: 400;
  opacity: 0.75;
}

.jj-spirit-pick .jj-pick {
  flex: 1 1 0;
  min-width: 84px;
}

.jj-spirit-icon {
  font-size: 1.7rem;
  line-height: 1.2;
}

/* The trail form's guide picker: each guide's own face. */
.jj-guide-pick {
  width: 30px;
  height: 30px;
  display: block;
  margin: 0 auto;
}

/* ------------------------------------------------------------------ boot
   The splash over a page that is still being put together. Everything else in
   <body> keeps its layout (visibility, not display) so onResize can measure it
   while it is hidden. game.js drops .jj-booting once the passport is drawn with
   your own save in it; if it never runs (a script failed to load) the
   failsafe below shows the page anyway rather than a splash forever. */
.jj-booting body > :not(.jj-boot) {
  visibility: hidden;
  animation: jj-boot-show 0s linear 20s forwards;
}

@keyframes jj-boot-show {
  to {
    visibility: visible;
  }
}

.jj-boot {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: var(--jj-safe-top) var(--jj-safe-right) var(--jj-safe-bottom) var(--jj-safe-left);
  background: var(--jj-navy);
  color: #fff;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

html:not(.jj-booting) .jj-boot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.jj-booting .jj-boot {
  animation: jj-boot-gone 0s linear 20s forwards;
}

@keyframes jj-boot-gone {
  to {
    visibility: hidden;
  }
}

.jj-boot-logo {
  margin: 0;
  font-size: 34px;
}

.jj-boot-gems {
  display: flex;
  gap: 12px;
}

.jj-boot-gems i {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: var(--jj-gold);
  animation: jj-boot-gem 0.9s ease-in-out infinite;
}

.jj-boot-gems i:nth-child(2) {
  background: #3fb6e8;
  animation-delay: 0.15s;
}

.jj-boot-gems i:nth-child(3) {
  background: #e8505b;
  animation-delay: 0.3s;
}

@keyframes jj-boot-gem {
  0%,
  100% {
    transform: rotate(45deg) scale(0.7);
    opacity: 0.5;
  }
  50% {
    transform: rotate(45deg) scale(1);
    opacity: 1;
  }
}

.jj-boot-say {
  margin: 0;
  font: 600 15px/1.3 system-ui, sans-serif;
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .jj-boot-gems i {
    animation: none;
    opacity: 1;
  }
}
