/* SITE INTEGRATION (wealthprism.ai): this is the owner's css/puzzle.css with every selector scoped to the
   .pz wrapper, so it cannot restyle the shared header and footer (and the site's own --accent/--focus
   tokens are untouched). Mapping: :root and body -> .pz, * -> .pz *, footer -> .pz .pz-foot (the build
   turns <footer> into the shared footer), everything else gets a ".pz " prefix. The page follows the
   site's light/dark toggle because the site always sets <html data-theme>, which the owner's dark rules
   already read. Other changes are marked "SITE EDIT". Site-specific glue lives in site-source/pages/p-puzzles.html. */
/* WealthPrism Puzzle Page: styles. Colours and type follow the WealthPrism brand book. */
/* Layout: one centred column under soft light from above; segmented tabs switch between four games; a dialog appears on a win. Tokens from the WealthPrism brand book. */
.pz {
  --surface: #F5F1EB; --raised: #FFFFFF; --text: #131916; --text-sub: #3E4A43; --text-muted: #56675F;
  --accent: #274B40; --cta: #274B40; --on-cta: #F5F1EB;
  --line: rgba(39,75,64,0.18); --line-strong: rgba(39,75,64,0.42); --chip: #E4EEE8; --focus: #274B40;
  --moss: #4F725F; --on-moss: #F5F1EB; --moss-tint: #DDECE3; --gold-tint: #F9E7CC;
  --brick-ink: #984838; --brick-tint: #F5E4DB;
  --beam: rgba(255,255,255,0.85); --beam-warm: rgba(220,165,94,0.14);
  --shadow: 0 24px 60px rgba(39,75,64,0.10); --scrim: rgba(19,25,22,0.55);
  /* fixed topic colours (same in both themes) */
  --t-gold: #DCA55E; --t-moss: #4F725F; --t-brick: #C16B55; --t-sage: #A4BAB1; --t-mint: #9ED7B7; --t-ink: #131916; --t-cream: #F5F1EB;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 12px; --r-md: 16px; --r-lg: 24px; --r-pill: 999px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pz {
    --surface: #131916; --raised: #1C2A22; --text: #F5F1EB; --text-sub: #C9D3CD; --text-muted: #B9C6BE;
    --accent: #9ED7B7; --cta: #9ED7B7; --on-cta: #131916; --line: rgba(245,241,235,0.16); --line-strong: rgba(245,241,235,0.38);
    --chip: rgba(245,241,235,0.08); --focus: #9ED7B7; --moss: #9ED7B7; --on-moss: #131916; --moss-tint: rgba(158,215,183,0.14);
    --gold-tint: rgba(220,165,94,0.16); --brick-ink: #F0A894; --brick-tint: rgba(193,107,85,0.18);
    --beam: rgba(158,215,183,0.10); --beam-warm: rgba(220,165,94,0.07); --shadow: 0 24px 60px rgba(0,0,0,0.22); --scrim: rgba(0,0,0,0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] .pz {
  --surface: #131916; --raised: #1C2A22; --text: #F5F1EB; --text-sub: #C9D3CD; --text-muted: #B9C6BE;
  --accent: #9ED7B7; --cta: #9ED7B7; --on-cta: #131916; --line: rgba(245,241,235,0.16); --line-strong: rgba(245,241,235,0.38);
  --chip: rgba(245,241,235,0.08); --focus: #9ED7B7; --moss: #9ED7B7; --on-moss: #131916; --moss-tint: rgba(158,215,183,0.14);
  --gold-tint: rgba(220,165,94,0.16); --brick-ink: #F0A894; --brick-tint: rgba(193,107,85,0.18);
  --beam: rgba(158,215,183,0.10); --beam-warm: rgba(220,165,94,0.07); --shadow: 0 24px 60px rgba(0,0,0,0.22); --scrim: rgba(0,0,0,0.6);
  color-scheme: dark;
}
.pz, .pz * { box-sizing: border-box; }
.pz [hidden] { display: none !important; }
.pz {
  background:
    radial-gradient(ellipse 70% 420px at 50% -60px, var(--beam), transparent 70%),
    radial-gradient(ellipse 40% 320px at 62% -40px, var(--beam-warm), transparent 70%),
    var(--surface);
  background-repeat: no-repeat;
  color: var(--text); font-family: var(--sans); font-size: 19px; line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 56px;
}
.pz .wrap { max-width: 860px; margin: 0 auto; display: grid; gap: 28px; }
.pz a { color: var(--accent); }
.pz :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.pz .masthead { text-align: center; display: grid; gap: 10px; justify-items: center; }
.pz .brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 24px; color: var(--text); }
.pz .brand svg { width: 30px; height: 30px; }
.pz .eyebrow { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 6px 0 0; }
.pz h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(42px, 9vw, 68px); line-height: 1.02; margin: 0; text-wrap: balance; }
.pz .lead { font-size: 21px; color: var(--text-sub); margin: 0; max-width: 34ch; text-wrap: balance; }

