/* Journeys with Jesus: play online. Matches the look of the other online games on the site. */
.jp, .jp-builder { --olive: #3f4a1d; --gold: #f3c24b; }
.jp { max-width: 1100px; margin: 0 auto; }
.jp [hidden] { display: none !important; }
.jp-logo { height: 44px; width: auto; max-width: 100%; }

.jp-card { background: #fff; border-radius: .6rem; padding: .8rem; margin-bottom: .9rem; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.jp-card h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.jp-card h3 { font-size: .95rem; margin: .8rem 0 .4rem; }
.jp-hint { font-weight: 400; font-size: .85rem; color: #5c636a; }

/* score bar */
.jp-bar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem; padding: .5rem .7rem; margin: 0 0 .5rem;
          background: #212529; color: #fff; border-radius: 0 0 .6rem .6rem; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.jp-score { display: flex; flex-direction: column; align-items: center; min-width: 4.6rem; padding: .15rem .6rem; border-radius: .5rem; border: 2px solid transparent; }
.jp-score .n { font-size: .8rem; font-weight: 600; }
.jp-score .pts { font-size: 1.7rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.jp-score .sub { font-size: .7rem; color: #ced4da; }
.jp-score.is-turn { border-color: var(--gold); background: rgba(243,194,75,.15); }
.jp-round { margin-left: auto; text-align: right; font-weight: 600; font-size: .85rem; align-self: center; }
.jp-round small { color: #ced4da; font-weight: 400; }
.jp-status { font-weight: 600; margin: .2rem 0 .7rem; min-height: 1.5rem; }

/* the board */
.jp-board { width: 100%; height: auto; display: block; border-radius: .4rem; margin: 0 auto; }
@media (max-width: 991px) { .jp-board { max-width: 560px; } }

/* the page: one column on a phone (journeys, map, piles, hand), two on a wide screen */
.jp-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; }
.jp-layout > .jp-card { margin-bottom: 0; }
@media (min-width: 992px) {
  .jp-layout { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-areas: "journeys board" "piles board" "hand board"; align-items: start; }
  .jp-journeys-box { grid-area: journeys; } .jp-piles-box { grid-area: piles; } .jp-hand-box { grid-area: hand; }
  .jp-boardcard { grid-area: board; position: sticky; top: 4.8rem; }
  .jp-board { max-height: calc(100vh - 7rem); }
}
.jp-cap { display: block; font-size: .78rem; font-weight: 700; line-height: 1.15; padding: .1rem .15rem .2rem; text-align: center; color: #212529; }

/* journeys in play */
.jp-journeys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; max-width: 420px; }
@media (min-width: 640px) { .jp-journeys { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; } }
.jp-journey { position: relative; padding: 0; border: 3px solid transparent; border-radius: 12px; background: none; }
.jp-journey img { width: 100%; height: auto; display: block; }

/* piles and hand */
.jp-piles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; max-width: 420px; }
@media (min-width: 640px) { .jp-piles { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 560px; } }
.jp-pile { position: relative; padding: 0; border: 3px solid transparent; border-radius: 12px; background: none; }
.jp-pile .jp-cap { position: absolute; left: 3px; right: 3px; bottom: 3px; background: rgba(255,255,255,.92); border-radius: 0 0 8px 8px; }
.jp-pile img { width: 100%; height: auto; display: block; }
.jp-pile:not(:disabled):hover { border-color: #0d6efd; }
.jp-pile:disabled { cursor: default; }
.jp-pile.is-empty { aspect-ratio: 480 / 670; border: 2px dashed #ced4da; border-radius: 12px; }
.jp-down .count { position: absolute; right: 6px; top: 6px; background: rgba(33,37,41,.9); color: #fff; font-weight: 700; font-size: .8rem; border-radius: 1rem; padding: 0 .5rem; }
.jp-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.jp-hand { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
@media (min-width: 640px) { .jp-hand { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); } }
.jp-hc { position: relative; padding: 0; border: 3px solid var(--rc); border-radius: 12px; background: #fff; overflow: hidden; }
.jp-hc img { width: 100%; height: auto; display: block; border-radius: 8px; }
.jp-hc.is-used { box-shadow: 0 0 0 4px var(--gold); transform: translateY(-4px); }
.jp-hc.is-pick { animation: jp-pulse 1.4s ease-in-out infinite; }
@keyframes jp-pulse { 50% { box-shadow: 0 0 0 5px rgba(13,110,253,.35); } }
@media (prefers-reduced-motion: reduce) { .jp-hc.is-pick { animation: none; outline: 3px solid #0d6efd; } }
.jp-token { display: inline-flex; align-items: center; justify-content: center; width: 78px; aspect-ratio: 1; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
            background: linear-gradient(135deg, #e5c35c, #a8851d); color: #3a2f08; font-weight: 800; font-size: .8rem; }

/* players and log */
.jp-player { border-left: 6px solid var(--pc, #ced4da); padding: .35rem .6rem; margin-bottom: .5rem; border-radius: .3rem; background: #f8f9fa; }
.jp-player.is-turn { background: #fff9e6; box-shadow: 0 0 0 2px var(--gold); }
.jp-player .head { display: flex; gap: .4rem; align-items: center; }
.jp-won { padding-left: 1.1rem; }
.jp-log { padding-left: 1.2rem; margin: 0; font-size: .9rem; max-height: 18rem; overflow: auto; }

/* dialogs */
.jp-dialog { border: 0; border-radius: .7rem; padding: 1rem 1.2rem; max-width: min(94vw, 560px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.jp-dialog::backdrop { background: rgba(0,0,0,.55); }
.jp-dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: .8rem; }
.jp-zoom { width: 100%; height: auto; max-height: 70vh; object-fit: contain; display: block; margin: 0 auto; }

@media (max-width: 560px) { .jp-token { width: 64px; } .jp-score { min-width: 3.9rem; padding: .1rem .35rem; } }

/* the cards you just drew */
.jp-drawn { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-bottom: .6rem; padding: .4rem .5rem; border-radius: .5rem; background: #fff9e6; border: 2px solid var(--gold); }
.jp-drawn .lbl { font-weight: 700; font-size: .85rem; margin-right: .2rem; }
.jp-dc { position: relative; width: 60px; padding: 0; border: 2px solid var(--gold); border-radius: 8px; background: #fff; }
.jp-dc img { width: 100%; height: auto; display: block; border-radius: 6px; }
.jp-dc .how { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(33,37,41,.85); color: #fff; font-size: .55rem; font-weight: 700; text-align: center; border-radius: 0 0 5px 5px; }
.jp-hc.is-new { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold); animation: jp-new 1.6s ease-out 2; }
.jp-hc .new { position: absolute; top: -2px; left: -2px; background: var(--gold); color: #3a2f08; font-size: .65rem; font-weight: 800; padding: 0 .35rem; border-radius: 8px 0 8px 0; }
@keyframes jp-new { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .jp-hc.is-new { animation: none; } }

/* results picture */
.share-box { margin: .4rem 0 .8rem; padding-top: .7rem; border-top: 1px solid #e9ecef; }
.share-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.share-preview { width: 100%; height: auto; display: block; border-radius: .5rem; border: 1px solid #dee2e6; margin-bottom: .4rem; }

/* ---- laying a journey by hand ---- */
html, body { max-width: 100%; overflow-x: hidden; }
.jp *, .jp-builder * { min-width: 0; }
.jp img, .jp svg { max-width: 100%; }
.jp-journey.can-pick { cursor: pointer; }
.jp-journey.can-pick:hover { border-color: #0d6efd; }
.jp-journey.is-selected { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(243,194,75,.55); transform: translateY(-3px); }
.jp-journey.is-won img { filter: saturate(.55) brightness(.9); }
.jp-journey.is-won { border-color: #198754; animation: jp-won .9s ease-out; }
.jp-journey .won { position: absolute; left: 4px; right: 4px; bottom: 6px; background: #198754; color: #fff; font-weight: 800; font-size: .95rem; padding: .1rem .3rem; border-radius: 6px; text-align: center; }
.jp-journey .won small { display: block; font-weight: 600; font-size: .65rem; }
.jp-journey.is-empty { display: flex; align-items: center; justify-content: center; text-align: center; aspect-ratio: 480 / 670; border: 2px dashed #ced4da; border-radius: 12px; color: #6c757d; font-size: .7rem; padding: .3rem; }
@keyframes jp-won { 0% { transform: scale(.9) rotate(-2deg); box-shadow: 0 0 0 0 rgba(25,135,84,.8); } 60% { transform: scale(1.08) rotate(1deg); box-shadow: 0 0 0 14px rgba(25,135,84,0); } 100% { transform: scale(1); } }
.jp-hc.can-lay:hover { border-color: #0d6efd; }
.jp-place { cursor: pointer; }
.jp-place:hover circle:not(.jp-hit) { stroke: #ffd23f; }

/* the route drawing itself, and the flash at both ends */
.jp-draw { animation: jp-draw 1.1s ease-out forwards; }
@keyframes jp-draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.jp-burst { transform-box: fill-box; transform-origin: center; animation: jp-burst 1.2s ease-out 1 both; }
@keyframes jp-burst { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(4.2); opacity: 0; } }
.jp-boardcard { position: relative; }
.jp-toast { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); z-index: 5; background: rgba(25,135,84,.96); color: #fff; border-radius: 1rem; padding: .3rem .9rem; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.35); pointer-events: none; max-width: 92%; }
.jp-toast b { display: block; font-size: 1.8rem; line-height: 1; }
.jp-toast span { font-size: .8rem; font-weight: 600; }
.jp-toast.show { animation: jp-toast 2.5s ease-out both; }
@keyframes jp-toast { 0% { opacity: 0; transform: translate(-50%, 14px) scale(.8); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -10px); } }
@media (prefers-reduced-motion: reduce) { .jp-draw, .jp-burst, .jp-journey.is-won, .jp-toast.show { animation: none; } .jp-draw { stroke-dasharray: none !important; } .jp-toast.show { opacity: 1; } }

/* the bar at the foot of the screen while you lay a journey */
.jp-builder { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fffdf5; border-top: 3px solid var(--gold); box-shadow: 0 -6px 18px rgba(0,0,0,.25); padding: .45rem .7rem calc(.45rem + env(safe-area-inset-bottom)); }
.jp-builder[hidden] { display: none; }
.jp-builder-main { display: flex; gap: .6rem; align-items: stretch; max-width: 1100px; margin: 0 auto; }
.jp-builder-info { flex: 1 1 auto; }
.jp-builder-title { font-weight: 800; }
.jp-builder-title .pts { background: var(--olive); color: #fff; border-radius: 1rem; padding: 0 .5rem; font-size: .8rem; margin-left: .2rem; }
.jp-builder-route { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; margin: .2rem 0; font-size: .85rem; }
.jp-builder-route i { font-style: normal; color: #6c757d; }
.jp-builder-route .chip { background: #fff; border: 2px solid var(--olive); border-radius: .6rem; padding: 0 .4rem; font-weight: 700; }
.jp-builder-route .chip.wild { border-style: dashed; }
.jp-builder-route .chip.reuse { border-color: #adb5bd; color: #5c636a; }
.jp-builder-route .chip.goal { border: 2px dashed #198754; color: #198754; background: #f1fbf5; }
.jp-builder-route .muted { color: #5c636a; }
.jp-builder-msg { font-size: .85rem; min-height: 1.2rem; color: #7a3b00; }
.jp-builder-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
body.has-builder { padding-bottom: 11rem; }
.jp-choose { display: flex; flex-wrap: wrap; gap: .4rem; }

/* after a computer player's turn */
.jp-ack { border-top-color: #0d6efd; }
.jp-ack .jp-builder-main { align-items: center; }
.jp-ack-list { margin: .2rem 0 0; padding-left: 1.1rem; font-size: .82rem; max-height: 6.5rem; overflow: auto; }
.jp-ack-btn { align-self: center; flex: 0 0 auto; min-width: 7.5rem; white-space: nowrap; font-weight: 700; padding: .55rem 1rem; }
body.has-ack { padding-bottom: 10rem; }

/* a phone on its side: keep the bars slim so the cards and map stay in view */
@media (max-height: 520px) {
  .jp-builder { padding: .25rem .6rem; }
  .jp-builder-info { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .8rem; }
  .jp-builder-msg { min-height: 0; }
  .jp-ack-list { max-height: 3.2rem; }
  body.has-builder, body.has-ack { padding-bottom: 6rem; }
}

/* cards flipped face down while you recite, tokens in your hand, and newly turned-up cards */
.jp-hc.is-down img { filter: none; }
.jp-hc.is-off { opacity: .35; }
.jp-hc.is-pick { cursor: pointer; }
.jp-tok { border-style: dashed; background: #fff9e6; }
.jp-tok img { padding: .3rem; aspect-ratio: 1; object-fit: contain; }
.jp-tok.is-used { opacity: .45; }
.jp-pile.is-new, .jp-journey.is-new { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold); animation: jp-new 1.6s ease-out 2; }
.jp-pile .new, .jp-journey .new { position: absolute; top: -2px; left: -2px; z-index: 2; background: var(--gold); color: #3a2f08; font-size: .68rem; font-weight: 800; padding: 0 .4rem; border-radius: 9px 0 9px 0; }
@media (prefers-reduced-motion: reduce) { .jp-pile.is-new, .jp-journey.is-new { animation: none; } }
