/* hug jar ♡ — the DOM layer. Tokens, gingham, pills, bubble, jelly letters and
   keyframes come straight from the site (public/style.css). */

:root {
  --milk: #ffe3ec;      /* strawberry milk */
  --gingham: rgba(255, 143, 177, 0.14);
  --bow: #e8384f;       /* bow red */
  --bow-deep: #b01c35;  /* small red text: 6.9:1 on white, 4.9:1 on the opt-in gingham (RVF-8) */
  --pink: #ff8fb1;      /* bubblegum */
  --nose: #ffcf3f;      /* nose yellow */
  --white: #ffffff;
  --ink: #5b2a3c;       /* berry-brown, never black */
  --ink-soft: rgba(91, 42, 60, 0.8);   /* 5:1 on the darkest gingham cell (AIA-6) */
  --gutter: clamp(16px, 3vw, 36px);
  --round: "M PLUS Rounded 1c", ui-rounded, "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  --pop: "Mochiy Pop One", var(--round);
  --heart-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M15 26 C2 17 3 7 9.5 6 C12.5 5.5 14.3 7.4 15 9 C15.7 7.4 17.5 5.5 20.5 6 C27 7 28 17 15 26Z' fill='%23e8384f' stroke='white' stroke-width='2.6' stroke-linejoin='round'/%3E%3C/svg%3E") 15 15, auto;

  /* The sprite colours, for the game's extra bits. */
  --mint: #7fdcc2;
  --lavender: #b49cff;
  --sky: #8fd3ff;
  --bow-pink: #ff5c8a;
  --ear-pink: #ffc2d4;
  --blush: #fff2f6;
  --dash: rgba(255, 143, 177, 0.55);
  --boing: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --edge: 36px;         /* desktop corner gutter */

  /* Sticker edge for text: a ring of white shadows plus the pink drop (site .name). */
  --ring:
    0.075em 0.000em 0 var(--white), 0.069em 0.029em 0 var(--white),
    0.053em 0.053em 0 var(--white), 0.029em 0.069em 0 var(--white),
    0.000em 0.075em 0 var(--white), -0.029em 0.069em 0 var(--white),
    -0.053em 0.053em 0 var(--white), -0.069em 0.029em 0 var(--white),
    -0.075em 0.000em 0 var(--white), -0.069em -0.029em 0 var(--white),
    -0.053em -0.053em 0 var(--white), -0.029em -0.069em 0 var(--white),
    -0.000em -0.075em 0 var(--white), 0.029em -0.069em 0 var(--white),
    0.053em -0.053em 0 var(--white), 0.069em -0.029em 0 var(--white),
    0 0.1em 0 var(--pink), 0 0.16em 0.22em rgba(232, 56, 79, 0.22);
  /* A lighter ring for text that changes every frame. */
  --ring-lite:
    0.07em 0 0 var(--white), -0.07em 0 0 var(--white), 0 0.07em 0 var(--white), 0 -0.07em 0 var(--white),
    0.05em 0.05em 0 var(--white), -0.05em 0.05em 0 var(--white), 0.05em -0.05em 0 var(--white),
    -0.05em -0.05em 0 var(--white), 0 0.12em 0 var(--pink);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  font-family: var(--round);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  height: 100dvh;
  background-color: var(--milk);
  /* Picnic-cloth gingham. */
  background-image:
    linear-gradient(90deg, var(--gingham) 50%, transparent 50%),
    linear-gradient(var(--gingham) 50%, transparent 50%);
  background-size: 46px 46px;
  cursor: var(--heart-cursor);
  transition: background-color 0.3s ease;
}

body.playing {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Bedtime is cancelled: the jar is in pajamas. */
body.night {
  --milk: #ece4ff;
  --gingham: rgba(180, 156, 255, 0.16);
}

body.brighten { background-color: #fff3f7; }

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

p { margin: 0; }

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 50% 48%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 120% 100% at 50% 50%, transparent 60%, rgba(255, 143, 177, 0.28) 100%);
}

#game {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  font: 800 34px/1 var(--round);
  color: var(--bow);
  pointer-events: none;
}
body:not([data-screen="boot"]) .boot { display: none; }

.wide-only { display: none !important; }
[data-layout="wide"] .wide-only { display: revert !important; }
[data-layout="wide"] .tall-only { display: none !important; }

/* ---------- Pills, buttons and chips ---------- */

/* The site's #music pill, generalised. */
.pill {
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 7px 16px 8px;
  font: 800 14px/1 var(--round);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  transition: translate 0.12s, box-shadow 0.12s, background-color 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.pill:active { translate: 0 3px; box-shadow: 0 0 0 var(--ink); }
.pill:focus-visible { outline: 3px solid var(--bow); outline-offset: 3px; }
.pill[aria-pressed="true"] { background: var(--pink); }
.pill.round { width: 44px; height: 44px; padding: 0; font-size: 18px; flex: none; }
.pill.small { padding: 6px 13px 7px; font-size: 13px; }
.pill.pill-pink { background: var(--pink); }
.pill .glyph { font-size: 17px; line-height: 1; }

@media (hover: hover) {
  .pill:hover { translate: 0 -1px; box-shadow: 0 4px 0 var(--ink); }
  .pill:active { translate: 0 3px; box-shadow: 0 0 0 var(--ink); }
  .pill:not([aria-pressed="true"]):not(.pill-pink):hover { background: #fff5f8; }
}

.pause-bars { display: flex; gap: 4px; }
.pause-bars span { width: 5px; height: 15px; border-radius: 3px; background: var(--ink); }

.gear { width: 24px; height: 24px; display: block; }
.gear-teeth { fill: none; stroke: var(--ink); stroke-width: 3.6; stroke-dasharray: 3.38 3.37; }
.gear-body { fill: var(--white); stroke: var(--ink); stroke-width: 2.4; }
.gear-hole { fill: var(--pink); stroke: var(--ink); stroke-width: 2; }

/* Candy-red primary button: the play ♡ of every screen. */
.btn-primary {
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  height: 64px;
  margin: 0;
  padding: 0 28px 3px;
  font: 400 26px/1 var(--pop);
  color: var(--white);
  white-space: nowrap;
  background: var(--bow);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--ink);
  text-shadow: 0 2px 0 rgba(91, 42, 60, 0.3);
  transition: translate 0.12s, box-shadow 0.12s, background-color 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* A little gloss so it looks like a sweet. */
.btn-primary::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 20px;
  width: 22px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.55);
  rotate: -12deg;
}

.btn-primary:active { translate: 0 5px; box-shadow: 0 0 0 var(--ink); }
.btn-primary:focus-visible { outline: 3px solid var(--bow); outline-offset: 4px; }
@media (hover: hover) {
  .btn-primary:hover { background: #ef4a60; }
}

.btn-play { animation: jelly-loop 3s ease-in-out 1.2s infinite; }
.btn-wide { min-width: 0; width: 100%; max-width: 300px; font-size: 22px; }

.chip {
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 0 16px 1px 12px;
  font: 800 14px/1 var(--round);
  color: var(--ink);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.78);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  transition: translate 0.12s, box-shadow 0.12s, background-color 0.15s;
  touch-action: manipulation;
}

.chip::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--white);
  transition: background-color 0.15s;
}

.chip[aria-checked="true"] { background: #e3f4ff; }
.chip[aria-checked="true"]::before { background: var(--bow); box-shadow: inset 0 0 0 2.5px var(--white); }
.chip:active { translate: 0 3px; box-shadow: 0 0 0 var(--ink); }
.chip:focus-visible { outline: 3px solid var(--bow); outline-offset: 3px; }

.new-dot {
  position: absolute;
  top: -8px;
  right: 8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bow);
  border: 2.5px solid var(--white);
  box-shadow: 0 0 0 2px var(--ink);
  animation: beat 1.1s ease-in-out infinite;
}

.sticker-text { color: var(--bow); text-shadow: var(--ring); }

/* ---------- Speech bubble (site .bubble) ---------- */