.pz .challenge { background: var(--gold-tint); border-radius: var(--r-md); padding: 14px 18px; text-align: center; font-weight: 700; }

.pz .tabs { display: flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: var(--r-pill); justify-self: center; flex-wrap: wrap; justify-content: center; }
.pz .tab { font: 700 17px/1 var(--sans); color: var(--text-sub); background: transparent; border: 0; border-radius: var(--r-pill); padding: 0 20px; min-height: 48px; cursor: pointer; }
.pz .tab[aria-selected="true"] { background: var(--raised); color: var(--text); box-shadow: 0 2px 10px rgba(19,25,22,0.08); }

.pz .panel { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(20px, 4vw, 40px); display: grid; gap: 18px; min-width: 0; }
.pz .panel h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 6vw, 44px); line-height: 1.1; margin: 0; text-align: center; text-wrap: balance; }
.pz .intro { margin: 0 auto; color: var(--text-sub); max-width: 56ch; text-align: center; }
.pz .meta { text-align: center; font-size: 16px; color: var(--text-muted); margin: 0; }
.pz .row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }
.pz .btn { font: 700 17px/1 var(--sans); border-radius: var(--r-pill); min-height: 48px; padding: 0 24px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.pz .btn-primary { background: var(--cta); color: var(--on-cta); border: 2px solid var(--cta); }
.pz .btn-outline { background: transparent; color: var(--text); border: 2px solid var(--line-strong); }
.pz .status { text-align: center; font-weight: 700; margin: 0; min-height: 1.6em; }
.pz .small { font-size: 16px; color: var(--text-muted); margin: 0; }
.pz .stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.pz .stat { background: var(--surface); border-radius: var(--r-md); padding: 10px 18px; text-align: center; min-width: 104px; }
.pz .stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pz .stat span { font-size: 15px; color: var(--text-muted); }

/* Bingo 3x3 */
.pz .bingo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 520px; width: 100%; margin: 0 auto; }
.pz .sq { font: 700 18px/1.3 var(--sans); color: var(--text); background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--r-md); aspect-ratio: 1; padding: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; position: relative; transition: background .15s, color .15s, transform .15s; }
.pz .sq[aria-pressed="true"] { background: var(--moss); color: var(--on-moss); border-color: var(--moss); }
.pz .sq[aria-pressed="true"]::after { content: ""; position: absolute; top: 10px; right: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--on-moss); }
.pz .sq.inline { outline: 4px solid var(--t-gold); outline-offset: 2px; }
.pz .sq .dot { position: absolute; top: 10px; left: 10px; width: 12px; height: 12px; border-radius: 50%; }
.pz .d-income { background: var(--t-gold); } .pz .d-pension { background: var(--t-moss); } .pz .d-home { background: var(--t-brick); } .pz .d-tax { background: var(--t-sage); }
.pz .sq[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--on-moss); }
.pz .explain .tag { font-size: 15px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
@media (max-width: 520px) { .pz .sq { font-size: 16px; padding: 6px; } .pz .bingo { gap: 8px; } }
@media (prefers-reduced-motion: no-preference) { .pz .sq:active { transform: scale(0.97); } }
.pz .explain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pz .explain li { background: var(--surface); border-radius: var(--r-sm); padding: 12px 16px; }
.pz .explain b { display: block; }

/* Pension Match */
.pz .mboard { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: min(100%, 476px); margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.pz .tile { aspect-ratio: 1; border: 0; border-radius: 12px; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .15s ease, opacity .18s ease; }
.pz .tile svg { width: 64%; height: 64%; }
.pz .tile.t0 { background: var(--t-moss); color: var(--t-cream); }
.pz .tile.t1 { background: var(--t-gold); color: var(--t-ink); }
.pz .tile.t2 { background: var(--t-brick); color: var(--t-ink); }
.pz .tile.t3 { background: var(--t-sage); color: var(--t-ink); }
.pz .tile.t4 { background: var(--t-mint); color: var(--t-ink); }
.pz .tile.sel { transform: scale(0.86); box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent); }
.pz .tile.pop { transform: scale(0.2); opacity: 0; }
.pz .tile.shake { animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .pz .tile { transition: none; } .pz .tile.shake { animation: none; } }
.pz .topics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 476px; width: 100%; margin: 0 auto; }
.pz .topic { border-radius: var(--r-sm); padding: 8px 4px; text-align: center; font-size: 15px; line-height: 1.25; font-weight: 700; color: var(--t-ink); }
.pz .topic b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.pz .topic.k0 { background: var(--t-moss); color: var(--t-cream); } .pz .topic.k1 { background: var(--t-gold); } .pz .topic.k2 { background: var(--t-brick); } .pz .topic.k3 { background: var(--t-sage); }
.pz .topic.full { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.pz .legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; font-size: 16px; color: var(--text-sub); }
.pz .legend span { display: inline-flex; align-items: center; gap: 6px; }
.pz .legend i { width: 18px; height: 18px; border-radius: 5px; display: inline-block; }

