/* TrickPvP store: lobby, rank showcase, 3D player, kit inventory and lava transition. */

/* ---------- lobby ---------- */
html[data-view="lobby"] .store-only, html[data-view="store"] .lobby-only { display: none !important; }
.lobby { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; min-height: 100vh; min-height: 100svh; padding: 26px 18px 18px; text-align: center; }
.lobby > canvas { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.lobby-logo { width: 112px; height: 112px; filter: drop-shadow(0 10px 12px rgb(0 0 0 / 0.65)); }
.pixel-ui .lobby .pixel-title { font-size: clamp(54px, 9vw, 96px); }
.lobby .lede { margin: 6px auto 24px; }
.lobby .beam { width: min(860px, 100%); background-image: var(--tex-crimson); }
.pixel-ui .lobby .banners { gap: 54px; }
.lobby .rope { height: 30px; background: var(--tex-chain) 26px 0 / 10px 20px repeat-y, var(--tex-chain) calc(100% - 26px) 0 / 10px 20px repeat-y; }
.lobby .banner.main { width: 250px; }
.lobby .banner.main .cloth { min-height: 260px; padding-bottom: 62px; }
/* shorter windows: tighten up so the whole lobby fits without scrolling */
@media (max-height: 860px) {
  .lobby { padding-top: 14px; }
  .lobby .lobby-logo { width: 88px; height: 88px; }
  .lobby .lede { margin-bottom: 16px; }
  .lobby-foot { padding-top: 14px; gap: 8px; }
}
.lobby .cloth img.crest { width: 90px; height: 90px; }
.lobby .cloth b { color: var(--ruby-shine); }
.pixel-ui .lobby .cloth .btn { min-height: 52px; font-size: 21px; }
.lobby .hanging-tag { min-width: 180px; }
.lobby .hanging-tag img { width: 48px; height: 48px; image-rendering: pixelated; }
.lobby .hanging-tag span { display: block; color: var(--lava); }
.lobby-foot { margin-top: auto; padding-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lobby-foot .row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px; }
.lobby-foot small { padding: 5px 10px; background: rgb(10 2 4 / 0.9); font-size: 13px; color: var(--ink); }

/* ---------- scroll cue: on a solid plate, because it sits over bright lava ---------- */
.scroll-cue { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; min-height: var(--hit); padding: 0 16px; white-space: nowrap; background: rgb(10 2 4 / 0.9); box-shadow: var(--outline); font: 18px var(--font-pixel); color: var(--ink); text-decoration: none; }
.scroll-cue i { width: 18px; height: 11px; background: var(--ink); clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 45%, 50% 100%, 0 45%); }

/* ---------- rank showcase ---------- */
html.snapping { scroll-snap-type: y proximity; }
.journey { position: relative; }
.snap { position: absolute; left: 0; width: 1px; height: 1px; scroll-snap-align: start; scroll-margin-top: var(--head, 70px); }
.journey-stage {
  --tier: var(--ruby); position: sticky; top: var(--head, 70px); min-height: 480px; overflow: hidden; isolation: isolate;
  height: calc(100vh - var(--head, 70px)); height: calc(100svh - var(--head, 70px));
  background: linear-gradient(#0a0405, #140709 70%, #230a08);
}
/* blackstone floor, tilted away from the viewer */
.journey-stage::after { content: ""; position: absolute; z-index: -1; left: -50%; right: -50%; bottom: 0; height: 34%; background: var(--tex-blackstone) 0 0 / 192px 192px; transform: perspective(420px) rotateX(62deg); transform-origin: 50% 100%; -webkit-mask-image: linear-gradient(transparent, #000 55%); mask-image: linear-gradient(transparent, #000 55%); }
.journey-title { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2; font: 400 34px/1 var(--font-display); white-space: nowrap; }

/* the player, the pod under it, and the View kit button */
.actor { position: absolute; z-index: 1; left: 50%; top: 50%; width: 340px; height: 440px; margin: -238px 0 0 -170px; }
.actor > canvas { position: absolute; left: 0; bottom: 0; width: 100%; height: 86%; image-rendering: pixelated; pointer-events: none; }
.actor .pod { position: absolute; left: 50%; bottom: 20px; width: 240px; height: 52px; margin-left: -120px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--tier) 62%, transparent), transparent); box-shadow: inset 0 0 0 3px var(--tier); }
.actor-player { position: absolute; left: 0; right: 0; top: 52px; height: 340px; cursor: grab; touch-action: pan-y; }
.actor-player:active { cursor: grabbing; }
.pixel-ui .actor-player:focus-visible, .pixel-ui .kit-player:focus-visible { outline-offset: -3px; }
/* Minecraft name tag over the player, with the rank in its colour */
.nametag { position: absolute; z-index: 2; top: 4px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 4px 12px; background: rgb(0 0 0 / 0.62); font: 19px var(--font-pixel); white-space: nowrap; }
.nametag b { font-weight: 400; color: var(--tier); }
.pixel-ui .view-kit { position: absolute; z-index: 3; right: 0; bottom: 70px; }
.view-kit img { width: 32px; height: 32px; image-rendering: pixelated; }
.kit-flag { position: absolute; z-index: 3; right: 0; bottom: 46px; padding: 1px 8px 2px; background: rgb(0 0 0 / 0.75); font: 15px var(--font-pixel); color: var(--ink); }

