/* Cara Pins (pins.html, docs/118): what it has that Cara Runs (css/run.css) and Stack the Stones (css/stack.css) do not. */

#pin-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; background: #1c130c; }
body.is-3d #pin-canvas { cursor: grab; }

/* the level: its number in a brass disc, its name beside it */
.phud__level { position: absolute; left: max(16px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; max-width: 46vw; pointer-events: none; }
.phud__level b { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe8a0, #d8a640 55%, #8a5c14); color: #2a1600; font: 900 1.35rem/1 var(--font-display); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 -2px 3px rgba(80, 40, 0, 0.4); }
.phud__level span { font: 800 1.1rem/1.15 var(--font-display); letter-spacing: 0.03em; color: #fff7ea; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the coins in the chest, of those needed: gold, then green when there are enough */
.phud__gold { border-color: rgba(255, 210, 120, 0.4); background: rgba(30, 18, 6, 0.66); transition: border-color 0.3s ease, background 0.3s ease; }
.phud__gold.is-enough { border-color: rgba(160, 255, 200, 0.6); background: rgba(10, 40, 22, 0.72); }
.phud__coin { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2b0, #f0b830 55%, #9a6a10); box-shadow: 0 0 0 2px #7a5008 inset, 0 0 10px rgba(255, 200, 80, 0.5); }
.phud__view { width: auto; min-width: 46px; padding: 0 10px; border-radius: 999px; font: 900 0.9rem/1 var(--font-body); letter-spacing: 0.04em; }

/* the level's tip, along the bottom */
.ptip { position: absolute; left: 50%; bottom: max(14px, calc(env(safe-area-inset-bottom) + 8px)); transform: translateX(-50%); max-width: min(92vw, 640px); padding: 7px 16px; border-radius: 12px; background: rgba(24, 14, 4, 0.66); font: 600 0.95rem/1.3 var(--font-body); text-align: center; color: #ffeccc; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.pturn { position: absolute; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 58px); transform: translateX(-50%); width: max-content; max-width: 90vw; padding: 7px 14px; border-radius: 999px; background: rgba(24, 14, 4, 0.72); border: 1px solid rgba(255, 210, 150, 0.35); font: 700 0.85rem/1.2 var(--font-body); color: #ffeccc; pointer-events: none; }
.pturn span { margin-right: 4px; }
.spraise.is-gem { color: #c8fbff; text-shadow: 0 0 18px rgba(90, 230, 255, 0.95), 0 3px 8px rgba(0, 0, 0, 0.5); }
.phud__gems { border-color: rgba(140, 230, 255, 0.45); background: rgba(6, 22, 34, 0.66); }
.phud__gems.is-enough { border-color: rgba(160, 255, 255, 0.8); background: rgba(10, 44, 56, 0.75); }
.pgems { margin: 6px 0 0; font: 700 0.92rem/1.3 var(--font-body); color: #bff6ff; }
.spraise.is-gold { color: #fff2b0; text-shadow: 0 0 18px rgba(255, 200, 60, 0.95), 0 3px 8px rgba(0, 0, 0, 0.5); }

/* the levels on the title card: a grid of brass-edged tiles, the stars each has */
.plevels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.plevel { display: grid; justify-items: center; align-content: start; gap: 2px; padding: 8px 4px 6px; border-radius: 12px; border: 1px solid rgba(255, 210, 150, 0.28); background: rgba(40, 26, 10, 0.7); color: #fff3df; cursor: pointer; transition: transform 0.12s ease, border-color 0.2s ease; min-width: 0; }
.plevel b { font: 900 1.3rem/1 var(--font-display); }
.plevel__name { font: 600 0.68rem/1.15 var(--font-body); color: rgba(255, 236, 204, 0.85); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plevel__stars { font-size: 0.8rem; letter-spacing: 1px; color: rgba(255, 255, 255, 0.22); }
.plevel__stars i { font-style: normal; }
.plevel__stars i.is-on { color: #ffd25a; text-shadow: 0 0 6px rgba(255, 200, 60, 0.7); }
.plevel.is-done { border-color: rgba(255, 210, 90, 0.6); }
.plevel:not(:disabled):hover, .plevel:not(:disabled):focus-visible { transform: translateY(-2px); border-color: #ffd48f; outline: none; }
.plevel.is-locked { opacity: 0.45; cursor: default; }
.plevel { position: relative; }
.plevel.is-ice { background: rgba(14, 30, 46, 0.72); border-color: rgba(160, 210, 255, 0.3); }
.plevel.is-jungle { background: rgba(16, 34, 14, 0.72); border-color: rgba(170, 220, 140, 0.3); }
.plevel__gem { position: absolute; top: 3px; right: 4px; font-size: 0.7rem; opacity: 0.3; filter: grayscale(1); }
.plevel__gem.is-on { opacity: 1; filter: none; }
/* each world's heading across the grid */
.pworld { grid-column: 1 / -1; margin: 8px 0 0; text-align: left; font: 800 0.8rem/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: #ffd48f; }
.pworld:first-child { margin-top: 0; }
.pworld.is-ice { color: #bfe4ff; }
.pworld.is-jungle { color: #c8eea0; }
.plevels { max-height: min(42vh, 330px); overflow-y: auto; padding-right: 4px; }

/* 2D, 2.5D or 3D */
.pviews { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; font: 600 0.85rem/1 var(--font-body); color: rgba(255, 236, 204, 0.8); }
.pviews button { padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 210, 150, 0.3); background: rgba(40, 26, 10, 0.6); color: #fff3df; font: 800 0.85rem/1 var(--font-body); cursor: pointer; }
.pviews button[aria-checked="true"] { background: linear-gradient(135deg, #ffd25a, #e09a20); color: #2a1600; border-color: transparent; }

/* the stars on the end card, popping in one by one */
.pstars { display: flex; justify-content: center; gap: 10px; margin: 2px 0 4px; }
.pstar { font-style: normal; font-size: clamp(2.4rem, 9vw, 3.4rem); line-height: 1; color: rgba(255, 255, 255, 0.16); }
.pstar.is-on { color: #ffd25a; text-shadow: 0 0 22px rgba(255, 200, 60, 0.8), 0 3px 8px rgba(0, 0, 0, 0.5); animation: pstar 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes pstar { 0% { transform: scale(0.2) rotate(-30deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }

@media (max-width: 560px) {
  .phud__level b { width: 36px; height: 36px; font-size: 1.1rem; }
  .phud__level span { display: none; }
  .phud__view { min-width: 40px; padding: 0 8px; font-size: 0.8rem; }
  .ptip { font-size: 0.82rem; padding: 6px 12px; }
  .plevels { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .plevel__name { display: none; }
  /* the buttons wrap to a second row rather than running over the level's disc */
  #pin-hud .rhud__right { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 72px); row-gap: 6px; }
  #pin-hud .rhud__right .rhud__tokens { padding: 4px 9px 4px 6px; font-size: 0.95rem; }
  .phud__coin { width: 18px; height: 18px; }
  .pturn { top: calc(max(14px, env(safe-area-inset-top)) + 100px); }
}
/* a phone on its side: the level's name stays, the tip goes small */
@media (max-height: 500px) {
  .plevels { margin-top: 8px; }
  .plevel { padding: 5px 2px 4px; }
  .plevel__name { display: none; }
  .pviews { margin-top: 6px; }
  .ptip { font-size: 0.8rem; padding: 4px 12px; }
  .pstar { font-size: 2.2rem; }
}
@media (max-width: 380px) { .rhud__right .phud__gold { padding: 4px 8px 4px 5px; font-size: 0.95rem; } .phud__coin { width: 18px; height: 18px; } }
@media (prefers-reduced-motion: reduce) { .pstar.is-on { animation: none; } }