/* Crossword */
.pz .clue-bar { background: var(--moss-tint); border-radius: var(--r-md); padding: 12px 16px; min-height: 56px; text-align: center; font-weight: 600; }
.pz .cw-wrap { overflow-x: auto; display: flex; justify-content: center; padding: 4px; }
.pz .cw { display: grid; gap: 2px; --cell: clamp(19px, calc((100vw - 76px) / 13), 42px); }
.pz .cell { width: var(--cell); height: var(--cell); position: relative; }
.pz .cell input { width: 100%; height: 100%; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); text-align: center; font: 700 max(16px, calc(var(--cell) * 0.55))/1 var(--sans); text-transform: uppercase; padding: 0; caret-color: transparent; }
.pz .cell input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pz .cell.word input { background: var(--moss-tint); }
.pz .cell.wrong input { background: var(--brick-tint); border-color: var(--brick-ink); color: var(--brick-ink); }
.pz .cell.hinted input { color: var(--accent); }
.pz .cell .n { position: absolute; top: 1px; left: 3px; font-size: 10px; line-height: 1; font-weight: 700; color: var(--text-muted); pointer-events: none; }
.pz .clues { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.pz .clues h3 { font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.pz .clues ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pz .clue { width: 100%; text-align: left; font: 400 17px/1.45 var(--sans); color: var(--text); background: transparent; border: 0; border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; display: grid; grid-template-columns: 2.2em 1fr; }
.pz .clue b { color: var(--accent); }
.pz .clue.active { background: var(--moss-tint); }
.pz .clue.done { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* Sudoku */
.pz .sd-wrap { display: flex; justify-content: center; }
.pz .sd { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 468px); aspect-ratio: 1; border: 3px solid var(--text); border-radius: 10px; overflow: hidden; background: var(--line-strong); gap: 1px; }
.pz .sd .c { background: var(--surface); display: flex; align-items: center; justify-content: center; font: 700 clamp(18px, 5vw, 26px)/1 var(--sans); font-variant-numeric: tabular-nums; min-width: 0; }
.pz .sd .c.given { background: var(--raised); color: var(--text); }
.pz .sd .c input { width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font: inherit; color: var(--accent); padding: 0; caret-color: transparent; }
.pz .sd .c input:focus { outline: none; background: var(--moss-tint); }
.pz .sd .c.wrong input { color: var(--brick-ink); background: var(--brick-tint); }
.pz .sd .c.br { box-shadow: inset -2px 0 0 var(--text); }
.pz .sd .c.bb { box-shadow: inset 0 -2px 0 var(--text); }
.pz .sd .c.br.bb { box-shadow: inset -2px 0 0 var(--text), inset 0 -2px 0 var(--text); }
.pz .tip { background: var(--gold-tint); border-radius: var(--r-md); padding: 14px 18px; text-align: center; margin: 0; }

/* Join band */
.pz .join { background: var(--accent); color: var(--on-cta); border-radius: 28px; padding: clamp(24px, 5vw, 44px); text-align: center; display: grid; gap: 14px; justify-items: center; }
.pz .join h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 5.5vw, 42px); line-height: 1.1; margin: 0; text-wrap: balance; }
.pz .join p { margin: 0; max-width: 46ch; }
.pz .join .btn-primary { background: var(--on-cta); color: var(--accent); border-color: var(--on-cta); }
.pz .join .btn-outline { color: var(--on-cta); border-color: currentColor; }
.pz .join-note { font-size: 16px; min-height: 1.6em; }
.pz .pz-foot { text-align: center; display: grid; gap: 6px; }

