/* Pikku Norppa
   Layout idea: the seal owns the middle of the screen. Everything else is a small
   snow-white pebble hugging an edge, and menus slide up from the bottom so the seal
   stays in view above them. One look, day or night: the 3D scene sets the mood. */
@font-face { font-family: 'DynaPuff'; src: url('../fonts/dynapuff-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --snow: #f6f9ff;       /* pebbles and sheets */
  --ink: #17264d;        /* text: deep winter-night blue */
  --ink-soft: #5d6c95;
  --ice: #dce8fa;        /* tracks, quiet buttons */
  --berry: #d8334f;      /* lingonberry: the one loud colour, for the main action and for alarm */
  --berry-deep: #a61f39;
  --night: #0f1c40;
  --tummy: #f2845c; --joy: #e8558c; --energy: #f2a71b; --clean: #3fa9e6; --good: #27a97a;
  --display: 'DynaPuff', ui-rounded, 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--ink);
  font: 600 15px/1.35 var(--body); -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
  touch-action: none; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #ffd45c; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse 85% 70% at 50% 56%, transparent 58%, rgba(8, 14, 40, .3) 100%); }

.pebble { background: rgba(246, 249, 255, .94); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .95), 0 5px 16px rgba(13, 24, 60, .24); }
/* A soft porcelain wash on the home controls, with the same sizes and colours. */
.hud .pebble { background-image: linear-gradient(160deg, rgba(255,255,255,.62), rgba(225,234,249,.22)); }
.hud .bar { box-shadow: inset 0 1px 2px rgba(35,57,98,.10); }
.hud .bar i { background-image: linear-gradient(to bottom, rgba(255,255,255,.22), transparent 70%); }
.ic { width: 22px; height: 22px; display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic .f { fill: currentColor; stroke: none; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; }
.hud > * { pointer-events: none; }
.hud button, .hud .coins { pointer-events: auto; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: calc(10px + var(--st)) calc(12px + var(--sr)) 0 calc(12px + var(--sl)); }
.plate { text-align: left; border-radius: 18px; padding: 7px 14px 9px; min-width: 128px; max-width: 46vw; display: grid; gap: 1px; }
.plate-name { font: 600 19px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-sub { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.plate-xp { height: 5px; border-radius: 3px; background: var(--ice); margin-top: 4px; overflow: hidden; display: block; }
.plate-xp i { display: block; height: 100%; width: 0; background: var(--joy); border-radius: 3px; transition: width .5s; }
.top-r { display: flex; gap: 7px; align-items: center; }
.coins { height: 38px; border-radius: 19px; padding: 0 12px 0 8px; display: flex; align-items: center; gap: 5px; font: 600 16px var(--display); font-variant-numeric: tabular-nums; }
.coins .ic { width: 22px; height: 22px; }
.round { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.round:active, .dock button:active, .btn:active, .cell:active { transform: scale(.94); }

.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px calc(12px + var(--sr)) 0 calc(12px + var(--sl)); max-width: 560px; }
.meter { height: 28px; border-radius: 14px; display: flex; align-items: center; gap: 5px; padding: 0 9px 0 7px; }
.meter .ic { width: 17px; height: 17px; }
.bar { flex: 1; height: 9px; border-radius: 5px; background: var(--ice); overflow: hidden; display: block; }
.bar i { display: block; height: 100%; width: 50%; border-radius: 5px; transition: width .5s; }
.meter[data-stat="food"] { color: var(--tummy); } .meter[data-stat="food"] i { background: var(--tummy); }
.meter[data-stat="joy"] { color: var(--joy); } .meter[data-stat="joy"] i { background: var(--joy); }
.meter[data-stat="energy"] { color: var(--energy); } .meter[data-stat="energy"] i { background: var(--energy); }
.meter[data-stat="clean"] { color: var(--clean); } .meter[data-stat="clean"] i { background: var(--clean); }
.meter.low { box-shadow: 0 0 0 2.5px var(--berry), 0 5px 16px rgba(13, 24, 60, .24); animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-2px); } }

.under { display: flex; flex-wrap: wrap; row-gap: 6px; justify-content: space-between; align-items: flex-start; gap: 6px 8px; padding: 7px calc(12px + var(--sr)) 0 calc(12px + var(--sl)); }
.sulk-chip, .med-chip, .sky-chip { flex: none; white-space: nowrap; }   /* on a narrow phone the chips drop to a second line rather than squash their words into the pill */
.sulk-chip { height: 26px; border-radius: 13px; padding: 0 11px; font-size: 12.5px; font-weight: 800; color: #b3412f; margin-right: auto; margin-left: 8px; }
.med-chip { height: 26px; border-radius: 13px; padding: 0 11px; font-size: 12.5px; font-weight: 800; color: #1f7a56; margin-right: auto; margin-left: 8px; }
.sulk-chip:not([hidden]) + .med-chip { margin-left: 0; }
.sulk-chip:not([hidden]):has(+ .med-chip:not([hidden])) { margin-right: 0; }
.medcam { position: fixed; inset: 0; z-index: 200; background: rgba(13, 24, 48, .62); display: flex; flex-direction: column; }
.medcam[hidden] { display: none; }
.medcam-x { position: absolute; right: calc(12px + var(--sr)); top: calc(12px + var(--st, 0px)); width: 44px; height: 44px; border-radius: 50%; font-size: 26px; line-height: 1; color: var(--ink); }
.medcam-card { position: relative; margin: auto 10px calc(12px + var(--sb)); max-width: 460px; align-self: center; width: calc(100% - 20px); background: #fff; border-radius: 26px; padding: 16px 16px 18px; text-align: center; box-shadow: 0 10px 30px rgba(8, 20, 40, .45); }
.medcam-card b { font: 600 20px var(--display); color: var(--ink); }
.medcam-card p { margin: 6px 0 14px; font-size: 14.5px; color: var(--ink-soft); min-height: 38px; }
.medcam-pic { display: block; margin: 10px auto 0; max-width: 100%; max-height: 42vh; border-radius: 16px; background: #0d1830; }
.medcam-pic[hidden] { display: none; }
.medcam-btns { display: flex; gap: 8px; }
.medcam-btns .btn { flex: 1; padding: 14px 10px; justify-content: center; }
.sulk-card { background: #fff2ee; border-radius: 18px; padding: 12px 14px; margin: 0 0 12px; box-shadow: inset 0 0 0 1.5px #f3c7bb; font-size: 14px; color: var(--ink-soft); }
.sulk-timer { font: 700 17px var(--display); color: #b3412f; margin: 3px 0 4px; }
.sulk-card b { color: #b3412f; }
.sulk-want { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.sulk-want span { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px 0 4px; border-radius: 15px; background: #fff; font-weight: 800; font-size: 12.5px; color: var(--ink); box-shadow: 0 2px 0 #ecd5cd; }
.sulk-want span img { width: 24px; height: 24px; }
.sulk-want span .ic { width: 18px; height: 18px; margin-left: 6px; }
.sulk-want span.done { background: #e2f7ec; box-shadow: 0 2px 0 #a8dcc0; color: #2b7a53; }
.family { display: flex; flex-direction: column; gap: 5px; }
.pup-chip { pointer-events: auto; height: 26px; border-radius: 13px; padding: 0 9px 0 4px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; }
.pup-chip .face { width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1.5px var(--ice); display: grid; place-items: center; font-size: 0; }
.pup-chip .face::before { content: ''; width: 9px; height: 3px; border-radius: 2px; box-shadow: -3px 0 0 -0.5px var(--ink), 3px 0 0 -0.5px var(--ink); margin-top: -2px; }
.fam-chip { pointer-events: auto; position: relative; height: 26px; border-radius: 13px; padding: 0 11px 0 8px; display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; align-self: flex-start; color: var(--ink); }
.fam-chip .ic { width: 15px; height: 15px; color: var(--berry); }
.pup-chip { position: relative; }
.fam-chip .dot, .pup-chip .dot { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--berry); box-shadow: 0 0 0 2px #fff; }
.pup-chip .bar { width: 34px; flex: none; height: 6px; } .pup-chip .bar i { background: var(--tummy); }
.pup-chip.bad { box-shadow: 0 0 0 2.5px var(--berry), 0 5px 16px rgba(13, 24, 60, .24); }
.sky-chip { height: 26px; border-radius: 13px; padding: 0 10px 0 7px; display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); margin-left: auto; }
.sky-chip .ic { width: 15px; height: 15px; }

.bubble { position: absolute; left: 0; top: 0; width: 46px; height: 46px; margin: -64px 0 0 -23px; border-radius: 50%; background: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(13, 24, 60, .28); color: var(--berry); will-change: transform; }
.bubble::after { content: ''; position: absolute; bottom: -5px; left: 50%; width: 12px; height: 12px; margin-left: -6px; background: #fff; transform: rotate(45deg); border-radius: 2px; }
.bubble .ic { width: 25px; height: 25px; position: relative; z-index: 1; }
.floats { position: absolute; inset: 0; overflow: hidden; }
.float { position: absolute; font: 600 20px var(--display); color: #fff; text-shadow: 0 2px 0 rgba(13, 24, 60, .55), 0 0 10px rgba(13, 24, 60, .5); animation: rise 1.1s ease-out forwards; white-space: nowrap; transform: translate(-50%, -50%); }
@keyframes rise { from { opacity: 0; margin-top: 8px; } 15% { opacity: 1; } to { opacity: 0; margin-top: -58px; } }

.toasts { position: absolute; left: 12px; right: 12px; bottom: calc(92px + var(--sb)); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { max-width: 100%; background: rgba(23, 38, 77, .93); color: #fff; border-radius: 17px; padding: 8px 14px 8px 10px; display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.25;
  box-shadow: 0 6px 18px rgba(8, 14, 40, .35); animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.3); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.toast .ic { width: 20px; height: 20px; color: #ffd45c; }
.toast.word .ic { color: #8fe3c1; } .toast.bad .ic { color: #ff9aa9; }
.toast b { font-weight: 800; } .toast em { font-style: normal; color: #ffd45c; font-weight: 800; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }


.dock { position: absolute; left: 0; right: 0; bottom: calc(12px + var(--sb)); display: flex; justify-content: center; gap: 9px; padding: 0 8px; }
.dock button { width: 62px; height: 66px; border-radius: 22px; display: grid; place-items: center; align-content: center; gap: 3px; font: 800 11.5px var(--body); position: relative; }
.dock .ic { width: 26px; height: 26px; }
.dock button.need::after { content: ''; position: absolute; top: -3px; right: -3px; width: 15px; height: 15px; border-radius: 50%; background: var(--berry); box-shadow: 0 0 0 2.5px var(--snow); animation: nudge 1.2s ease-in-out infinite; }
.dock button.on { background: var(--ink); color: #fff; box-shadow: 0 5px 16px rgba(13, 24, 60, .3); }
.hud.busy .dock button { opacity: .55; }

/* ---------- buttons ---------- */
.btn { font: 600 17px/1 var(--display); padding: 14px 24px; border-radius: 999px; background: var(--berry); color: #fff; box-shadow: 0 4px 0 var(--berry-deep); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: var(--ice); color: var(--ink); box-shadow: 0 4px 0 #b6c9ea; }
.btn.small { font-size: 14px; padding: 9px 15px; box-shadow: 0 3px 0 var(--berry-deep); }
.btn.small.ghost { box-shadow: 0 3px 0 #b6c9ea; }
.btn.big { font-size: 20px; padding: 17px 32px; }
.btn[disabled] { opacity: .45; }

/* ---------- sheet ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 62%; margin: 0 auto; max-width: 560px; background: var(--snow); border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 40px rgba(8, 14, 40, .38); display: flex; flex-direction: column; transform: translateY(102%); transition: transform .3s cubic-bezier(.2, .9, .3, 1); padding-bottom: var(--sb); }
.sheet.open { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; flex: none; }
.sheet-head h2 { font: 600 22px/1.1 var(--display); }
.sheet-head .round { background: var(--ice); }
.tabs { display: flex; gap: 5px; padding: 4px 14px 8px; overflow-x: auto; touch-action: pan-x; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 7px 12px; border-radius: 999px; background: var(--ice); font-weight: 800; font-size: 13.5px; white-space: nowrap; color: var(--ink-soft); }
.tab.on { background: var(--ink); color: #fff; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 16px 18px; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.lead { color: var(--ink-soft); font-size: 13.5px; margin: 0 2px 10px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
@media (min-width: 440px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cell { background: #fff; border-radius: 18px; padding: 6px 5px 9px; text-align: center; position: relative; display: grid; justify-items: center; gap: 1px; width: 100%;
  box-shadow: 0 1px 0 rgba(23, 38, 77, .07), 0 3px 10px rgba(23, 38, 77, .08); }
.cell img { width: 68px; height: 68px; display: block; pointer-events: none; background: radial-gradient(circle at 50% 54%, #e6effc 0 44%, rgba(230, 239, 252, 0) 46%); }
.cell { min-width: 0; }
.cell b { font-size: 13.5px; font-weight: 800; line-height: 1.15; max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }   /* Finnish compounds (Sateenkaarikaulaliina) are wider than a cell on a phone: break them rather than stretch the shelf */
.cell .gain { display: inline-flex; align-items: center; gap: 2px; margin: 0 3px; font-weight: 800; color: var(--ink); }
.cell .gain .ic { width: 13px; height: 13px; }
.cell small { font-size: 11.5px; color: var(--ink-soft); line-height: 1.15; }
.cell .tag { margin-top: 5px; font: 600 12.5px var(--display); padding: 4px 9px; border-radius: 999px; background: var(--ice); display: inline-flex; align-items: center; gap: 3px; }
.cell .tag .ic { width: 14px; height: 14px; }
.cell .tag.buy { background: #fff1c9; color: #8a5a00; }
.cell .tag.cant { background: var(--ice); color: var(--ink-soft); }
.cell .tag.on { background: var(--good); color: #fff; }
.cell .count { position: absolute; top: 6px; right: 7px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--ink); color: #fff; font: 600 12.5px/22px var(--display); padding: 0 6px; }
.cell .new { position: absolute; top: 6px; left: 7px; height: 20px; border-radius: 10px; background: var(--berry); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; padding: 0 7px; }
.cell.locked img { filter: brightness(0) opacity(.16); }
.cell.locked b, .cell.locked small { color: #a9b4cf; }
.cell.fav::before { content: ''; position: absolute; inset: 0; border-radius: 18px; box-shadow: inset 0 0 0 2.5px var(--joy); pointer-events: none; }
/* shop and larder tiles: orange for food, yellow for energy drinks, coffee brown for the coffee */
.cell.k-food { background: #ffe3c6; } .cell.k-food img { background: radial-gradient(circle at 50% 54%, #ffa94d 0 44%, rgba(255, 169, 77, 0) 46%); }
.cell.k-drink { background: #fff3b3; } .cell.k-drink img { background: radial-gradient(circle at 50% 54%, #ffe033 0 44%, rgba(255, 224, 51, 0) 46%); }
.cell.k-coffee { background: #ead7c3; } .cell.k-coffee img { background: radial-gradient(circle at 50% 54%, #b98458 0 44%, rgba(185, 132, 88, 0) 46%); }
.cell.k-food .tag, .cell.k-drink .tag, .cell.k-coffee .tag { background: rgba(255, 255, 255, .82); }
.rows { display: grid; gap: 8px; }
.row { background: #fff; border-radius: 18px; padding: 11px 12px; display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; box-shadow: 0 1px 0 rgba(23, 38, 77, .07), 0 3px 10px rgba(23, 38, 77, .08); }
.row .ic-wrap { width: 44px; height: 44px; border-radius: 14px; background: var(--ice); display: grid; place-items: center; flex: none; color: var(--ink); }
.row .ic-wrap.pic { overflow: hidden; background: #eaf4ff; width: 52px; height: 52px; border-radius: 16px; }
.row .ic-wrap.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row.done .ic-wrap.pic { background: #eaf4ff; }
.row .ic-wrap.warm { background: #ffe9c2; color: #9a5b00; } .row .ic-wrap.rose { background: #ffe0ea; color: #b02358; } .row .ic-wrap.sea { background: #d6efff; color: #0f6aa6; } .row .ic-wrap.leaf { background: #d9f5e8; color: #14784f; }
.row .txt { flex: 1; min-width: 0; }
.row b { display: block; font: 600 16px/1.2 var(--display); }
.row span.d { display: block; font-size: 13px; color: var(--ink-soft); line-height: 1.3; margin-top: 1px; }
.row em.risk { display: block; font: italic 600 12px/1.3 var(--display); color: #b02358; margin-top: 3px; }
.row .side { font: 600 13px var(--display); color: var(--ink-soft); white-space: nowrap; text-align: right; }
.row.off { opacity: .55; }
.row .side .mood { display: flex; align-items: center; justify-content: flex-end; gap: 2px; flex-wrap: wrap; font: 600 15px var(--display); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.row .side .mood.up { color: #14784f; } .row .side .mood.down { color: #b02358; }
.row .side .mood .ic { width: 18px; height: 18px; } .row .side .mood .ic.hrt { width: 34px; height: 34px; margin-right: 0; } .row .side .mood small { flex-basis: 100%; text-align: right; }
.happy-card { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 10px; padding: 11px 13px; border-radius: 16px; background: #eef3fb; font: 500 14px/1.4 var(--body, inherit); }
.happy-card .ic { width: 30px; height: 30px; flex: none; } .happy-card b { display: block; font-family: var(--display); }
.happy-card.up { background: #e3f5ec; } .happy-card.up .ic, .happy-card.up b { color: #14784f; }
.happy-card.down { background: #fbe6ee; } .happy-card.down .ic, .happy-card.down b { color: #b02358; }
.note:has(.ic) { display: block; text-align: center; } .note .ic { width: 17px; height: 17px; display: inline-block; vertical-align: -3px; margin-right: 5px; }
.row .side small { display: block; font: 600 11.5px var(--display); color: var(--ink-soft); margin-top: 2px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip-btn.on { background: var(--ink); color: #fff; }
.note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; font: 600 13.5px var(--display); color: var(--ink-soft); }
.note.up { color: #14784f; } .note.down { color: #b02358; }
.row.done .ic-wrap { background: #fff1c9; color: #b07400; }
.word-fi { font: 600 17px/1.2 var(--display); }
.row.locked b, .row.locked .d { color: #a9b4cf; }
.statline { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1.5px solid var(--ice); font-size: 14px; }
.statline b { font-weight: 800; }
.toggle { width: 50px; height: 30px; border-radius: 15px; background: #b9c6e0; position: relative; flex: none; transition: background .2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(13, 24, 60, .25); transition: transform .2s; }
.toggle.on { background: var(--good); } .toggle.on::after { transform: translateX(20px); }
.seg { display: flex; background: var(--ice); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 11px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(13, 24, 60, .18); }
.field { width: 100%; font: 600 18px var(--display); color: var(--ink); background: #fff; border: 2.5px solid var(--ice); border-radius: 16px; padding: 12px 14px; text-align: center; -webkit-user-select: text; user-select: text; }
textarea.field { font: 600 12px/1.3 ui-monospace, Menlo, Consolas, monospace; text-align: left; height: 84px; resize: none; word-break: break-all; }
.note { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; line-height: 1.4; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(8, 14, 40, .5); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .22s; }
.modal.open { opacity: 1; }
.modal-card { width: min(350px, 100%); max-height: 88%; overflow-y: auto; touch-action: pan-y; background: var(--snow); border-radius: 28px; padding: 22px 20px 0; text-align: center; box-shadow: 0 20px 60px rgba(8, 14, 40, .5);
  transform: translateY(14px) scale(.96); transition: transform .28s cubic-bezier(.2, .9, .3, 1.25); }
.modal.open .modal-card { transform: none; }
.modal-card h3 { font: 600 24px/1.15 var(--display); text-wrap: balance; }
.modal-card p { margin-top: 8px; color: var(--ink-soft); font-size: 15px; text-wrap: pretty; }
.modal-card p b { color: var(--ink); font-weight: 800; }
.modal-card p.small { font-size: 13.5px; }
.modal.over { z-index: 30; }   /* the first screen comes later in the page, so a pop-up opened from it needs lifting */
.modal-card ol.steps { list-style: none; counter-reset: step; display: grid; gap: 10px; margin: 12px 0 2px; padding: 0; text-align: left; }
.modal-card ol.steps li { counter-increment: step; display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 15px; line-height: 1.35; color: var(--ink); }
.modal-card ol.steps li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--berry); color: #fff; font: 600 14px/26px var(--display); text-align: center; }
.inst-ic { width: 18px; height: 18px; vertical-align: -3px; margin: 0 2px; }
.modal-card .pup-skills { font-size: 14px; display: flex; justify-content: center; margin: 6px 0; }
.modal-card .pup-skills .radar { max-width: 100%; height: auto; }
.modal-card .art { width: 132px; height: 132px; margin: -4px auto 4px; display: block; }
.modal-card .actions { display: flex; flex-direction: column; gap: 9px; margin: 6px -20px 0; padding: 12px 20px 20px; position: sticky; bottom: 0;
  background: linear-gradient(to bottom, rgba(246, 249, 255, 0), var(--snow) 14px); }   /* when a tall card has to scroll (a short screen), the buttons stay in reach at the bottom */
@media (orientation: landscape) and (max-height: 480px) {   /* a phone on its side: a wider, taller card with the buttons side by side, so there is room left to read */
  .modal { padding: 10px 16px; }
  .modal-card:not(.game-result) { width: min(500px, 100%); max-height: 96%; padding-top: 14px; }
  .modal-card:not(.game-result) .actions { flex-direction: row; padding-bottom: 14px; }
  .modal-card:not(.game-result) .actions .btn { flex: 1; min-width: 0; }
}
.modal-card .away { text-align: left; margin-top: 12px; display: grid; gap: 7px; }
.away div { display: flex; gap: 9px; align-items: flex-start; font-size: 14.5px; line-height: 1.3; }
.away .ic { width: 19px; height: 19px; margin-top: 1px; color: var(--ink-soft); }
.away .bad { color: var(--berry-deep); } .away .bad .ic { color: var(--berry); }
.away .good .ic { color: var(--good); }
.pick { display: flex; gap: 8px; margin-top: 14px; }
.pick .field { flex: 1; min-width: 0; }
.pick .round { width: 52px; height: 52px; background: var(--ice); flex: none; }
.means { min-height: 20px; font-size: 13px; color: var(--ink-soft); margin-top: 7px; }
.loot { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.loot .chip { background: #fff; border-radius: 14px; padding: 6px 11px 6px 6px; display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; box-shadow: 0 2px 8px rgba(23, 38, 77, .1); }
.loot .chip img { width: 30px; height: 30px; } .loot .chip .ic { width: 22px; height: 22px; }
.bigscore { font: 600 54px/1 var(--display); color: var(--berry); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- mini-games ---------- */
.gamehud { position: fixed; inset: 0; pointer-events: none; }
.g-top { display: flex; gap: 8px; align-items: center; padding: calc(10px + var(--st)) calc(12px + var(--sr)) 0 calc(12px + var(--sl)); }
.g-pill { height: 40px; border-radius: 20px; padding: 0 15px; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); font-weight: 800; }
.g-pill b { font: 600 20px var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.g-pill b.bump { animation: bump .28s cubic-bezier(.2, .9, .3, 1.4); display: inline-block; }
@keyframes bump { from { transform: scale(1.55); color: var(--berry); } }
.g-top .round { margin-left: auto; pointer-events: auto; }
.g-top .round.back { width: auto; padding: 0 15px 0 9px; border-radius: 19px; gap: 3px; grid-auto-flow: column; font: 800 13px var(--body, inherit); color: var(--ink-soft); }
.g-big { position: absolute; left: 0; right: 0; top: 30%; text-align: center; font: 600 76px/1 var(--display); color: #fff; text-shadow: 0 4px 0 rgba(13, 24, 60, .5), 0 0 30px rgba(13, 24, 60, .5); }
.g-big.pop { animation: pop .5s cubic-bezier(.2, .9, .3, 1.4); }
.g-big.too-slow { top: 38%; font-size: min(68px, 17vw); color: #ffd3d3; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.sg { position: absolute; right: calc(14px + var(--sr)); top: 50%; transform: translateY(-50%); height: min(62vh, 440px); display: flex; gap: 8px; }
.sg-heat { position: relative; width: 46px; border-radius: 23px; background: linear-gradient(#e2503a, #f3a13c 32%, #f4dc8a 55%, #8fc7f2 80%, #4f8fe0); box-shadow: inset 0 0 0 4px #fff, 0 6px 18px rgba(20, 10, 0, .4); overflow: hidden; }
.sg-heat i { position: absolute; left: 4px; right: 4px; border-radius: 12px; background: rgba(62, 200, 120, .9); box-shadow: inset 0 0 0 3px #1f9a5a; }
.sg-heat i.out { background: rgba(62, 200, 120, .45); }
.sg-heat b { position: absolute; left: 0; right: 0; height: 8px; margin-top: -4px; border-radius: 4px; background: #17264d; box-shadow: 0 0 0 2px #fff; }
.sg-calm { position: relative; width: 14px; border-radius: 7px; background: rgba(255, 255, 255, .85); overflow: hidden; box-shadow: 0 6px 18px rgba(20, 10, 0, .4); }
.sg-calm i { position: absolute; left: 0; right: 0; bottom: 0; background: #2fbf71; border-radius: 7px; }
.sg-pad { position: absolute; left: calc(16px + var(--sl)); bottom: calc(112px + var(--sb)); width: 84px; height: 84px; border-radius: 50%; display: grid; place-content: center; justify-items: center; gap: 1px; background: rgba(255, 255, 255, .16); border: 3px dashed rgba(255, 255, 255, .9); color: #fff; font: 600 15px var(--display); text-shadow: 0 2px 0 rgba(13, 24, 60, .5); animation: sgpad 1.3s ease-in-out infinite; pointer-events: auto; touch-action: none; cursor: pointer; }
.sg-pad .ic { width: 30px; height: 30px; filter: drop-shadow(0 2px 0 rgba(13, 24, 60, .45)); }
.sg-pad.on { background: rgba(90, 170, 255, .8); border-style: solid; animation: none; transform: scale(1.08); }
@keyframes sgpad { 50% { transform: scale(1.1); background: rgba(255, 255, 255, .3); } }
/* the how-to card shown before Löyly */
.how { text-align: left; margin-top: 12px; display: grid; gap: 14px; }
.how p { margin: 0; font-size: 14.5px; line-height: 1.4; color: var(--ink-soft); }
.how p b, .how li b { color: var(--ink); font-weight: 800; }
.how-hold { display: flex; gap: 12px; align-items: center; }
.how-pad { flex: none; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font: 600 15px var(--display); color: #2a62b7; background: #dbe9fb; border: 3px dashed #4f8fe0; }
.how-gauge-row { display: flex; gap: 12px; align-items: center; }
.how-gauge { flex: none; width: 58px; height: auto; }
.how-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14.5px; line-height: 1.35; color: var(--ink-soft); }
.how .how-end { padding-top: 2px; }
/* Ice Piano: four lanes of dark water with ice tiles sliding down them, drawn on a canvas. */
.pt { position: absolute; left: 50%; top: 36%; bottom: 0; transform: translateX(-50%); width: min(100vw, 480px); pointer-events: auto; overflow: hidden; border-radius: 22px 22px 0 0;
  background: #173a73; box-shadow: inset 0 0 0 3px #2a579f, 0 -6px 24px rgba(8, 20, 40, .35); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
.pt canvas { display: block; width: 100%; height: 100%; touch-action: none; }
/* Puffer Sweep: floes of ice on dark water. Opening a tile leaves the water, with a number on it. */
.pf { position: absolute; left: 50%; bottom: calc(10px + var(--sb)); transform: translateX(-50%); width: max-content; pointer-events: auto; padding: 7px; border-radius: 22px;
  background: #173a73; box-shadow: inset 0 0 0 3px #2a579f, 0 10px 30px rgba(8, 20, 40, .45); --t: min((100vw - 26px) / 9, (100vh - 290px) / 9, 50px);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pf-tip { position: absolute; left: -8px; right: -8px; bottom: calc(100% + 10px); width: fit-content; margin: 0 auto; padding: 4px 12px; border-radius: 14px; background: rgba(16, 43, 82, .6); text-align: center; font: 600 16px var(--display); color: #fff; text-shadow: 0 2px 0 rgba(13, 24, 60, .55), 0 0 12px rgba(13, 24, 60, .5); pointer-events: none; text-wrap: balance; }   /* a soft dark pill, so it reads over the white ice floes behind it */
.pf-grid { display: grid; grid-template-columns: repeat(9, var(--t)); grid-auto-rows: var(--t); touch-action: none; }
.pf-c { margin: 1.5px; border-radius: calc(var(--t) * .22); display: grid; place-items: center; font: 600 calc(var(--t) * .56)/1 var(--display); color: #fff; touch-action: none;
  background: linear-gradient(#fafdff, #c3e2fa); box-shadow: inset 0 2px 0 #fff, 0 2px 0 #6f9fd6; -webkit-tap-highlight-color: transparent; }
.pf-c:not(.open):active { transform: translateY(1px); box-shadow: inset 0 2px 0 #fff, 0 1px 0 #6f9fd6; }
.pf-c svg { width: 72%; height: 72%; pointer-events: none; }
.pf-c.open { background: rgba(255, 255, 255, .045); box-shadow: none; }
.pf-c.fresh { animation: pfopen .18s ease-out; }
.pf-c.n1 { color: #8fd0ff; } .pf-c.n2 { color: #8ee6a4; } .pf-c.n3 { color: #ffa99a; } .pf-c.n4 { color: #cdb6ff; }
.pf-c.n5 { color: #ffd27a; } .pf-c.n6 { color: #7fe3df; } .pf-c.n7 { color: #fff; } .pf-c.n8 { color: #c9d8ff; }
.pf-c.puff svg { width: 86%; height: 86%; animation: pfpuff .3s cubic-bezier(.2, .9, .3, 1.5); }
.pf-c.hit { background: #e2503a; }
.pf-c.wrong { opacity: .45; }
.pf-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 3px 2px; }
.pf-prize { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 10px; border-radius: 22px; background: rgba(255, 255, 255, .1); color: #fff; font: 600 20px var(--display); font-variant-numeric: tabular-nums; }
.pf-prize .ic { width: 24px; height: 24px; }
.pf-mode { display: flex; padding: 3px; border-radius: 25px; background: rgba(255, 255, 255, .1); }
.pf-mode button { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 92px; height: 44px; padding: 0 14px; border-radius: 22px; font: 600 16px var(--display); color: #c9dcff; }
.pf-mode button svg { width: 20px; height: 20px; }
.pf-mode button.on { background: #fff; color: #17264d; box-shadow: 0 3px 0 #9fbfe8; }
.pf.flagging .pf-c:not(.open):not(.flag) { background: linear-gradient(#fff6ee, #ffd9c2); box-shadow: inset 0 2px 0 #fff, 0 2px 0 #d99a78; }

/* Wide screens: keep the square board below the HUD and put controls beside it.
   Reflowing with orientation preserves the current puzzle and timer. */
@media (orientation: landscape) and (min-width: 480px) {
  .pf {
    top: auto;   /* as tall as the board, sitting at the bottom: a roomy screen then has space above it for the seal */
    bottom: calc(10px + var(--sb));
    display: grid;
    grid-template-columns: auto 180px;
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center;
    column-gap: 14px;
    row-gap: 12px;
    --t: min((100vw - var(--sl) - var(--sr) - 238px) / 9, (100vh - var(--st) - var(--sb) - 94px) / 9, 50px);
    --t: min((100vw - var(--sl) - var(--sr) - 238px) / 9, (100dvh - var(--st) - var(--sb) - 94px) / 9, 50px);
  }
  .pf-grid { grid-column: 1; grid-row: 1 / 3; }
  .pf-tip { position: static; grid-column: 2; grid-row: 1; font-size: 15px; width: auto; margin: 0; padding: 0; background: none; }
  .pf-bar { grid-column: 2; grid-row: 2; flex-direction: column; padding: 0; gap: 12px; }
  .pf-mode { width: 100%; }
  .pf-mode button { min-width: 0; flex: 1; padding: 0 8px; }
}

@keyframes pfopen { from { transform: scale(.6); opacity: .2; } }
@keyframes pfpuff { from { transform: scale(.3); } }
/* Blackjack lives in blackjack-table.css */
.g-song { position: absolute; left: 0; right: 0; top: calc(64px + var(--st)); text-align: center; padding: 0 16px; font: 700 18px var(--display); color: #fff; text-shadow: 0 2px 0 rgba(13, 24, 60, .55), 0 0 12px rgba(13, 24, 60, .6); pointer-events: none; }
/* First-time tutorial cards. A step card stays up until the player makes the move it asks for; a tip card fades on its own. Neither takes taps: they go to the game. */
.g-tut { position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 28px)); max-height: calc(100% - 140px); overflow-y: auto; box-sizing: border-box; pointer-events: none; text-align: center; padding: 14px 18px 16px; border-radius: 24px; background: #f6f9ff; color: var(--ink); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .95), 0 8px 24px rgba(13, 24, 60, .35); animation: tutIn .28s cubic-bezier(.2, .9, .3, 1.2); }
.g-tut.at-top { top: calc(64px + var(--st)); }
.g-tut.at-bottom { bottom: calc(14px + var(--sb)); }
.g-tut p { margin: 0 0 7px; font: 600 16px/1.3 var(--display); text-wrap: balance; }
.g-tut p + p { font-size: 15px; color: var(--ink-soft); }
.g-tut p:last-child { margin-bottom: 0; }
.g-tut.ask { box-shadow: inset 0 0 0 3px rgba(216, 51, 79, .45), 0 8px 24px rgba(13, 24, 60, .35); }
.g-tut.tip { animation: tutIn .28s cubic-bezier(.2, .9, .3, 1.2), tutOut .4s ease-in forwards; animation-delay: 0s, var(--tip-out, 999s); }
@keyframes tutOut { to { opacity: 0; } }
.tut-demo.tut-spot { position: fixed; z-index: 4; margin: calc(-20px * var(--k)) 0 0 calc(-75px * var(--k)); pointer-events: none; }
.tut-glow { animation: tutGlow 1s ease-in-out infinite alternate !important; }
@keyframes tutGlow { from { box-shadow: 0 0 0 2px rgba(255, 212, 92, .9), 0 0 10px 2px rgba(255, 212, 92, .5); } to { box-shadow: 0 0 0 5px #ffd45c, 0 0 26px 8px rgba(255, 212, 92, .85); } }
@keyframes tutIn { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.96); } }
.tut-demo { --k: 1; position: relative; width: calc(150px * var(--k)); height: calc(70px * var(--k)); margin: 0 auto 8px; }
.tut-demo svg { position: absolute; left: 50%; top: calc(18px * var(--k)); width: calc(31px * var(--k)); height: calc(43px * var(--k)); margin-left: calc(-15.5px * var(--k)); overflow: visible; filter: drop-shadow(0 3px 3px rgba(13, 24, 60, .28)); }
.tut-demo .rip { position: absolute; left: 50%; top: calc(20px * var(--k)); width: calc(16px * var(--k)); height: calc(16px * var(--k)); margin: calc(-8px * var(--k)) 0 0 calc(-8px * var(--k)); box-sizing: border-box; border-radius: 50%; border: 3px solid var(--berry); background: rgba(216, 51, 79, .18); opacity: 0; }
.tut-demo .arr { position: absolute; width: calc(11px * var(--k)); height: calc(11px * var(--k)); box-sizing: border-box; border-top: 3px solid var(--berry); border-right: 3px solid var(--berry); opacity: .7; }
.tut-demo.tap svg { animation: tutPress 1.4s ease-in-out infinite; }
.tut-demo.tap .rip { animation: tutRip 1.4s ease-out infinite; }
.tut-demo.swipe svg { animation: tutSwipe 1.7s ease-in-out infinite; }
.tut-demo.swipe .arr { top: calc(36px * var(--k)); }
.tut-demo.swipe .a1 { left: calc(10px * var(--k)); transform: rotate(-135deg); }
.tut-demo.swipe .a2 { right: calc(10px * var(--k)); transform: rotate(45deg); }
.tut-demo.drag, .tut-demo.flick { width: calc(70px * var(--k)); height: calc(104px * var(--k)); }
.tut-demo.drag svg { top: calc(8px * var(--k)); animation: tutDrag 1.7s ease-in-out infinite; }
.tut-demo.drag .a1 { left: 50%; bottom: calc(2px * var(--k)); margin-left: calc(-5.5px * var(--k)); transform: rotate(135deg); }
.tut-demo.flick svg { top: calc(24px * var(--k)); animation: tutFlick 1.5s ease-in infinite; }
.tut-demo.flick .a1 { left: 50%; top: calc(2px * var(--k)); margin-left: calc(-5.5px * var(--k)); transform: rotate(-45deg); }
@keyframes tutPress { 0%, 78%, 100% { transform: translateY(calc(-10px * var(--k))); } 28%, 52% { transform: translateY(0); } }
@keyframes tutRip { 0%, 28% { opacity: 0; transform: scale(.4); } 30% { opacity: .95; transform: scale(.6); } 85%, 100% { opacity: 0; transform: scale(3.4); } }
@keyframes tutSwipe { 0%, 100% { transform: translateX(calc(-46px * var(--k))); } 50% { transform: translateX(calc(46px * var(--k))); } }
@keyframes tutDrag { 0%, 10% { transform: translateY(0); } 70%, 100% { transform: translateY(calc(26px * var(--k))); } }
@keyframes tutFlick { 0% { transform: translateY(calc(36px * var(--k))); opacity: 1; } 75% { transform: translateY(calc(-4px * var(--k))); opacity: 1; } 100% { transform: translateY(calc(-14px * var(--k))); opacity: 0; } }
/* Snowball Toss's aim line for the first three throws: drawn full screen over the game, under the wind sign. */
.tl { position: fixed; inset: 0; pointer-events: none; }
.tl svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tl .glow { stroke: rgba(255, 255, 255, .8); stroke-width: 16; stroke-linecap: round; }
.tl .dash { stroke: var(--berry); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 1 13; animation: tlMarch .9s linear infinite; }
.tl polygon { fill: var(--berry); stroke: #fff; stroke-width: 3; stroke-linejoin: round; }
.tl circle { fill: rgba(216, 51, 79, .16); stroke: var(--berry); stroke-width: 4; }
.tl .fing { filter: drop-shadow(0 3px 3px rgba(13, 24, 60, .35)); }
.tl text { font: 700 17px var(--display); fill: var(--berry); text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round; }
@keyframes tlMarch { to { stroke-dashoffset: -14; } }
@media (min-width: 700px) and (min-height: 600px) { .g-tut { width: min(520px, calc(100% - 40px)); padding: 18px 24px 20px; } .g-tut p { font-size: 19px; } .g-tut p + p { font-size: 17px; } }
@media (max-height: 520px) { .g-tut { width: min(560px, calc(100% - 28px)); padding: 9px 16px 11px; max-height: calc(100% - 96px); } .g-tut p { font-size: 14px; margin-bottom: 4px; } .g-tut p + p { font-size: 13px; } .g-tut.at-top { top: calc(56px + var(--st)); } .tut-demo { --k: .62; margin-bottom: 5px; } }
@media (max-width: 340px) { .g-tut { padding: 12px 14px 14px; } .g-tut p { font-size: 15px; } }
.g-hint.tut { pointer-events: auto; left: 14px; right: 14px; bottom: calc(14px + var(--sb)); min-height: 128px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 24px; background: rgba(246, 249, 255, .96); color: var(--ink); text-shadow: none; font: 600 16px/1.3 var(--display); text-wrap: balance; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .95), 0 8px 24px rgba(13, 24, 60, .35); }
.g-hint.tut .btn { margin-top: 2px; }
.g-hint { position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(26px + var(--sb)); text-align: center; font: 600 16px var(--display); color: #fff; text-shadow: 0 2px 0 rgba(13, 24, 60, .55), 0 0 12px rgba(13, 24, 60, .5); padding: 0 20px; }

/* ---------- first screen ---------- */
.title { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; padding: 24px;
  background: linear-gradient(180deg, rgba(10, 18, 48, .92) 0%, rgba(10, 18, 48, .62) 42%, rgba(10, 18, 48, .18) 100%); transition: opacity .7s; }
.title.gone { opacity: 0; pointer-events: none; }
.title-in { display: grid; justify-items: center; gap: 14px; margin-top: -12vh; }
.title h1 { font: 600 clamp(52px, 17vw, 84px)/.92 var(--display); letter-spacing: -.01em; text-shadow: 0 5px 0 rgba(10, 18, 48, .45), 0 0 40px rgba(90, 160, 255, .45); }
.title-sub { font-size: 16px; color: #c9d8ff; min-height: 22px; }
.title-foot { font-size: 13px; color: #a9bcec; max-width: 290px; text-wrap: balance; }
.title-lang { font: 800 14px var(--body); color: #e3ebff; padding: 9px 18px; border-radius: 999px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3); margin-top: 4px; }
.title-lang:active { transform: scale(.95); }
.title-update { margin-top: -4px; background: none; box-shadow: none; font-size: 13px; color: #b9caf5; text-decoration: underline; text-underline-offset: 3px; padding: 6px 12px; }
.title-update:disabled { opacity: .75; text-decoration: none; }
.title-install { color: #fff1c2; background: rgba(255, 212, 92, .14); box-shadow: inset 0 0 0 1.5px rgba(255, 212, 92, .55); margin-top: 0; }
.title-more { display: contents; }   /* the three small buttons stack as before; on a phone on its side they sit in one row (below), or the last one slides off the bottom */
.fade { position: fixed; inset: 0; background: #f4f8ff; opacity: 0; pointer-events: none; transition: opacity .5s; }
.fade.on { opacity: 1; }

@media (orientation: landscape) and (max-height: 480px) {
  .meters { max-width: 420px; } .dock button { height: 56px; } .sheet { max-height: 86%; } .title-in { margin-top: 0; gap: 8px; } .title h1 { font-size: 44px; }
  .title-more { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; } .title-more .title-lang { margin-top: 0; }
  .toasts { bottom: calc(80px + var(--sb)); }
}
/* Very narrow phones (320px wide): squeeze the top row so the settings button stays on screen. */
@media (max-width: 350px) {
  .top { gap: 6px; padding-left: calc(8px + var(--sl)); padding-right: calc(8px + var(--sr)); }
  .plate { min-width: 0; max-width: 40vw; padding: 6px 10px 8px; grid-template-columns: minmax(0, 1fr); }
  .plate-sub { overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
  .top-r { gap: 5px; flex: none; }
  .coins { height: 36px; padding: 0 9px 0 6px; font-size: 15px; gap: 4px; }
  .round { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .modal, .modal-card, .bar i, .plate-xp i { transition: none; }
  .meter.low, .dock button.need::after, .toast, .g-big.pop, .bj-card.deal, .bj-card.flip, .pf-c.fresh, .pf-c.puff svg { animation: none; }
  .g-tut, .tut-demo svg, .tut-demo .rip, .tl .dash, .tut-glow { animation: none !important; }
  .tut-glow { box-shadow: 0 0 0 4px #ffd45c !important; }
}

.note a { color: inherit; text-decoration: underline; }

/* shop shelves */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 2px 8px; margin: 0 -2px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: 0 0 auto; font: 600 13px var(--display); padding: 7px 12px; border-radius: 999px; background: var(--ice); color: var(--ink); white-space: nowrap; }
.chip-btn:active { transform: scale(.95); }
.shelf { display: flex; align-items: baseline; justify-content: space-between; font: 600 16.5px var(--display); margin: 14px 4px 8px; scroll-margin-top: 6px; }
.shelf span { font: 800 12.5px var(--body, inherit); color: var(--ink-soft); }
.chips + .shelf { margin-top: 4px; }

/* the toss game's throwing guide */
/* Snowball Toss: the wind, big, right above the snowball */
.tw { position: absolute; transform: translate(-50%, calc(-100% - 20px)); display: grid; justify-items: center; gap: 1px; pointer-events: none; color: var(--tw, #fff); text-shadow: 0 3px 0 rgba(13, 24, 60, .55), 0 0 18px rgba(13, 24, 60, .5); }
.tw[hidden] { display: none; }
.tw small { font: 700 10.5px var(--display); letter-spacing: .1em; text-transform: uppercase; color: #fff; opacity: .92; }
.tw b { font: 600 min(34px, 9vw)/1 var(--display); font-variant-numeric: tabular-nums; }
.tw-arrow { display: flex; align-items: center; filter: drop-shadow(0 3px 0 rgba(13, 24, 60, .5)); }
.tw-arrow i { height: 6px; border-radius: 3px; background: var(--tw); }
.tw-arrow em { width: 0; height: 0; border: 9px solid transparent; }
.tw-arrow.r em { border-left: 14px solid var(--tw); border-right: 0; margin-left: -3px; }
.tw-arrow.l { flex-direction: row-reverse; }
.tw-arrow.l em { border-right: 14px solid var(--tw); border-left: 0; margin-right: -3px; }

/* Comfortable instrument choices even on narrow phone screens. */
.music-choices { display: grid; gap: 7px; margin-top: 10px; }
.music-choice { text-align: left; padding: 10px 12px; border: 2px solid var(--ice); border-radius: 14px; background: #f5faff; color: var(--ink); min-height: 48px; }
.music-choice.on { border-color: #508db1; background: #e2f2fa; }
.music-choice:focus-visible { outline: 3px solid #508db1; outline-offset: 2px; }

/* Coffee Memory: the box for writing the customer's name on the cup. */
.cfn { position: absolute; left: 50%; top: calc(76px + var(--st, 0px)); transform: translateX(-50%); width: min(86vw, 340px); display: flex; gap: 8px; pointer-events: auto; }
.cfn .field { flex: 1; min-width: 0; box-shadow: 0 6px 18px rgba(8, 20, 40, .35); }
.cfn button { font: 600 17px var(--display); color: #3a2414; background: #ffd45c; border-radius: 16px; padding: 0 18px; box-shadow: 0 3px 0 #c79a1e; }
.cfn button:active { transform: translateY(2px); box-shadow: 0 1px 0 #c79a1e; }

/* Game results use the width of a sideways phone, with both actions in view. */
.result-estimate { font-size: 12px !important; }
@media (orientation: landscape) and (min-width: 480px) {
  .modal:has(.game-result) {
    padding: max(10px, var(--st)) max(14px, var(--sr)) max(10px, var(--sb)) max(14px, var(--sl));
  }
  .modal-card.game-result { width: min(760px, 100%); max-height: 100%; padding: 14px 18px; }
  .game-result h3 { font-size: 21px; }
  .game-result .result-body { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: center; gap: 18px; margin-top: 8px; }
  .game-result .result-summary:only-child { grid-column: 1 / -1; }
  .game-result .bigscore { font-size: 48px; line-height: 1.05; }
  .game-result p { font-size: 13px; margin-top: 5px; }
  .game-result .note { font-size: 13px; }
  .game-result .loot { margin-top: 7px; gap: 5px; }
  .game-result .result-estimate { margin-top: 8px; }
  .game-result .actions { flex-direction: row; gap: 10px; margin: 10px 0 0; padding: 0; position: static; background: none; }
  .game-result .actions .btn { flex: 1; min-width: 0; padding: 12px 10px; font-size: 14px; line-height: 1.2; }
}

/* Village cosmetic storefronts. */
.shop-fronts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:8px 0 20px}
.shop-front{font:inherit;color:var(--ink);border:2px solid #dbcdbb;border-radius:20px;background:#fff8ec;padding:0 12px 18px;overflow:hidden;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;min-width:0}
.shop-front:nth-child(3n+2){background:#eef5ff;border-color:#c6d9eb}.shop-front:nth-child(3n){background:#edf8ef;border-color:#c6ddcc}
.shop-art{display:grid;place-items:center;font-size:48px;width:calc(100% + 24px);height:108px;border-top:14px solid #dba994;border-bottom:3px solid #e1c8a4;background:repeating-linear-gradient(90deg,#ffffff70 0 22px,#ffffff00 22px 44px)}
.shop-front b{font-size:17px}.shop-front>span:last-child{font-size:12px}.shop-front.locked{opacity:.65}.shop-front:focus-visible{outline:3px solid #548bb1;outline-offset:3px}
@media(min-width:700px){.shop-fronts{grid-template-columns:repeat(3,minmax(0,1fr))}}

.sg-ladle { width: 68px; height: 46px; transition: transform .15s ease; transform-origin: 65% 60%; }
.sg-pad.on .sg-ladle { transform: rotate(-28deg); }
.sg-pad:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }

/* Family album: then and now */
.then-now { display: flex; justify-content: center; gap: 14px; margin: 2px 0 14px; }
.then-now figure { margin: 0; text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.then-now img, .then-now .ic-wrap { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 26px; background: radial-gradient(circle at 50% 40%, #fff, #e3ecf8); box-shadow: 0 3px 0 #d6e0ee; margin-bottom: 5px; }

/* Developer options search */
.dev-find { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; padding: 6px 12px 6px 6px; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 1.5px #dbe3ef; }
.dev-find input { flex: 1; min-width: 0; border: 0; background: none; font: 800 15px var(--body); -webkit-user-select: text; user-select: text; color: var(--ink); padding: 8px 0; outline: none; }
.row.dev-row[hidden] { display: none; }

.row .radar.mini { display: block; margin-top: 6px; }

/* Spend-points window: the whole card scrolls, and the choices sit in a compact two-by-two block pinned at the bottom so the text above stays readable. */
.modal-card.spend { text-align: left; }
.modal-card.spend h3, .modal-card.spend > p:first-of-type { text-align: center; }
.modal-card.spend p.small { font-size: 14px; line-height: 1.45; margin-top: 10px; }
.modal-card.spend .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px; padding-bottom: 14px; }
.modal-card.spend .actions .btn { min-height: 0; padding: 12px 8px; font-size: 16px; }
.modal-card.spend .actions .btn:last-child { grid-column: 1 / -1; }
