/* «Геоугадайка» on the big screen, one look on the shared screen (/tv/) and on a PC player's stage (owner 2026-10-29:
   «версии некоторых экранов в ПК и ТВ почти не отличаются» → one code for both, after wml-stage.css and the others).
   The markup and the moving part are shared/client/geo-stage.ts. The page supplies the palette (--geo-green,
   --geo-red, --geo-surface, --geo-ink, --tv-line, --text-secondary, --rp-wrong) and the cuts (--cut-1…4, --cut-shadow).

   The map is a cut-paper picture with a white frame and the globe-green shadow (no Street View: billed per load).
   play / vote: the map left, «Где это?» or «Кто импостер?» and the hint right («На выбывание»: everyone's hearts).
   reveal: the flag and the avatar pins with dashed lines on the map; the place on a white cut card, a row per player
   (distance, points or hearts) dealt in the pins' order, then the round's board (reveal-results.js) in their place.
   The pins are also the phone's results map (drawGeoGuesses). */
@keyframes gss-cut-in { from { opacity: 0; transform: translateY(-26px) rotate(-5deg) scale(1.06); } }
@keyframes gss-row-in { from { opacity: 0; transform: translateX(30px) rotate(1.5deg); } }
@keyframes gss-drop { 0% { opacity: 0; transform: translateY(-46px) scale(1.25); } 60% { opacity: 1; transform: translateY(4px) scale(.95); } 100% { transform: none; } }
@keyframes gss-wave { 0%, 100% { transform: skewY(0); } 50% { transform: skewY(-7deg); } }
@keyframes gss-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--geo-green, #9bcb31) 70%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
@keyframes gss-heart { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); opacity: .3; } }

