/* Pals Post Decks — scoped styles. Follows SmartMag's scheme: light by default,
   dark under .s-dark (the theme's dark-mode class). */

.pp-scope {
  --pp-bg: #faf9f7; --pp-surface: #ffffff; --pp-surface2: #f1efeb; --pp-border: #e2dfd8;
  --pp-ink: #1c1e22; --pp-muted: #5c6069; --pp-faint: #8b8f97;
  --pp-accent: #0b8d80; --pp-accent-hi: #0aa393; --pp-on-accent: #ffffff;
  --pp-tcg: #8a6d00; --pp-good: #217a4b; --pp-bad: #b3323e;
  --pp-red: #d93a45; --pp-blue: #2f6fdb; --pp-green: #3a8f4d; --pp-purple: #8a4fd3; --pp-colorless: #767b84;
  --pp-shadow: 0 1px 2px rgba(28,30,34,.05), 0 4px 16px rgba(28,30,34,.06);
  color: var(--pp-ink);
  font-size: 14px; line-height: 1.6;
}
.s-dark .pp-scope {
  --pp-bg: #0f1114; --pp-surface: #16191e; --pp-surface2: #1d2127; --pp-border: #262b33;
  --pp-ink: #edeae0; --pp-muted: #8f929c; --pp-faint: #676c76;
  --pp-accent: #12d6c2; --pp-accent-hi: #3ee2d0; --pp-on-accent: #06211e;
  --pp-tcg: #ffd429; --pp-good: #3ef08c; --pp-bad: #ff6e7c;
  --pp-red: #e14b56; --pp-blue: #4285e0; --pp-green: #37a057; --pp-purple: #9560e6; --pp-colorless: #9aa0aa;
  --pp-shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
}
.pp-scope *, .pp-scope *::before, .pp-scope *::after { box-sizing: border-box; }
/* Width/padding comes from the theme's Pagebuilder template; we only add breathing room. */
#pp-desk.pp-scope, #pp-community.pp-scope { margin: 10px 0 50px; }
.pp-scope button { font: inherit; cursor: pointer; }
.pp-loading { color: var(--pp-faint); }
.pp-eyebrow {
  font-family: Consolas, "Cascadia Code", ui-monospace, monospace;
  font-size: 10px; font-weight: 700; letter-spacing: .17em; color: var(--pp-muted);
}
.pp-pip, .pp-scope .pp-pip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 5px; color: #fff;
  font-family: Consolas, ui-monospace, monospace; font-size: 10px; font-weight: 700;
  vertical-align: 2px;
}
.pp-pip-red { background: var(--pp-red); } .pp-pip-blue { background: var(--pp-blue); }
.pp-pip-green { background: var(--pp-green); } .pp-pip-purple { background: var(--pp-purple); }
.pp-pip-colorless { background: var(--pp-colorless); }