.bubble {
  position: relative;
  margin: 0;
  width: min(300px, 52vw);
  min-height: 4.6em;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  font: 800 clamp(13px, 1.5vw, 16px)/1.45 var(--round);
  color: var(--ink);
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 4px 0 var(--ink);
  transition: opacity 0.35s ease;
}

/* Tail pointing back at the kitty. */
.bubble::before,
.bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  border-style: solid;
}

.bubble::before {
  left: -16px;
  margin-top: -10px;
  border-width: 10px 16px 10px 0;
  border-color: transparent var(--ink) transparent transparent;
}

.bubble::after {
  left: -11px;
  margin-top: -7px;
  border-width: 7px 12px 7px 0;
  border-color: transparent var(--white) transparent transparent;
}

/* speech.js may quiet the bubble between lines. */
.bubble.quiet,
.bubble.is-hidden { opacity: 0; }

/* ---------- Jelly name (site .name) ---------- */

.name {
  margin: 0;
  font: 400 1em/1 var(--pop);    /* the size comes from .logo, so the badge can scale with it */
  letter-spacing: 0.06em;
  padding-left: 0.06em;
  color: var(--bow);
  text-shadow: var(--ring);
  filter: drop-shadow(0 0 0.5px var(--white));
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.name span {
  display: inline-block;
  pointer-events: auto;
  animation: pop 0.75s var(--boing) both;
}

.name span:nth-child(2) { animation-delay: 0.08s; }
.name span:nth-child(3) { animation-delay: 0.16s; }
.name span:nth-child(4) { animation-delay: 0.24s; }
.name span:nth-child(5) { animation-delay: 0.32s; }
.name span:nth-child(6) { animation-delay: 0.4s; }

@media (hover: hover) {
  .name span:hover { animation: jelly 0.6s ease; }
}

/* ---------- Keyframes (site) ---------- */

@keyframes pop {
  from { transform: translateY(0.4em) scale(0.2); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes jelly {
  0%, 100% { transform: none; }
  25%      { transform: scale(1.18, 0.86) rotate(-4deg); }
  50%      { transform: scale(0.9, 1.12) rotate(3deg); }
  75%      { transform: scale(1.05, 0.96); }
}

@keyframes boing {
  0%   { transform: translateY(0) scale(1, 1); }
  30%  { transform: translateY(-18px) scale(0.94, 1.08); }
  60%  { transform: translateY(0) scale(1.08, 0.92); }
  100% { transform: translateY(0) scale(1, 1); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96%           { transform: scaleY(0.1); }
}

@keyframes wiggle {
  0%, 80%, 100% { transform: rotate(0); }
  85%           { transform: rotate(-9deg); }
  90%           { transform: rotate(7deg); }
  95%           { transform: rotate(-4deg); }
}

@keyframes beat {
  0%, 60%, 100% { transform: scale(1); }
  15%           { transform: scale(1.35); }
  30%           { transform: scale(1.05); }
  45%           { transform: scale(1.25); }
}

/* ---------- Game keyframes ---------- */

@keyframes jelly-loop {
  0%, 76%, 100% { transform: none; }
  81%           { transform: scale(1.1, 0.9) rotate(-2deg); }
  87%           { transform: scale(0.94, 1.07) rotate(1.5deg); }
  93%           { transform: scale(1.03, 0.98); }
}

@keyframes badge-in {
  from { transform: scale(0.2) rotate(-30deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes card-in {
  0%   { transform: translateY(46px) scale(0.6); opacity: 0; }
  55%  { transform: translateY(-6px) scale(1.04); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

@keyframes rise-in {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes stamp {
  0%   { transform: scale(2.6); opacity: 0; }
  50%  { opacity: 1; }
  100% { transform: none; opacity: 1; }
}

@keyframes chip-in {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes slide-down {
  from { transform: translateY(calc(-100% - 48px)) rotate(-4deg); }
  to   { transform: none; }
}

@keyframes slide-up {
  from { transform: none; opacity: 1; }
  to   { transform: translateY(calc(-100% - 48px)); opacity: 0; }
}

@keyframes toast-in {
  from { transform: translateY(24px) scale(0.7); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateY(16px) scale(0.9); opacity: 0; }
}

@keyframes heart-fly {
  0%   { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot)); opacity: 0; }
}

@keyframes zfloat {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(18px, -34px) scale(1.15); opacity: 0; }
}

@keyframes glow-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.55; }
  50%      { transform: scale(1.08); opacity: 1; }
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.7) rotate(0deg); opacity: 0.5; }
  50%      { transform: scale(1.15) rotate(20deg); opacity: 1; }
}

/* ---------- Screens ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.card {
  position: relative;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 6px 0 var(--ink);
}

.card-x { position: absolute; top: 12px; right: 12px; }

.card-title {
  margin: 0;
  font: 400 26px/1.15 var(--pop);
}

/* ---------- Title ---------- */

.screen-title {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sat) + 66px) calc(var(--sar) + 16px) calc(var(--sab) + 18px) calc(var(--sal) + 16px);
}

.link-home {
  position: absolute;
  top: calc(var(--sat) + 12px);
  left: calc(var(--sal) + 14px);
}

#btn-music-title {
  position: absolute;
  top: calc(var(--sat) + 12px);
  right: calc(var(--sar) + 14px + 54px);
  width: 44px;
  padding: 0;
}

#btn-settings {
  position: absolute;
  top: calc(var(--sat) + 12px);
  right: calc(var(--sar) + 14px);
}

.title-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.7dvh, 16px);
  width: min(100%, 560px);
}

.logo {
  --word: min(clamp(64px, 19vw, 150px), 16dvh);
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: clamp(24px, calc(var(--word) * 0.3), 34px);
  font-size: var(--word);
}

/* The badge hangs under the end of the word, so every letter of "eliana" stays readable (L1). */
.badge {
  position: absolute;
  right: calc(var(--word) * -0.05);
  top: calc(100% - var(--word) * 0.1);
  rotate: -5deg;
  padding: 0.27em 0.62em 0.36em;
  font: 400 clamp(17px, calc(var(--word) * 0.22), 28px)/1 var(--pop);
  color: var(--bow);          /* the wordmark's red: pink was 2.1:1 on the white pill (CARE-6) */
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  animation: badge-in 0.6s var(--boing) 0.55s both;
}

.friend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

#title-kitty {
  width: 128px;
  height: auto;
  overflow: visible;
  flex: none;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 6px 0 rgba(255, 143, 177, 0.55));
  transform-origin: 50% 100%;
  animation: sway 5s ease-in-out infinite;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#title-kitty.boing { animation: boing 0.6s var(--boing); }

.kitty-svg .blink {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4.8s infinite;
}

.kitty-svg .bow {
  transform-box: fill-box;
  transform-origin: 50% 60%;
  animation: wiggle 2.6s ease-in-out infinite;
}

/* Title bubble: under the kitty with the tail up (site phone style). */
.friend .bubble {
  width: min(320px, calc(100vw - 32px));
  min-height: 3.6em;
  justify-content: center;
  text-align: center;
  font-size: 14px;
}

.friend .bubble::before {
  left: 50%;
  top: -16px;
  margin: 0 0 0 -10px;
  border-width: 0 10px 16px 10px;
  border-color: transparent transparent var(--ink) transparent;
}

.friend .bubble::after {
  left: 50%;
  top: -11px;
  margin: 0 0 0 -7px;
  border-width: 0 7px 12px 7px;
  border-color: transparent transparent var(--white) transparent;
}

.btn-play { margin-top: 4px; }

.title-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 8px;
}

.title-pills .pill { padding: 7px 13px 8px; }

.title-stats {
  font: 800 13px/1.45 var(--round);
  color: var(--ink-soft);
  text-align: center;
  text-wrap: balance;
}

.title-stats span { white-space: nowrap; }
/* The separator may wrap after its dot, so a very long line (a corrupt save's trillions) breaks
   instead of running off the screen (CODE-4). */