.gss-root { flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 34px; padding: 4px 6px 12px; }
.gss-map-card {
    flex: 0 0 61%; min-width: 0; position: relative; padding: 10px; background: #fff;
    border-radius: var(--cut-1); box-shadow: 9px 11px 0 color-mix(in srgb, var(--geo-green, #9bcb31) 55%, transparent);
    rotate: -.6deg; animation: gss-cut-in .7s cubic-bezier(.3, 1.45, .5, 1) both;
}
.gss-map { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: var(--cut-2); background: #aad3df; }
.gss-map .leaflet-control-attribution { font-size: 10px; }
/* «Где и когда»: the round's archive photo over the map card while the room guesses (the map is back for the reveal). */
.gss-photo { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; border-radius: var(--cut-2); background: var(--geo-surface, #211c54); }
.gss-photo[hidden] { display: none; }
.gss-root[data-photo="1"] .gss-map { visibility: hidden; }
.gss-place-year { margin: 2px 0 0; font-family: var(--font-display, 'Unbounded', sans-serif); font-size: 44px; font-weight: 800; line-height: 1; color: var(--geo-red, #d63037); }
.gss-place-year[hidden], .gss-place-year:empty { display: none; }
.gss-map .geo-map-error { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; color: #fff; background: var(--geo-surface, #211c54); }
.gss-map .geo-map-error p { margin: 0; font-size: 22px; font-weight: 700; }
.gss-map .geo-map-retry { justify-self: center; padding: 12px 26px; font-size: 18px; font-weight: 800; border: 0; border-radius: 999px; color: #fff; background: var(--geo-red, #d63037); }

.gss-side { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.gss-root :is(.gss-place, .gss-note, .gss-rows, .gss-board) { display: none; }
.gss-root[data-step="reveal"] .gss-ask { display: none; }
.gss-root[data-step="reveal"] :is(.gss-place, .gss-rows) { display: flex; }
.gss-root[data-step="reveal"] .gss-note:not(:empty) { display: block; }
.gss-root[data-step="reveal"][data-phase="board"] .gss-rows { display: none; }
.gss-root[data-step="reveal"][data-phase="board"] .gss-board { display: block; }

/* play / vote */
.gss-ask { display: flex; flex-direction: column; gap: 14px; animation: gss-row-in .5s ease both .15s; }
.gss-kicker { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--geo-green, #9bcb31); }
.gss-title { margin: 0; font-family: var(--font-display, 'Unbounded', sans-serif); font-size: 58px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; color: #fff; }
.gss-hint { margin: 0; font-size: 23px; font-weight: 600; line-height: 1.35; color: var(--text-secondary, #c9c4f0); text-wrap: pretty; }
.gss-lives { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; padding: 0; list-style: none; max-height: 300px; overflow: hidden; }
.gss-lives:empty { display: none; }
.gss-life { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 20px; }
.gss-life.is-out { opacity: .45; }

/* Hearts: «На выбывание» */
.gss-hearts { display: inline-flex; gap: 2px; flex: none; }
.gss-heart { font-size: 20px; color: var(--rp-wrong, #fe726d); }
.gss-row .gss-heart { font-size: 17px; }
.gss-tag:empty { display: none; }
.gss-heart.is-empty { color: rgb(255 255 255 / 22%); }
.gss-heart.is-losing { color: rgb(255 255 255 / 22%); animation: gss-heart .9s ease both calc(1s + var(--gss-deal, 0) * .52s); }

/* reveal: the place */
.gss-place {
    flex-direction: column; gap: 4px; padding: 20px 26px; color: var(--geo-ink, #17191f); background: #fff;
    border-radius: var(--cut-3); box-shadow: 7px 9px 0 color-mix(in srgb, var(--geo-green, #9bcb31) 60%, transparent);
    rotate: .8deg; animation: gss-cut-in .6s cubic-bezier(.3, 1.45, .5, 1) both .2s;
}
.gss-place-label { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #5a5480; }
.gss-place-name { margin: 0; font-family: var(--font-display, 'Unbounded', sans-serif); font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; overflow-wrap: anywhere; }
.gss-note { margin: 0; padding: 12px 18px; font-size: 19px; font-weight: 700; line-height: 1.35; border-radius: var(--cut-2); background: var(--geo-surface, #211c54); border: 2px solid var(--tv-line, rgb(255 255 255 / 14%)); }
.gss-note.is-caught { border-color: var(--geo-green, #9bcb31); }
.gss-note.is-escaped { border-color: #c084fc; }

/* reveal: a row per player, dealt in the pins' order (farthest first); the clipping list keeps room for the cut cards. */
.gss-rows {
    flex: 1 1 auto; min-height: 0; flex-direction: column; justify-content: safe center; gap: 8px; margin: 0;
    padding: var(--cut-room, 14px); list-style: none; overflow: hidden;
}
.gss-row {
    display: flex; align-items: center; gap: 9px; min-height: 0; padding: 0 12px;
    height: min(58px, calc((420px - (var(--gss-rows, 1) - 1) * 8px) / var(--gss-rows, 1)));
    background: var(--geo-surface, #211c54); border: 1.5px solid var(--tv-line, rgb(255 255 255 / 14%));
    border-radius: var(--cut-1); box-shadow: var(--cut-shadow, 5px 6px 0 rgb(0 0 0 / 34%)); rotate: -.5deg; font-size: 20px;
}
.gss-row:nth-child(4n + 2) { border-radius: var(--cut-2); rotate: .6deg; }
.gss-row:nth-child(4n + 3) { border-radius: var(--cut-3); rotate: -.3deg; }
.gss-row:nth-child(4n + 4) { border-radius: var(--cut-4); rotate: .4deg; }
.gss-row:first-child { border-color: var(--geo-green, #9bcb31); box-shadow: 6px 7px 0 color-mix(in srgb, var(--geo-green, #9bcb31) 55%, #000); }
.gss-rows.is-dealing .gss-row { animation: gss-row-in .5s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc(1s + var(--gss-deal, 0) * .52s); }
.gss-rank {
    flex: none; display: grid; place-items: center; width: 34px; height: 34px; font-family: var(--font-display, 'Unbounded', sans-serif);
    font-size: 16px; font-weight: 800; color: var(--geo-ink, #17191f); background: var(--geo-green, #9bcb31);
    border-radius: 46% 54% 50% 50% / 54% 46% 54% 46%; rotate: -6deg; box-shadow: 2px 3px 0 rgb(0 0 0 / 30%);
}
.gss-row > :nth-child(2) { min-width: 96px; flex: 1 1 auto; overflow: hidden; }
.gss-distance { flex: none; margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gss-points { flex: none; min-width: 66px; text-align: right; font-weight: 800; color: var(--geo-green, #9bcb31); font-variant-numeric: tabular-nums; }
.gss-tag { flex: none; padding: 3px 9px; font-size: 13px; font-weight: 800; border-radius: 999px; color: var(--geo-ink, #17191f); background: var(--rp-wrong, #fe726d); }
.gss-row.is-impostor .gss-tag { color: #fff; background: #8b4fd8; }
.gss-row.is-losing { border-color: var(--rp-wrong, #fe726d); }

/* reveal: the round's board (reveal-results.js) in the rows' place */
.gss-board { flex: 1 1 auto; position: relative; min-height: 0; }
.gss-board .rr-container.rr-dashboard .rr-screen2 { padding: var(--cut-room, 14px); justify-content: safe center; }
.gss-board .rr-leaderboard { width: 100%; gap: 8px; }
.gss-board .rr-leaderboard-title { font-size: 18px; margin-bottom: 10px; }
.gss-board .rr-lb-row { padding: 0 16px; gap: 12px; height: min(58px, calc((470px - (var(--tv-rows, 1) - 1) * 8px) / var(--tv-rows, 1))); }
.gss-board .rr-lb-pos { width: 34px; height: 34px; font-size: 16px; }
.gss-board .rr-lb-avatar { width: 36px; height: 36px; }
.gss-board .rr-lb-name { font-size: 21px; }
.gss-board .rr-lb-score { font-size: 22px; min-width: 60px; color: var(--geo-green, #9bcb31); }
.gss-board .rr-lb-delta { font-size: 17px; }

/* The map's pins (also the phone's results map: .gss-pin--small) */
.gss-pin-wrap { background: none; border: 0; }
.gss-pin {
    width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; overflow: hidden; box-sizing: border-box;
    background: var(--geo-green, #9bcb31); box-shadow: 0 4px 10px rgb(0 0 0 / 40%); animation: gss-drop .5s cubic-bezier(.3, 1.4, .5, 1) both;
}
.gss-pin--impostor { border-color: #c084fc; box-shadow: 0 0 0 3px #8b4fd8, 0 4px 10px rgb(0 0 0 / 40%); }
.gss-pin .gss-pin-avatar { position: relative; overflow: hidden; display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; margin: 0; border: 0; border-radius: 50%; font-size: 15px; font-weight: 800; color: var(--geo-ink, #17191f); background: var(--geo-green, #9bcb31); box-shadow: none; }
.gss-pin .gss-pin-avatar :is(img, video) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.gss-flag { position: relative; width: 100%; height: 100%; animation: gss-drop .6s cubic-bezier(.3, 1.4, .5, 1) both; }
.gss-flag-pole { position: absolute; left: 6px; bottom: 2px; width: 4px; height: 48px; border-radius: 2px; background: var(--geo-ink, #17191f); }
.gss-flag-cloth {
    position: absolute; left: 10px; top: 2px; width: 32px; height: 22px; transform-origin: left center;
    background: var(--geo-red, #d63037); border: 2px solid #fff; border-left: 0; border-radius: 0 6px 6px 0; animation: gss-wave 1.6s ease-in-out infinite;
}
.gss-flag-dot { position: absolute; left: 1px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--geo-green, #9bcb31); border: 2px solid #fff; animation: gss-pulse 1.4s ease-out infinite; }
.gss-line { stroke: var(--geo-red, #d63037); stroke-opacity: .9; }
.gss-line--impostor { stroke: #8b4fd8; }
.leaflet-tooltip.gss-tooltip {
    padding: 4px 10px; font-size: 15px; font-weight: 800; color: var(--geo-ink, #17191f); background: #fff;
    border: 0; border-radius: 10px 6px 11px 7px / 7px 11px 6px 10px; box-shadow: 3px 4px 0 rgb(0 0 0 / 30%); white-space: nowrap;
}
.leaflet-tooltip.gss-tooltip::before { display: none; }

@media (prefers-reduced-motion: reduce) {
    .gss-root *, .gss-root *::before, .gss-root *::after, .gss-pin, .gss-flag, .gss-flag * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; }
}