/* ── deck view (single + embed) ── */
.pp-deck-view { border: 1px solid var(--pp-border); border-radius: 12px; overflow: hidden; background: var(--pp-surface); box-shadow: var(--pp-shadow); margin: 1em 0; }
.pp-dhead { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--pp-border); flex-wrap: wrap; }
.pp-dtitle-wrap { flex: 1; min-width: 180px; }
.pp-dtitle { font-size: 18px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-dauthor { font-size: 12px; color: var(--pp-faint); }
.pp-dauthor b { color: var(--pp-muted); }
.pp-vote {
  display: flex; flex-direction: column; align-items: center; line-height: 1.2;
  border: 1px solid var(--pp-border); background: var(--pp-surface2); border-radius: 9px; padding: 6px 14px;
  color: var(--pp-muted); transition: all .15s;
}
.pp-vote .pp-arrow { font-size: 13px; }
.pp-vote .pp-n { font-family: Consolas, ui-monospace, monospace; font-size: 14px; font-weight: 700; }
.pp-vote:hover { border-color: var(--pp-accent); color: var(--pp-accent); background: var(--pp-surface2); }
.pp-vote.pp-voted:hover { background: color-mix(in srgb, var(--pp-accent) 12%, var(--pp-surface)); }
.pp-vote.pp-voted { border-color: var(--pp-accent); color: var(--pp-accent); background: color-mix(in srgb, var(--pp-accent) 12%, var(--pp-surface)); }
.pp-dstats { display: flex; border-bottom: 1px solid var(--pp-border); flex-wrap: wrap; }
.pp-dstat { flex: 1; min-width: 100px; padding: 10px 16px; border-right: 1px solid var(--pp-border); display: flex; flex-direction: column; gap: 3px; }
.pp-dstat:last-child { border-right: none; }
.pp-dstat .pp-k { font-family: Consolas, ui-monospace, monospace; font-size: 10px; letter-spacing: .14em; color: var(--pp-faint); font-weight: 700; }
.pp-dstat .pp-v { font-size: 14px; font-weight: 600; }
.pp-spark { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 20px; width: 72px; }
.pp-spark i { flex: 1; background: var(--pp-accent); border-radius: 2px 2px 0 0; min-height: 1.5px; opacity: .85; }
.pp-group-h {
  display: flex; justify-content: space-between; padding: 12px 16px 6px;
  font-family: Consolas, ui-monospace, monospace; font-size: 10px; font-weight: 700;
  letter-spacing: .16em; color: var(--pp-muted);
}
.pp-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; padding: 4px 16px 14px; }
.pp-gcard { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 5px rgba(0,0,0,.3); }
.pp-gcard img { display: block; width: 100%; height: auto; }
.pp-gcard .pp-q {
  position: absolute; right: 3px; bottom: 3px; background: rgba(10,12,14,.85); color: #fff;
  font-family: Consolas, ui-monospace, monospace; font-size: 10px; font-weight: 700;
  border-radius: 5px; padding: 1px 5px;
}
.pp-dfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--pp-surface2); flex-wrap: wrap; }
.pp-dactions { display: flex; gap: 8px; flex-wrap: wrap; }
.pp-btn, .pp-scope a.pp-btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px; border: none;
  background: var(--pp-accent); color: var(--pp-on-accent); font-size: 13px; font-weight: 700;
  text-decoration: none; transition: background .15s;
}
.pp-btn:hover { background: var(--pp-accent-hi); color: var(--pp-on-accent); }
.pp-btn-ghost, .pp-scope a.pp-btn-ghost { background: var(--pp-surface); color: var(--pp-muted); border: 1px solid var(--pp-border); }
.pp-btn-ghost:hover { color: var(--pp-ink); border-color: var(--pp-faint); background: var(--pp-surface); }
.pp-src { font-size: 10px; color: var(--pp-faint); }