.title-stats span + span::before { content: "\00a0· "; white-space: normal; }
/* The next bow to earn, on a line of its own (PLAY-6). */
.title-stats .goal { display: block; }
.title-stats .goal::before { content: none; }

/* Title, desktop: the site's corners plus a centred column. */
[data-layout="wide"] .screen-title { padding: var(--edge); }

[data-layout="wide"] .corner-tl {
  position: absolute;
  top: max(var(--edge), var(--sat));
  left: max(var(--edge), var(--sal));
  font: 500 14px/1.5 var(--round);
  color: var(--ink-soft);
}

.corner-tl .strong { color: var(--ink); font-weight: 800; }

[data-layout="wide"] #btn-music-title {
  top: max(var(--edge), var(--sat));
  right: max(var(--edge), var(--sar));
  width: auto;
  padding: 7px 16px 8px;
}

[data-layout="wide"] .link-home {
  top: auto;
  left: auto;
  bottom: max(var(--edge), var(--sab));
  right: max(var(--edge), var(--sar));
}

[data-layout="wide"] #btn-settings {
  top: auto;
  bottom: calc(max(var(--edge), var(--sab)) + 56px);
  right: max(var(--edge), var(--sar));
}

[data-layout="wide"] .title-stats {
  position: absolute;
  left: max(var(--edge), var(--sal));
  bottom: max(var(--edge), var(--sab));
  font: 500 14px/1.6 var(--round);
  text-align: left;
}

[data-layout="wide"] .title-stats span { display: block; }
[data-layout="wide"] .title-stats span + span::before { content: none; }

[data-layout="wide"] .friend { flex-direction: row; gap: 22px; }
[data-layout="wide"] #title-kitty { width: 168px; }

[data-layout="wide"] .friend .bubble {
  width: 300px;
  min-height: 4.6em;
  justify-content: flex-start;
  text-align: left;
  font-size: 15px;
}

[data-layout="wide"] .friend .bubble::before {
  left: -16px;
  top: 50%;
  margin: -10px 0 0 0;
  border-width: 10px 16px 10px 0;
  border-color: transparent var(--ink) transparent transparent;
}

[data-layout="wide"] .friend .bubble::after {
  left: -11px;
  top: 50%;
  margin: -7px 0 0 0;
  border-width: 7px 12px 7px 0;
  border-color: transparent var(--white) transparent transparent;
}

[data-layout="compact"] .title-col { gap: 8px; }
[data-layout="compact"] #title-kitty { width: 108px; }
[data-layout="compact"] .friend { gap: 12px; }
[data-layout="compact"] .friend .bubble { min-height: 0; padding: 9px 14px; }

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  color: var(--ink-soft);
  transition: opacity 0.4s ease;
}

.hud-corner { position: absolute; display: flex; }

.hud-tl {
  top: calc(var(--sat) + 6px);
  left: calc(var(--sal) + 14px);
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  align-items: center;
  column-gap: 8px;
}

.hud-label { grid-column: 1 / -1; font: 800 12px/1 var(--round); }

/* Label + score + best stay inside the 56px top bar (VIS-9). */
.hud-score {
  grid-column: 1;
  font: 400 24px/1 var(--pop);
  color: var(--ink);
  text-shadow: var(--ring-lite);
  transform-origin: 0 70%;
  white-space: nowrap;
}

.hud-best {
  grid-column: 1 / -1;
  justify-self: start;
  font: 800 12px/1.15 var(--round);
  white-space: nowrap;
}

/* New best: a wiggling stamp beside the score, so the top bar stays 56px tall. */
.hud-best.is-new {
  grid-column: 2;
  grid-row: 2;
  padding: 1px 7px 2px;
  color: var(--ink);
  background: var(--nose);
  border: 2px solid var(--ink);
  border-radius: 8px;
  rotate: -4deg;
  animation: wiggle 2.6s ease-in-out infinite;
}

.hud-tr {
  top: calc(var(--sat) + 6px);
  right: calc(var(--sar) + 10px);
  gap: 8px;
}

.hud-bl {
  bottom: calc(var(--sab) + 8px);
  left: calc(var(--sal) + 14px);
  flex-direction: column;
  font: 800 13px/1.35 var(--round);
  white-space: nowrap;
}

/* A deeper bow red: --bow is only ~3:1 on the gingham at 13px (AIA-6). */
#hud-full.hot { color: var(--bow-deep); }

.hud-br {
  bottom: calc(var(--sab) + 8px);
  right: calc(var(--sar) + 2px);
  min-width: 76px;
  flex-direction: column;
  align-items: center;
}

.hud-hint { display: none; }

.hud .pill,
.hud .bighug { pointer-events: auto; }

body.over .hud { opacity: 0.45; }
body.over .hud .pill { pointer-events: none; }
body.over .hud-br { visibility: hidden; }

[data-layout="wide"] .hud-tl { top: max(var(--edge), var(--sat)); left: max(var(--edge), var(--sal)); }
[data-layout="wide"] .hud-label,
[data-layout="wide"] .hud-best { font-size: 14px; }
[data-layout="wide"] .hud-score { font-size: 32px; }
[data-layout="wide"] .hud-tr { top: max(var(--edge), var(--sat)); right: max(var(--edge), var(--sar)); }
[data-layout="wide"] .hud-bl { bottom: max(var(--edge), var(--sab)); left: max(var(--edge), var(--sal)); font-size: 14px; }
[data-layout="wide"] .hud-br { bottom: calc(max(var(--edge), var(--sab)) - 6px); }
/* Only a real keyboard-and-mouse setup gets the key hint (not a phone held sideways or an iPad). */
@media (hover: hover) and (pointer: fine) {
  /* The negative side margins keep the heart where it was; the text overhangs into the gutter. */
  [data-layout="wide"] .hud-hint {
    display: block;
    margin: 6px -44px 0;
    font: 800 12px/1.3 var(--round);
    color: var(--ink-soft);
    text-align: center;
    white-space: nowrap;
  }
  [data-layout="wide"] .hud-hint span { display: block; }
}

