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

:root {
  --font-ui: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  --font-round: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --ink: #3a2f28;
  --ink-soft: #7a6555;
  --warm: #c2410c;
  --good: #1c9a5f;
  --bad: #d6443b;
  --gold: #e6a417;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-bottom);
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

/* Keep the home link apart from the play area and other controls. */
.home-link {
  position: absolute;
  top: calc(var(--safe-top, 0px) + 12px);
  left: calc(var(--safe-left, 0px) + 12px);
  z-index: 18;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(58, 47, 40, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: #514636;
  box-shadow: 0 3px 10px rgba(58, 47, 40, 0.12);
  text-decoration: none;
  touch-action: manipulation;
  cursor: pointer;
}

.home-link svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.home-link:hover {
  background: #fff;
}

.home-link:focus-visible {
  outline: 3px solid #4c88ce;
  outline-offset: 3px;
}

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Soft shapes behind everything, in the puzzle's colors. */
.backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, var(--blob-a) 0 70px, transparent 71px),
    radial-gradient(circle at 92% 30%, var(--blob-b) 0 54px, transparent 55px),
    radial-gradient(circle at 80% 88%, var(--blob-a) 0 90px, transparent 91px),
    radial-gradient(circle at 6% 76%, var(--blob-b) 0 40px, transparent 41px);
  pointer-events: none;
}

/* Screens: title, problem list, result, pause */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-top) + 72px) calc(var(--safe-right) + 16px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}

.title {
  font-family: var(--font-round);
  font-size: clamp(36px, 11vw, 60px);
  font-weight: 900;
  line-height: 1.15;
  color: var(--ink);
  text-shadow: 0 3px 0 #fff, 0 8px 20px rgba(58, 47, 40, 0.18);
  white-space: nowrap;
}

.title-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-shadow: none;
}

.hero {
  position: relative;
  margin-top: 16px;
}

.hero-caption {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.hero-caption strong {
  color: var(--accent-dark);
  font-size: 17px;
}

.card {
  width: min(100%, 340px);
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
  box-shadow: 0 8px 24px rgba(58, 47, 40, 0.14);
}

.card strong {
  color: var(--accent-dark);
}

.card-best {
  margin-top: 6px;
  color: var(--warm);
}

.card-best:empty {
  display: none;
}

/* Buttons */
.actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(100%, 340px);
  margin-top: auto;
  padding-top: 18px;
}

.btn {
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-round);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.3;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
}

.btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.btn-gold {
  background: #ffc93c;
  color: #5a3b00;
  box-shadow: 0 5px 0 #e0a100;
}

.btn-main {
  border: 2px solid rgba(58, 47, 40, 0.16);
  background: #fff;
  color: var(--ink);
}

.btn-sub {
  background: var(--ink);
  color: #fff;
}

.btn-note {
  display: block;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.8;
}

.btn-note:empty {
  display: none;
}

.btn:focus-visible,
.more-games:focus-visible,
.link-button:focus-visible,
.round-button:focus-visible,
.stage:focus-visible,
.board:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.links {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.more-games,
.link-button {
  align-self: center;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Round buttons in the corners: back, how to play, sound. */
.round-button {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  z-index: 15;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(58, 47, 40, 0.1);
  color: var(--ink);
  font-family: var(--font-round);
  font-size: 22px;
  font-weight: 900;
}

.back-toggle {
  left: calc(var(--safe-left) + 76px);
}

.help-toggle {
  right: calc(var(--safe-right) + 64px);
}

.sound-toggle {
  right: calc(var(--safe-right) + 12px);
}

.round-button svg {
  width: 24px;
  height: 24px;
}

.sound-toggle .icon-off,
.sound-toggle[aria-pressed="false"] .icon-on {
  display: none;
}

.sound-toggle[aria-pressed="false"] .icon-off {
  display: block;
}

/* The top middle, between the corner buttons: which problem, or the time left. */
.top-label {
  position: absolute;
  top: calc(var(--safe-top) + 18px);
  left: calc(var(--safe-left) + 128px);
  right: calc(var(--safe-right) + 116px);
  z-index: 14;
  max-width: none;
  padding: 5px 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(58, 47, 40, 0.12);
  font-family: var(--font-round);
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.top-label.is-low {
  color: var(--bad);
}

/* Problem list */
.select-screen {
  padding-top: calc(var(--safe-top) + 72px);
}

.screen-title {
  min-height: 32px;
  padding: 0 96px;
  font-family: var(--font-round);
  font-size: 20px;
  white-space: nowrap;
  font-weight: 900;
  line-height: 32px;
}

.select-total {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
}

.levels {
  display: grid;
  gap: 12px;
  width: min(100%, 440px);
  margin-top: 16px;
  text-align: left;
}

.level {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 18px rgba(58, 47, 40, 0.1);
}

.level-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-badge {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-round);
  font-size: 12px;
  font-weight: 900;
}

.level-name {
  min-width: 0;
  font-family: var(--font-round);
  font-size: 16px;
  font-weight: 900;
}

.level-count {
  flex: none;
  margin-left: auto;
  color: #b27a0c;
  font-size: 13px;
  font-weight: 900;
}

.level-note {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 56px;
  padding: 4px 0;
  border: 2px solid rgba(58, 47, 40, 0.14);
  border-radius: 14px;
  background: #fff;
}

.stage-no {
  font-family: var(--font-round);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.mini-stars {
  min-height: 15px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: -1px;
  line-height: 1.2;
}

.stage.is-cleared {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.stage.is-next {
  border-color: #e0a100;
  background: #fff6d6;
  box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.45);
}

.random-card {
  width: min(100%, 440px);
  text-align: left;
}

.random-card h3 {
  font-family: var(--font-round);
  font-size: 16px;
}

.card-note {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.random-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.random-level {
  padding: 10px 2px;
  font-size: 13px;
}

/* Play */
.play {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top) + 72px) calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 14px) calc(var(--safe-left) + 12px);
}

.hud-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 440px);
  padding: 8px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 18px rgba(58, 47, 40, 0.1);
}