/* ── community grid ── */
.pp-comm-tools { display: flex; gap: 8px; margin: 0 0 14px; align-items: center; flex-wrap: wrap; }
.pp-comm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.pp-cd { background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 12px; box-shadow: var(--pp-shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s; }
.pp-cd:hover { transform: translateY(-2px); }
.pp-cd-fan { position: relative; height: 112px; background: var(--pp-surface2); overflow: hidden; display: block; }
.pp-cd-fan img { position: absolute; width: 88px; height: auto; border-radius: 6px; box-shadow: 0 3px 10px rgba(0,0,0,.35); top: 12px; }
.pp-cd-fan img:nth-child(1) { left: 11%; transform: rotate(-7deg); }
.pp-cd-fan img:nth-child(2) { left: 37%; transform: rotate(-1deg) translateY(-4px); z-index: 1; }
.pp-cd-fan img:nth-child(3) { left: 62%; transform: rotate(6deg); }
.pp-cd-fan::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40px; background: linear-gradient(transparent, var(--pp-surface)); }
.pp-cd-body { padding: 6px 14px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.pp-cd-title { font-size: 15.5px; font-weight: 800; display: flex; gap: 7px; align-items: center; }
.pp-cd-title a { color: var(--pp-ink); text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-cd-title a:hover { color: var(--pp-accent); }
.pp-cd-author { font-size: 12px; color: var(--pp-faint); margin-top: -4px; }
.pp-cd-author b { color: var(--pp-muted); }
.pp-cd-stats { display: flex; align-items: center; gap: 10px; font-family: Consolas, ui-monospace, monospace; font-size: 10px; color: var(--pp-muted); }
.pp-cd-actions { display: flex; gap: 8px; margin-top: auto; }
.pp-cd-actions .pp-vote { flex-direction: row; gap: 6px; padding: 6px 12px; font-size: 12px; }
.pp-cd-actions .pp-btn { flex: 1; text-align: center; }

/* ── deck desk (builder) ── */
.pp-desk { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .pp-desk { grid-template-columns: 1fr; } }
.pp-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pp-tool-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.pp-search { flex: 1; min-width: 180px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--pp-border); background: var(--pp-surface); color: var(--pp-ink); }
.pp-chip {
  border: 1px solid var(--pp-border); background: transparent; border-radius: 999px; padding: 4px 11px;
  font-family: Consolas, ui-monospace, monospace; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--pp-muted); transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
}
.pp-chip:hover { border-color: var(--pp-faint); color: var(--pp-ink); background: var(--pp-surface2); }
.pp-chip.pp-on:hover { background: var(--pp-ink); color: var(--pp-bg); border-color: var(--pp-ink); }
.pp-chip.pp-on { background: var(--pp-ink); color: var(--pp-bg); border-color: var(--pp-ink); }
.pp-chip .pp-dot { width: 9px; height: 9px; border-radius: 3px; }
.pp-result { font-family: Consolas, ui-monospace, monospace; font-size: 11px; color: var(--pp-faint); letter-spacing: .05em; }
.pp-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px 10px; }
.pp-pcard { position: relative; text-align: left; background: none; border: none; padding: 0; display: flex; flex-direction: column; gap: 5px; height: auto; min-height: 0; line-height: inherit; }
.pp-pcard .pp-imgwrap { flex: none; }
.pp-pcard .pp-imgwrap { position: relative; border-radius: 4.5%/3.2%; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.28); transition: transform .15s, opacity .15s; }
.pp-scope .pp-pcard:hover, .pp-scope .pp-pcard:focus { background: transparent; }
.pp-pcard:hover .pp-imgwrap { transform: translateY(-3px); }
.pp-pcard img { display: block; width: 100%; height: auto; }
.pp-pcard .pp-qty { position: absolute; top: 6px; right: 6px; background: var(--pp-accent); color: var(--pp-on-accent); font-family: Consolas, ui-monospace, monospace; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.pp-pcard.pp-capped .pp-imgwrap { opacity: .5; }
.pp-pcard.pp-offcolor .pp-imgwrap { opacity: .3; filter: grayscale(1); }
.pp-pcard.pp-offcolor:hover .pp-imgwrap { transform: none; }
.pp-pcard.pp-offcolor .pp-cap .pp-nm, .pp-pcard.pp-offcolor .pp-cap .pp-no { color: var(--pp-faint); }
.pp-pcard .pp-lockbadge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--pp-ink); color: var(--pp-bg); font-family: Consolas, ui-monospace, monospace;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.pp-pcard .pp-cap { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; }
.pp-pcard .pp-cap .pp-nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--pp-ink); }
.pp-pcard .pp-cap .pp-no { font-family: Consolas, ui-monospace, monospace; font-size: 10px; color: var(--pp-faint); flex: none; }
.pp-preview { position: fixed; z-index: 9999; width: 250px; pointer-events: none; opacity: 0; transition: opacity .12s; filter: drop-shadow(0 10px 28px rgba(0,0,0,.45)); overflow: hidden; }
/* aspect-ratio reserves the image's height before it loads, so the very first
   hover measures the panel correctly instead of centring against a 0px image.
   Structures are LANDSCAPE (559x400); everything else is portrait (400x559).
   The `auto` keyword means the real ratio wins once the image has loaded, so a
   card of any future shape can never be stretched by these numbers. */
.pp-preview img { display: block; width: 100%; height: auto; aspect-ratio: auto 400 / 559; border-radius: 4.5%/3.2%; }
.pp-preview.pp-land img { aspect-ratio: auto 559 / 400; }
.pp-preview .pp-pv { margin-top: 6px; background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 10px; padding: 9px 11px; font-size: 12px; line-height: 1.45; color: var(--pp-ink); }
.pp-preview .pp-pv .pp-fx { color: var(--pp-muted); }
.pp-preview .pp-pv .pp-mt { font-family: Consolas, ui-monospace, monospace; font-size: 10px; color: var(--pp-faint); margin-top: 5px; letter-spacing: .06em; }