/* The big hug: a heart meter that fills from the bottom. */
.bighug {
  position: relative;
  isolation: isolate;
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.bighug svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bh-shadow { fill: var(--ink); translate: 0 1.7px; }
.bh-heart { transition: translate 0.12s; }
.bh-base { fill: var(--white); }
.bh-fill {
  fill: var(--pink);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleY(0);
  transition: transform 0.4s var(--boing), fill 0.2s;
}
.bh-shine { fill: none; stroke: var(--white); stroke-width: 1.7; stroke-linecap: round; opacity: 0.9; }
.bh-edge { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.bighug:active .bh-heart { translate: 0 1.6px; }
.bighug:focus-visible { outline: 3px solid var(--bow); outline-offset: 4px; border-radius: 50%; }

.bh-label {
  position: absolute;
  left: 50%;
  top: 36px;
  translate: -50% 0;
  pointer-events: none;
  padding: 2px 5px 3px;
  font: 400 10px/1 var(--pop);
  letter-spacing: -0.01em;
  color: var(--bow);
  white-space: nowrap;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  opacity: 0;
  scale: 0.5;
  transition: opacity 0.2s, scale 0.35s var(--boing);
}

.bighug.ready { animation: wiggle 3s ease-in-out infinite; }
.bighug.ready .bh-fill { fill: var(--bow); }
.bighug.ready + .bh-label { opacity: 1; scale: 1; }
/* The glow is a box-shadow so it never widens the button's box. */
.bighug.ready::before {
  content: "";
  position: absolute;
  inset: 10px 8px 6px;
  z-index: -1;
  border-radius: 50%;
  background: rgba(255, 143, 177, 0.45);
  box-shadow: 0 0 18px 12px rgba(255, 143, 177, 0.6);
  animation: glow-pulse 1.4s ease-in-out infinite;
}

[data-layout="wide"] .hud-br { min-width: 92px; right: calc(max(var(--edge), var(--sar)) - 10px); }

/* Tablet portrait: the jar is big, so the corners grow up with it instead of keeping the
   phone sizes jammed in the corners (VIS-9). Everything still fits the 56px bars. */
@media (min-width: 600px) {
  [data-layout="tall"] .hud-tl { top: calc(var(--sat) + 8px); left: calc(var(--sal) + 24px); column-gap: 10px; }
  [data-layout="tall"] .hud-label { font-size: 13px; }
  [data-layout="tall"] .hud-score { font-size: 28px; }
  [data-layout="tall"] .hud-best { font-size: 13px; }
  [data-layout="tall"] .hud-tr { right: calc(var(--sar) + 20px); }
  [data-layout="tall"] .hud-bl { left: calc(var(--sal) + 24px); bottom: calc(var(--sab) + 10px); font-size: 14px; }
  [data-layout="tall"] .hud-br { right: calc(var(--sar) + 14px); }
}
[data-layout="wide"] .bighug { width: 72px; height: 72px; }
[data-layout="wide"] .bh-label { top: 50px; padding: 2px 6px 3px; font-size: 12px; }

/* ---------- Play-scene overlays ---------- */

.playfield {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.playfield .bubble {
  position: absolute;
  min-height: 0;
  padding: 8px 14px 9px;
  justify-content: center;
  text-align: center;
  font: 800 14px/1.38 var(--round);
  border-radius: 20px;
  pointer-events: none;
}

/* Row (phones): tail points down at the kitty, wherever she is. */
.playfield .bubble[data-mode="row"]::before {
  left: var(--tail-x, 50%);
  top: auto;
  bottom: -14px;
  margin: 0 0 0 -9px;
  border-width: 14px 9px 0 9px;
  border-color: var(--ink) transparent transparent transparent;
}

.playfield .bubble[data-mode="row"]::after {
  left: var(--tail-x, 50%);
  top: auto;
  bottom: -9px;
  margin: 0 0 0 -6px;
  border-width: 10px 6px 0 6px;
  border-color: var(--white) transparent transparent transparent;
}

/* Side (desktop) and overlay with the kitty to the right: tail points right. */
.playfield .bubble[data-mode="side"] { translate: 0 -50%; text-align: left; justify-content: flex-start; padding: 12px 16px; font-size: 15px; }

.playfield .bubble[data-tail="right"]::before,
.playfield .bubble[data-tail="right"]::after { top: var(--tail-y, 50%); }

.playfield .bubble[data-tail="right"]::before {
  left: auto;
  right: -16px;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent var(--ink);
}

.playfield .bubble[data-tail="right"]::after {
  left: auto;
  right: -11px;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent var(--white);
}

.playfield .bubble[data-mode="overlay"] { font-size: 13px; padding: 7px 12px 8px; }

/* Phones: the pause line hangs over the veil, its tail on the sleeping kitty. On desktop the
   bubble would point at the hidden canvas kitty, so it naps under the veil (VISUAL-3). */
body[data-screen="pause"][data-layout="tall"] .playfield { z-index: 11; }
body[data-layout="wide"][data-screen="pause"] .playfield { visibility: hidden; }

.chain-pill {
  position: fixed;
  z-index: 7;
  translate: -50% -50%;
  padding: 7px 16px 9px;
  font: 400 18px/1 var(--pop);
  color: var(--bow);
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  pointer-events: none;
}

.chain-pill[data-level="2"] { background: var(--nose); color: var(--ink); }
.chain-pill[data-level="3"] {
  color: var(--ink);
  background: linear-gradient(90deg, #ff8fb1, #ffcf3f 30%, #7fdcc2 55%, #8fd3ff 78%, #b49cff);
}
.chain-pill.total { color: var(--ink); background: var(--white); }

.coach {
  position: fixed;
  z-index: 7;
  pointer-events: none;
  translate: -50% -50%;
}

.coach-hand {
  display: block;
  width: 34px;
  height: 34px;
}

/* ---------- Today's jar ---------- */

.screen-daily,
.screen-pause,
.screen-results {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 12px) calc(var(--sab) + 16px) calc(var(--sal) + 12px);
}

.screen-daily { background: rgba(255, 227, 236, 0.55); }

.daily-card {
  margin: auto;
  width: min(360px, 100%);
  padding: 24px 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: card-in 0.55s var(--boing) both;
}

.daily-date { font: 800 13px/1 var(--round); color: var(--ink-soft); }

.daily-icon {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin: 4px 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--white) 0 50%, var(--milk) 51%);
  border: 2.5px dashed var(--dash);
}

.daily-name { font: 400 20px/1.2 var(--pop); color: var(--ink); }
.daily-line { font: 800 14px/1.45 var(--round); color: var(--ink-soft); text-wrap: balance; }
.daily-note { font: 500 12px/1.45 var(--round); color: var(--ink-soft); max-width: 280px; text-wrap: balance; }

.mini-stats { display: flex; gap: 10px; width: 100%; }

.mini {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 18px;
  background: var(--blush);
  border: 2px solid rgba(255, 143, 177, 0.4);
}

.mini b { font: 400 20px/1 var(--pop); color: var(--ink); }
.mini small { font: 800 11px/1.2 var(--round); color: var(--ink-soft); }

/* ---------- Pause ---------- */

/* The veil is a touch thicker up top, where the dropper kitty sleeps, so only one kitty shows. */
.screen-pause {
  background:
    linear-gradient(rgba(255, 227, 236, 0.97) 0, rgba(255, 227, 236, 0.97) 34%, rgba(255, 227, 236, 0) 52%),
    rgba(255, 227, 236, 0.86);
}

body.night .screen-pause {
  background:
    linear-gradient(rgba(236, 228, 255, 0.97) 0, rgba(236, 228, 255, 0.97) 34%, rgba(236, 228, 255, 0) 52%),
    rgba(236, 228, 255, 0.88);
}

.pause-col {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: rise-in 0.35s ease-out both;
}

.sleepy { position: relative; margin-bottom: 2px; }

.kitty-sleep {
  display: block;
  width: 122px;
  overflow: visible;
  filter: drop-shadow(0 6px 0 rgba(255, 143, 177, 0.55));
  transform-origin: 50% 100%;
  animation: sway 6s ease-in-out infinite;
}

.zz { position: absolute; top: 4px; right: -14px; }

.zz span {
  position: absolute;
  font: 400 18px/1 var(--pop);
  color: #8a6fe8;
  text-shadow: var(--ring-lite);
  opacity: 0;
  animation: zfloat 2.7s ease-out infinite;
}

.zz span:nth-child(2) { animation-delay: 0.9s; font-size: 14px; }
.zz span:nth-child(3) { animation-delay: 1.8s; font-size: 22px; }

.pause-title { margin: 0; font: 400 40px/1.1 var(--pop); }

.pause-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  animation: chip-in 0.3s var(--boing) both;
}

.confirm-q { font: 800 15px/1 var(--round); color: var(--ink); }

/* ---------- Results ---------- */

.screen-results {
  background: rgba(255, 227, 236, 0.4);
  padding-top: calc(var(--sat) + 76px);
}

/* Phones: the card hugs the top so the peek kitty always covers the canvas kitty. */
.results-stack {
  position: relative;
  margin: 0 auto auto;
  width: min(360px, 92vw);
  animation: card-in 0.6s var(--boing) both;
}

/* Desktop: the real (sleeping) kitty is right above the card, so no peek kitty… */
[data-layout="wide"] .screen-results { padding-top: var(--results-top, 24px); }
[data-layout="wide"] .results-stack { width: 420px; margin: auto; }
[data-layout="wide"] .screen-results:not(.peek-on) .peek,
[data-layout="wide"] .screen-results:not(.peek-on) .paw { display: none; }
/* …unless a tall card has to cover her face: then a milky veil tucks her in, as on pause,
   and the peek kitty naps on the card instead (ui.js placeResults, VISUAL-1). */