/* the rank details, on the opposite side to the player */
.rank-panel { position: absolute; z-index: 2; top: 50%; width: min(390px, 38%); transform: translateY(-58%); padding: 24px 24px 30px; --from: -60px; }
.journey-stage[data-side="1"] .rank-panel { left: max(18px, calc(50% - 530px)); --from: -60px; }
.journey-stage[data-side="-1"] .rank-panel { right: max(18px, calc(50% - 530px)); --from: 60px; }
.rank-panel.arrive { animation: arrive 0.55s var(--ease-out); }
@keyframes arrive { from { opacity: 0; transform: translateY(-58%) translateX(var(--from)) perspective(800px) rotateY(calc(var(--from) / 3px * 1deg)); } }
.rank-panel h3 { font: 400 clamp(40px, 5vw, 60px)/0.95 var(--font-display); color: var(--tier); }
.rank-panel .price { margin-top: 10px; display: block; }
.pixel-ui .rank-panel ul { margin: 14px 0 20px; max-height: 24vh; overflow-y: auto; }
.rank-panel li { position: relative; margin-top: 7px; padding-left: 20px; font-size: 15px; color: var(--ink-soft); }
.rank-panel li::before { content: ""; position: absolute; left: 0; top: 7px; width: 9px; height: 9px; background: var(--tier); }
.panel-actions { display: grid; gap: 14px; }