.pp-rail { position: sticky; top: 90px; background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 12px; box-shadow: var(--pp-shadow); display: flex; flex-direction: column; max-height: calc(100vh - 110px); }
@media (max-width: 960px) { .pp-rail { position: static; max-height: none; } }
.pp-rail-top { padding: 13px 14px 0; }
.pp-name-input { width: 100%; border: none; border-bottom: 1px dashed var(--pp-border); background: transparent; font-size: 17px; font-weight: 800; padding: 2px 0 6px; color: var(--pp-ink); }
.pp-name-input:focus { outline: none; border-bottom-color: var(--pp-accent); }
.pp-author-input { width: 100%; border: none; border-bottom: 1px dashed var(--pp-border); background: transparent; font-size: 12px; padding: 4px 0; color: var(--pp-muted); }
.pp-author-input:focus { outline: none; border-bottom-color: var(--pp-accent); }
.pp-strip { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px 0 0; }
.pp-cell { background: var(--pp-surface2); border-radius: 8px; padding: 6px 9px; }
.pp-cell .pp-k { font-family: Consolas, ui-monospace, monospace; font-size: 10px; letter-spacing: .12em; color: var(--pp-faint); font-weight: 700; }
.pp-cell .pp-v { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.pp-cell .pp-of { color: var(--pp-faint); font-weight: 400; font-size: 11px; }
.pp-cell.pp-bad .pp-v { color: var(--pp-bad); }
.pp-prog { height: 4px; border-radius: 999px; background: var(--pp-surface2); overflow: hidden; margin: 8px 0 0; }
.pp-prog i { display: block; height: 100%; background: var(--pp-accent); transition: width .25s; border-radius: 999px; }
.pp-prog.pp-over i { background: var(--pp-bad); }
.pp-rail-scroll { overflow-y: auto; padding: 0 14px 8px; flex: 1; }
.pp-srow { position: relative; display: flex; align-items: center; gap: 8px; border-radius: 8px; overflow: hidden; margin-bottom: 5px; min-height: 33px; border: 1px solid var(--pp-border); background: var(--pp-surface2); }
.pp-srow .pp-art { position: absolute; inset: 0; background-size: 190%; background-position: center 20%; opacity: .32; -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%); mask-image: linear-gradient(90deg, transparent, #000 30%); }
.pp-srow > *:not(.pp-art) { position: relative; }
.pp-srow .pp-cost { flex: none; width: 23px; height: 23px; margin-left: 5px; border-radius: 50%; background: color-mix(in srgb, var(--pp-bg) 75%, transparent); border: 1.5px solid var(--pp-cc, var(--pp-colorless)); font-family: Consolas, ui-monospace, monospace; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--pp-ink); }
.pp-srow .pp-nm { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--pp-ink); text-shadow: 0 1px 3px color-mix(in srgb, var(--pp-bg) 80%, transparent); }
.pp-srow .pp-lk { color: var(--pp-tcg); font-size: 11px; flex: none; }
.pp-step { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 5px; }
.pp-step button { width: 21px; height: 21px; border-radius: 6px; border: 1px solid var(--pp-border); background: color-mix(in srgb, var(--pp-surface) 88%, transparent); font-size: 12px; display: flex; align-items: center; justify-content: center; color: var(--pp-muted); padding: 0; }
.pp-step button:hover { border-color: var(--pp-accent); color: var(--pp-accent); background: var(--pp-surface); }
.pp-step button:disabled { opacity: .35; cursor: default; }
.pp-step .pp-q { font-family: Consolas, ui-monospace, monospace; font-size: 12px; font-weight: 700; width: 19px; text-align: center; color: var(--pp-ink); }
.pp-hint { font-size: 10px; color: var(--pp-faint); padding: 4px 0 0; }
.pp-curve-wrap { padding: 12px 0 0; }
.pp-curve-head { display: flex; justify-content: space-between; }
.pp-curve { display: flex; align-items: flex-end; gap: 2px; height: 40px; margin-top: 6px; }
.pp-cbar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.pp-cbar i { display: block; background: var(--pp-accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; transition: height .2s; }
.pp-curve-x { display: flex; gap: 2px; margin-top: 3px; }
.pp-curve-x span { flex: 1; text-align: center; font-family: Consolas, ui-monospace, monospace; font-size: 10px; color: var(--pp-faint); }
.pp-notes { margin-top: 12px; border: 1px solid color-mix(in srgb, var(--pp-tcg) 34%, var(--pp-border)); border-radius: 10px; padding: 9px 11px 10px; background: color-mix(in srgb, var(--pp-tcg) 5%, var(--pp-surface)); }
.pp-notes .pp-nh { font-family: Consolas, ui-monospace, monospace; font-size: 10px; font-weight: 700; letter-spacing: .17em; color: var(--pp-tcg); }
.pp-notes ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.pp-notes li { font-size: 12px; line-height: 1.45; color: var(--pp-muted); display: flex; gap: 7px; }
.pp-notes li::before { content: "✎"; flex: none; color: var(--pp-tcg); font-size: 11px; }
.pp-notes li.pp-praise::before { content: "✓"; color: var(--pp-good); }
.pp-notes li b { color: var(--pp-ink); }
.pp-checks { padding: 10px 0 0; display: flex; flex-direction: column; gap: 3px; }
.pp-check { display: flex; gap: 8px; font-size: 12px; color: var(--pp-muted); }
.pp-check .pp-i { font-family: Consolas, ui-monospace, monospace; font-weight: 700; width: 12px; }
.pp-check.pp-ok .pp-i { color: var(--pp-good); }
.pp-check.pp-no .pp-i { color: var(--pp-bad); }
.pp-rail-foot { padding: 12px 14px 14px; border-top: 1px solid var(--pp-border); }
.pp-submit { width: 100%; padding: 11px; border-radius: 9px; border: none; background: var(--pp-accent); color: var(--pp-on-accent); font-weight: 700; transition: background .15s, opacity .15s; }
.pp-submit:hover { background: var(--pp-accent-hi); color: var(--pp-on-accent); }
.pp-submit:disabled { opacity: .4; cursor: default; }
.pp-reset { width: 100%; margin-top: 7px; padding: 8px; border-radius: 9px; border: 1px solid var(--pp-border); background: transparent; color: var(--pp-muted); font-size: 12px; font-weight: 700; transition: background .15s, color .15s, border-color .15s; }
.pp-reset:hover { background: var(--pp-surface2); color: var(--pp-ink); border-color: var(--pp-faint); }
.pp-reset.pp-arm { background: var(--pp-red); border-color: var(--pp-red); color: #fff; }
.pp-reset.pp-arm:hover { background: var(--pp-red); border-color: var(--pp-red); color: #fff; }
.pp-reset:disabled { opacity: .35; cursor: default; }
.pp-reset:disabled:hover { background: transparent; color: var(--pp-muted); border-color: var(--pp-border); }
.pp-soul { font-size: 10px; color: var(--pp-faint); text-align: center; padding-top: 7px; }
.pp-toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px); z-index: 99999; background: #1c1e22; color: #faf9f7; border-radius: 999px; padding: 10px 18px; font-family: "Public Sans", system-ui, sans-serif; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; box-shadow: 0 4px 18px rgba(0,0,0,.35); }
.s-dark .pp-toast { background: #edeae0; color: #0f1114; }
.pp-toast.pp-show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .pp-scope *, .pp-toast { transition: none !important; } }

/* ── login wall (Deck Desk, signed out) ── */
.pp-wall { display: flex; justify-content: center; margin: 26px 0 60px; }
.pp-wall-card {
  max-width: 480px; width: 100%; text-align: center; padding: 34px 30px 26px;
  background: var(--pp-surface); border: 1px solid var(--pp-border);
  border-radius: 14px; box-shadow: var(--pp-shadow);
}
.pp-wall-h { font-size: 18px; font-weight: 800; margin: 8px 0 10px; color: var(--pp-ink); }
.pp-wall-p { font-size: 13px; color: var(--pp-muted); line-height: 1.6; margin: 0 0 18px; }
.pp-wall-actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }
.pp-wall-foot { font-size: 12px; color: var(--pp-faint); margin: 18px 0 0; }
.pp-author-as { font-size: 12px; color: var(--pp-faint); padding: 6px 0 2px; }
.pp-author-as b { color: var(--pp-muted); }