.timebar {
  width: min(100%, 440px);
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(58, 47, 40, 0.12);
}

.timebar-fill {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: #36b37e;
  transform-origin: left center;
}

.timebar-fill.is-low {
  background: #e5483e;
}

.message {
  min-height: 3.2em;
  max-width: min(100%, 440px);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.6;
  text-align: center;
}

.message.is-bad {
  color: var(--bad);
}

.message.is-good {
  color: var(--good);
}

.message.is-hint {
  color: #9a6a00;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(100%, 440px);
}

.controls .btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 4px;
  font-size: 14px;
  box-shadow: 0 3px 0 rgba(58, 47, 40, 0.12);
}

.btn-hint {
  border: 2px solid #f0cf7a;
  background: #fff8df;
  color: #6b4a00;
}

/* Result: over the play screen */
.result-screen {
  justify-content: center;
  background: rgba(58, 47, 40, 0.38);
  z-index: 12;
}

.result-screen .actions {
  margin-top: 16px;
}

.result-screen .links .more-games,
.result-screen .links .link-button {
  color: #fff;
  text-shadow: 0 1px 4px rgba(40, 30, 20, 0.7);
}

.result-card {
  margin-top: 0;
  animation: pop-in 0.3s ease;
}

.result-label {
  color: var(--ink-soft);
  font-size: 14px;
}

.result-big {
  font-family: var(--font-round);
  font-size: 44px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--accent-dark);
}

.result-stars {
  color: var(--gold);
  font-size: 40px;
  letter-spacing: 4px;
  line-height: 1.2;
}

.result-stars span {
  display: inline-block;
  animation: star-pop 0.4s ease backwards;
}

.result-stars span:nth-child(2) {
  animation-delay: 0.12s;
}

.result-stars span:nth-child(3) {
  animation-delay: 0.24s;
}

.result-line {
  font-size: 15px;
}

.result-line:empty {
  display: none;
}

.result-line.is-new {
  color: var(--warm);
  font-size: 17px;
}

.result-note {
  color: var(--bad);
  font-size: 13px;
}

.result-note:empty {
  display: none;
}

.pause-screen {
  justify-content: center;
  z-index: 13;
  background: rgba(58, 47, 40, 0.3);
}

.pause-title {
  font-family: var(--font-round);
  font-size: 24px;
  font-weight: 900;
}

.cta {
  margin-top: 16px;
  padding: 12px 30px;
  border-radius: 999px;
  background: #ffc93c;
  color: #5a3b00;
  font-family: var(--font-round);
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 5px 0 #e0a100;
}

/* Banner */
.banner {
  position: absolute;
  top: calc(var(--safe-top) + 120px);
  left: 50%;
  z-index: 16;
  max-width: calc(100% - 32px);
  padding: 10px 22px;
  border-radius: 24px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-round);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  white-space: pre-line;
  box-shadow: 0 8px 22px rgba(58, 47, 40, 0.25);
  opacity: 0;
  transform: translate(-50%, -10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* How to play */
.help-sheet {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px);
  background: rgba(40, 30, 20, 0.5);
}