/* the bottom bar that jumps to a rank */
.rail { position: absolute; z-index: 4; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 9px; width: max-content; max-width: calc(100% - 24px); padding: 3px; }
.pixel-ui .rail button { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 8px; min-width: var(--hit); min-height: var(--hit); padding: 5px 12px 5px 7px; background: var(--slate); box-shadow: var(--bevel-tab); text-align: left; font: 16px/1 var(--font-pixel); }
.rail img { grid-row: 1 / 3; width: 36px; height: 36px; image-rendering: pixelated; }
.rail span { color: var(--tier); }
.rail small { font: 15px var(--font-pixel); color: var(--ink-muted); }
.pixel-ui .rail button[aria-current] { background: color-mix(in srgb, var(--tier) 22%, var(--slate)); box-shadow: 0 0 0 3px var(--tier); }
/* the outline carries the rank colour; white text keeps the selected label readable */
.rail button[aria-current] span, .rail button[aria-current] small { color: #fff; }

/* ---------- 3D player ---------- */
.p3 { --u: 9px; position: absolute; left: 50%; top: 50%; perspective: 1100px; }
.p3-model, .p3-joint, .p3-swing, .p3-box { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.p3-face { position: absolute; left: 0; top: 0; display: block; backface-visibility: hidden; image-rendering: pixelated; background-repeat: no-repeat; }
.p3-armour.p3-enchanted::after {
  content: ""; position: absolute; inset: 0;
  mask-image: var(--tex); mask-size: var(--tex-size); mask-position: var(--tex-pos); mask-repeat: no-repeat;
  background: repeating-linear-gradient(115deg, transparent 0 18px, rgb(190 90 255 / 0.3) 26px, rgb(255 120 220 / 0.14) 32px, transparent 40px 66px);
  background-size: 200px 100%; animation: sheen 2.8s linear infinite;
}
@keyframes sheen { to { background-position: 200px 0; } }
/* held item hangs from the fist: its bottom-left corner sits at the hand */
.p3-held { position: absolute; left: 0; top: calc(var(--u) * -5); width: calc(var(--u) * 14); height: calc(var(--u) * 14); image-rendering: pixelated; transform-origin: 0 100%; transform: translate3d(0, calc(var(--u) * -1), calc(var(--u) * -1)) rotateY(-90deg); }
.p3-held[hidden] { display: none; }
.p3-armR { transform: rotateX(-18deg); }
.p3-armL { animation: arm 3.4s ease-in-out infinite alternate; }
.p3-legR { transform: rotateX(4deg); }
.p3-legL { transform: rotateX(-4deg); }
.p3-head { animation: look 7s ease-in-out infinite alternate; }
@keyframes arm { from { transform: rotateX(8deg) rotateZ(-2deg); } to { transform: rotateX(-8deg) rotateZ(-6deg); } }
@keyframes look { 0%, 30% { transform: rotateY(-12deg); } 70%, 100% { transform: rotateY(12deg) rotateX(4deg); } }

/* ---------- kit inventory ---------- */
.pixel-ui dialog.kit-dialog { --tier: var(--ruby); width: min(640px, 100% - 20px); max-height: calc(100svh - 24px); overflow: auto; }
.pixel-ui .kit-dialog .win-body { gap: 12px; padding: 16px; }
.kit-dialog .win-title h2 { color: var(--tier); }
.inv { --slot: min(52px, calc((100vw - 74px) / 9)); display: grid; gap: 10px; justify-content: center; padding: 14px; background: #2a2024; box-shadow: inset 3px 3px 0 #54424a, inset -3px -3px 0 #130c0f, 0 0 0 3px var(--edge); }
.inv-top { display: flex; gap: 10px; align-items: stretch; }
.inv-armour { display: grid; grid-auto-rows: var(--slot); gap: 2px; }
.kit-player { position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--well); box-shadow: var(--bevel-well); cursor: grab; touch-action: none; }
.kit-player .p3 { --u: 5.4px; top: 49%; }
.inv-info { width: calc(var(--slot) * 3.4); padding: 10px; background: #170f12; box-shadow: var(--bevel-well); }
.inv-info b { display: block; font: 400 22px/1.1 var(--font-pixel); color: var(--tier); }
.inv-info span { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-soft); }
.inv-grid { display: grid; grid-template-columns: repeat(9, var(--slot)); grid-auto-rows: var(--slot); gap: 2px; }
.pixel-ui .inv-slot { position: relative; display: grid; place-items: center; width: var(--slot); height: var(--slot); padding: 0; background: #120b0e; box-shadow: inset 2px 2px 0 #050204, inset -2px -2px 0 #4a3a41; }
.pixel-ui button.inv-slot:hover, .pixel-ui .inv-slot.on { background: color-mix(in srgb, var(--tier) 38%, #120b0e); }
.inv-slot img { width: min(32px, 86%); aspect-ratio: 1; image-rendering: pixelated; }
.inv-slot.enchanted::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(32px, 86%); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: screen;
  -webkit-mask: var(--sprite) center / 100% 100% no-repeat; mask: var(--sprite) center / 100% 100% no-repeat;
  background: repeating-linear-gradient(115deg, transparent 0 9px, rgb(190 90 255 / 0.65) 12px, transparent 16px 28px);
  background-size: 120px 100%; animation: sheen-slot 2.8s linear infinite;
}
@keyframes sheen-slot { to { background-position: 120px 0; } }
/* stack counts get a dark backing so white digits read over white items such as cobwebs */
.inv-slot b { position: absolute; right: 1px; bottom: 1px; padding: 0 3px 1px; background: rgb(0 0 0 / 0.82); font: 400 clamp(14px, 3.6vw, 18px)/1 var(--font-pixel); color: #fff; pointer-events: none; }

/* below 620px nine columns cannot reach 44px each: show only the filled slots, wrapped, at 48px */
@media (max-width: 620px) {
  .kit-dialog .inv { --slot: 48px; justify-content: stretch; }
  .inv-grid { grid-template-columns: repeat(auto-fill, var(--slot)); justify-content: center; }
  .inv-grid span.inv-slot { display: none; }
  .inv-top { flex-wrap: wrap; }
  .inv-info { width: 100%; }
}

/* ---------- lava transition ---------- */
.lava-pour { position: fixed; inset: 0; z-index: 80; }
.lava-pour canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.lava-pour div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; opacity: 0; transform: translateY(14px) scale(0.94); transition: opacity 0.2s, transform 0.35s var(--ease-out); }
.lava-pour div.on { opacity: 1; transform: none; }
.lava-pour img { width: 96px; height: 96px; filter: drop-shadow(0 8px 10px rgb(0 0 0 / 0.7)); }
.lava-pour b { max-width: calc(100% - 24px); padding: 6px 18px 12px; background: rgb(26 6 0 / 0.9); box-shadow: var(--outline); font: 400 clamp(36px, 7vw, 68px)/1 var(--font-display); color: #fff; }

/* ---------- sections swing in as they scroll into view ---------- */
.reveal { transition: transform 0.8s var(--ease-out), opacity 0.8s var(--ease-out); }
.reveal.waiting { opacity: 0; transform: perspective(900px) translateY(50px) rotateX(18deg) rotateY(var(--turn, 0deg)); }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .journey-title { font-size: 26px; top: 8px; }
  /* 46px down so the name tag clears the title; narrow enough that View kit stays on screen on either side */
  .actor { top: 46px; width: 232px; height: 296px; margin: 0 0 0 -116px; }
  .actor .p3 { --u: 6px; }
  .actor-player { top: 36px; height: 230px; }
  .actor .pod { width: 170px; height: 36px; margin-left: -85px; bottom: 10px; }
  .pixel-ui .view-kit { right: 0; bottom: 36px; }
  .kit-flag { right: 0; bottom: 12px; }
  .rank-panel { top: auto; bottom: 76px; width: auto; transform: none; padding: 12px 16px 20px; }
  .journey-stage[data-side] .rank-panel { left: 12px; right: 12px; }
  @keyframes arrive { from { opacity: 0; transform: translateX(var(--from)); } }
  .rank-panel h3 { font-size: 34px; }
  .rank-panel .price { position: absolute; right: 18px; top: 14px; margin: 0; font-size: 30px; }
  .pixel-ui .rank-panel ul { margin: 6px 0 12px; max-height: 8vh; }
  .rail { gap: 7px; }
  .pixel-ui .rail button { display: grid; grid-template-columns: 1fr; justify-items: center; padding: 6px; }
  .rail img { grid-row: auto; width: 36px; height: 36px; }
  .rail span, .rail small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pixel-ui .lobby .banners { gap: 18px; }
  .lobby-logo { width: 84px; height: 84px; }
  .pixel-ui .kit-dialog .win-body { padding: 10px; }
  .kit-dialog .inv { padding: 8px; }
  .kit-player { min-height: calc(var(--slot) * 4 + 6px); }
  /* 32 skin pixels tall, so this always fits inside the four-slot-high box */
  .kit-player .p3 { --u: calc(var(--slot) * 0.112); }
}
@media (max-width: 760px) and (min-width: 621px) {
  .kit-dialog .inv { --slot: calc((100vw - 108px) / 9); }
}
/* short phones: a smaller player so the View kit button clears the rank panel */
@media (max-width: 760px) and (max-height: 700px) {
  .journey-title { font-size: 22px; }
  .actor { top: 40px; height: 236px; }
  .actor .p3 { --u: 4.6px; }
  .actor-player { top: 26px; height: 170px; }
  .pixel-ui .view-kit { bottom: 24px; }
  .kit-flag { bottom: 0; }
}
/* very short phones: a tighter panel and a smaller player */
@media (max-width: 760px) and (max-height: 600px) {
  .actor { height: 192px; }
  .actor .p3 { --u: 3.6px; }
  .actor-player { top: 24px; height: 128px; }
  .actor .pod { width: 130px; height: 26px; margin-left: -65px; bottom: 14px; }
  .pixel-ui .view-kit { bottom: 4px; }
  /* bottom left, clear of the name tag above and the View kit button on the right */
  .kit-flag { right: auto; left: 0; bottom: 4px; }
  .rank-panel { padding: 8px 14px 14px; }
  .rank-panel h3 { font-size: 28px; }
  .pixel-ui .rank-panel .price { margin-top: 0; font-size: 22px; }
  .pixel-ui .rank-panel ul { margin: 0 0 8px; max-height: 40px; }
  .rank-panel li { margin-top: 2px; }
}
@media (max-width: 360px) {
  /* narrower player box, so View kit and its label stay on screen when the player moves to one side */
  .actor { width: 216px; margin-left: -108px; }
  /* price sits under the rank name instead of beside it, where long names would collide */
  .rank-panel .price { position: static; display: block; margin-top: 4px; font-size: 26px; }
  /* logo only, so the header stays on two rows; the link keeps its name for screen readers */
  .pixel-ui .brand { justify-content: center; min-width: var(--hit); gap: 0; font-size: 0; }
  .rail { gap: 4px; max-width: calc(100% - 8px); }
  .pixel-ui .rail button { padding: 4px; }
}
@media (max-height: 640px) and (min-width: 761px) {
  .actor .p3 { --u: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  html.snapping { scroll-snap-type: none; }
  .journey-stage, .reveal, .lava-pour div { transition: none; }
}