[data-layout="wide"] .screen-results.veil-on {
  background: linear-gradient(var(--milk) 0, var(--milk) var(--veil-h, 160px), rgba(255, 227, 236, 0.4) calc(var(--veil-h, 160px) + 56px));
}

/* The gameover line is the card title, so kitty's bubble steps aside here (on desktop it
   would slide under the card, VIS-3). */
body[data-screen="results"] .playfield { visibility: hidden; }

/* A sleepy kitty hangs on to the top of the card. */
.peek {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 0;
  width: 108px;
  overflow: visible;
  translate: -50% -76%;
}

.paw {
  position: absolute;
  top: -8px;
  z-index: 2;
  width: 24px;
  height: 16px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
}

.paw-l { left: calc(50% - 36px); }
.paw-r { left: calc(50% + 12px); }

.results-card {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  text-align: center;
}

.results-card.is-locking { pointer-events: none; }

.stamp {
  position: absolute;
  z-index: 3;
  top: -25px;
  right: -12px;
  rotate: -8deg;
  padding: 7px 10px 8px;
  font: 400 15px/1 var(--pop);
  color: var(--ink);
  white-space: nowrap;
  background: var(--nose);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink);
  animation: stamp 0.5s var(--boing) 0.85s both;
}

.results-mode {
  padding: 5px 11px 6px;
  font: 800 12px/1 var(--round);
  color: var(--ink-soft);
  background: var(--blush);
  border-radius: 999px;
}

.results-title { margin: 0; font: 400 24px/1.15 var(--pop); color: var(--bow); }

.results-score {
  margin-top: 2px;
  font: 400 44px/1 var(--pop);
  color: var(--ink);
  text-shadow: 0 3px 0 var(--ear-pink);
  white-space: nowrap;
}

.results-unit { margin-top: -6px; font: 800 12px/1 var(--round); color: var(--ink-soft); }
/* What to beat next time, on every result that was not a new best (PLAY-5). Unlike the unit,
   it stays on compact cards. */
.results-best { margin-top: -6px; font: 800 12px/1 var(--round); color: var(--ink-soft); }

.results-stats {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.results-stats li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  padding: 8px 4px 9px;
  border-radius: 18px;
  background: var(--blush);
  border: 2px solid rgba(255, 143, 177, 0.4);
}

.results-stats b { font: 400 16px/1.1 var(--pop); color: var(--ink); white-space: nowrap; }
.results-stats small { font: 800 11px/1.1 var(--round); color: var(--ink-soft); white-space: nowrap; }
.rs-icon { display: grid; place-items: center; height: 40px; }

.results-near {
  width: 100%;
  text-wrap: balance;
  padding: 10px 12px;
  font: 800 14px/1.42 var(--round);
  color: var(--ink);
  background: var(--blush);
  border: 2px dashed var(--pink);
  border-radius: 16px;
}

/* Small sticker chips that pack several to a row, so a big first run doesn't push "again" away (VIS-5). */
.results-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 4px; }

.uchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px 1px 3px;
  font: 800 11px/1 var(--round);
  white-space: nowrap;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 2px 0 var(--ink);
  animation: chip-in 0.4s var(--boing) both;
}

.uchip .icon,
.uchip .bow-art { flex: none; }
.uchip .icon { width: 20px !important; height: 20px !important; }
.uchip .bow-art { width: 24px; height: 16px; margin-left: 2px; }

.bowbar { width: 100%; display: flex; flex-direction: column; gap: 6px; }

.bowbar-text {
  font: 800 12px/1.3 var(--round);
  color: var(--ink-soft);
  text-wrap: balance;
}

.bowbar-row { display: flex; align-items: center; gap: 6px; }
.bowbar-icon { display: inline-flex; flex: none; }
.bowbar-icon:empty { display: none; }
.bowbar-icon .bow-art { width: 36px; height: 24px; }

.bowbar-track {
  position: relative;
  flex: 1;
  height: 16px;
  overflow: hidden;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
}

.bowbar-fill {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg, var(--pink) 0 7px, #ffa6c2 7px 14px);
  border-right: 2.5px solid var(--ink);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 1.1s var(--boing);
}

.results-rank { font: 400 17px/1 var(--pop); color: var(--bow-deep); }
.results-rank small { font: 800 12px/1 var(--round); color: var(--ink-soft); }

.optin {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 20px;
  background: var(--milk);
  background-image:
    linear-gradient(90deg, rgba(255, 143, 177, 0.12) 50%, transparent 50%),
    linear-gradient(rgba(255, 143, 177, 0.12) 50%, transparent 50%);
  background-size: 20px 20px;
  border: 2px solid rgba(91, 42, 60, 0.18);
  animation: rise-in 0.4s ease-out 0.9s both;
}

.optin-q { font: 800 14px/1.4 var(--round); color: var(--ink); }
.optin-q { text-wrap: balance; }
.optin-q b { color: var(--bow-deep); white-space: nowrap; }
.optin-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.optin-btns .pill { padding: 6px 12px 7px; font-size: 13px; }
.optin-note { font: 800 13px/1.4 var(--round); color: var(--ink-soft); text-wrap: pretty; }
.optin-note:focus { outline: none; }
.optin-note:focus-visible { outline: 3px solid var(--bow); outline-offset: 3px; border-radius: 8px; }

.name-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.name-choices .pill { font-size: 13px; padding: 6px 12px 7px; }

/* The buttons ride along the bottom of the screen while a long card scrolls under them,
   so "again ♡" is always in reach (VIS-5, FLOW-6). Sticky insets count from inside the
   screen's padding, so -16px reaches the real bottom edge (and the home bar gets paint too). */
.results-actions {
  position: sticky;
  bottom: calc(-16px - var(--sab));
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: -6px 0 calc(-8px - var(--sab));
  padding: 16px 0 calc(10px + var(--sab));
  background: linear-gradient(rgba(255, 255, 255, 0), var(--white) 16px);
}
.btn-again { min-width: 0; width: 100%; max-width: 260px; height: 58px; font-size: 24px; }
/* The card runs on under the bar (first results with the board question, a big unlock haul):
   a little ink tab says so until the first scroll, and a tap scrolls (ui.js checkMore, PLAY-3). */
.more-hint {
  position: absolute;
  top: -10px;
  left: 50%;
  translate: -50% 0;
  z-index: 1;
  display: none;
  padding: 4px 10px 5px;
  font: 800 11px/1 var(--round);
  color: var(--white);
  white-space: nowrap;
  background: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}
.screen-results.has-more .more-hint { display: block; animation: more-bob 1.6s var(--boing) infinite; }
/* A longer fade over the card, so the tab sits on white rather than on half a chip. */
.screen-results.has-more .results-actions::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 34px;
  background: linear-gradient(rgba(255, 255, 255, 0), var(--white) 70%);
  pointer-events: none;
}
@keyframes more-bob {
  0%, 60%, 100% { transform: none; }
  30% { transform: translateY(3px); }
}
/* Anything scrolled or focused into view stops above that bar, not under it. */
.screen-results { scroll-padding-bottom: 150px; }
[data-layout="compact"] .screen-results { scroll-padding-bottom: 136px; }

[data-layout="wide"] .kitty-sleep { width: 150px; }

[data-layout="compact"] .screen-results { padding-top: calc(var(--sat) + 66px); }
[data-layout="compact"] .peek { width: 96px; }
[data-layout="compact"] .results-card { gap: 7px; padding: 18px 16px 14px; }
[data-layout="compact"] .results-title { font-size: 20px; }
[data-layout="compact"] .results-score { font-size: 36px; }
[data-layout="compact"] .results-unit { display: none; }
[data-layout="compact"] .results-stats li { padding: 5px 4px 6px; }
[data-layout="compact"] .rs-icon,
[data-layout="compact"] .results-stats li:not(:first-child) .rs-icon { height: 30px; }
[data-layout="compact"] .rs-icon .icon { width: 30px !important; height: 30px !important; }
[data-layout="compact"] .results-near { padding: 7px 10px; font-size: 13px; }
[data-layout="compact"] .optin { gap: 7px; padding: 9px 8px; }
[data-layout="compact"] .optin-q { font-size: 13px; }
[data-layout="compact"] .results-actions { gap: 8px; }
[data-layout="compact"] .btn-again { height: 52px; font-size: 22px; }