/* Dialog */
.pz .scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.pz .dialog { position: relative; background: var(--raised); color: var(--text); border-radius: var(--r-lg); box-shadow: var(--shadow); width: min(100%, 520px); max-height: 100%; overflow-y: auto; padding: clamp(22px, 5vw, 36px); display: grid; gap: 14px; text-align: center; }
.pz .dialog h2 { padding-inline: 40px; }
.pz .dialog p:empty { display: none; }
.pz .dlg-x { position: sticky; top: 0; justify-self: end; margin: -6px -6px -54px 0; z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--chip); color: var(--text); font: 400 30px/1 var(--sans); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pz .linkish { background: none; border: 0; color: var(--accent); font: 600 17px/1.4 var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; justify-self: center; }
.pz .micro { font-size: 16px; margin: 0; }
.pz .dialog h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 7vw, 44px); line-height: 1.08; margin: 0; text-wrap: balance; }
.pz .dialog p { margin: 0; color: var(--text-sub); }
.pz .dialog .grid-share { font-size: 28px; line-height: 1.15; letter-spacing: 2px; white-space: pre; }
.pz .dialog .stack { display: grid; gap: 10px; }
.pz .dialog .btn { width: 100%; }

@media (max-width: 520px) {
  .pz .tab { padding: 0 12px; font-size: 15px; }
  .pz .panel { padding: 20px 14px; }
  .pz .stat { min-width: 92px; padding: 8px 12px; }
}
.pz button, .pz a.btn, .pz .tile, .pz .sq, .pz .clue { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body.modal-open { overflow: hidden; }
@media (max-width: 520px) {
  .pz { padding-block: 16px 40px; }
  .pz .wrap { gap: 20px; }
  .pz .masthead { gap: 6px; }
  .pz h1 { font-size: 36px; }
  .pz .lead { font-size: 17px; }
  .pz .intro { font-size: 17px; line-height: 1.5; }
  .pz .panel h2 { font-size: 30px; }
  .pz .topic { font-size: 14px; } /* SITE EDIT: was 13px; the site sets no text below 14px */
  .pz .topic b { font-size: 18px; }
  .pz #crossword.panel { padding-inline: 8px; }
  .pz .cw-wrap { padding: 2px; }
  .pz .cell .n { font-size: 9px; left: 2px; }
}
@media (max-width: 360px) {
  .pz .tabs { flex-wrap: nowrap; width: 100%; }
  .pz .tab { flex: 1 1 auto; padding: 0 6px; font-size: 14px; min-height: 44px; }
  .pz .cw { gap: 1px; --cell: clamp(18px, calc((100vw - 72px) / 13), 42px); }
  .pz .sq { font-size: 15px; padding: 5px; }
  .pz .stat { min-width: 84px; padding: 6px 10px; }
  .pz .stat b { font-size: 28px; }
  .pz .topic { font-size: 14px; } /* SITE EDIT: was 13px; the site sets no text below 14px */
  .pz .lead { font-size: 19px; }
  .pz .btn { padding: 0 18px; }
}
