/* Fold Pairs: kraft paper on a dark cutting mat. Scoped to .fp. */
.fp{--desk:#1b2230;--desk2:#232c3e;--paper:#f1e7d1;--ink:#d2452a;--gold:#f2c14e;--mute:#a9b2c3;
  position:relative;background:var(--desk);color:var(--paper);border-radius:16px;padding:10px 10px calc(10px + env(safe-area-inset-bottom,0px));
  font-family:"Avenir Next","Trebuchet MS",system-ui,sans-serif;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;margin-top:.5rem}
.fp *{box-sizing:border-box}
.fp button{font-family:inherit;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.fp-hud{display:flex;justify-content:space-between;align-items:flex-end;gap:8px;padding:2px 4px 8px}
.fp-stat{display:flex;flex-direction:column;min-width:0}
.fp-stat:last-child{text-align:right;align-items:flex-end}
.fp-k{font-size:.68rem;letter-spacing:.08em;text-transform:uppercase;color:var(--mute)}
.fp-stat b{font-family:Georgia,"Iowan Old Style",serif;font-size:1.15rem;font-variant-numeric:tabular-nums;color:var(--paper)}
.fp-folds{align-items:center;text-align:center}
.fp-pips{display:flex;gap:3px;flex-wrap:wrap;justify-content:center;max-width:150px;min-height:10px;margin:3px 0 1px}
.fp-pip{width:12px;height:7px;border-radius:2px;background:#39435a}
.fp-pip.on{background:var(--gold)}
.fp-stage{position:relative;width:100%;border-radius:12px;overflow:hidden;background:#171d29}
.fp-stage canvas{display:block;touch-action:none;-webkit-user-select:none;user-select:none;cursor:grab}
.fp-peekbar{position:absolute;left:0;right:0;top:0;height:5px;background:rgba(255,255,255,.08)}
.fp-peekbar[hidden]{display:none}
.fp-peekbar i{display:block;height:100%;background:var(--gold);transform-origin:0 50%}
.fp-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:12px;background:rgba(18,23,33,.72);overflow:auto}
.fp-overlay[hidden]{display:none}
.fp-card{width:100%;max-width:330px;background:var(--paper);color:#2b2418;border-radius:14px;padding:16px 16px 14px;display:flex;flex-direction:column;gap:8px;
  box-shadow:0 10px 28px rgba(0,0,0,.45);border:2px solid #c2ad84}
.fp-h{font-family:Georgia,"Iowan Old Style",serif;font-size:1.6rem;line-height:1.1;color:#2b2418}
.fp-sub{font-size:.92rem;line-height:1.35;color:#4a3f2b}
.fp-how{font-size:.86rem;line-height:1.35;color:#4a3f2b;padding-left:1.2rem}
.fp-how li{margin:2px 0}
.fp-stats{display:grid;grid-template-columns:1fr auto;gap:2px 10px;font-size:.92rem;border-top:1px dashed #b39d70;border-bottom:1px dashed #b39d70;padding:6px 0}
.fp-stats dt{color:#4a3f2b}.fp-stats dd{font-weight:700;text-align:right;font-variant-numeric:tabular-nums}
.fp-record{font-weight:700;color:#a8321b;font-size:.9rem}
.fp-best{font-size:.8rem;color:#6a5d43;text-align:center}
.fp-btn{min-height:46px;border-radius:10px;border:2px solid #2b2418;background:#fff7e3;color:#2b2418;font-size:1rem;font-weight:700;padding:8px 12px;cursor:pointer}
.fp-btn.primary{background:var(--gold);}
.fp-btn.ghost{background:transparent;border-color:#b39d70;color:#4a3f2b;font-weight:600}
.fp-btn:active{transform:translateY(1px)}
.fp-btn:focus-visible,.fp-bar button:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.fp-hint{min-height:2.6em;margin:8px 4px 4px;font-size:.9rem;line-height:1.3;color:#d9d0bb;text-align:center}
.fp-bar{display:flex;gap:8px}
.fp-bar button{flex:1;min-height:46px;border-radius:10px;border:1px solid #3d4862;background:var(--desk2);color:var(--paper);font-size:.9rem;font-weight:600;cursor:pointer;padding:6px 8px}
.fp-bar button:disabled{opacity:.4;cursor:default}
.fp-bar button:active:not(:disabled){background:#2d3850}
@media (prefers-reduced-motion:reduce){.fp *{animation:none!important;transition:none!important}}

.fp-starrow{display:flex;justify-content:center;gap:6px;font-size:2rem;line-height:1}
.fp-star{color:#cdbb92}
.fp-star.on{color:#e0a21c;text-shadow:0 1px 0 #8a5d08}
.fp-starrow.fresh .fp-star.on{animation:fp-pop .45s cubic-bezier(.2,1.6,.4,1) both}
@keyframes fp-pop{from{transform:scale(.2) rotate(-25deg);opacity:0}to{transform:none;opacity:1}}
.fp-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;max-height:42vh;overflow:auto;padding:2px}
.fp-lv{min-height:52px;border-radius:10px;border:2px solid #b39d70;background:#fff7e3;color:#2b2418;display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer;font-family:inherit}
.fp-lv b{font-size:1.05rem}
.fp-lv i{font-style:normal;font-size:.7rem;color:#a8691c;letter-spacing:.05em}
.fp-lv.cur{border-color:#2b2418;background:var(--gold)}
.fp-lv:focus-visible{outline:3px solid var(--gold);outline-offset:2px}

/* depth: soft lamp light and edge shadow on the mat */
.fp-stage{background:radial-gradient(120% 90% at 50% 30%,#232c3e 0%,#171d29 70%);box-shadow:inset 0 0 0 1px rgba(255,255,255,.05),inset 0 -18px 30px rgba(0,0,0,.28)}
.fp-card{animation:fp-rise .28s cubic-bezier(.2,.9,.3,1) both}
@keyframes fp-rise{from{transform:translateY(10px) scale(.97);opacity:0}to{transform:none;opacity:1}}

/* full screen: the playfield fills the stage under the dock */
html.pip-immersive .game-wrap,html.pip-native .game-wrap{display:flex;flex-direction:column;overflow:hidden!important;padding-bottom:env(safe-area-inset-bottom,0px)}
html.pip-immersive .game-wrap>.fp,html.pip-native .game-wrap>.fp{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;margin-top:0;border-radius:0;padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px))}
html.pip-immersive .fp-stage,html.pip-native .fp-stage{flex:1 1 auto;min-height:0;height:auto}
html.pip-immersive .fp-stage canvas,html.pip-native .fp-stage canvas{position:absolute;left:0;top:0}
html.pip-immersive .fp-hint,html.pip-native .fp-hint{min-height:0;margin:4px 4px 2px;font-size:.85rem}
html.pip-immersive .fp-hint:empty,html.pip-native .fp-hint:empty{display:none}
html.pip-immersive .fp-bar,html.pip-native .fp-bar{flex:0 0 auto}
html.pip-immersive .game-wrap>.pip-actions,html.pip-native .game-wrap>.pip-actions,html.pip-immersive .fp-how,html.pip-native .fp-how{display:none}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .game-wrap>.fp,html.pip-native .game-wrap>.fp{display:grid;grid-template-columns:1fr 150px;grid-template-rows:auto 1fr;gap:4px 8px}
  html.pip-immersive .fp-hud,html.pip-native .fp-hud{grid-column:1/3;padding-bottom:2px}
  html.pip-immersive .fp-stage,html.pip-native .fp-stage{grid-column:1;grid-row:2}
  html.pip-immersive .fp-hint,html.pip-native .fp-hint{display:none}
  html.pip-immersive .fp-bar,html.pip-native .fp-bar{grid-column:2;grid-row:2;flex-direction:column;justify-content:center}
  html.pip-immersive .fp-sub,html.pip-native .fp-sub{display:none}
}