/* ---------- Sheets: book, board, settings ---------- */

.sheet {
  display: flex;
  flex-direction: column;
  background-color: var(--milk);
  background-image:
    radial-gradient(ellipse 80% 45% at 50% 20%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 70%),
    linear-gradient(90deg, var(--gingham) 50%, transparent 50%),
    linear-gradient(var(--gingham) 50%, transparent 50%);
  background-size: 100% 100%, 46px 46px, 46px 46px;
  animation: fade-in 0.2s ease-out both;
}

.sheet-head {
  flex: none;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 14px) 10px calc(var(--sal) + 14px);
}

.sheet-title {
  margin: 0;
  font: 400 clamp(20px, 6.4vw, 26px)/1.15 var(--pop);   /* fits beside "13/21 found" at 360px (VIS-6) */
  white-space: nowrap;
}

.count-chip {
  padding: 7px 12px 8px;
  font: 800 13px/1 var(--round);
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}

.sheet-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px calc(var(--sar) + 16px) calc(var(--sab) + 28px) calc(var(--sal) + 16px);
}

.sheet-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise-in 0.35s ease-out both;
}

.sheet-hint { font: 800 13px/1.4 var(--round); color: var(--ink-soft); text-align: center; text-wrap: pretty; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}

.tab {
  flex: 1;
  min-height: 44px;
  margin: 0;
  padding: 0 8px 1px;
  font: 800 14px/1 var(--round);
  color: var(--ink-soft);
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s, color 0.15s;
}

.tab[aria-selected="true"] { color: var(--ink); background: var(--pink); box-shadow: inset 0 0 0 2px var(--ink); }
.tab:focus-visible { outline: 3px solid var(--bow); outline-offset: 2px; }
.tab small { font-weight: 800; opacity: 0.7; }

/* Sticker book grid. */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 108px);
  grid-auto-rows: minmax(132px, auto);
  justify-content: center;
  gap: 14px 10px;
  padding: 4px 0 8px;
}

[data-layout="wide"] .sticker-grid { grid-template-columns: repeat(5, 108px); gap: 18px 14px; }

.sticker-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 108px;
  margin: 0;
  padding: 9px 6px 10px;
  text-align: center;
  color: var(--ink);
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--ink);
  rotate: var(--tilt, 0deg);
  cursor: pointer;
  touch-action: manipulation;
  transition: translate 0.12s, box-shadow 0.12s;
  animation: chip-in 0.4s var(--boing) both;
}

.sticker-card:nth-child(3n + 1) { --tilt: -1.6deg; }
.sticker-card:nth-child(3n + 2) { --tilt: 1.2deg; }
.sticker-card:nth-child(3n) { --tilt: -0.6deg; }
.sticker-card:active { translate: 0 3px; box-shadow: 0 1px 0 var(--ink); }
.sticker-card:focus-visible { outline: 3px solid var(--bow); outline-offset: 3px; }

.sticker-card.locked {
  --tilt: 0deg;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 2.5px dashed rgba(91, 42, 60, 0.38);
  box-shadow: none;
}

.sticker-card.wearing { background: #fff0f5; box-shadow: 0 4px 0 var(--ink), 0 0 0 4px var(--pink); }

.sc-art {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle, var(--white) 0 54%, var(--milk) 55%);
}

.locked .sc-art { background: rgba(255, 227, 236, 0.7); }
.sc-art .bow-art { width: 62px; height: 40px; }
.sc-name { font: 800 13px/1.15 var(--round); overflow-wrap: anywhere; }
.sc-name.sc-q { font: 400 16px/1 var(--pop); }

.sc-sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font: 800 11px/1.25 var(--round);
  color: var(--ink-soft);
}

.sc-bar {
  width: 78px;
  height: 8px;
  margin-top: 2px;
  overflow: hidden;
  border: 2px solid rgba(91, 42, 60, 0.45);
  border-radius: 999px;
  background: var(--white);
}

.sc-bar span { display: block; height: 100%; background: var(--pink); transform-origin: 0 50%; }

.sc-new {
  position: absolute;
  top: -9px;
  right: -8px;
  rotate: 8deg;
  padding: 3px 7px 4px;
  font: 400 11px/1 var(--pop);
  color: var(--white);
  background: var(--bow-deep);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.sc-wear {
  position: absolute;
  top: -9px;
  left: 50%;
  translate: -50% 0;
  padding: 3px 8px 4px;
  font: 800 11px/1 var(--round);
  white-space: nowrap;
  background: var(--pink);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.envelope { width: 56px; height: 44px; display: block; overflow: visible; }

.bow-art { display: block; overflow: visible; }
.locked .bow-art .bow > *,
.locked-art .bow-art .bow > * { fill: rgba(91, 42, 60, 0.32); stroke: none; }

.icon { display: block; }

/* Detail modal. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: calc(var(--sat) + 20px) 20px calc(var(--sab) + 20px);
}

.modal-back { position: absolute; inset: 0; background: rgba(255, 214, 228, 0.8); animation: fade-in 0.2s ease-out both; }

.modal-card {
  width: min(340px, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 22px 24px;
  text-align: center;
  animation: card-in 0.5s var(--boing) both;
}

.modal-x { position: absolute; top: 10px; right: 10px; }

.modal-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 184px;
  height: 184px;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--white) 0 56%, var(--milk) 57%);
  cursor: pointer;
  touch-action: manipulation;
}

.modal-art:focus-visible { outline: 3px solid var(--bow); outline-offset: 3px; }
.modal-art > * { grid-area: 1 / 1; }
.modal-art .alt { visibility: hidden; }
.modal-art.blinking .alt.sleep,
.modal-art.emote .alt.happy { visibility: visible; }
.modal-art.blinking .main,
.modal-art.emote .main,
.modal-art.emote .alt.sleep { visibility: hidden; }
.modal-art .envelope { width: 120px; height: 94px; }
.modal-art .bow-art { width: 150px; height: 96px; }

.modal-name { margin: 6px 0 0; font: 400 26px/1.15 var(--pop); color: var(--bow); }

.modal-tag {
  padding: 5px 11px 6px;
  font: 800 12px/1.2 var(--round);
  color: var(--ink-soft);
  background: var(--blush);
  border-radius: 999px;
}

.modal-bio { min-height: 4.4em; font: 800 15px/1.5 var(--round); color: var(--ink); }

/* Board. */
.name-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 4px 0 var(--ink);
}

.nc-top, .nc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nc-label { font: 800 12px/1 var(--round); color: var(--ink-soft); }
.nc-name { font: 400 20px/1.2 var(--pop); color: var(--bow); }
.nc-note { font: 800 12px/1.35 var(--round); color: var(--ink-soft); }
.name-card .name-choices { justify-content: flex-start; }

.board-status {
  font: 800 14px/1.45 var(--round);
  color: var(--ink-soft);
  text-align: center;
}

.board-status:empty { display: none; }

.board-status.nap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  border: 2.5px dashed rgba(91, 42, 60, 0.35);
  border-radius: 22px;
}

.board-status .nap-bests { font: 800 13px/1.4 var(--round); color: var(--ink-soft); }

.board-list {
  margin: 0;
  padding: 2px 0;
  list-style: none;
  overflow: hidden;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 4px 0 var(--ink);
}

.board-row {
  display: grid;
  grid-template-columns: 36px 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 14px 0 8px;
  font: 800 14px/1 var(--round);
  animation: rise-in 0.3s ease-out both;
}