.help-panel {
  width: min(100%, 360px);
  max-height: 100%;
  overflow-y: auto;
  padding: 20px 18px 16px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.help-title {
  font-family: var(--font-round);
  font-size: 21px;
  font-weight: 900;
  text-align: center;
}

.help-steps {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  text-align: left;
}

.help-steps li {
  position: relative;
  margin-top: 10px;
  padding-left: 34px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
  counter-increment: step;
}

.help-steps li::before {
  content: counter(step);
  position: absolute;
  top: 1px;
  left: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-round);
  font-size: 14px;
  font-weight: 900;
  line-height: 24px;
  text-align: center;
}

.help-steps strong {
  color: var(--warm);
}

.help-close {
  display: block;
  margin: 16px auto 0;
  padding: 10px 34px;
  border: 0;
  border-radius: 999px;
  background: #ffc93c;
  color: #5a3b00;
  font-family: var(--font-round);
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 4px 0 #e0a100;
}

/* Confetti on a clear */
.confetti {
  position: absolute;
  inset: 0;
  z-index: 11;
  overflow: hidden;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall 1.6s ease-in forwards;
}

@keyframes confetti-fall {
  to {
    transform: translate(var(--dx), 110vh) rotate(var(--spin));
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes star-pop {
  from {
    opacity: 0;
    transform: scale(2.2);
  }
}

@keyframes shake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes hop {
  30% {
    transform: translateY(-14px);
  }
  60% {
    transform: translateY(0);
  }
  80% {
    transform: translateY(-6px);
  }
}

/* ---------- けいさんめいろ ---------- */
:root {
  --accent: #2f7fd6;
  --accent-dark: #1d5ea8;
  --accent-soft: #e6f1fd;
  --accent-line: #b8d4f3;
  --bg-top: #dcecfc;
  --bg-bottom: #fff6e6;
  --blob-a: rgba(47, 127, 214, 0.08);
  --blob-b: rgba(255, 201, 60, 0.2);
  --start: #1f9d61;
  --goal: #ef8420;
  --minus: #5566dd;
  --double: #c98a00;
}

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

/* The little maze on the title screen, with the mouse on its way. */
.hero-demo {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 5px;
  justify-content: center;
}

.demo {
  display: grid;
  place-items: center;
  height: 46px;
  border: 2px solid #e3d9c6;
  border-radius: 12px;
  background: #fff;
  font-family: var(--font-round);
  font-size: 20px;
  font-weight: 900;
}

.demo.is-on {
  border-color: #9cc4f0;
  background: var(--accent-soft);
}

.demo.is-start {
  border-color: var(--start);
  background: var(--start);
  color: #fff;
  font-size: 12px;
}

.demo.is-goal {
  border-color: var(--goal);
  background: #fff1dd;
}

.demo .cheese {
  width: 34px;
  height: 28px;
}

.demo-trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.demo-trail polyline {
  fill: none;
  stroke: rgba(47, 127, 214, 0.3);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 14;
}

.demo-mouse {
  position: absolute;
  left: 92px;
  top: 104px;
  width: 42px;
  height: 36px;
  animation: demo-walk 1.2s ease-in-out infinite alternate;
}

@keyframes demo-walk {
  to {
    transform: translate(6px, -3px);
  }
}

/* Goal card: the target and the running total */
.goal-text {
  font-size: 15px;
  font-weight: 800;
}

.goal-text strong {
  color: var(--goal);
  font-family: var(--font-round);
  font-size: 30px;
  line-height: 1;
  vertical-align: -2px;
}

.goal-now {
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.goal-now strong {
  color: var(--accent-dark);
  font-family: var(--font-round);
  font-size: 26px;
  line-height: 1;
  vertical-align: -2px;
}

.goal-card.is-over .goal-now {
  background: #ffe7e5;
}

.goal-card.is-over .goal-now strong {
  color: var(--bad);
}

.goal-card.is-exact .goal-now {
  background: #e3f6ea;
}

.goal-card.is-exact .goal-now strong {
  color: var(--good);
}

/* Board */
.board-area {
  display: grid;
  flex: 1;
  place-items: center;
  width: 100%;
  min-height: 0;
}

.board {
  position: relative;
  width: 300px;
  height: 400px;
  border-radius: 16px;
  touch-action: none;
}

.tiles,
.labels {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 4), minmax(0, 1fr));
}

.labels {
  pointer-events: none;
}

.tile {
  margin: 3px;
  border: 2px solid #e3d9c6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 0 #e8dfcf;
  transition: background-color 0.12s, border-color 0.12s;
}

.tile.is-minus {
  border-color: #c9cff6;
  background: #f1f3ff;
}

.tile.is-double {
  border-color: #efd27a;
  background: #fff7da;
}

.tile.is-star {
  border-color: #f0c64d;
}

.tile.is-start {
  border-color: var(--start);
  background: var(--start);
  box-shadow: 0 3px 0 #147848;
}

.tile.is-goal {
  border-color: var(--goal);
  background: #fff1dd;
  box-shadow: 0 3px 0 #e8b27a;
}

.tile.is-on:not(.is-start):not(.is-goal) {
  border-color: #8fbbec;
  background: var(--accent-soft);
}

.tile.is-head:not(.is-start):not(.is-goal) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 127, 214, 0.25);
}

