/* Postcard (public/postcard.js). The photo as a postcard with a stamp, the Local's clues as paper
   tags, and a world map to zoom, drag and pin. Every screen fits the window (style.css caps the
   match area): the map and the photo share what's left. */
.pc { --pc-ocean: #a9d4ea; --pc-land: #f4ead0; --pc-coast: #9c8a62; display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; }
.pc > * { flex: none; }
.pc .gd-bar { flex-wrap: nowrap; margin-bottom: .85rem; }
.pc .gd-bar .gd-hint { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc .gd-kicker.pc-glimpse-tag { background: #ffb3cf; }
.pc .gd-bar .pc-bar-status { display: none; }

.pc-stage { display: flex; gap: 1.2rem; flex: 0 1 auto; height: clamp(17rem, 62vh, 32rem); min-height: 0; }
.pc-left { display: flex; flex-direction: column; gap: .6rem; flex: 0 0 clamp(15rem, 36%, 25rem); min-width: 0; min-height: 0; }
.pc-left > * { flex: none; }
.pc-side { display: flex; flex-direction: column; gap: .6rem; flex: 1 1 0; min-width: 0; min-height: 0; }
.pc-side > * { flex: none; }

/* ---- The postcard. ---- */
.pc-card { display: flex; flex-direction: column; gap: .25rem; flex: 0 1 auto; min-height: 0; margin: 0; cursor: zoom-in; }
.pc-photo {
  --pc-mat: 7px;
  position: relative; display: block; flex: 0 1 auto; aspect-ratio: 3 / 2; min-height: 5rem; max-height: 100%;
  background: #fffdf8; border: 3px solid var(--gd-ink); border-radius: 10px; box-shadow: 5px 5px 0 var(--gd-ink); rotate: -1.2deg; overflow: hidden;
}
/* Laid over the print rather than sized by it, so the whole photo always shows (never cropped). */
.pc-img {
  position: absolute; left: var(--pc-mat); top: var(--pc-mat); width: calc(100% - 2 * var(--pc-mat));
  height: calc(100% - var(--pc-mat) - var(--pc-mat-bottom, var(--pc-mat)));
  object-fit: contain; border-radius: 4px; opacity: 0; transition: opacity .35s; user-select: none;
}
.pc-img.is-loaded { opacity: 1; }
.pc-stamp {
  position: absolute; right: 12px; top: 12px; padding: .2rem .45rem .24rem; color: #8f3a2c; background: #fffaf3;
  border: 2.5px dashed #8f3a2c; border-radius: 4px; rotate: 6deg; font: 800 .7rem/1.1 var(--font); letter-spacing: .08em; text-transform: uppercase;
}
/* Glimpse: once the three seconds are up, the postcard turns over. */
.pc-back {
  position: absolute; inset: var(--pc-mat) var(--pc-mat) var(--pc-mat-bottom, var(--pc-mat)); display: none; place-content: center; gap: .3rem; padding: 1rem; color: var(--gd-ink); text-align: center; border-radius: 4px;
  background: repeating-linear-gradient(0deg, transparent 0 26px, #1b11401a 26px 28px), #fffdf8;
}
.pc-back strong { font: 800 1.3rem/1.1 var(--font); }
.pc-back span { color: var(--gd-muted); font-weight: 700; }
.is-gone .pc-img { display: none; }
.is-gone .pc-back { display: grid; }
.pc-credit-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pc-credit-link:hover, .pc-credit-link:focus-visible { color: var(--gd-paper); }
.pc-credit { flex: none; overflow: hidden; color: var(--muted); font-size: .7rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Clues. ---- */
.pc-clues { display: flex; flex-direction: column; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.pc-clue, .pc-option {
  display: grid; gap: .05rem; padding: .35rem .7rem .4rem; color: var(--gd-ink); text-align: left; background: var(--gd-paper);
  border: 2.5px solid var(--gd-ink); border-left: 7px solid #8f3a2c; border-radius: 10px; box-shadow: 3px 3px 0 var(--gd-ink);
}
.pc-clue-kind { color: var(--gd-muted); font: 800 .64rem/1.1 var(--font); letter-spacing: .08em; text-transform: uppercase; }
.pc-clue-text { font: 800 .92rem/1.2 var(--font); }
.pc-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; flex: 0 1 auto; min-height: 0; }
.pc-option { min-height: 0; margin: 0; font: inherit; cursor: pointer; border-left-color: var(--gd-muted); transition: background .15s, translate .15s, box-shadow .15s; }
.pc-option:not(:disabled):hover { translate: 0 -2px; box-shadow: 4px 5px 0 var(--gd-ink); }
.pc-option[aria-pressed="true"] { background: #fff1c9; border-left-color: #8f3a2c; }
.pc-option:disabled:not([aria-pressed="true"]) { opacity: .5; }
.pc-option .pc-clue-text { font-size: .86rem; }
.pc .pc-send { align-self: flex-start; min-height: 3rem; }
.pc-answer {
  display: grid; gap: .1rem; padding: .5rem .8rem .55rem; color: var(--gd-ink); background: #e8f8c8; border: 3px solid var(--gd-ink);
  border-radius: 12px; box-shadow: 4px 4px 0 var(--gd-ink);
}
.pc-answer-label { color: var(--gd-muted); font: 800 .68rem/1.1 var(--font); letter-spacing: .08em; text-transform: uppercase; }
.pc-answer-place { font: 800 clamp(1.15rem, 2.1vw, 1.5rem)/1.15 var(--font); overflow-wrap: anywhere; }
.pc-tip { max-width: 34rem; margin: 0; color: var(--muted); font-weight: 650; }
.pc-note { margin: 0; color: var(--muted); font-weight: 750; }
.pc-note:empty { display: none; }

/* Waiting for the Local. */
.pc-wait { display: grid; justify-items: center; align-content: center; gap: 1rem; padding: 1rem 0 .5rem; text-align: center; }
.pc-up { display: flex; align-items: center; gap: .9rem; }
.pc-up .sb-face { width: 3.6rem; height: 3.6rem; font-size: 1.3rem; }
.pc-up-text { margin: 0; font: 800 clamp(1.3rem, 2.6vw, 1.8rem)/1.1 var(--font); letter-spacing: -.02em; text-align: left; }

/* ---- The map. ---- */
.pc-map {
  position: relative; flex: 1 1 0; min-height: 8rem; overflow: hidden; background: var(--pc-ocean);
  border: 3px solid var(--gd-ink); border-radius: 14px; box-shadow: 5px 5px 0 var(--gd-ink);
}
.pc-world { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.pc-map.is-picking .pc-world { cursor: crosshair; }
.pc-map.is-dragging .pc-world { cursor: grabbing; }
.pc-map.is-missing::after { content: "The map couldn’t load. Reopen the party to retry."; position: absolute; inset: auto 0 45%; color: var(--gd-ink); text-align: center; font-weight: 800; }
.pc-ocean { fill: var(--pc-ocean); }
.pc-land { fill: var(--pc-land); stroke: var(--pc-coast); stroke-width: .9px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pc-water { fill: var(--pc-ocean); stroke: var(--pc-coast); stroke-width: .7px; vector-effect: non-scaling-stroke; }
.pc-borders { fill: none; stroke: #9c8a6299; stroke-width: .8px; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.pc-pin path { fill: var(--c); stroke: var(--gd-ink); stroke-width: 2px; stroke-linejoin: round; animation: pc-drop .35s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.pc-pin.is-mine path { stroke-width: 2.6px; }
.pc-pin-initial { fill: var(--gd-ink); font: 800 10px/1 var(--font); pointer-events: none; }
@keyframes pc-drop { from { opacity: 0; transform: translateY(-14px); } }
.pc-star path { fill: #ffc845; stroke: var(--gd-ink); stroke-width: 2px; stroke-linejoin: round; }
.pc-star-glow { fill: #ffc84566; animation: pc-pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pc-pulse { 50% { transform: scale(1.5); opacity: .4; } }
.pc-line { stroke: var(--c); stroke-width: 2.2px; stroke-dasharray: 5 3; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .9; animation: pc-fade .5s ease-out both; }
@keyframes pc-fade { from { opacity: 0; } }
.pc-tag-text { fill: var(--gd-ink); font: 800 11px/1 var(--font); paint-order: stroke; stroke: #fffdf8; stroke-width: 3.5px; stroke-linejoin: round; animation: pc-fade .4s .9s ease-out both; }
.pc-zoom { position: absolute; right: .5rem; top: .5rem; display: grid; gap: .3rem; }
.pc .pc-zoom-button {
  display: grid; place-items: center; min-width: 2.3rem; min-height: 2.3rem; padding: 0 .4rem; color: var(--gd-ink); background: #fffdf8;
  border: 2.5px solid var(--gd-ink); border-radius: 10px; box-shadow: 2px 2px 0 var(--gd-ink); font: 800 1.15rem/1 var(--font);
}
.pc .pc-zoom-whole { font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
.pc .pc-zoom-button:disabled { opacity: .45; box-shadow: none; }
.pc-actions { display: flex; align-items: center; justify-content: flex-end; gap: .8rem; min-width: 0; }
.pc-actions .pc-note { flex: 1 1 auto; min-width: 0; }
.pc .pc-lock { min-height: 2.9rem; padding-inline: 1.6rem; font-size: 1.02rem; }
.pc .pc-lock[hidden] { display: none; }

/* ---- The reveal. ---- */
.pc-reveal .pc-left { flex-basis: clamp(16rem, 32%, 23rem); }
.pc-reveal .pc-photo { min-height: 3.5rem; rotate: 0deg; }
.pc-reveal .pc-card { flex: 0 100 auto; cursor: default; }
.pc-rows { display: grid; align-content: start; gap: .38rem; flex: none; min-height: 0; margin: 0; padding: 0 4px 4px 0; overflow: hidden; list-style: none; }
.pc-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .5rem; min-width: 0; padding: .24rem .6rem .24rem .3rem;
  color: var(--gd-ink); background: var(--gd-paper); border: 2.5px solid var(--gd-ink); border-left: 7px solid var(--c); border-radius: 12px;
  box-shadow: 3px 3px 0 var(--gd-ink); opacity: 0; translate: 14px 0; transition: opacity .3s, translate .4s cubic-bezier(.2, 1.4, .4, 1);
}
.pc-row.is-in { opacity: 1; translate: none; }
.pc-row.is-mine { background: #fff1c9; }
.pc-row.is-lost .pc-row-km { color: #c2321c; }
.pc-row-local { background: #e8f0ff; }
.pc-row .sb-face { width: 1.75rem; height: 1.75rem; border-width: 2px; font-size: .7rem; }
.pc-row-text { display: grid; min-width: 0; }
.pc-row-name, .pc-row-km { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-row-name { font: 800 .92rem/1.15 var(--font); }
.pc-row-km { color: var(--gd-muted); font-size: .76rem; font-weight: 700; }
.pc-row-points { font: 800 1rem/1 var(--font); font-variant-numeric: tabular-nums; }
.pc-empty { color: var(--muted); font-weight: 700; }
.pc-many .pc-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .34rem .38rem; }
.pc-many .pc-row { gap: .32rem; padding-right: .4rem; }
.pc-many .pc-row .sb-face { width: 1.45rem; height: 1.45rem; }
.pc-many .pc-row-name { font-size: .82rem; }
.pc-many .pc-row-points { font-size: .88rem; }

/* ---- Laptop heights. ---- */
@media (min-width: 46.01rem) and (max-height: 50rem) {
  .pc .gd-bar { margin-bottom: .6rem; }
  .pc-stage { height: clamp(15rem, 60vh, 28rem); gap: 1rem; }
  .pc-left, .pc-side { gap: .5rem; }
  .pc-clue { padding-block: .25rem .3rem; }
  .pc .pc-lock { min-height: 2.6rem; }
  .pc-reveal.pc-many .pc-card { display: none; }
}
@media (min-width: 46.01rem) and (max-height: 38rem) {
  .pc-stage { height: clamp(13rem, 58vh, 22rem); }
  .pc-credit { font-size: .64rem; }
  .pc-clue-kind, .pc-answer-label { display: none; }
  .pc-reveal .pc-card { display: none; }
  .pc-row { padding-block: .14rem; }
  .pc-row-km { display: none; }
  .pc-option { padding-block: .2rem .25rem; }
  .pc-pick-tip { display: none; }
}

/* ---- A phone (either way up): the round fills the screen. ---- */
@media (max-width: 46rem), (max-height: 30rem) {
  .pc { flex: 1 1 0; }
  .pc .gd-bar { margin-bottom: .5rem; }
  .pc .gd-bar .gd-hint { font-size: .84rem; }
  .pc-stage { flex: 1 1 0; height: auto; }
  .pc .pc-lock { min-height: 2.6rem; padding-inline: 1.2rem; font-size: .95rem; }
  .pc-zoom { right: .35rem; top: .35rem; gap: .25rem; }
  .pc .pc-zoom-button { min-width: 2.1rem; min-height: 2.1rem; padding: 0 .3rem; border-width: 2px; border-radius: 8px; font-size: 1rem; }
  .pc .pc-zoom-whole { font-size: .58rem; }
  .pc-actions .pc-note { font-size: .84rem; line-height: 1.2; }
}
/* Upright: the postcard and clues above the map. Tap the postcard to see it bigger. */
@media (max-width: 46rem) and (min-height: 30.01rem) {
  .pc-stage { flex-direction: column; gap: .5rem; }
  .pc-left { flex: 0 1 38%; gap: .4rem; }
  .pc-guess .pc-left { flex-basis: 57%; }
  /* The guess: the status sits in the round bar, Lock in floats on the map's corner, and the credit
     is written on the print's bottom edge, so the photo and the map get the room. */
  .pc-guess .gd-bar .gd-hint { display: none; }
  .pc-guess .gd-bar .pc-bar-status { display: block; white-space: normal; line-height: 1.2; }
  .pc-guess .pc-side { position: relative; }
  .pc-guess .pc-actions { position: absolute; right: .45rem; bottom: .45rem; }
  .pc-guess .pc-actions .pc-note { display: none; }
  .pc-guess .pc-lock { box-shadow: 3px 3px 0 var(--gd-ink); }
  .pc-guess .pc-card { position: relative; }
  .pc-guess .pc-photo { --pc-mat-bottom: 15px; }
  .pc-guess .pc-credit { position: absolute; left: 8px; right: 8px; bottom: 2px; color: var(--gd-muted); font-size: .56rem; line-height: 13px; }
  .pc-card { flex: 1 1 0; }
  .pc-photo { --pc-mat: 5px; flex: 1 1 0; aspect-ratio: auto; rotate: 0deg; box-shadow: 3px 3px 0 var(--gd-ink); }
  .pc-credit { font-size: .62rem; }
  .pc-clues { flex-direction: row; flex-wrap: wrap; gap: .3rem; }
  .pc-clue { padding: .12rem .45rem .16rem; border-width: 2px; border-left-width: 5px; box-shadow: 2px 2px 0 var(--gd-ink); }
  .pc-clue .pc-clue-kind { display: none; }
  .pc-clue .pc-clue-text { font-size: .76rem; }
  .pc-side { flex: 1 1 0; gap: .45rem; }
  .is-photo-big .pc-left { flex: 1 1 0; }
  .is-photo-big .pc-map-side { display: none; }
  .pc-pick { gap: .35rem; }
  .pc-option { padding: .2rem .4rem .24rem; border-left-width: 5px; }
  .pc-option .pc-clue-kind { font-size: .56rem; }
  .pc-option .pc-clue-text { font-size: .74rem; }
  .pc-pick-tip { display: none; }
  .pc .pc-send { align-self: stretch; min-height: 2.7rem; }
  .pc-clues-stage .pc-left { flex: 0 1 40%; }
  .pc-answer { padding: .3rem .65rem .35rem; }
  .pc-answer-label { display: none; }
  .pc-answer-place { font-size: 1.05rem; }
  /* The reveal: the map, the place, then everyone as compact chips. */
  .pc-reveal .pc-stage { flex-direction: column; }
  .pc-reveal .pc-left { flex: none; }
  .pc-reveal .pc-card { display: none; }
  .pc-reveal .pc-rows { display: flex; flex-wrap: wrap; gap: .3rem; overflow: visible; }
  .pc-reveal .pc-row { gap: .25rem; padding: .08rem .4rem .08rem .15rem; border-width: 2px; border-left-width: 5px; box-shadow: 2px 2px 0 var(--gd-ink); }
  .pc-reveal .pc-row .sb-face { width: 1.2rem; height: 1.2rem; border-width: 1.5px; }
  .pc-reveal .pc-row-text { display: flex; align-items: baseline; gap: .3rem; }
  .pc-reveal .pc-row-name { max-width: 4.6rem; font-size: .76rem; }
  .pc-reveal .pc-row-km { font-size: .7rem; }
  .pc-reveal .pc-row-points { font-size: .78rem; }
}
/* Short phones: a little less postcard, so the map keeps room for its hint and button. */
@media (max-width: 46rem) and (min-height: 30.01rem) and (max-height: 42rem) {
  .pc-guess .pc-left { flex-basis: 52%; }
}
/* Sideways: the postcard beside the map. */
@media (max-height: 30rem) {
  :is(.pc-guess, .pc-reveal) > .gd-bar { display: none; }
  .pc-stage { gap: .7rem; }
  .pc-left { flex-basis: 38%; gap: .35rem; }
  .pc-photo { --pc-mat: 5px; box-shadow: 3px 3px 0 var(--gd-ink); }
  .pc-credit { font-size: .6rem; }
  .pc-clues { gap: .25rem; }
  .pc-clue { padding: .1rem .45rem .14rem; border-width: 2px; border-left-width: 5px; box-shadow: 2px 2px 0 var(--gd-ink); }
  .pc-clue .pc-clue-kind { display: none; }
  .pc-clue .pc-clue-text { font-size: .74rem; }
  .pc-side { gap: .35rem; }
  .pc-reveal .pc-card { display: none; }
  .pc-reveal .pc-left { flex-basis: 44%; }
  .pc-answer { padding: .25rem .6rem .3rem; }
  .pc-answer-label { display: none; }
  .pc-answer-place { font-size: 1rem; }
  .pc-rows { grid-template-columns: repeat(auto-fill, minmax(7.2rem, 1fr)); gap: .28rem; }
  .pc-row { padding: .06rem .4rem .06rem .15rem; gap: .3rem; border-width: 2px; border-left-width: 5px; box-shadow: 2px 2px 0 var(--gd-ink); }
  .pc-row .sb-face { width: 1.15rem; height: 1.15rem; }
  .pc-row-km { display: none; }
  .pc-row-name { font-size: .78rem; }
  .pc-row-points { font-size: .78rem; }
  .pc-pick { gap: .3rem; }
  .pc-option { padding: .15rem .4rem .2rem; }
  .pc-option .pc-clue-kind { display: none; }
  .pc-option .pc-clue-text { font-size: .74rem; }
  .pc-pick-tip { display: none; }
  .pc-wait { padding: 0; gap: .5rem; }
}