.board-row + .board-row { border-top: 2px dashed var(--dash); }
.board-row.me { background: #ffe8f0; }
.board-row.gap { height: 26px; justify-content: center; grid-template-columns: 1fr; color: var(--ink-soft); }

.rank-heart { position: relative; display: grid; place-items: center; width: 36px; height: 34px; }
.rank-heart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rank-heart b { position: relative; margin-top: -3px; font: 400 13px/1 var(--pop); color: var(--ink); }
.rank-num { font: 400 14px/1 var(--pop); color: var(--ink-soft); text-align: center; }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-you { margin-left: 4px; color: var(--bow-deep); }
.board-score { font: 400 15px/1 var(--pop); color: var(--ink); }
.board-near { font: 800 14px/1.45 var(--round); color: var(--ink); text-align: center; }

/* Settings. */
.set-card {
  padding: 2px 16px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--ink);
}

.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: 66px;
  padding: 10px 0;
}

.set-row + .set-row { border-top: 2px dashed var(--dash); }

.set-label {
  display: flex;
  flex-direction: column;
  flex: 1 1 140px;
  min-width: 0;
  font: 800 15px/1.2 var(--round);
  color: var(--ink);
}

.set-label small { margin-top: 3px; font: 500 12px/1.3 var(--round); color: var(--ink-soft); }
.set-name { margin-top: 4px; font: 400 16px/1.2 var(--pop); color: var(--bow-deep); }
.set-row-name .name-choices { flex-basis: 100%; justify-content: flex-start; }

.switch {
  position: relative;
  flex: none;
  width: 72px;
  height: 44px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  touch-action: manipulation;
  transition: background-color 0.2s, translate 0.12s, box-shadow 0.12s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3.5px;
  left: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 2.5px solid var(--ink);
  transition: translate 0.3s var(--boing);
}

.switch[aria-checked="true"] { background: var(--pink); }
.switch[aria-checked="true"]::after { translate: 27px 0; }
.switch:active { translate: 0 3px; box-shadow: 0 0 0 var(--ink); }
.switch:focus-visible { outline: 3px solid var(--bow); outline-offset: 3px; }

.seg {
  display: flex;
  flex: none;
  gap: 0;
  padding: 0;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}

.seg button {
  min-width: 60px;
  min-height: 44px;
  margin: 0;
  padding: 0 10px 1px;
  font: 800 13px/1 var(--round);
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}

.seg button[aria-checked="true"] { color: var(--ink); background: var(--pink); box-shadow: inset 0 0 0 2px var(--ink); }
.seg button:focus-visible { outline: 3px solid var(--bow); outline-offset: 2px; }

