/* planet-generator/css/cards-shell.css — Code Cards shell styles */
  /* sparkle: the ✨ button (bottom right) and its iOS-attachment-style menu */
  #pgSpark { position: fixed; right: max(16px, calc(env(safe-area-inset-right, 0px) + 10px)); bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 10px)); z-index: 41;   /* equidistant from bottom & right edges */
    width: 68px; height: 68px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; line-height: 1;
    background: radial-gradient(circle at 50% 38%, rgba(var(--ui-accent), .38), rgba(var(--ui-bg), .88) 72%); border: 1.5px solid rgba(var(--ui-accent), .85);
    box-shadow: 0 0 22px rgba(var(--ui-accent), .5), 0 0 6px rgba(var(--ui-accent), .7), inset 0 0 14px rgba(var(--ui-accent), .3);
    -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: box-shadow .2s ease; animation: pgSparkGlow 3.2s ease-in-out infinite; }
  /* press squash is .pg-squash / .pg-pop under html.pg-bounce, not :active */
  #pgSpark:hover { box-shadow: 0 0 30px rgba(var(--ui-accent), .7), 0 0 8px rgba(var(--ui-accent), .9), inset 0 0 16px rgba(var(--ui-accent), .4); }
  @keyframes pgSparkGlow { 50% { box-shadow: 0 0 32px rgba(var(--ui-accent), .7), 0 0 8px rgba(var(--ui-accent), .85), inset 0 0 18px rgba(var(--ui-accent), .4); } }
  body.title-showing #pgSpark, body.title-showing #pgSparkMenu { display: none; }
  /* Menu catcher above sparkle (41) so the panel pops in front during grow-from-button. */
  #pgSparkMenu { position: fixed; inset: 0; z-index: 120; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  #pgSparkMenu[hidden] { display: none; }
  /* Compact panel above ✨ — leave air so the button stays visible (not under frost). */
  #pgSparkMenu .pgsm { position: absolute; z-index: 2; right: max(12px, calc(env(safe-area-inset-right, 0px) + 8px)); bottom: max(98px, calc(env(safe-area-inset-bottom, 0px) + 92px));
    min-width: 200px; max-width: min(240px, calc(100vw - 24px)); padding: 6px; border-radius: 22px;
    /* Keep the layout box and its contents at full size. The glass is the animated fake-collapse layer below. */
    background: transparent; box-shadow: none; isolation: isolate;
    -webkit-backface-visibility: hidden; backface-visibility: hidden; }
  /* Backdrop owns click-away taps; its native switch supplies the trusted close tick. */
  #pgSparkMenu .pg-spark-backdrop { position: absolute; z-index: 1; inset: 0; pointer-events: auto; }
  /* Local frost hugs the panel only — oversized insets were a gigantic blur rect covering ✨. */
  #pgSparkMenu .pgsm::before { content: ''; position: absolute; z-index: 0; pointer-events: none;
    inset: -6px -5px -6px -5px; border-radius: 26px;
    background: rgba(22,22,24,.55);
    box-shadow: 0 12px 28px rgba(0,0,0,.28), 0 0 0 .5px rgba(255,255,255,.1);
    /* Only this glass layer collapses; text and icons never get scaled. */
    transform-origin: var(--pg-spark-ox, 78%) var(--pg-spark-oy, 130%);
    transform: translateZ(0) scale(1); opacity: 1;
    /* One phase: same duration/ease for scale+opacity from the ✨ origin. */
    transition: transform calc(.26s + .14s * var(--pg-m-menu, 1)) cubic-bezier(.32, .08, .24, 1),
                opacity calc(.26s + .14s * var(--pg-m-menu, 1)) cubic-bezier(.32, .08, .24, 1);
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3); }
  /* Drop frost while GPU-scaling — scaled backdrop-filter hitch on mobile.
     Keep fill/shadow matched so re-enabling blur is not a second “pop”. */
  #pgSparkMenu .pgsm.pg-spark-busy::before {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    background: rgba(22,22,24,.78);
    box-shadow: 0 12px 28px rgba(0,0,0,.28), 0 0 0 .5px rgba(255,255,255,.1); }
  html:not(.pg-m-menu) #pgSparkMenu:not(.on) .pgsm { visibility: hidden; }
  /* Fake collapse: one smooth shrink+fade toward ✨ — never park a tiny opaque glass rectangle. */
  html.pg-m-menu #pgSparkMenu:not(.on) .pgsm::before {
    transform: translateZ(0) scale(calc(0.12 + 0.06 * (1 - var(--pg-m-menu))));
    opacity: 0; }
  html.pg-m-menu #pgSparkMenu.on .pgsm::before { transform: translateZ(0) scale(1); opacity: 1; }
  /* Contents fade in the same window as the glass. */
  #pgSparkMenu .pgsm > button { position: relative; z-index: 1; opacity: 0;
    transition: opacity calc(.26s + .14s * var(--pg-m-menu, 1)) cubic-bezier(.32, .08, .24, 1); }
  #pgSparkMenu.on .pgsm > button { opacity: 1; }
  html:not(.pg-m-menu) #pgSparkMenu .pgsm > button { opacity: 1; transition: none; }
  /* Closing: release the full-screen catcher so ✨ taps work (queue reopen / interrupt). */
  #pgSparkMenu.pg-spark-closing,
  #pgSparkMenu.pg-spark-closing .pg-spark-backdrop { pointer-events: none; }
  #pgSparkMenu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 12px 5px 4px; border: 0; border-radius: 16px; background: transparent !important;
    color: #fff; font: 700 15px/1 system-ui, -apple-system, 'Segoe UI', sans-serif; letter-spacing: .05em; text-align: left; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; -webkit-tap-highlight-color: transparent; }
  #pgSparkMenu button:active, #pgSparkMenu button:hover { background: rgba(255,255,255,.07) !important; }
  #pgSparkMenu .ic { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #3a3a3c; display: flex; align-items: center; justify-content: center; }
  #pgSparkMenu .ic svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  @media (prefers-reduced-motion: reduce) { #pgSpark { animation: none; } }
  /* capture overlay */
  .pgc { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 30%, #0d1426, #03050b 80%); color: #e2e8f0;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; overflow: hidden; }
  .pgc button { backdrop-filter: none; }
  .pgc-top { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px; border-bottom: 1px solid rgba(var(--ui-accent), .22); flex: none; }
  .pgc-heading { flex: 1; margin: 0; text-align: center; font-size: 14px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: rgb(var(--ui-accent)); outline: none; }
  .pgc-back { min-width: 38px; width: 38px; min-height: 38px; padding: 0; }
  .pgc-back[hidden] { display: block !important; visibility: hidden; }
  .pgc-note { margin: 8px 16px 0; color: #fbbf24; font-size: 13px; text-align: center; }
  .pgc-home { flex: 1; overflow-y: auto; padding: 16px 16px 8px; -webkit-overflow-scrolling: touch; }
  .pgc-home > .cch { max-width: 480px; margin: 0 auto; }
  .pgc .cch-primary { background: rgba(var(--ui-accent), .2) !important; border-color: rgba(var(--ui-accent), .8) !important; color: #fff !important; }
  .pgc-extra { max-width: 480px; margin: 14px auto 0; display: flex; }
  .pgc-extra button { flex: 1; min-height: 46px; border-color: rgba(var(--ui-accent), .45); letter-spacing: .08em; }
  .pgc-view { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .pgc-view[hidden], .pgc-cam[hidden] { display: none; }
  .pgc-cam { position: relative; flex: 1; min-height: 0; background: #000; }
  .pgc-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .pgc-frame { position: absolute; left: 12%; right: 12%; top: 22%; bottom: 22%; border: 2px solid rgba(var(--ui-accent), .7); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.28); pointer-events: none; }
  .pgc-status { position: absolute; left: 0; right: 0; top: 10px; text-align: center; font-size: 14px; color: #fff; text-shadow: 0 1px 4px #000; }
  .pgc-torch { position: absolute; right: 12px; top: 40px; }
  .pgc-strip { display: none !important; }
  .pgc-canvas { max-width: 100%; height: auto; background: #fff; border-radius: 6px; }
  /* ringfix: multi-photo import stage (photo being scanned + boxes), thumbnail strip */
  .pgc-photo.pgc-multi { overflow: hidden; padding: 10px 12px 8px; gap: 8px; }
  .pgc-stage { position: relative; flex: 1; min-height: 120px; width: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
  .pgc-stage[hidden], .pgc-thumbs[hidden], .pgc-row[hidden], .pgc-canvas[hidden], .pgc-msg[hidden] { display: none; }
  .pgc-shot { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; border-radius: 8px; background: rgb(var(--ui-bg));
    box-shadow: 0 0 0 1px rgba(var(--ui-accent), .35), 0 8px 30px rgba(0,0,0,.6); }
  .pgc-shotnum { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 10px; font-size: 12px; letter-spacing: .08em; color: rgb(var(--ui-fg));
    background: rgba(var(--ui-bg), .72); pointer-events: none; }
  .pgc-shotnum:empty { display: none; }
  .pgc-stage.pgc-scanning::after { content: ''; position: absolute; left: 6%; right: 6%; height: 2px; top: 10%; border-radius: 2px; pointer-events: none;
    background: rgb(var(--ui-accent)); box-shadow: 0 0 12px 3px rgba(var(--ui-accent), .75); animation: pgcSweep 1.1s ease-in-out infinite alternate; }
  @keyframes pgcSweep { from { top: 10%; } to { top: 90%; } }
  @media (prefers-reduced-motion: reduce) { .pgc-stage.pgc-scanning::after { display: none; } }
  .pgc-thumbs { flex: none; display: flex; gap: 6px; max-width: 100%; overflow-x: auto; padding: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .pgc .pgc-thumb { position: relative; flex: none; min-width: 0; min-height: 0; height: 56px; padding: 0; border-radius: 6px; overflow: hidden;
    background: rgba(var(--ui-bg), .9); border: 2px solid rgba(var(--ui-fg), .22); }
  .pgc .pgc-thumb.on { border-color: rgb(var(--ui-accent)); }
  .pgc-thumb canvas { display: block; height: 52px; width: auto; min-width: 40px; }
  .pgc-thumb.hit::after { content: ''; position: absolute; right: 3px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--ui-accent)); box-shadow: 0 0 0 1.5px rgba(0,0,0,.6); }
  .pgc-row { display: flex; gap: 8px; width: 100%; max-width: 440px; justify-content: center; }
  .pgc-text { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.4); color: #fff; font-size: 16px; }
  .pgc-msg { margin: 0; font-size: 13px; color: #cbd5e1; text-align: center; }
  .pgc-digits { font: 15px ui-monospace, Menlo, monospace; letter-spacing: .2em; color: #cbd5e1; }
  .pgc-zoom { flex: 1; } .pgc-zoomline { width: 52px; font-size: 13px; }
  .pgc-btn { min-height: 44px; padding: 10px 18px; font-size: 14px; }
  .pgc-btn-accent { background: rgba(var(--ui-accent), .22) !important; border-color: rgba(var(--ui-accent), .85) !important; color: #fff; font-weight: 700; letter-spacing: .1em; }
  .pgc-tray { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0 max(12px, env(safe-area-inset-bottom, 0px));
    background: rgba(0,0,0,.72); border-top: 1px solid rgba(var(--ui-accent), .25); --card-h: clamp(86px, 17vh, 140px); }
  .pgc-tray[hidden] { display: none; }
  .pgc-tray .ccs { flex: none; width: 100%; height: calc(var(--card-h) + 12px); }
  .pgc-tray .ccs[hidden] { display: none; }
  .pgc-tray .ccs .ccs-card { height: var(--card-h); width: calc(var(--card-h) * 0.714); margin-left: calc(var(--card-h) * -0.357); border-radius: 8px; }
  /* Sealed capture fan: look-only booster preview — no tap/flip/hold/drag hit targets. */
  .pgc-tray .ccs.ccs-sealed .ccs-card {
    cursor: default; pointer-events: none; -webkit-user-select: none; user-select: none;
  }
  .pgc-count { font-size: 13px; color: #cbd5e1; letter-spacing: .08em; }
  .pgc-done { min-width: 160px; }
  /* Sealed-fan Done: gentle CSS pulse while tray is up; class cleared on Done / close. */
  @keyframes pgcDonePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: 0.88; }
  }
  .pgc-done.pgc-done-pulse {
    animation: pgcDonePulse 1.8s ease-in-out infinite;
  }
  @media (prefers-reduced-motion: reduce) {
    .pgc-done.pgc-done-pulse { animation: none; }
  }
  /* translation screen: the card table over black; tap turns a card, hold a turned card to make its body */
  /* tactile: the tabletop is a fading click-away backdrop; the cards on it are the hand's own card elements (pg-cards/catch-cards.js) */
  .pgt { position: fixed; inset: 0; z-index: 92; overflow: visible; -webkit-tap-highlight-color: transparent; color: #e2e8f0; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; user-select: none; -webkit-user-select: none; }
  .pgt-bg { position: absolute; inset: 0; background: rgba(0,0,0,.32); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0; transition: opacity .35s ease; }
  .pgt.on .pgt-bg { opacity: 1; }
  .pgt.leaving { pointer-events: none; }
  .pgt.leaving .pgt-bg { opacity: 0; }
  @media (prefers-reduced-motion: reduce) { .pgt-bg { transition: none; } }
  /* Production planet card face: stats over body art (#2) with the collectible foil/keyline from the trading-card pick.
     live-text1: layout size + --pgc-s (no CSS transform upscale) so body-face copy stays crisp DOM text.
     Tiny visual cards (.pgc-fp--lod-tiny) omit text overlays (fan LOD). */
  .pgc-fp { position: relative; width: 200px; height: 280px; box-sizing: border-box; overflow: hidden; color: #f3f6ff;
    --pgc-s: 1; border-radius: 12px; border: 2px solid rgba(255,179,71,.78);
    background: #0a101c; font-family: ui-sans-serif, system-ui, sans-serif;
    box-shadow: 0 18px 38px rgba(0,0,0,.58), 0 0 0 1px rgba(255,179,71,.24), inset 0 0 24px rgba(126,200,255,.10); }
  .pgc-fp::before { content: ''; position: absolute; inset: calc(4px * var(--pgc-s)); z-index: 5; pointer-events: none; border: 1px solid rgba(255,220,142,.42); border-radius: calc(7px * var(--pgc-s)); }
  .pgc-fp .pgc-art { position: absolute; inset: 0; width: 100%; height: 100%; background: #0a101c; }
  .pgc-fp .pgc-art .hero { position: absolute; inset: 0; width: 100%; height: 100%; }
  .pgc-fp .pgc-art .hero { display: block; object-fit: cover; }
  .pgc-fp .pgc-art .fallback { background: var(--pgc-fallback); }
  .pgc-fp .pgc-shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(3,7,16,.16) 18%, rgba(3,7,16,.40) 42%, rgba(3,7,16,.96) 78%, #050914 100%); }
  .pgc-fp .pgc-top, .pgc-fp .pgc-copy { position: absolute; z-index: 3; left: calc(13px * var(--pgc-s)); right: calc(13px * var(--pgc-s)); }
  .pgc-fp .pgc-top { top: calc(11px * var(--pgc-s)); text-align: left; display: flex; align-items: flex-start; justify-content: space-between; gap: calc(8px * var(--pgc-s)); }
  /* body-face1: Cosmic ID + system words gone — drop name/stats lower into freed bottom band. */
  .pgc-fp .pgc-copy { bottom: calc(10px * var(--pgc-s)); text-align: left; text-shadow: 0 1px 3px rgba(0,0,0,.9); }
  .pgc-fp .super { font-size: calc(8px * var(--pgc-s)); line-height: 1.1; letter-spacing: .22em; text-transform: uppercase; color: #ffc56f; font-weight: 800; padding-top: calc(2px * var(--pgc-s)); }
  .pgc-fp .nm { margin-top: calc(2px * var(--pgc-s)); font-size: calc(18px * var(--pgc-s)); line-height: 1.08; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; overflow-wrap: anywhere; }
  .pgc-fp .nm.l1 { font-size: calc(14px * var(--pgc-s)); letter-spacing: .11em; } .pgc-fp .nm.l2 { font-size: calc(12px * var(--pgc-s)); letter-spacing: .06em; }
  .pgc-fp .subty { margin: calc(2px * var(--pgc-s)) 0 calc(7px * var(--pgc-s)); font-size: calc(9px * var(--pgc-s)); line-height: 1.15; letter-spacing: .08em; color: #c5d0e5; }
  .pgc-fp .pgc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: calc(5px * var(--pgc-s)) calc(10px * var(--pgc-s)); }
  .pgc-fp .pgc-stat { min-width: 0; display: flex; flex-direction: column; gap: calc(1px * var(--pgc-s)); }
  .pgc-fp .pgc-stat .k { display: inline-flex; align-items: center; gap: calc(3px * var(--pgc-s));
    font: 700 calc(7px * var(--pgc-s))/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; color: #9eabc4; }
  .pgc-fp .pgc-stat .k .lab { min-width: 0; }
  .pgc-fp .pgc-ico { flex: none; width: calc(9px * var(--pgc-s)); height: calc(9px * var(--pgc-s));
    fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
  /* iOS Weather-style temperature range: lo | fat gradient band | hi (° only). */
  .pgc-fp .pgc-temp { display: flex; align-items: center; gap: calc(5px * var(--pgc-s)); margin-top: calc(2px * var(--pgc-s)); min-width: 0; }
  .pgc-fp .pgc-temp .lo, .pgc-fp .pgc-temp .hi {
    flex: none; font: 700 calc(10px * var(--pgc-s))/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #f4f7ff;
    letter-spacing: .02em; min-width: calc(22px * var(--pgc-s)); }
  .pgc-fp .pgc-temp .lo { text-align: right; }
  .pgc-fp .pgc-temp .hi { text-align: left; }
  .pgc-fp .pgc-temp .bar {
    flex: 1; min-width: calc(36px * var(--pgc-s)); height: calc(5px * var(--pgc-s)); border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 1px 3px rgba(0,0,0,.45); }
  .pgc-fp .pgc-stat .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 calc(10px * var(--pgc-s))/1.15 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #f4f7ff; }
  .pgc-fp .pgc-stat.wide { grid-column: 1 / -1; }
  .pgc-fp .pgc-stat.wide .v { white-space: normal; overflow: visible; text-overflow: unset; font-size: calc(8.5px * var(--pgc-s)); line-height: 1.25; letter-spacing: .02em; }
  .pgc-fp .pgc-rule { height: 1px; margin: 0 0 calc(7px * var(--pgc-s)); background: rgba(255,210,120,.38); }
  /* body-face1: chain/link share control (replaces BODY / LOCK stamp); flips to code face. */
  .pgc-fp .pgc-share {
    flex: none; position: relative; z-index: 4;
    width: calc(22px * var(--pgc-s)); height: calc(22px * var(--pgc-s));
    margin: 0; padding: 0; border-radius: 999px;
    border: 1px solid rgba(255, 210, 140, .42);
    background: rgba(6, 12, 26, .42);
    color: rgba(255, 214, 150, .92);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none; appearance: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
  }
  .pgc-fp .pgc-share svg {
    width: calc(13px * var(--pgc-s)); height: calc(13px * var(--pgc-s));
    fill: none; stroke: currentColor; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .pgc-fp .pgc-share:active { transform: scale(.94); color: #ffe0a8; background: rgba(12, 20, 40, .62); }
  .pgc-fp .pgc-stamp { display: none !important; }
  /* Tiny fan / list thumbs: omit body-face text (art only) — avoids soft micro-type + layout cost. */
  .pgc-fp--lod-tiny .pgc-top, .pgc-fp--lod-tiny .pgc-copy, .pgc-fp--lod-tiny .pgc-stamp, .pgc-fp--lod-tiny .pgc-share { display: none !important; }
  .pgc-fp .st, .pgc-fp .bd, .pgc-fp .tg, .pgc-fp hr { display: none; }
  .pgt-back { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
  .pgt-plate { transform-origin: 50% 50%; }
  /* used mark lives on .pgk-tile (collection check); no USED text overlay on the card face */
  .pgt-ring { position: absolute; inset: 0; margin: auto; width: 78%; height: auto; aspect-ratio: 1; pointer-events: none; opacity: 0; transition: opacity .12s;
    z-index: 6; transform: translateZ(48px); /* sit above flipped faces in preserve-3d so progress is never half-occluded */ }
  .pgt-ring.on { opacity: 1; }
  .pgcard.pg-hold-feedback .pgcard-face {
    box-shadow: 0 0 22px 3px rgba(var(--ui-accent), .75), 0 0 48px rgba(var(--ui-accent), .4), 0 10px 28px rgba(0,0,0,.72);
  }
  .pgt-revisit { position: absolute; left: 0; right: 0; top: 9px; z-index: 7; transform: translateZ(48px); text-align: center; font-family: Inter, "Avenir Next", "Segoe UI", system-ui, sans-serif; font-size: 12px; font-weight: 800; line-height: 1; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 8px rgba(0,0,0,.9); pointer-events: none; }
  .pgt-ring circle { fill: none; stroke: rgb(var(--ui-accent)); stroke-width: 5; stroke-linecap: round;
    /* rotate is an SVG attribute (not CSS) so dash progress stays a full turn on back-facing cards */
    filter: drop-shadow(0 0 5px rgba(var(--ui-accent), .85)); }
  /* collection focus / lay-flat inspect overlay.
     Do NOT put filter / opacity<1 on an ancestor of .pgcard — both flatten preserve-3d and, with
     backface-visibility:hidden on flipped collection backs, the card vanishes (looks like tap-to-hide).
     Fade the dim only; scale the stage with preserve-3d; use box-shadow (filter always flattens). */
  .pgk-focus { position: fixed; inset: 0; z-index: 100050; display: flex; align-items: center; justify-content: center;
    pointer-events: none; -webkit-tap-highlight-color: transparent; }
  .pgk-focus.on { pointer-events: auto; }
  .pgk-focus-dim { position: absolute; inset: 0; background: rgba(0,0,0,.72); cursor: pointer;
    opacity: 0; transition: opacity .47s ease; }
  .pgk-focus.on .pgk-focus-dim { opacity: 1; }
  .pgk-focus-stage { position: relative; z-index: 1; width: min(72vw, 340px, 56vh); aspect-ratio: 140 / 196;
    border-radius: 14px;
    transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
    box-shadow: 0 18px 50px rgba(0,0,0,.85);
    transform: scale(.88); transition: transform .50s cubic-bezier(.2,1.16,.38,1); }
  .pgk-focus.on .pgk-focus-stage { transform: scale(1); }
  .pgk-focus-stage .pgcard { position: relative !important; left: auto !important; top: auto !important; width: 100% !important; height: 100% !important;
    transform: none !important; margin: 0;
    transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
  @media (prefers-reduced-motion: reduce) {
    .pgk-focus-dim, .pgk-focus-stage { transition: none; }
    .pgk-focus-stage { transform: none; }
  }
  /* Flip affordance under full-screen maximized cards (collection + table/fan focus). */
  .pg-flip-hint {
    position: absolute; z-index: 130; left: 50%;
    top: calc(50% + min(72vw, 340px, 56vh) * 0.7 + 12px);
    transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 7px;
    margin: 0; padding: 7px 14px 7px 11px; border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .26);
    background: rgba(6, 12, 26, .52);
    color: rgba(186, 210, 240, .78);
    font: 650 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    letter-spacing: .2em; text-transform: uppercase;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
    opacity: 0; pointer-events: none;
    transition: opacity .45s ease, transform .18s ease, background .18s ease, color .18s ease;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none; appearance: none;
  }
  .pg-flip-hint svg {
    width: 18px; height: 18px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.55;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .pgk-focus.on .pg-flip-hint,
  .pgt.pg-focusing > .pg-flip-hint { opacity: 1; pointer-events: auto; }
  .pg-flip-hint:active { transform: translateX(-50%) scale(.96); color: rgba(210, 230, 255, .95); background: rgba(10, 18, 36, .68); }
  @media (prefers-reduced-motion: reduce) { .pg-flip-hint { transition: none; } }
  /* game collection */
  .pgk { position: fixed; inset: 0; z-index: 91; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 20%, #0d1426, #03050b 80%); color: #e2e8f0;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; user-select: none; -webkit-user-select: none; }
  .pgk-top { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px; border-bottom: 1px solid rgba(var(--ui-accent), .22); }
  .pgk-top-spacer { flex: none; width: 38px; height: 38px; } /* balance X so the title stays centered */
  .pgk-top h2 { flex: 1; margin: 0; text-align: center; font-size: 14px; letter-spacing: .24em; text-transform: uppercase; color: rgb(var(--ui-accent)); }
  /* size under X on the right: bar shares top's 12px inset so the control sits under X, not flush to the wall; Show used sits just left of it */
  .pgk-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px 10px; font-size: 13px; color: #cbd5e1; }
  .pgk-bar .pgk-n { flex: 1; min-width: 0; }
  .pgk-bar .pgk-used-lab { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: none; font-size: 16px; font-weight: 650; letter-spacing: .02em; padding: 6px 2px; -webkit-tap-highlight-color: transparent; }
  .pgk-bar input.pgk-used { width: 26px; height: 26px; min-width: 26px; min-height: 26px; accent-color: rgb(var(--ui-accent)); flex: none; cursor: pointer; }
  .pgk-bar .pgk-flip, .pgk-bar .pgk-size { flex: none; position: relative; }
  .pgk-flip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  /* Collection filter: single <select> in the header bar (no chip row). */
  .pgk-bar .pgk-filter-lab { display: flex; align-items: center; gap: 6px; flex: none; font-size: 12px; color: #94a3b8; }
  .pgk-bar .pgk-filter-lbl { letter-spacing: .08em; text-transform: uppercase; font-weight: 650; }
  .pgk-bar .pgk-filter {
    appearance: none; -webkit-appearance: none;
    max-width: min(42vw, 160px); padding: 6px 28px 6px 10px; border-radius: 10px;
    background: rgba(148, 163, 184, .12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%94a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid rgba(148, 163, 184, .28); color: #e2e8f0;
    font: 650 12px/1.2 system-ui, -apple-system, 'Segoe UI', sans-serif; letter-spacing: .03em;
    cursor: pointer; outline: none;
  }
  .pgk-bar .pgk-filter:focus { border-color: rgba(var(--ui-accent), .7); }
  .pgk-bar .pgk-filter option { background: #0d1426; color: #e2e8f0; }
  .pgk-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; padding: 6px 16px max(20px, env(safe-area-inset-bottom, 0px)); align-content: start; }
  .pgk-tile { position: relative; display: flex; flex-direction: column; gap: 6px; -webkit-touch-callout: none; touch-action: pan-y; cursor: pointer;
    /* Offscreen tiles skip work; avoid always-on contain:paint (clips preserve-3d flips). */
    content-visibility: auto; contain-intrinsic-size: auto 220px; }
  .pgk-size svg { width: 16px; height: 16px; stroke-width: 1.5; }
  .pgk-tile .pgcard { position: relative; width: 100%; height: auto; aspect-ratio: 140 / 196; touch-action: pan-y; }
  /* Focused collection card: full gesture set (swipe/hold/drag); flat tiles keep pan-y for grid scroll. */
  .pgk-focus-stage .pgcard, .pgk-tile .pgcard.pg-focused { touch-action: none; }
  .pgk-tile .cap { font-size: 11px; line-height: 1.35; color: #cbd5e1; text-align: center; letter-spacing: .05em; }
  .pgk-tile .cap b { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #fff; }
  /* used cards stay full-colour; mark with .pgk-check only */
  .pgk-check { position: absolute; top: 6px; right: 6px; z-index: 4; width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
    background: rgba(4, 12, 22, .72); border: 1.5px solid rgba(var(--ui-accent), .95); color: rgb(var(--ui-accent)); pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.45); }
  .pgk-check svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
  .pgk-tile .wordless { display: flex; align-items: center; justify-content: center; aspect-ratio: .714; border-radius: 8px; background: #141923; color: #94a3b8; font-size: 11px; }
  .pgk-empty { grid-column: 1 / -1; text-align: center; color: #94a3b8; padding: 40px 16px; font-size: 14px; line-height: 1.5; }
  @media (min-width: 700px) { .pgk-grid:not([data-size]) { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
  /* collection density: one card, 2×2, ~3×3, list. data-size wins over the fluid fallback. */
  .pgk-grid[data-size="full"] { display: flex; flex-direction: column; align-items: center; gap: 0; scroll-snap-type: y mandatory; }
  .pgk-grid[data-size="full"] .pgk-tile { width: min(100%, 460px); min-height: 100%; flex: none; scroll-snap-align: start; justify-content: center; box-sizing: border-box; padding: 8px 0 18px; }
  .pgk-grid[data-size="full"] .pgk-tile .pgcard { width: min(86vw, 420px); }
  .pgk-grid[data-size="g2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; align-content: start; }
  .pgk-grid[data-size="g3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; align-content: start; }
  .pgk-grid[data-size="list"] { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: min(100%, 640px); margin: 0 auto; box-sizing: border-box; }
  .pgk-grid[data-size="list"] .pgk-tile { flex-direction: row; align-items: center; gap: 12px; padding: 4px 2px; }
  .pgk-grid[data-size="list"] .pgk-tile .pgcard { width: 64px; flex: none; }
  .pgk-grid[data-size="list"] .pgk-tile .cap { text-align: left; flex: 1; min-width: 0; }
  @media (min-width: 800px) {
    .pgk-grid[data-size="g2"] { grid-template-columns: repeat(2, minmax(0, 280px)); justify-content: center; }
    .pgk-grid[data-size="g3"] { grid-template-columns: repeat(3, minmax(0, 210px)); justify-content: center; }
  }


/* mobile selection lock: gestures must not highlight the card shell / HUD as text */
#pgSpark, #pgSparkMenu, .pgk, .pgk-focus, .pgc, .pgh, .pgt, .pgz, .pgfx, #pgArrivalName {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.pgk input, .pgk textarea, .pgc input, .pgc textarea,
.pgc [contenteditable="true"] {
  user-select: text; -webkit-user-select: text; -webkit-touch-callout: default;
}
