:root{--ink:#26322e;--paper:#e4dcc0;--paper2:#d6cca8;--teal:#1d7a68;--brass:#c8962d;--rust:#b3442b;--night:#1c2522}
*{box-sizing:border-box;margin:0;padding:0}
html,body{background:var(--night);color:#e9e3cc}
body{font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;min-height:100vh;padding-bottom:env(safe-area-inset-bottom);-webkit-tap-highlight-color:transparent}
.game-header{display:flex;justify-content:space-between;align-items:center;padding:.5rem 1rem;padding-left:max(1rem,env(safe-area-inset-left));padding-right:max(1rem,env(safe-area-inset-right));border-bottom:2px solid #2f3b36;min-height:44px}
.game-header a{color:#e9e3cc;text-decoration:none;font-weight:600;min-height:44px;display:inline-flex;align-items:center}
.game-tag{font-size:.8rem;color:#a9b3a4}
.game-wrap h1{font:700 1rem Georgia,"Times New Roman",serif;letter-spacing:.04em;margin:.2rem 0 .5rem;color:#e9e3cc}
.fc{width:100%;max-width:388px;margin:0 auto}
.fc-hud{display:flex;align-items:center;gap:6px;min-height:48px}
.fc-stat{flex:1;min-width:0;display:flex;flex-direction:column;font-family:Georgia,serif}
.fc-stat b{font-size:1.05rem}
.fc-stat span{font:600 .8rem system-ui,sans-serif;color:#b9c3b4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ib{width:44px;height:44px;border:2px solid var(--ink);border-radius:12px;background:var(--paper);color:var(--ink);display:grid;place-items:center;cursor:pointer;box-shadow:2px 3px 0 #0e1311;padding:0}
.ib:active{transform:translate(2px,3px);box-shadow:none}
.ib svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.fc-bar{height:5px;background:#33403a;border-radius:3px;overflow:hidden;margin:2px 0 6px}
.fc-bar i{display:block;height:100%;width:100%;background:var(--brass);transform-origin:left center;transform:scaleX(1)}
.fc-field{position:relative;margin:0 auto;border-radius:10px;overflow:hidden;background:var(--paper);box-shadow:3px 4px 0 #0e1311;touch-action:none;user-select:none;-webkit-user-select:none}
#cv{display:block;touch-action:none;width:100%;height:100%;-webkit-touch-callout:none}
.fc-tip{position:absolute;left:8px;right:8px;bottom:10px;padding:8px 10px;background:rgba(38,50,46,.88);color:#f4efd9;border-radius:8px;font-size:.88rem;line-height:1.3;text-align:center;pointer-events:none;opacity:0;transition:opacity .4s}
.fc-tip.show{opacity:1}
.fc-over{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(28,37,34,.55);padding:12px;overflow:auto}
.fc-over[hidden]{display:none}
.card{width:100%;max-width:330px;background:var(--paper);color:var(--ink);border:3px solid var(--ink);border-radius:14px;padding:16px;box-shadow:4px 5px 0 #0e1311;display:flex;flex-direction:column;gap:10px;text-align:center}
.card h2{font:700 1.4rem Georgia,serif}
.logo{font:italic 700 1.9rem Georgia,"Times New Roman",serif;line-height:1.05;color:var(--teal)}
.lede,.meta{font-size:.9rem;line-height:1.35}
.meta{color:#4d5a54;font-size:.82rem}
.big{font:700 1.15rem Georgia,serif}
.btn{min-height:46px;border:2px solid var(--ink);border-radius:12px;background:var(--paper2);color:var(--ink);font:700 1rem system-ui,sans-serif;cursor:pointer;padding:0 12px;box-shadow:2px 3px 0 var(--ink);display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none}
.btn:active{transform:translate(2px,3px);box-shadow:none}
.btn.main{background:var(--teal);color:#f6f1dc;font-size:1.1rem;min-height:52px}
.btn.small{min-height:44px;padding:0 14px}
.btn:focus-visible,.ib:focus-visible,.cell:focus-visible{outline:3px solid var(--brass);outline-offset:2px}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.pips{display:inline-flex;gap:3px;vertical-align:middle}
.pip{width:12px;height:12px;border-radius:50%;border:2px solid var(--ink);background:transparent;display:inline-block}
.pip.on{background:#a96a3a}.pip.on.m2{background:#aeb4b2}.pip.on.m3{background:var(--brass)}
.medalrow{display:flex;gap:10px;align-items:center;justify-content:center;font-weight:700}
.medalrow .pip{width:20px;height:20px}
.sel{max-width:none;max-height:100%;overflow:auto;-webkit-overflow-scrolling:touch}
.selhead{display:flex;justify-content:space-between;align-items:center}
.grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}
.cell{min-height:52px;border:2px solid var(--ink);border-radius:10px;background:var(--paper2);color:var(--ink);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;cursor:pointer;font:inherit;box-shadow:2px 2px 0 var(--ink)}
.cell b{font:700 1rem Georgia,serif}
.cell .pip{width:8px;height:8px;border-width:1.5px}
.cell.lock{opacity:.45;box-shadow:none;cursor:default}
.res.win h2{color:var(--teal)}.res.lose h2{color:var(--rust)}
.fc-about{margin:18px auto;max-width:388px;font-size:.92rem;line-height:1.5;color:#c9d1c3}
.fc-about h2{font:700 1.05rem Georgia,serif;margin-bottom:6px;color:#e9e3cc}
.pip-actions{max-width:388px;margin:12px auto}
footer{text-align:center;font-size:.8rem;padding:14px;color:#a9b3a4}
footer a{color:#cfd8c8;display:inline-block;min-height:24px}
@keyframes fcpop{from{transform:translateY(14px) scale(.96);opacity:0}to{transform:none;opacity:1}}
@keyframes fcpip{0%{transform:scale(.4)}60%{transform:scale(1.35)}100%{transform:scale(1)}}
.fc-over .card{animation:fcpop .28s ease-out both}
.res.win .pip.on{animation:fcpip .45s ease-out both}
.res.win .pip.on:nth-child(2){animation-delay:.12s}.res.win .pip.on:nth-child(3){animation-delay:.24s}
.fc-over{padding-bottom:max(12px,env(safe-area-inset-bottom))}
.card .meta+.meta{margin-top:-4px}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}.btn:active,.ib:active{transform:none}}

/* full screen: the board fills the stage, extras are hidden */
html.pip-immersive .game-wrap>h1,html.pip-immersive .fc-about,html.pip-immersive .pip-actions,html.pip-immersive .ad-well,html.pip-immersive .game-header,html.pip-immersive footer{display:none}
html.pip-immersive .game-wrap{max-width:none}
html.pip-immersive .fc{max-width:none;display:flex;flex-direction:column;align-items:center}
html.pip-immersive .fc-hud,html.pip-immersive .fc-bar{width:100%;max-width:388px}
html.pip-immersive .fc-field{flex:none}
html.pip-immersive .fc.fc-land{display:grid;grid-template-columns:150px auto;grid-template-rows:auto auto 1fr;column-gap:8px;justify-content:center;align-items:start}
html.pip-immersive .fc.fc-land .fc-hud{grid-column:1;grid-row:1;flex-wrap:wrap;width:150px}
html.pip-immersive .fc.fc-land .fc-stat{flex:1 0 100%}
html.pip-immersive .fc.fc-land .fc-bar{grid-column:1;grid-row:2;width:150px}
html.pip-immersive .fc.fc-land .fc-field{grid-column:2;grid-row:1/4;align-self:center}
html.pip-immersive .fc-over .card{max-height:100%;overflow:auto}