.hold {
  position: relative;
  flex: none;
  overflow: hidden;
  min-height: 44px;
  margin: 0;
  padding: 0 18px 1px;
  font: 800 14px/1 var(--round);
  color: var(--bow-deep);
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hold-fill {
  position: absolute;
  inset: 0;
  background: var(--pink);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.hold.holding .hold-fill { transform: scaleX(1); transition: transform 2s linear; }
.hold-text { position: relative; }
.hold:focus-visible { outline: 3px solid var(--bow); outline-offset: 3px; }

.set-foot { font: 800 12px/1.4 var(--round); color: var(--ink-soft); text-align: center; }

/* ---------- Little overlays ---------- */

.friend-card {
  position: fixed;
  z-index: 20;
  top: calc(var(--sat) + 10px);
  left: 0;
  right: 0;
  width: min(360px, calc(100vw - 24px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 12px 16px 12px 12px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 5px 0 var(--ink);
  pointer-events: none;
}

.friend-card::before,
.friend-card::after {
  content: "✦";
  position: absolute;
  font: 800 16px/1 var(--round);
  color: var(--nose);
  text-shadow: var(--ring-lite);
  animation: twinkle 1.6s ease-in-out infinite;
}

.friend-card::before { top: -9px; left: 22px; }
.friend-card::after { bottom: -8px; right: 26px; font-size: 13px; color: var(--pink); animation-delay: 0.7s; }

.friend-card.entering { animation: slide-down 0.55s var(--boing) both; }
.friend-card.leaving { animation: slide-up 0.28s ease-in both; }

.fc-icon {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--milk);
}

.fc-kicker { font: 800 12px/1.1 var(--round); color: var(--bow-deep); }
.fc-name { font: 400 20px/1.2 var(--pop); color: var(--ink); }
.fc-bio { min-height: 2.7em; font: 800 12.5px/1.35 var(--round); color: var(--ink-soft); }

/* Phones: a slim two-line card (kicker over name), so the score, pause and kitty stay in
   view (L2). The bio is the screen reader's #friend-news line and the sticker book's job here.
   Tall phones: in kitty's speech row, nudged up by ui.js until it clears her thought bubble.
   Compact phones have no speech row (the world starts under the top bar, kitty's head and all),
   so the card docks in the 48px bottom bar instead, where the toasts live, and the two take
   turns (RVF-1). A short desktop screen (a phone held sideways) gets the same slim card beside
   the jar (.slim, ui.js). */
body:not([data-layout="wide"]) .friend-card { top: calc(var(--sat) + 58px); }

body:not([data-layout="wide"]) .friend-card {
  height: 44px;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 1px;
  align-content: center;
  padding: 0 14px 0 4px;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
}

.friend-card.slim {
  height: 64px;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 10px;
  padding: 8px 10px 8px 8px;
  border-radius: 22px;
  box-shadow: 0 4px 0 var(--ink);
}

body:not([data-layout="wide"]) .fc-icon { grid-row: 1 / span 2; width: 34px; height: 34px; }
body:not([data-layout="wide"]) .fc-icon .icon { width: 30px !important; height: 30px !important; }
.friend-card.slim .fc-icon { grid-row: 1 / span 2; width: 44px; height: 44px; }
.friend-card.slim .fc-icon .icon { width: 40px !important; height: 40px !important; }
body:not([data-layout="wide"]) .fc-kicker { font-size: 11.5px; line-height: 1.05; }
body:not([data-layout="wide"]) .fc-name { font-size: 16px; line-height: 1.1; }
body:not([data-layout="wide"]) .fc-name,
.friend-card.slim .fc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-card.slim .fc-name { font-size: 17px; }
body:not([data-layout="wide"]) .fc-bio,
.friend-card.slim .fc-bio { display: none; }
body:not([data-layout="wide"]) .friend-card::before { left: auto; right: 34%; }
.friend-card.tight .fc-name { font-size: 14px; }

body[data-layout="compact"] .friend-card {
  top: auto;
  bottom: calc(var(--sab) + 6px);
  left: calc(var(--sal) + 8px);
  right: auto;
  width: min(300px, calc(100vw - var(--sal) - var(--sar) - 94px));
  margin: 0;
  box-shadow: 0 3px 0 var(--ink);
}

body[data-layout="compact"] .friend-card.entering { animation: toast-in 0.4s var(--boing) both; }
body[data-layout="compact"] .friend-card.leaving { animation: toast-out 0.25s ease-in both; }

/* The tall card sits where kitty's speech row is, so kitty politely waits under it. */
body[data-layout="tall"]:has(> .friend-card:not([hidden])) .playfield .bubble { opacity: 0; }

.toast {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: calc(var(--sab) + 24px);
  width: max-content;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 6px 16px 7px 8px;
  font: 800 14px/1.25 var(--round);
  color: var(--ink);
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  pointer-events: none;
}

.toast .bow-art { width: 34px; height: 22px; margin-left: 4px; }
.toast.entering { animation: toast-in 0.4s var(--boing) both; }
.toast.leaving { animation: toast-out 0.25s ease-in both; }
.toast-text { text-wrap: pretty; }
/* In play the toast borrows the bottom-left HUD corner for 2 s, so the jar stays clear.
   Phones: up to two short lines inside the 48px bottom bar, left of the big hug heart (L3),
   so a secret's name (the news) is never the part that gets cut (RVF-9). The whole line
   still reaches screen readers through role=status. */
body[data-screen="play"]:not([data-layout="wide"]) .toast {
  left: calc(var(--sal) + 8px);
  right: auto;
  bottom: calc(var(--sab) + 5px);
  height: 40px;
  max-width: calc(100vw - var(--sal) - var(--sar) - 94px);
  margin: 0;
  gap: 6px;
  padding: 0 14px 1px 6px;
  font-size: 13px;
  line-height: 1.1;
  box-shadow: 0 3px 0 var(--ink);
}

body[data-screen="play"]:not([data-layout="wide"]) .toast-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
body[data-screen="play"]:not([data-layout="wide"]) .toast .icon { flex: none; width: 28px !important; height: 28px !important; }
body[data-screen="play"]:not([data-layout="wide"]) .toast .bow-art { flex: none; width: 30px; height: 20px; margin-left: 2px; }

/* Desktop: above the bottom-left corner, never wider than the gap beside the jar. */
body[data-layout="wide"][data-screen="play"] .toast {
  left: max(var(--edge), var(--sal));
  right: auto;
  bottom: calc(max(var(--edge), var(--sab)) + 56px);
  max-width: max(160px, calc(var(--jar-l, 50vw) - max(var(--edge), var(--sal)) - 24px));
  margin: 0;
}

/* Screen-reader-only text (the CSP blocks inline styles, so this has to live here). */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.fx-layer { position: fixed; inset: 0; z-index: 25; overflow: hidden; pointer-events: none; }

.heart-pop {
  position: absolute;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  animation: heart-fly 0.95s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.noscript {
  position: fixed;
  inset: auto 0 18% 0;
  z-index: 40;
  text-align: center;
  font: 800 18px var(--round);
}

/* ---------- Short landscape (a phone held sideways) ---------- */

/* The desktop layout on a short screen: tighter corners and smaller stickers, so the title,
   pause and results all fit between the top and bottom edges (FLOW-6, VIS-4). */
@media (max-height: 520px) {
  [data-layout="wide"] { --edge: 16px; }
  [data-layout="wide"] .hud-bl { font-size: 13px; }

  /* Title: the site corner steps aside and the stats take its place up top. */
  [data-layout="wide"] .screen-title { padding: max(10px, var(--sat)) max(var(--edge), var(--sar)) max(10px, var(--sab)) max(var(--edge), var(--sal)); }
  [data-layout="wide"] .corner-tl.wide-only { display: none !important; }
  [data-layout="wide"] .title-stats { top: max(var(--edge), var(--sat)); bottom: auto; font-size: 13px; line-height: 1.45; }
  [data-layout="wide"] .title-col { gap: 6px; }
  [data-layout="wide"] .logo { --word: min(84px, 15dvh); margin-bottom: 24px; }
  [data-layout="wide"] .friend { gap: 18px; }
  [data-layout="wide"] #title-kitty { width: 92px; }
  [data-layout="wide"] .friend .bubble { width: 270px; min-height: 0; padding: 9px 14px; font-size: 14px; }
  [data-layout="wide"] .btn-play { min-width: 200px; height: 52px; margin-top: 0; font-size: 23px; }
  [data-layout="wide"] .title-pills { gap: 8px; }

  /* Pause (and its "leave this jar?" question). */
  [data-layout="wide"] .screen-pause { padding-top: max(10px, var(--sat)); padding-bottom: max(10px, var(--sab)); }
  [data-layout="wide"] .pause-col { gap: 8px; }
  [data-layout="wide"] .kitty-sleep { width: 84px; }
  [data-layout="wide"] .zz { top: 14px; right: -18px; }
  [data-layout="wide"] .pause-title { font-size: 30px; }
  [data-layout="wide"] #btn-resume { min-width: 200px; height: 52px; font-size: 23px; }

  /* Results: a compact card with the buttons in one row along the bottom. The dimmed score
     corners would peek out from under it, and the card already says it all. */
  body[data-layout="wide"][data-screen="results"] .hud-tl,
  body[data-layout="wide"][data-screen="results"] .hud-bl { visibility: hidden; }
  /* Results: a compact card with the buttons in one row along the bottom. */
  [data-layout="wide"] .results-card { gap: 7px; padding: 16px 16px 10px; }
  [data-layout="wide"] .results-title { font-size: 20px; }
  [data-layout="wide"] .results-score { font-size: 34px; }
  [data-layout="wide"] .results-unit { display: none; }
  [data-layout="wide"] .results-stats li { padding: 4px 4px 5px; }
  [data-layout="wide"] .rs-icon,
  [data-layout="wide"] .results-stats li:not(:first-child) .rs-icon { height: 28px; }
  [data-layout="wide"] .rs-icon .icon { width: 28px !important; height: 28px !important; }
  [data-layout="wide"] .results-near { padding: 6px 10px; font-size: 13px; }
  [data-layout="wide"] .optin { gap: 7px; padding: 8px; }
  [data-layout="wide"] .optin-q { font-size: 13px; }
  [data-layout="wide"] .results-actions { flex-direction: row; justify-content: center; gap: 8px; padding-top: 14px; }
  [data-layout="wide"] .screen-results { scroll-padding-bottom: 84px; }
  [data-layout="wide"] .results-actions .pause-row { flex-wrap: nowrap; gap: 8px; }
  [data-layout="wide"] .btn-again { width: auto; min-width: 160px; height: 50px; padding: 0 22px 3px; font-size: 21px; }
  [data-layout="wide"] .btn-again::before { top: 7px; left: 14px; width: 16px; height: 6px; }

  /* Today's jar: two columns (the forecast on the left, the stats and the button on the
     right), so "play today's jar" starts on screen (RVF-4). */
  [data-layout="wide"] .screen-daily { padding-top: max(10px, var(--sat)); padding-bottom: max(10px, var(--sab)); }
  [data-layout="wide"] .daily-card {
    width: min(560px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "title title"
      "date  date"
      "icon  stats"
      "name  play"
      "line  play";
    justify-items: center;
    align-items: center;
    gap: 6px 22px;
    padding: 14px 20px 16px;
  }
  [data-layout="wide"] .daily-card .card-title { grid-area: title; font-size: 23px; }
  [data-layout="wide"] .daily-date { grid-area: date; }
  [data-layout="wide"] .daily-icon { grid-area: icon; width: 72px; height: 72px; margin: 0; }
  [data-layout="wide"] .daily-icon .icon { width: 58px !important; height: 58px !important; }
  [data-layout="wide"] .daily-name { grid-area: name; font-size: 18px; }
  [data-layout="wide"] .daily-line { grid-area: line; align-self: start; font-size: 13px; }
  [data-layout="wide"] .daily-card .mini-stats { grid-area: stats; }
  [data-layout="wide"] .daily-card .mini { padding: 8px 6px; }
  [data-layout="wide"] .daily-note { display: none; }
  [data-layout="wide"] #btn-daily-play { grid-area: play; height: 56px; font-size: 20px; }

  /* Sticker book detail. */
  [data-layout="wide"] .modal { padding-top: max(12px, var(--sat)); padding-bottom: max(12px, var(--sab)); }
  [data-layout="wide"] .modal-card { gap: 6px; padding: 14px 20px 16px; }
  [data-layout="wide"] .modal-art { width: 124px; height: 124px; }
  [data-layout="wide"] .modal-art .icon { width: 110px !important; height: 110px !important; }
  [data-layout="wide"] .modal-art .envelope { width: 84px; height: 66px; }
  [data-layout="wide"] .modal-art .bow-art { width: 104px; height: 66px; }
  [data-layout="wide"] .modal-name { margin-top: 0; font-size: 22px; }
  [data-layout="wide"] .modal-bio { min-height: 0; font-size: 14px; }
}

/* ---------- Calm motion ---------- */

/* JS sets data-motion from settings; before that, follow the device. */
:root[data-motion="calm"] *,
:root[data-motion="calm"] *::before,
:root[data-motion="calm"] *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
}

:root[data-motion="calm"] .switch::after { transition-duration: 0.12s; }

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion]) *,
  :root:not([data-motion]) *::before,
  :root:not([data-motion]) *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }
}
