/* planet-generator/css/cards-shell.css -- Code Cards shell styles */
  /* sparkle: cards FAB (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; }
  #pgSpark .pg-hud-ico { display: block; width: 28px; height: 28px; pointer-events: none; color: #fff; filter: drop-shadow(0 0 6px rgba(var(--ui-accent), .85)); }
  /* 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 sparkle -- 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-multi .pgc-thumbs { min-height: 60px; } .pgc-multi .pgc-thumbs[hidden] { display: flex; visibility: hidden; }   /* load-fast4: strip space reserved */
  .pgc-stage[hidden], .pgc-thumbs[hidden], .pgc-row[hidden], .pgc-canvas[hidden], .pgc-msg[hidden] { display: none; }
  /* load-fast4: the shot fills the stage (object-fit) so a new photo size never moves the box (CLS 0.21 on the owner's run) */
  .pgc-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
  .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; }
  /* Blur plane alone at z0 + isolation -- mid-flip edge-on cards must not sample this
     backdrop as dark vertical strips between neighbors. Cards stack above at z1+. */
  .pgt-bg { position: absolute; inset: 0; z-index: 0; isolation: isolate;
    background: rgba(0,0,0,.42); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    opacity: 0; transition: opacity .35s ease; }
  .pgt > .pgcard { z-index: 1; isolation: isolate; }
  .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; --pgc-stat-fs: 8.5px; --pgc-name-fs: 13px; 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); }
  /* Shape stand-in (first paint): drawn at 2x then downscaled. Cover like real heroes. */
  .pgc-fp .pgc-art .hero.standin { image-rendering: auto; }
  /* mtg-face1: slightly stronger top shade so white name+gold icon stay readable over hero art. */
  .pgc-fp .pgc-shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(3,7,16,.58) 0%, rgba(3,7,16,.22) 16%, 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)); }
  /* Kind icon in its own circle, seated in the top-left elbow of the gold frame; the name sits beside it, raised. */
  .pgc-fp .pgc-top { top: calc(3px * var(--pgc-s)); left: calc(3px * var(--pgc-s)); right: calc(13px * var(--pgc-s));
    display: block; padding-left: calc(32px * var(--pgc-s)); min-height: calc(28px * var(--pgc-s));
    text-align: left; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 10px rgba(0,0,0,.55); }
  .pgc-fp .pgc-kind { position: absolute; top: 0; left: 0; z-index: 6; box-sizing: border-box; margin: 0;
    width: calc(28px * var(--pgc-s)); height: calc(28px * var(--pgc-s)); border-radius: 50%; color: #ffc56f;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 30%, #1a2238, #070b16 75%); border: calc(1.5px * var(--pgc-s)) solid rgba(255,179,71,.9);
    box-shadow: 0 1px 4px rgba(0,0,0,.85), 0 0 0 1px rgba(5,9,20,.9); }
  .pgc-fp .pgc-kind .pgc-kind-svg { display: block; width: 64%; height: 64%; filter: drop-shadow(0 1px 1px rgba(0,0,0,.8)); }
  /* card-drag3: smaller name; --pgc-name-fs shrinks to keep one line (fitCardName). */
  .pgc-fp .pgc-top .nm { display: block; width: 100%; box-sizing: border-box; min-width: 0; margin: 0; padding-top: calc(2px * var(--pgc-s));
    font-size: calc(var(--pgc-name-fs, 13px) * var(--pgc-s)); line-height: 1.05; letter-spacing: .1em;
    text-transform: uppercase; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: clip;
    overflow-wrap: normal; word-break: keep-all; }
  .pgc-fp .pgc-top .nm.l1 { --pgc-name-fs: 11.5px; letter-spacing: .08em; }
  .pgc-fp .pgc-top .nm.l2 { --pgc-name-fs: 10px; letter-spacing: .05em; }
  /* body-face1 + mtg-face1: type line + stats in bottom band (name moved to top). */
  .pgc-fp .pgc-copy { bottom: calc(10px * var(--pgc-s)); text-align: left; text-shadow: 0 1px 3px rgba(0,0,0,.9); }
  /* Type line: gold SUPERTYPE then white subtype. */
  .pgc-fp .pgc-type { display: flex; align-items: baseline; flex-wrap: wrap; gap: calc(5px * var(--pgc-s));
    margin: 0 0 calc(7px * var(--pgc-s)); }
  .pgc-fp .super { font-size: calc(8px * var(--pgc-s)); line-height: 1.15; letter-spacing: .2em; text-transform: uppercase; color: #ffc56f; font-weight: 800; padding-top: 0; }
  .pgc-fp .subty { margin: 0; font-size: calc(9px * var(--pgc-s)); line-height: 1.2; letter-spacing: .06em; color: #e8eef8; font-weight: 600; }
  /* comet-names3: comet epithet sits beside the gold label; a long one shrinks a step and wraps within its own column. */
  .pgc-fp .pgc-type.one { flex-wrap: nowrap; } .pgc-fp .pgc-type.one .super { flex: none; } .pgc-fp .pgc-type.one .subty { min-width: 0; }
  .pgc-fp .pgc-type.one.long .subty { font-size: calc(8px * var(--pgc-s)); letter-spacing: .02em; line-height: 1.15; }
  /* Legacy .nm under copy (if any stale markup) -- keep readable. */
  .pgc-fp .pgc-copy .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 .pgc-copy .nm.l1 { font-size: calc(14px * var(--pgc-s)); letter-spacing: .11em; } .pgc-fp .pgc-copy .nm.l2 { font-size: calc(12px * var(--pgc-s)); letter-spacing: .06em; }
  /* card-fit1: never ellipsis-truncate values; --pgc-stat-fs shrinks when the block is tight. */
  .pgc-fp .pgc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: calc(3px * var(--pgc-s)) calc(6px * var(--pgc-s)); }
  .pgc-fp .pgc-stat { min-width: 0; display: flex; flex-direction: row; align-items: center; gap: calc(3px * var(--pgc-s)); }
  .pgc-fp .pgc-stat .k { display: inline-flex; align-items: center; gap: calc(2px * var(--pgc-s)); flex: none;
    font: 700 calc(var(--pgc-stat-fs) * 0.78 * var(--pgc-s))/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .06em; text-transform: uppercase; color: #9eabc4; }
  .pgc-fp .pgc-stat .k .lab { min-width: 0; }
  .pgc-fp .pgc-ico { flex: none; width: calc(var(--pgc-stat-fs) * 0.95 * var(--pgc-s)); height: calc(var(--pgc-stat-fs) * 0.95 * var(--pgc-s));
    fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
  .pgc-fp .pgc-temp { display: flex; align-items: center; gap: calc(3px * var(--pgc-s)); margin-top: 0; min-width: 0; flex: 1 1 auto; }
  .pgc-fp .pgc-temp .lo, .pgc-fp .pgc-temp .hi {
    flex: none; font: 700 calc(var(--pgc-stat-fs) * var(--pgc-s))/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #f4f7ff;
    letter-spacing: .01em; min-width: 0; }
  .pgc-fp .pgc-temp .lo { text-align: right; }
  .pgc-fp .pgc-temp .hi { text-align: left; }
  .pgc-fp .pgc-temp .bar {
    flex: 1 1 auto; min-width: calc(18px * var(--pgc-s)); height: calc(4px * 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 { flex: 1 1 auto; min-width: 0; overflow: visible; text-overflow: clip; white-space: nowrap;
    font: 700 calc(var(--pgc-stat-fs) * var(--pgc-s))/1.1 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: nowrap; overflow: visible; text-overflow: clip; letter-spacing: .01em; }
  .pgc-fp .pgc-rule { height: 1px; margin: 0 0 calc(7px * var(--pgc-s)); background: rgba(255,210,120,.38); }
  /* card-ux1: chain/share icon removed entirely (no replacement). */
  .pgc-fp .pgc-share, .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; container-type: size; }
  /* card-box1: the gold face fills the card. A pixel box from an early measure
     stayed small on asteroids (short stats, no temperature bar) and sat centered
     inside a full-size neighbor. The plate tracks the card; flex must not
     shrink it down to whatever text happens to be inside. */
  .pgt-back > .pgt-plate {
    flex: none; min-width: 0; min-height: 0;
    width: calc(100% - 2 * clamp(3px, 3.5cqw, 6px)); height: calc(100% - 2.8 * clamp(3px, 3.5cqw, 6px));
    container-type: size; container-name: pgcf;
    transform-origin: 50% 50%;
  }
  .pgt-plate > .pgc-fp {
    width: 100%; height: 100%; max-width: none; max-height: none;
    --pgc-s: calc(100cqh / 280px);
  }
  /* 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: 25; transform: translateZ(72px); /* above faces; below VISITING/REVISITING label */ }
  .pgt-ring.on { opacity: 1; }
  /* hold-cer1: StarCode nebula aurora glow (purple/magenta/cyan) -- not --ui-accent amber.
     Intensity rides --pg-hold-glow (0->1 over the hold). */
  .pgcard.pg-hold-feedback .pgcard-face {
    --pg-hg: var(--pg-hold-glow, 0.5);
    box-shadow:
      0 0 calc(14px + 18px * var(--pg-hg)) calc(2px + 4px * var(--pg-hg)) rgba(168, 85, 247, calc(0.32 + 0.55 * var(--pg-hg))),
      0 0 calc(28px + 36px * var(--pg-hg)) rgba(232, 121, 249, calc(0.18 + 0.42 * var(--pg-hg))),
      0 0 calc(40px + 40px * var(--pg-hg)) rgba(34, 211, 238, calc(0.12 + 0.38 * var(--pg-hg))),
      0 14px 34px rgba(0,0,0,.76);
  }
  /* hold-cer1: VISITING/REVISITING ~3x (12->36), sits slightly above the card after hold completes. */
  .pgt-revisit { position: absolute; left: -12%; right: -12%; top: -28px; z-index: 40; transform: translateZ(96px); text-align: center; font-family: Inter, "Avenir Next", "Segoe UI", system-ui, sans-serif; font-size: 36px; font-weight: 800; line-height: 1; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 12px rgba(168,85,247,.55), 0 0 18px rgba(34,211,238,.35), 0 0 8px rgba(0,0,0,.9); pointer-events: none; }
  .pgcard.pgz-flat > .pgt-revisit { transform: none; z-index: 40; } /* flat stack: z-index alone (no 3D) */
  .pgt-ring circle { fill: none; stroke-width: 5; stroke-linecap: round;
    /* stroke colour comes from the SVG nebula gradient attribute (JS) -- do not set stroke here or CSS wins over url(#grad). */
    /* rotate is an SVG attribute (not CSS) so dash progress stays a full turn on back-facing cards */
    filter: drop-shadow(0 0 4px rgba(232,121,249,.9)) drop-shadow(0 0 10px rgba(34,211,238,.55)); }
  /* 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;
    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:not(.pg-flip-hint--busy) { transform: translateX(-50%) scale(.96); color: rgba(210, 230, 255, .95); background: rgba(10, 18, 36, .68); }
  /* flip-shock1: busy stays pointer-events:auto so taps do not fall through to the dim/backdrop. */
  .pg-flip-hint.pg-flip-hint--busy {
    opacity: .38; cursor: default;
    color: rgba(140, 160, 190, .55); background: rgba(6, 12, 26, .35);
  }
  .pgk-focus.on .pg-flip-hint.pg-flip-hint--busy,
  .pgt.pg-focusing > .pg-flip-hint.pg-flip-hint--busy { opacity: .38; pointer-events: auto; }
  @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-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: 22px 16px max(20px, env(safe-area-inset-bottom, 0px)); align-content: start; scroll-padding-top: 22px; }
  .pgk-tile { position: relative; display: flex; flex-direction: column; gap: 6px; -webkit-touch-callout: none; touch-action: pan-y; cursor: pointer;
    /* No content-visibility: auto -- it implies contain and can flatten/clip preserve-3d scrub flips on dense grids. */
    /* Flat tile host + isolate: each card owns 3D; avoids shared-context bleed / blur strips. */
    transform-style: flat; -webkit-transform-style: flat; isolation: isolate; z-index: 0; }
  .pgk-tile:has(.pgcard.pg-scrubbing), .pgk-tile:has(.pgcard.pg-focused) { z-index: 5; }
  .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; isolation: isolate; z-index: 1; }
  .pgk-tile .pgcard.pg-scrubbing { touch-action: none; }
  /* 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; }
  /* The card face already carries the name and type; only the list view, with its thumbnail, keeps a caption. */
  .pgk-grid:not([data-size="list"]) .pgk-tile .cap { display: 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, 2x2, ~3x3, list. data-size wins over the fluid fallback. */
  /* One card wide, free scrolling: no snap, so a slow thumb drag moves the list instead of springing back. */
  .pgk-grid[data-size="full"] { display: flex; flex-direction: column; align-items: center; gap: 18px; }
  .pgk-grid[data-size="full"] .pgk-tile { width: min(100%, 460px); flex: none; justify-content: center; box-sizing: border-box; padding: 8px 0 6px; }
  .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: 16px 16px; align-content: start; }
  .pgk-grid[data-size="g3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 14px; 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;
}
  /* card-dock1: the current world's card, docked at the left edge. Relative layout inside a fixed dock. */
  :root { --pg-dock-w: 150px; }
  @media (max-width: 720px) { :root { --pg-dock-w: 112px; } }
  #worldDock { position: fixed; left: max(10px, calc(env(safe-area-inset-left, 0px) + 6px)); bottom: max(14px, calc(env(safe-area-inset-bottom, 0px) + 10px)); z-index: 40; width: var(--pg-dock-w); height: calc(var(--pg-dock-w) * 1.4); }
  #worldDock[hidden] { display: none; }
  #worldDock .pgcard.pg-dock-card { position: relative; width: 100%; height: 100%; }
  /* Fallback code face for a world with no card: scales with the card so it reads the same docked and enlarged. */
  .pg-dock-plain { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; text-align: center; color: #dfe6f5; font: 11px/1.3 system-ui, sans-serif; container-type: inline-size; }
  .pgk-focus-stage .pg-dock-plain { font-size: 20px; gap: 8px; padding: 24px; }
  .pgk-focus-stage .pg-dock-plain b { font-size: 26px; }
  .pgk-focus-stage .pg-dock-plain small { font-size: 14px; }
  .pgk-focus-stage .pg-dock-plain code { font-size: 20px; }
  .pgk-focus-stage .pg-dock-plain p { font-size: 17px; }
  .pg-dock-plain b { font-size: 13px; letter-spacing: .04em; }
  .pg-dock-plain small { color: #ffa133; font-size: 9px; letter-spacing: .2em; margin-top: 6px; }
  .pg-dock-plain code { font-size: 11px; color: #c5cddc; }
  .pg-dock-plain p { color: #8c96ab; font-size: 10px; margin: 8px 0 0; }
  body.title-showing #worldDock, body.pane-open #worldDock, body.pg-collection-open #worldDock { display: none; }
  /* card-reveal1: unvisited mystery face -- drifting dark nebula + two-line prompt, no name / type / stats. */
  .pgc-fp.pgc-mystery .pgc-art { overflow: hidden; background: #04030a; }
  .pgc-fp.pgc-mystery .pgc-neb { position: absolute; inset: -18%; background-size: cover; background-position: center; opacity: .95;
    animation: pgcNeb 46s ease-in-out infinite alternate; will-change: transform; }
  .pgc-fp.pgc-mystery .pgc-neb.b { opacity: .45; mix-blend-mode: screen; transform: scale(1.25) rotate(180deg); animation: pgcNebB 63s ease-in-out infinite alternate; }
  @keyframes pgcNeb { from { transform: translate(-4%, -3%) scale(1.05); } to { transform: translate(4%, 3%) scale(1.15); } }
  @keyframes pgcNebB { from { transform: translate(3%, 2%) scale(1.3) rotate(180deg); } to { transform: translate(-3%, -4%) scale(1.2) rotate(186deg); } }
  .pgc-fp.pgc-mystery .pgc-shade { background: radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(0,0,0,.65) 100%); }
  .pgc-fp.pgc-mystery .pgc-myst { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 3;
    gap: calc(4px * var(--pgc-s, 1)); color: rgba(226,216,255,.88); font-weight: 800; letter-spacing: .2em; text-align: center;
    font-size: calc(9px * var(--pgc-s, 1)); text-shadow: 0 0 calc(6px * var(--pgc-s, 1)) rgba(150,110,255,.55), 0 1px 2px rgba(0,0,0,.9); }
  @media (prefers-reduced-motion: reduce) { .pgc-fp.pgc-mystery .pgc-neb { animation: none; } }
  /* card-reveal1: Polaroid develop -- dark and washed out, then art and text settle together (~2.6 s). */
  .pgc-fp.pgc-developing .pgc-art > *, .pgc-fp.pgc-developing .pgc-top, .pgc-fp.pgc-developing .pgc-copy { opacity: 0; }
  .pgc-fp.pgc-develop .pgc-art > * { animation: pgcDevArt 2.6s ease-out both; }
  .pgc-fp.pgc-develop .pgc-top, .pgc-fp.pgc-develop .pgc-copy { animation: pgcDevTxt 2.6s ease-out both; }
  @keyframes pgcDevArt { 0% { opacity: .15; filter: brightness(.25) saturate(0) contrast(.6) blur(1.5px); }
    45% { opacity: .8; filter: brightness(1.35) saturate(.35) contrast(.75) blur(.4px); } 100% { opacity: 1; filter: none; } }
  @keyframes pgcDevTxt { 0% { opacity: 0; } 35% { opacity: .2; } 100% { opacity: 1; } }
  #worldDock { transition: transform .55s cubic-bezier(.2,.8,.2,1); transform-origin: 0 100%; }
  #worldDock.pg-reveal { transform: translate(calc(50vw - 50% - 16px), calc(-50vh + 50% + 20px)) scale(1.9); z-index: 60; }
