:root {
  --bg: #fff1dc; --bg2: #ffe3c2; --panel: #fffaf2; --panel2: #fff0da; --line: #f0d9b5; --ink: #2d2a3b; --muted: #80705f;
  --accent: #ff7a59; --accent2: #ff5f3d; --accent3: #ffb088; --gold: #ffc93c; --gold2: #ffaa1f; --red: #ff5a5f; --green: #3fc380; --sheet-h: 74vh;
  --shadow: 0 10px 30px rgba(110, 60, 20, .18), 0 2px 6px rgba(110, 60, 20, .08);
  --glass: rgba(255, 252, 247, .62);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #e2bd90; color: var(--ink); font: 600 15px/1.35 var(--font); overflow: hidden; overscroll-behavior: none; }
#app { position: relative; width: 100%; height: 100%; max-width: 560px; margin: 0 auto; background: var(--bg); overflow: hidden; overflow: clip; }
button { font: inherit; color: inherit; }
img.missing { visibility: hidden; }
a { color: var(--accent2); cursor: pointer; text-decoration: underline; }

/* ---------- title ---------- */
.screen { position: absolute; inset: 0; z-index: 50; background: #ffd9a8; display: flex; flex-direction: column; justify-content: space-between; transition: opacity .5s, transform .5s; }
.screen.gone { opacity: 0; transform: scale(1.04); pointer-events: none; }
#splash { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 70%; }
.ttop { position: relative; padding: calc(54px + env(safe-area-inset-top)) 24px 0; text-align: center; background: linear-gradient(180deg, rgba(60,30,80,.28), rgba(60,30,80,0)); }
.ttop h1 { font-family: var(--display); font-weight: 700; font-size: 66px; line-height: .9; margin: 0; letter-spacing: 1px; color: #fff; text-shadow: 0 3px 0 #e06a44, 0 7px 0 #b94c2c, 0 14px 24px rgba(80, 30, 0, .45); }
.ttop h1 span { display: block; }
.ttop h1 .accent { font-size: 84px; color: #ffe27a; text-shadow: 0 3px 0 #e59a1f, 0 7px 0 #b8720e, 0 14px 24px rgba(80, 30, 0, .45); }
.tag { color: #fff; margin: 14px 0 0; font-weight: 800; text-shadow: 0 1px 2px rgba(60,20,0,.55), 0 4px 14px rgba(60,20,0,.35); font-size: 15px; letter-spacing: .3px; }
.tcontent { position: relative; width: 100%; padding: 70px 26px calc(22px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(255,205,150,0) 0%, rgba(255,205,150,.75) 40%, #ffc98e 100%); text-align: center; }
.tstatus { color: #8c6a3e; font-size: 12px; margin: 10px 0 0; }
.mbr { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 14px; font-weight: 800; color: #4a3114; letter-spacing: .4px; }
.mbr img { height: 34px; width: auto; }

/* ---------- buttons ---------- */
.btn { position: relative; background: linear-gradient(180deg, #ff9a6e, var(--accent) 45%, var(--accent2)); border: 0; border-radius: 18px; padding: 12px 18px; font-weight: 900; color: #fff; cursor: pointer; white-space: nowrap; letter-spacing: .2px; text-shadow: 0 1px 1px rgba(120,30,0,.3);
  box-shadow: 0 5px 0 #c94a2b, 0 10px 22px rgba(255, 95, 61, .35), inset 0 1px 0 rgba(255,255,255,.55); transition: transform .08s, box-shadow .08s; overflow: hidden; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #c94a2b, 0 4px 12px rgba(255, 95, 61, .3), inset 0 1px 0 rgba(255,255,255,.55); }
.btn.big { width: 100%; padding: 15px; font-size: 17px; margin-top: 10px; }
.btn.play { background: linear-gradient(180deg, #ffe680, #ffcf3a 50%, #ffb21e); color: #4a2f08; font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: 1px; text-shadow: 0 1px 0 rgba(255,255,255,.6); box-shadow: 0 6px 0 #cf8a0c, 0 14px 30px rgba(190, 120, 0, .4), inset 0 1px 0 rgba(255,255,255,.8); padding: 16px; }
.btn.play:active { transform: translateY(3px); box-shadow: 0 3px 0 #cf8a0c, 0 6px 14px rgba(190, 120, 0, .35), inset 0 1px 0 rgba(255,255,255,.8); }
.btn .shine { position: absolute; top: -40%; left: -60%; width: 40%; height: 180%; background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.55), rgba(255,255,255,0)); transform: rotate(12deg); animation: shine 3.2s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 0%, 55% { left: -60%; } 100% { left: 140%; } }
.btn.ghost { background: rgba(255,255,255,.75); color: #5a4a3a; border: 1px solid rgba(190,150,100,.35); box-shadow: 0 2px 0 rgba(140,90,40,.12); text-shadow: none; }
.btn.ghost:active { transform: translateY(1px); box-shadow: none; }
.btn.ghost.red { color: var(--red); }
.btn.gold { background: linear-gradient(180deg, #ffe07a, var(--gold) 50%, var(--gold2)); color: #4a2f08; text-shadow: 0 1px 0 rgba(255,255,255,.5); box-shadow: 0 5px 0 #cf8a0c, 0 10px 22px rgba(200, 130, 0, .3), inset 0 1px 0 rgba(255,255,255,.7); }
.btn.off, .btn:disabled { opacity: .45; cursor: default; }
.btn .cost { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; background: rgba(255,255,255,.28); padding: 2px 8px; border-radius: 99px; font-size: 13px; }
.ic { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }

/* ---------- pages ---------- */
.page { position: absolute; inset: 0; display: none; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 14px 0; }
.page.on { display: flex; }
.bgimg { position: absolute; inset: 0; background: center / cover no-repeat; z-index: 0; }
.bgimg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,241,220,.35), rgba(255,241,220,.72) 38%, rgba(255,241,220,.9) 70%, rgba(255,241,220,.95)); }
.page > *:not(.bgimg) { position: relative; z-index: 1; }
.top { display: flex; align-items: center; gap: 8px; min-height: 44px; z-index: 2; }
.top h2 { font-family: var(--display); font-weight: 700; font-size: 28px; margin: 0; flex: 1; letter-spacing: .2px; text-shadow: 0 1px 0 #fff; }
.pill { color: var(--ink); background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); border: 1px solid rgba(255,255,255,.7); box-shadow: 0 4px 14px rgba(120,80,30,.14), inset 0 1px 0 rgba(255,255,255,.7); border-radius: 999px; padding: 5px 13px 5px 7px; display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 14px; min-height: 38px; }
.pill img { width: 24px; height: 24px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.pill.gear, .pill.back { padding: 0; width: 40px; justify-content: center; font-size: 20px; }
.pill.back { font-size: 30px; line-height: 1; padding-bottom: 4px; }
.pill.prembtn { color: #7a4e00; background: linear-gradient(180deg, rgba(255,232,150,.9), rgba(255,208,90,.9)); border-color: rgba(255,255,255,.8); }
.pill.timer { font-variant-numeric: tabular-nums; min-width: 72px; justify-content: center; padding: 5px 12px; }
#home .top .pill:first-child { margin-right: auto; }
.scroll { flex: 1; overflow-y: auto; padding: 6px 0 calc(100px + env(safe-area-inset-bottom)); }

/* ---------- home ---------- */
.hero { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; }
.mascot { width: 112px; height: 112px; object-fit: contain; flex: none; filter: drop-shadow(0 8px 10px rgba(80,40,0,.28)); animation: breathe 3.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-4px) rotate(1deg); } }
.bubble { position: relative; background: rgba(255,255,255,.92); border-radius: 18px; padding: 11px 15px; font-size: 14px; font-weight: 800; box-shadow: 0 6px 18px rgba(120,80,30,.14); color: #4a3a2a; }
.bubble::before { content: ''; position: absolute; left: -8px; top: 50%; width: 16px; height: 16px; background: rgba(255,255,255,.92); transform: translateY(-50%) rotate(45deg); border-radius: 3px; }
.cards { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.bigcard { position: relative; text-align: left; background: var(--panel); border: 1px solid rgba(255,255,255,.8); border-radius: 24px; padding: 15px 17px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.9); font: inherit; color: inherit; flex: none; overflow: hidden; }
.bigcard::after { content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.35); pointer-events: none; }
.bigcard.daily { background: linear-gradient(135deg, #fff3cf, #ffd9a6); }
.bigcard.camp { background: linear-gradient(135deg, #e6f5ff, #c9e3ff); }
.bigcard.free { background: linear-gradient(135deg, #ebfaea, #cdefd6); }
.ch b { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .2px; }
.ch small { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.cb { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cb .size { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: 0; }
.cb .go { background: linear-gradient(180deg, #ff9a6e, var(--accent) 45%, var(--accent2)); color: #fff; padding: 9px 20px; border-radius: 14px; font-weight: 900; box-shadow: 0 4px 0 #c94a2b, 0 8px 16px rgba(255,95,61,.3), inset 0 1px 0 rgba(255,255,255,.5); text-shadow: 0 1px 1px rgba(120,30,0,.3); }
.cb .done { color: var(--green); font-weight: 900; }
.cf { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.cf img { width: 22px; height: 22px; object-fit: contain; }
.bar { height: 10px; background: rgba(0,0,0,.08); border-radius: 99px; overflow: hidden; margin-top: 8px; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent3), var(--accent2)); border-radius: 99px; transition: width .4s; }
.pills { display: flex; gap: 6px; margin-top: 8px; }
.pl { flex: 1; border: 2px solid transparent; background: rgba(255,255,255,.7); border-radius: 12px; padding: 8px 0; font-weight: 900; text-transform: capitalize; box-shadow: 0 2px 0 rgba(0,0,0,.05); }
.pl.on { border-color: var(--accent); background: #fff; color: var(--accent2); box-shadow: 0 2px 0 rgba(255,95,61,.25); }

/* ---------- levels ---------- */
#levellist h3 { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-weight: 700; font-size: 21px; margin: 16px 0 8px; letter-spacing: .5px; }
#levellist h3 small { color: var(--muted); font: 800 12px var(--font); }
.lgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.lv { aspect-ratio: 1; border: 1px solid rgba(255,255,255,.9); border-radius: 16px; background: linear-gradient(180deg, #fff, #fff6e8); box-shadow: 0 4px 0 rgba(140,90,40,.14), 0 6px 14px rgba(140,90,40,.1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lv b { font-family: var(--display); font-weight: 700; font-size: 21px; }
.lv i { font-style: normal; display: flex; gap: 1px; min-height: 14px; }
.lv.done { background: linear-gradient(180deg, #fff8dc, #ffecb8); }
.lv.next { background: linear-gradient(180deg, #ff9a6e, var(--accent2)); color: #fff; border-color: rgba(255,255,255,.5); box-shadow: 0 4px 0 #c94a2b, 0 8px 18px rgba(255,95,61,.35); animation: pulse 1.2s infinite alternate; }
.lv.locked { opacity: .45; filter: saturate(.6); }
@keyframes pulse { to { transform: scale(1.06); box-shadow: 0 4px 0 #c94a2b, 0 0 0 7px rgba(255,122,89,.22); } }

/* ---------- play ---------- */
#play { padding-left: 10px; padding-right: 10px; }
#play .bgimg::after { background: linear-gradient(180deg, rgba(255,241,220,.2), rgba(255,241,220,.45) 30%, rgba(255,241,220,.55) 60%, rgba(255,241,220,.8)); }
.ptitle { flex: 1; text-align: center; line-height: 1.1; }
.ptitle b { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .2px; display: block; text-shadow: 0 1px 0 #fff, 0 2px 8px rgba(255,255,255,.8); }
.ptitle small { color: #6a5a4a; font-size: 11px; font-weight: 800; text-shadow: 0 1px 0 rgba(255,255,255,.8); }
.hearts { display: flex; gap: 1px; min-width: 76px; justify-content: flex-end; align-items: center; }
.hearts .hsvg { width: 27px; height: 27px; object-fit: contain; transition: transform .25s, filter .25s; filter: drop-shadow(0 2px 2px rgba(120,0,0,.3)); }
.hearts .hsvg.lost { filter: grayscale(1) opacity(.3); transform: scale(.8); }
.hearts .inf { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #8a5a00; }
.hearts .inf .hsvg { width: 22px; height: 22px; }
.prow { display: flex; justify-content: space-between; margin: 8px 0; }
#boardwrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
/* ---------- clay yards board (2026-11-01): yards are continuous clay pieces on a dark tray, seams only where yards meet ---------- */
.frame { position: relative; padding: 12px; border-radius: 30px; background: linear-gradient(155deg, #fffdf3, #f9eed9 45%, #ead9bb); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 6px 0 #cdb795, 0 14px 28px rgba(83,61,45,.26), 0 26px 50px rgba(65,48,35,.2), inset 0 2px 2px rgba(255,255,255,.95), inset 0 -3px 5px rgba(129,98,62,.14); width: min(100%, calc(100vh - 318px), 540px); }
.frame::before { content: ''; position: absolute; inset: 6px; border-radius: 25px; border: 2px solid rgba(129,97,67,.16); box-shadow: inset 0 2px 4px rgba(91,67,43,.12), 0 1px 0 rgba(255,255,255,.85); pointer-events: none; }
#board { --g: 2px; --r: 11px; position: relative; z-index: 1; display: grid; gap: 0; width: 100%; aspect-ratio: 1; padding: var(--g); box-sizing: border-box; background: #6b4f43; border-radius: 17px; box-shadow: inset 0 3px 8px rgba(0,0,0,.4), inset 0 -1px 0 rgba(255,255,255,.14), 0 1px 0 rgba(255,255,255,.7); touch-action: none; user-select: none; -webkit-user-select: none; }
.cell { position: relative; min-width: 0; min-height: 0; cursor: pointer; background: var(--c); box-shadow: var(--e); transition: filter .15s; -webkit-tap-highlight-color: transparent; }
.cell::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.05) 38%, rgba(0,0,0,0) 62%, rgba(0,0,0,.07)); pointer-events: none; }
/* rounded corners only where a yard has a convex corner; the dark tray shows through them */
.cell.bt.bl { border-top-left-radius: var(--r); }
.cell.bt.br { border-top-right-radius: var(--r); }
.cell.bb.bl { border-bottom-left-radius: var(--r); }
.cell.bb.br { border-bottom-right-radius: var(--r); }
.cell:active { filter: brightness(.92); }
/* pup: sits on the clay with a soft oval shadow */
.cell .pshadow { position: absolute; left: 50%; bottom: 8%; width: 58%; height: 14%; transform: translateX(-50%); border-radius: 50%; background: rgba(60,35,25,.34); filter: blur(2px); pointer-events: none; }
.cell .pup { position: absolute; left: 6%; bottom: 7%; width: 88%; height: 86%; object-fit: contain; object-position: center bottom; transform-origin: 50% 85%; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(60,20,0,.28)); }
.pupfallback { position: absolute; left: 20%; top: 20%; width: 60%; height: 60%; border-radius: 50%; background: #c98a3a; border: 3px solid #fff; }
/* X: a cocoa stamp, slightly tilted */
.cell .x { position: absolute; left: 30%; top: 30%; width: 40%; height: 40%; color: #5a3b31; opacity: .72; transform: rotate(-7deg); filter: drop-shadow(0 1px 0 rgba(255,255,255,.35)); pointer-events: none; animation: xstamp .18s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes xstamp { 0% { opacity: 0; transform: rotate(-17deg) scale(1.6); } 100% { opacity: .72; transform: rotate(-7deg) scale(1); } }
/* hint: gold ring with a paw print badge */
.cell.hint::after { content: ''; position: absolute; inset: 7%; border: 3px solid #ffdc68; border-radius: 26%; box-shadow: 0 0 0 1px rgba(111,71,22,.3), 0 0 10px 3px rgba(255,209,70,.6), inset 0 0 8px rgba(255,241,143,.45); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23fff1b3' stroke='%236a4420' stroke-width='1.3' stroke-linejoin='round'%3E%3Ccircle cx='5.2' cy='9.6' r='2.3'/%3E%3Ccircle cx='9.8' cy='5.4' r='2.5'/%3E%3Ccircle cx='15.2' cy='5.4' r='2.5'/%3E%3Ccircle cx='19.8' cy='9.6' r='2.3'/%3E%3Cpath d='M12.5 10.2c3.9 0 7 2.9 7 6.2 0 2.5-1.8 4.1-3.9 4.1-1.2 0-2.1-.7-3.1-.7s-1.9.7-3.1.7c-2.1 0-3.9-1.6-3.9-4.1 0-3.3 3.1-6.2 7-6.2z'/%3E%3C/g%3E%3C/svg%3E") no-repeat 94% 6% / 34% auto; animation: hintpulse 1.3s ease-in-out infinite; pointer-events: none; z-index: 4; }
@keyframes hintpulse { 0%, 100% { opacity: .78; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.02); box-shadow: 0 0 0 2px rgba(255,232,125,.55), 0 0 16px 6px rgba(255,209,70,.75), inset 0 0 8px rgba(255,241,143,.45); } }
@keyframes ring { from { transform: scale(.9); opacity: .7; } to { transform: scale(1.04); opacity: 1; } }
.cell.shake { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.cell.pop .pup { animation: puppop .42s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes puppop { 0% { transform: translateY(-24%) scale(.55); opacity: 0; } 45% { transform: translateY(4%) scale(1.12, .86); opacity: 1; } 70% { transform: translateY(-8%) scale(.95, 1.08); } 100% { transform: none; opacity: 1; } }
/* win: a wave of light runs across the yards, pups hop, a sparkle pops over each pup */
#board.won .cell { animation: winwave .65s ease-in-out both; animation-delay: calc(var(--i) * 28ms); }
@keyframes winwave { 0% { filter: brightness(1); } 35% { filter: brightness(1.3) saturate(1.2); } 70% { filter: brightness(1.1); } 100% { filter: brightness(1); } }
#board.won .pup { animation: pupwin .65s ease-in-out both; animation-delay: calc(var(--i) * 28ms + 100ms); }
@keyframes pupwin { 0%, 100% { transform: none; } 35% { transform: translateY(-12%) rotate(-7deg) scale(1.08); } 65% { transform: translateY(-5%) rotate(6deg); } }
#board.won .cell[data-m="pup"]::after { content: ''; position: absolute; top: 2%; right: 4%; width: 30%; height: 30%; background: #fff3b0; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); filter: drop-shadow(0 0 4px #ffce58); z-index: 5; pointer-events: none; animation: sparkle .8s ease-out both; animation-delay: calc(var(--i) * 28ms + 200ms); }
@keyframes sparkle { 0% { opacity: 0; transform: scale(0) rotate(-40deg); } 45% { opacity: 1; transform: scale(1.3) rotate(20deg); } 100% { opacity: 0; transform: scale(.5) rotate(65deg) translateY(-30%); } }
/* dense boards: finer seams */
#board.n8 { --r: 9px; }
#board.n9, #board.n10 { --g: 1.5px; --r: 7px; }
#board.n9 .cell .x, #board.n10 .cell .x { left: 27%; top: 27%; width: 46%; height: 46%; }
#board.n9 .cell .pup, #board.n10 .cell .pup { left: 3%; width: 94%; height: 92%; bottom: 5%; }
@media (prefers-reduced-motion: reduce) { .cell, .cell .pup, .cell .x, .cell.hint::after { animation: none !important; } }
.hintbox { min-height: 20px; margin: 10px 4px 0; text-align: center; font-size: 13px; font-weight: 800; color: #6a3a10; background: linear-gradient(180deg, rgba(255,236,170,.92), rgba(255,214,110,.92)); border: 1px solid rgba(255,255,255,.8); border-radius: 14px; padding: 8px 12px; opacity: 0; transition: opacity .25s; box-shadow: 0 6px 16px rgba(160,100,0,.18); }
.hintbox.show { opacity: 1; }
.tools { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 9px; padding: 10px 0 calc(14px + env(safe-area-inset-bottom)); }
.tool { border: 1px solid rgba(255,255,255,.8); border-radius: 18px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); padding: 10px 6px; font-weight: 900; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 6px 16px rgba(120,80,30,.14), inset 0 1px 0 #fff; transition: transform .08s; }
.tool:active { transform: translateY(2px); }
.tool span { font-size: 19px; line-height: 1; }
.tool:disabled { opacity: .4; }
.tool.on span { color: var(--accent2); }
.tool.hintbtn { background: linear-gradient(180deg, #ffe07a, var(--gold) 50%, var(--gold2)); color: #4a2f08; flex-direction: row; gap: 6px; font-size: 15px; box-shadow: 0 5px 0 #cf8a0c, 0 10px 20px rgba(200,130,0,.3), inset 0 1px 0 rgba(255,255,255,.7); border: 0; }
.tool.hintbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 #cf8a0c, 0 4px 10px rgba(200,130,0,.3), inset 0 1px 0 rgba(255,255,255,.7); }
.tool.hintbtn img { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.tool.hintbtn em { font-style: normal; background: rgba(0,0,0,.14); padding: 1px 8px; border-radius: 99px; font-size: 12px; }
#confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 45; }
#confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: fall 2s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .6; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; text-align: center; }
.stats div { background: rgba(255,255,255,.85); border-radius: 16px; padding: 11px 2px; box-shadow: 0 4px 12px rgba(120,80,30,.1), inset 0 1px 0 #fff; }
.stats b { display: block; font-family: var(--display); font-weight: 700; font-size: 23px; color: var(--accent2); }
.stats small { color: var(--muted); font-size: 11px; font-weight: 800; }
#statlist h3, .sheet h3 { font-size: 13px; color: var(--muted); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: 1.2px; }
.best { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.best div { background: rgba(255,255,255,.85); border-radius: 16px; padding: 9px; text-align: center; box-shadow: 0 4px 12px rgba(120,80,30,.1); }
.best b { display: block; font-family: var(--display); font-weight: 700; font-size: 16px; }
.best span { display: block; color: var(--accent2); font-weight: 900; }
.best small { color: var(--muted); font-size: 11px; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.badge { background: rgba(255,255,255,.85); border-radius: 16px; padding: 11px 6px; text-align: center; opacity: .45; filter: saturate(.3); box-shadow: 0 4px 12px rgba(120,80,30,.1); }
.badge.on { opacity: 1; filter: none; background: linear-gradient(180deg, #fff8dc, #ffecb8); }
.badge img { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.badge b { display: block; font-size: 13px; }
.badge small { display: block; color: var(--muted); font-size: 11px; }

/* ---------- nav ---------- */
#nav { position: absolute; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 5px; border-radius: 30px; background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); border: 1px solid rgba(255,255,255,.8); box-shadow: 0 14px 34px rgba(120,80,30,.26), inset 0 1px 0 #fff; }
#nav button { position: relative; background: none; border: 0; border-radius: 24px; padding: 6px 0 5px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 900; color: var(--ink); transition: background .2s, color .2s, transform .1s; }
#nav button:active { transform: scale(.94); }
#nav button.on { background: rgba(255,255,255,.9); color: var(--accent2); box-shadow: 0 2px 8px rgba(120,80,30,.15); }
#nav button img { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.22)); }

/* ---------- sheet ---------- */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 35; max-height: var(--sheet-h); background: rgba(255,250,242,.95); -webkit-backdrop-filter: blur(28px) saturate(160%); backdrop-filter: blur(28px) saturate(160%); border-top: 1px solid rgba(255,255,255,.9); border-radius: 28px 28px 0 0; padding: 10px 16px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -12px 44px rgba(120,80,30,.3); }
.sheet:not(.open) { visibility: hidden; }
.sheet.open { transform: none; }
.sheet .grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet .x { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #efe3cc; color: #6b5f52; font-weight: 900; }
.sheet h2 { font-family: var(--display); font-weight: 700; font-size: 26px; margin: 4px 0 6px; letter-spacing: .2px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.premcard { display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, #fff3cf, #ffd9a6); border: 1px solid rgba(255,255,255,.9); border-radius: 20px; padding: 13px; box-shadow: var(--shadow); }
.premcard .ic { width: 58px; height: 58px; }
.premcard ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: #6b4a22; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; }
.packs.two { grid-template-columns: repeat(2, 1fr); }
.pack { position: relative; background: #fff; border-radius: 16px; padding: 14px 6px 10px; text-align: center; cursor: pointer; border: 2px solid transparent; font: inherit; box-shadow: 0 4px 12px rgba(120,80,30,.1); }
.pack.tagged { border-color: var(--gold); }
.pack em { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: linear-gradient(180deg, #ffe07a, var(--gold2)); color: #4a2f08; font-style: normal; font-size: 10px; font-weight: 900; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pack img { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.pack b { display: block; font-size: 15px; }
.pack small { display: block; color: var(--muted); font-size: 12px; }
.pack .price { display: inline-block; margin-top: 8px; background: linear-gradient(180deg, #ff9a6e, var(--accent2)); color: #fff; font-weight: 900; padding: 6px 12px; border-radius: 10px; font-size: 13px; box-shadow: 0 3px 0 #c94a2b; }
.setrow { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 16px; padding: 11px 13px; margin-top: 8px; box-shadow: 0 3px 10px rgba(120,80,30,.08); }
.setrow small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.tog { width: 50px; height: 30px; border-radius: 99px; border: 0; background: #ddd; position: relative; transition: background .2s; box-shadow: inset 0 1px 3px rgba(0,0,0,.15); }
.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.tog.on { background: var(--green); }
.tog.on::after { left: 23px; }

/* ---------- toasts and modal ---------- */
#toasts { position: absolute; left: 0; right: 0; bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { color: var(--ink); background: rgba(255,255,255,.9); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.8); border-radius: 14px; padding: 9px 14px; font-size: 14px; font-weight: 800; max-width: 86%; text-align: center; opacity: 0; transform: translateY(10px); transition: all .25s; box-shadow: 0 8px 24px rgba(120,80,30,.22); }
.toast.show { opacity: 1; transform: none; }
#modal { position: absolute; inset: 0; z-index: 40; background: rgba(70,35,10,.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 24px; }
#modal.open { display: flex; }
#modal .box { background: linear-gradient(180deg, #fffdf8, var(--panel2)); border: 1px solid rgba(255,255,255,.9); border-radius: 28px; padding: 22px 20px 16px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 30px 70px rgba(60,30,0,.45), inset 0 1px 0 #fff; max-height: 90%; overflow-y: auto; animation: rise .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes rise { from { transform: translateY(24px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
#modal h2 { font-family: var(--display); font-weight: 700; font-size: 30px; margin: 4px 0; letter-spacing: .2px; }
#modal p { color: var(--muted); font-size: 14px; margin: 6px 0; }
#modal .hero { width: 128px; height: 128px; object-fit: contain; filter: drop-shadow(0 10px 12px rgba(80,40,0,.3)); margin-top: -4px; }
.rules { text-align: left; padding-left: 20px; font-size: 14px; margin: 8px 0 4px; }
.rules li { margin: 7px 0; }
.result { list-style: none; padding: 0; margin: 8px 0; font-size: 15px; }
.result li { padding: 4px 0; }
.result em { font-style: normal; background: var(--green); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
.stars { display: flex; justify-content: center; gap: 4px; margin: 6px 0; }
.stars span .ssvg { width: 46px; height: 46px; object-fit: contain; filter: grayscale(1) opacity(.25); }
.stars span.on .ssvg { filter: drop-shadow(0 3px 4px rgba(160,100,0,.4)); animation: pop .5s cubic-bezier(.34, 1.56, .64, 1); }
.stars span:nth-child(2).on .ssvg { animation-delay: .12s; animation-fill-mode: backwards; }
.stars span:nth-child(3).on .ssvg { animation-delay: .24s; animation-fill-mode: backwards; }
.newbadge { background: linear-gradient(180deg, #fff8dc, #ffecb8); border-radius: 16px; padding: 10px; font-size: 13px; margin: 6px 0; }
.lv i .ssvg { width: 12px; height: 12px; object-fit: contain; }

/* ---------- coach (guided levels) ---------- */
.coach { display: none; align-items: center; gap: 10px; margin: 2px 2px 0; padding: 10px 12px; border-radius: 20px; background: rgba(255,255,255,.93); border: 1px solid #fff; box-shadow: var(--shadow); animation: rise .3s cubic-bezier(.2,.9,.3,1.2); }
.coach.on { display: flex; }
.coach .cimg { width: 60px; height: 60px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 5px rgba(80,40,0,.25)); }
.coach .ctext { flex: 1; font-size: 13.5px; font-weight: 800; color: #4a3a2a; line-height: 1.3; }
.coach .ctext b { display: block; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: .2px; color: var(--ink); margin-bottom: 2px; }
.coach .btn { margin: 0; padding: 10px 14px; font-size: 14px; border-radius: 14px; flex: none; }
#play.coaching .frame { width: min(100%, calc(100vh - 440px), 540px); }
#board.dimmed .cell:not(.target) { opacity: .42; filter: saturate(.6); }
#board.dimmed .cell.target { z-index: 2; }
.cell.target::after { content: ''; position: absolute; inset: 6%; border: 3px solid #ffdc68; border-radius: 26%; box-shadow: 0 0 0 1px rgba(111,71,22,.3), 0 0 14px 5px rgba(255,209,70,.75), inset 0 0 8px rgba(255,241,143,.45); animation: hintpulse 1.3s ease-in-out infinite; pointer-events: none; z-index: 4; }
.cell .pt { position: absolute; left: 50%; top: -34%; width: 26%; height: 26%; margin-left: -13%; background: linear-gradient(180deg, #ffe07a, var(--gold2)); clip-path: polygon(50% 100%, 0 30%, 25% 30%, 25% 0, 75% 0, 75% 30%, 100% 30%); filter: drop-shadow(0 3px 3px rgba(120,70,0,.4)); animation: bounce .6s ease-in-out infinite alternate; pointer-events: none; z-index: 3; }
@keyframes bounce { from { transform: translateY(-18%); } to { transform: translateY(10%); } }
.learn { font-size: 12px; font-weight: 900; color: #7a4e00; background: linear-gradient(180deg, rgba(255,232,150,.95), rgba(255,208,90,.95)); border: 1px solid #fff; padding: 5px 11px; border-radius: 99px; box-shadow: 0 3px 10px rgba(160,100,0,.18); white-space: nowrap; }