.tile.is-hint {
  animation: hint-glow 0.9s ease-in-out infinite;
}

.tile.is-shake {
  animation: shake 0.3s ease;
}

.board.is-over .tile.is-on:not(.is-start):not(.is-goal) {
  border-color: #f0a8a3;
  background: #fff0ef;
}

.board.is-wrong .tile.is-goal {
  animation: shake 0.4s ease;
}

.board.is-done .tile.is-on:not(.is-start):not(.is-goal) {
  border-color: #f0c64d;
  background: #fff5cf;
}

.label {
  position: relative;
  display: grid;
  place-items: center;
  font-family: var(--font-round);
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 900;
  line-height: 1;
}

.label.is-start {
  color: #fff;
  font-size: 12px;
  letter-spacing: -0.02em;
}

.label.is-goal .cheese {
  width: 58%;
  max-width: 44px;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.board.is-done .label.is-goal .cheese {
  opacity: 0;
  transform: scale(0.2) rotate(-30deg);
}

.label.is-minus {
  color: var(--minus);
}

.label.is-double {
  color: var(--double);
}

.label-sum {
  position: absolute;
  right: 8px;
  bottom: 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.board.is-over .label-sum {
  color: var(--bad);
}

.star-badge {
  position: absolute;
  top: 5px;
  left: 8px;
  color: var(--gold);
  font-size: 15px;
}

.trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.trail-line {
  fill: none;
  stroke: rgba(47, 127, 214, 0.42);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 0.3;
}

.board.is-over .trail-line {
  stroke: rgba(214, 68, 59, 0.4);
}

.board.is-done .trail-line {
  stroke: rgba(230, 164, 23, 0.55);
}

/* The mouse walks along the route, with the running total over its head. */
.walker {
  position: absolute;
  z-index: 2;
  width: calc(var(--cell, 70px) * 0.66);
  height: calc(var(--cell, 70px) * 0.58);
  pointer-events: none;
  transform: translate(-50%, -30%);
  transition: left 0.16s ease, top 0.16s ease;
}

.walker-body {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 2px rgba(58, 47, 40, 0.25));
  transition: transform 0.12s;
}

.walker.face-left .walker-body {
  transform: scaleX(-1);
}

.walker-total {
  position: absolute;
  bottom: 84%;
  left: 50%;
  min-width: 28px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-round);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 2px 4px rgba(58, 47, 40, 0.2);
}

.board.is-over .walker-total {
  background: var(--bad);
}

.walker.is-happy {
  animation: hop 0.7s ease 2;
}

.walker.is-happy .walker-total {
  background: var(--good);
}

.walker.is-sad {
  animation: shake 0.4s ease;
}

@keyframes hint-glow {
  50% {
    border-color: var(--gold);
    background: #fff4c7;
    box-shadow: 0 0 0 5px rgba(230, 164, 23, 0.35);
  }
}

@media (max-width: 360px) {
  .stage-no {
    font-size: 16px;
  }

  .controls .btn {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile.is-hint,
  .tile.is-shake,
  .board.is-wrong .tile.is-goal,
  .result-card,
  .result-stars span,
  .walker,
  .walker.is-happy,
  .walker.is-sad,
  .demo-mouse {
    animation: none;
    transition: none;
  }

  .tile.is-hint {
    border-color: var(--gold);
    background: #fff4c7;
  }
}

.label.is-goal .label-main {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.label.is-goal .cheese {
  width: 64%;
  max-width: 52px;
  height: auto;
}

/* Shorter phones: a little tighter, so everything fits without scrolling. */
@media (max-height: 700px) {
  .screen {
    padding-top: calc(var(--safe-top) + 72px);
  }

  .title-screen .hero {
    margin-top: 6px;
    zoom: 0.85;
  }

  .card {
    margin-top: 10px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
  }

  .actions {
    gap: 8px;
    padding-top: 12px;
  }

  .btn {
    padding: 10px 18px;
  }

  .play {
    padding-top: calc(var(--safe-top) + 72px);
    gap: 6px;
  }

  .message {
    min-height: 2.6em;
    font-size: 14px;
  }
}
