:root {
  color-scheme: light;
  --paper: #fafaf7;
  --ink: #272824;
  --muted: #81847b;
  --line: #dcded6;
  --accent: #b56939;
  --soft: #eff0e9;
  font-family: "PingFang SC","Microsoft YaHei",sans-serif;
  color: var(--ink);
  background: var(--paper)
}

.jump-controls { display: none; }
.is-jump-challenge .keyboard-help,
.is-jump-challenge .touch-controls,
.is-jump-challenge .scene-caption { display: none; }
.is-jump-challenge .jump-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  font-size: 12px;
  color: #77776d;
}
.jump-controls button {
  min-width: 180px;
  min-height: 54px;
  padding: 10px 22px;
  border: 1px solid #55554d;
  border-radius: 5px 3px 6px 3px;
  background: #41413b;
  color: #fcfcfa;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.jump-controls button small { display: block; margin-top: 3px; font-size: 10px; opacity: .8; }
.jump-controls button.held { background: #77776a; transform: translateY(2px); }
.is-jump-challenge canvas { touch-action: none; }

* {
  box-sizing: border-box
}

body {
  margin: 0
}

button,a {
  -webkit-tap-highlight-color: transparent
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer
}

button:disabled {
  opacity: .35;
  cursor: default
}

button:focus-visible,a:focus-visible,canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px
}

[hidden] {
  display: none!important
}

.game-shell {
  width: min(1200px,100%);
  margin: auto;
  padding: 0 38px
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 102px;
  border-bottom: 1px solid var(--line);
  gap: 20px
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  font-size: 16px;
  letter-spacing: .09em
}

.wordmark svg {
  width: 35px;
  height: 35px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round
}

.wordmark small {
  font-size: 8px;
  letter-spacing: .25em;
  display: block;
  color: var(--muted);
  margin-top: 5px
}

.chapter-tag {
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--muted)
}

.chapter-tag span {
  font-size: 12px;
  color: var(--ink);
  margin-left: 12px;
  letter-spacing: .08em
}

.top-actions {
  display: flex;
  gap: 14px
}

.icon-button {
  border: 0;
  background: none;
  padding: 9px 0;
  font-size: 12px;
  color: #65695f
}

.icon-button span {
  margin-left: 4px;
  font-size: 10px
}

.icon-button[aria-pressed=true] {
  color: var(--accent)
}

kbd {
  font-family: inherit;
  border: 1px solid #d5d8ce;
  box-shadow: 0 2px 0 #e9ebe3;
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 5px;
  margin-right: 4px;
  color: #606558;
  background: #fff
}

.icon-button kbd {
  margin-left: 4px;
  margin-right: 0;
  font-size: 9px
}

.scene-heading {
  padding: 29px 0 23px;
  display: flex;
  justify-content: space-between;
  align-items: center
}

.small-label {
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--muted)
}

h1 {
  font-weight: 500;
  font-size: 23px;
  letter-spacing: .04em;
  margin: 7px 0 0
}

.clock {
  display: grid;
  grid-template-columns: 25px 66px;
  align-items: center;
  column-gap: 8px
}

.clock svg {
  width: 23px;
  height: 23px;
  stroke: var(--ink);
  fill: none;
  stroke-width: 1.4
}

.clock span {
  font-family: Georgia,serif;
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em
}

.clock small {
  grid-column: 2;
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: .12em
}

.clock.urgent {
  color: #a74128
}

.clock.urgent svg {
  stroke: #a74128
}

.stage {
  width: 100%;
  aspect-ratio: 1100/640;
  position: relative;
  border: 1px solid #30342c;
  border-radius: 2px;
  overflow: hidden;
  background: #fcfcfa
}

.stage::after {
  content: "";
  position: absolute;
  inset: 5px;
  pointer-events: none;
  border: 1px solid #46483e12;
  z-index: 6
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none
}

.scene-caption {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: .08em;
  pointer-events: none;
  color: #777b70;
  gap: 15px
}

.scene-caption span {
  background: #fcfcfae3;
  padding: 3px 6px
}

.toast {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #fcfcfaf5;
  color: #34372f;
  border: 1px solid #767b67;
  padding: 10px 18px;
  border-radius: 3px;
  text-align: center;
  max-width: 88%;
  width: max-content;
  font-size: 13px;
  opacity: 0;
  transition: opacity .18s,transform .18s;
  pointer-events: none;
  z-index: 4
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0)
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: #fcfcfad9;
  backdrop-filter: blur(3px);
  padding: 28px
}

.intro {
  background: linear-gradient(90deg,#fcfcfa 2%,#fcfcfaf2 46%,#fcfcfa54);
  backdrop-filter: none;
  place-items: center start;
  padding-left: 8%
}

.intro-card {
  max-width: 420px
}

.overline {
  font-size: 11px;
  letter-spacing: .19em;
  color: #7c8174;
  margin: 0 0 20px
}

h2 {
  font-family: "Songti SC","STSong",serif;
  font-size: 43px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: .045em;
  margin: 0 0 20px
}

h2 span {
  display: block
}

.intro-copy {
  font-size: 13px;
  line-height: 2;
  color: #686e60;
  max-width: 350px;
  margin: 0
}

.intro-rule {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 10px;
  color: #727867;
  margin: 25px 0
}

.intro-rule i {
  width: 3px;
  height: 3px;
  background: #929888;
  border-radius: 50%
}

.primary-button {
  background: #2d3328;
  color: #fbfcf7;
  border: 1px solid #2d3328;
  padding: 14px 21px;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 35px;
  border-radius: 2px;
  transition: background .2s
}

.primary-button:hover {
  background: #454e3d
}

.primary-button span {
  font-size: 20px;
  line-height: 1
}

.intro-hint {
  font-size: 10px;
  color: #8c9283;
  line-height: 1.8;
  margin: 18px 0 0
}

.dialog-card {
  text-align: center;
  max-width: 490px
}

.dialog-card h2 {
  font-size: 35px
}

.dialog-card>p:not(.overline) {
  font-size: 14px;
  color: #636b59;
  line-height: 1.8
}

.dialog-card .primary-button {
  margin: 22px auto 0
}

.text-button {
  border: 0;
  background: none;
  font-size: 12px;
  color: #747c69;
  margin-top: 19px;
  text-decoration: underline;
  text-underline-offset: 4px
}

.result.won {
  position: relative;
  inset: auto;
  background: #f5f0e7;
  backdrop-filter: none;
  border-top: 1px solid #ded4c5
}

/* Keep the collected photograph unobscured, with its caption below the canvas. */
.stage:has(.result.won:not([hidden])) {
  aspect-ratio: auto
}

.stage:has(.result.won:not([hidden])) canvas {
  height: auto
}

.is-memory .scene-caption,
.is-memory .toast,
.is-memory .clock,
.is-memory .task-bar,
.is-memory .controls {
  display: none
}

.result.won .dialog-card {
  width: 100%;
  max-width: none
}

.result.won .overline {
  margin-bottom: 8px
}

.result.won h2 {
  margin-bottom: 10px;
  font-size: 33px
}

.result.won .primary-button {
  margin-top: 14px
}

.result-stats {
  font-size: 11px;
  letter-spacing: .05em;
  color: #747d69;
  margin-top: 12px
}

.scene-transition {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: page-turn .9s ease both
}

.scene-transition>span {
  font: italic 40px Georgia,serif;
  color: #a1a697
}

.scene-transition strong {
  font-size: 25px;
  font-weight: 500;
  letter-spacing: .15em;
  margin-top: 15px
}

.scene-transition p {
  color: #8a9180;
  font-size: 12px;
  margin-top: 20px
}

@keyframes page-turn {
  0% {
    opacity: 0
  }
  23%,78% {
    opacity: 1
  }
  100% {
    opacity: 0
  }
}

.scene-trail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 19px 0;
  border-bottom: 1px solid var(--line);
  gap: 8px;
  color: #9a9f91
}

.trail-stop {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap
}

.trail-stop i {
  font: italic 12px Georgia,serif;
  border: 1px solid #d8ddcf;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #909880
}

.trail-stop.active {
  color: #2f3827
}

.trail-stop.active i {
  border-color: #414d37;
  color: #303c26;
  background: #f2f5eb
}

.trail-stop.done {
  color: #696f61
}

.trail-stop.done i {
  color: #677759;
  border-color: #9fab92
}

.scene-trail b {
  font-weight: 400;
  letter-spacing: 3px;
  font-size: 12px
}

.task-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 18px;
  gap: 20px
}

.task-label p {
  font-size: 15px;
  margin: 7px 0 0
}

.task-detail {
  text-align: right;
  max-width: 50%
}

.task-detail>span {
  font-size: 12px;
  color: #515b45
}

.task-detail small {
  display: block;
  font-size: 10px;
  color: #8a917e;
  margin-top: 7px;
  line-height: 1.6
}

.controls {
  padding: 14px 0 22px;
  border-bottom: 1px solid var(--line)
}

.keyboard-help {
  display: flex;
  justify-content: center;
  gap: 26px;
  font-size: 11px;
  color: #828b75
}

.touch-controls {
  display: none;
  justify-content: space-between;
  gap: 20px
}

.direction-pad,.action-pad {
  display: flex;
  gap: 8px;
  align-items: center
}

.touch-controls button {
  width: 47px;
  height: 47px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid #b8c1ab;
  border-radius: 8px;
  background: #f3f5ed;
  font-size: 22px;
  box-shadow: 0 3px 0 #e3e7da
}

.touch-controls button.held {
  background: #dce5d0;
  transform: translateY(2px);
  box-shadow: none
}

.touch-controls button small {
  display: block;
  font-size: 8px;
  line-height: 1;
  margin-top: 2px
}

.touch-controls .interact-button {
  background: #333d2b;
  color: #fff
}

.action-pad button {
  font-size: 18px
}

footer {
  font-size: 10px;
  color: #999e91;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0 24px;
  letter-spacing: .05em
}

@media(pointer:coarse) {
  .keyboard-help {
    display: none
  }
  .touch-controls {
    display: flex
  }
}

@media(max-width:700px) {
  .game-shell {
    padding: 0 16px
  }
  .masthead {
    height: 74px;
    gap: 10px
  }
  .chapter-tag {
    display: none
  }
  .wordmark {
    font-size: 14px;
    gap: 8px
  }
  .wordmark svg {
    width: 29px
  }
  .wordmark small {
    font-size: 7px
  }
  .top-actions {
    gap: 14px
  }
  .icon-button {
    font-size: 11px
  }
  .icon-button kbd {
    display: none
  }
  .scene-heading {
    padding: 23px 0 18px
  }
  h1 {
    font-size: 20px
  }
  .clock span {
    font-size: 24px
  }
  .stage {
    overflow: visible
  }
  .stage canvas {
    border-radius: 2px
  }
  .overlay,.scene-transition {
    border-radius: 2px
  }
  .stage::after {
    inset: 3px
  }
  .scene-caption {
    left: 7px;
    right: 7px;
    top: 6px;
    font-size: 8px
  }
  .scene-caption span:last-child {
    display: none
  }
  .scene-trail {
    gap: 3px;
    padding: 16px 0
  }
  .trail-stop {
    font-size: 9px;
    gap: 4px
  }
  .trail-stop i {
    font-size: 10px;
    width: 18px;
    height: 18px
  }
  .scene-trail b {
    letter-spacing: 0;
    font-size: 9px
  }
  .task-bar {
    padding: 18px 0;
    align-items: start;
    gap: 10px
  }
  .task-label p {
    font-size: 13px;
    line-height: 1.5;
    max-width: 240px
  }
  .small-label {
    font-size: 9px
  }
  .task-detail>span {
    font-size: 10px
  }
  .task-detail small {
    font-size: 9px
  }
  .task-detail {
    max-width: 42%;
    padding-top: 2px
  }
  .keyboard-help {
    display: none
  }
  .touch-controls {
    display: flex
  }
  .controls {
    padding-top: 3px
  }
  .intro {
    padding: 16px 22px;
    background: #fcfcfaed
  }
  .intro-card {
    max-width: 100%;
    width: 100%
  }
  .overline {
    font-size: 8px;
    margin-bottom: 9px
  }
  h2 {
    font-size: 23px;
    margin-bottom: 9px
  }
  h2 span {
    display: inline
  }
  .intro-copy {
    font-size: 10px;
    line-height: 1.6;
    max-width: 95%
  }
  .intro-rule {
    display: none
  }
  .primary-button {
    min-width: 150px;
    padding: 10px 14px;
    font-size: 12px;
    margin-top: 12px;
    width: fit-content
  }
  .primary-button span {
    font-size: 16px
  }
  .intro-hint {
    font-size: 8px;
    position: absolute;
    bottom: 16px;
    right: 15px;
    line-height: 1.6;
    max-width: 118px
  }
  .overlay {
    padding: 18px
  }
  .dialog-card h2 {
    font-size: 23px;
    margin-bottom: 9px
  }
  .dialog-card>p:not(.overline) {
    font-size: 11px
  }
  .dialog-card .primary-button {
    margin-top: 12px
  }
  .text-button {
    margin-top: 11px;
    font-size: 10px
  }
  .toast {
    font-size: 10px;
    padding: 7px 9px;
    bottom: 4%
  }
  .scene-transition>span {
    font-size: 27px
  }
  .scene-transition strong {
    font-size: 20px;
    margin-top: 8px
  }
  .scene-transition p {
    font-size: 9px;
    margin-top: 10px
  }
  .result.won {
    position: relative;
    inset: auto;
    background: #f5f0e7;
    border: 1px solid var(--line);
    margin-top: 0;
    z-index: 14
  }
  .stage:has(.result.won:not([hidden])) {
    margin-bottom: 0
  }
  .stage:has(.result.won:not([hidden])) canvas {
    aspect-ratio: 1;
    object-fit: cover
  }
  .result.won h2 {
    font-size: 25px
  }
  footer {
    font-size: 8px
  }
  .result-stats {
    font-size: 9px
  }
}

@media(max-width:370px) {
  .game-shell {
    padding: 0 10px
  }
  .intro {
    padding: 12px 17px
  }
  .intro-hint {
    display: none
  }
  h2 {
    font-size: 21px
  }
  .intro-copy {
    font-size: 9px
  }
  .primary-button {
    padding: 8px 12px
  }
  .scene-trail b {
    display: none
  }
  .touch-controls button {
    width: 43px
  }
  .task-detail {
    max-width: 39%
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    animation-duration: .01ms!important;
    transition: none!important
  }
}

/* Keep the entire playfield and its controls visible on ordinary laptop screens. */
@media(min-width:701px) {
  .game-shell {
    width: min(1200px,100%,max(700px,calc((100svh - 350px)*1.71875 + 76px)))
  }
  .masthead {
    height: 70px
  }
  .scene-heading {
    padding: 18px 0 17px
  }
  h1 {
    font-size: 21px;
    margin-top: 5px
  }
  .scene-trail {
    padding: 11px 0
  }
  .task-bar {
    padding: 13px 0
  }
  .controls {
    padding: 10px 0 14px
  }
  footer {
    padding: 14px 0 17px
  }
  .keyboard-help {
    gap: 18px;
    font-size: 10px
  }
}

@media(min-width:701px) and (max-height:850px) {
  .intro {
    padding-left: 7%
  }
  .intro .overline {
    margin-bottom: 12px
  }
  .intro h2 {
    font-size: 31px;
    margin-bottom: 12px
  }
  .intro-copy {
    font-size: 11px;
    line-height: 1.8;
    max-width: 320px
  }
  .intro-rule {
    margin: 14px 0
  }
  .intro-hint {
    margin-top: 10px;
    font-size: 9px
  }
  .intro .primary-button {
    padding: 11px 16px
  }
  .dialog-card h2 {
    font-size: 28px
  }
  .result.won h2 {
    font-size: 27px
  }
  .result.won .dialog-card>p:not(.overline) {
    font-size: 11px;
    margin: 6px 0
  }
  .result.won .primary-button {
    padding: 10px 16px;
    margin-top: 9px
  }
  .result-stats {
    margin-top: 7px
  }
  .chapter-tag {
    display: none
  }
  .scene-caption {
    font-size: 8px;
    left: 12px;
    right: 12px;
    top: 10px
  }
}

/* The opening is a quiet title card; start() restores the existing game layout. */
.is-title-screen .masthead,
.is-title-screen .scene-heading,
.is-title-screen .scene-caption,
.is-title-screen .scene-trail,
.is-title-screen .task-bar,
.is-title-screen .controls,
.is-title-screen .toast,
.is-title-screen footer {
  display: none;
}

.is-title-screen .game-shell {
  width: min(1100px, 100%);
  min-height: 100svh;
  padding: 20px;
  display: grid;
  align-items: center;
}

.is-title-screen .stage {
  aspect-ratio: auto;
  height: min(680px, calc(100svh - 40px));
  min-height: 320px;
  overflow: hidden;
  border-radius: 3px 5px 2px 4px;
}

/* Scene labels painted into the canvas stay out of the uncluttered opening. */
.is-title-screen canvas {
  visibility: hidden;
}

.is-title-screen .intro {
  padding: 28px 16px;
  place-items: center;
  background: #fcfcfa;
  backdrop-filter: none;
}

.is-title-screen .intro-card {
  width: 100%;
  max-width: 640px;
  text-align: center;
}

.is-title-screen .intro h2 {
  font-size: clamp(38px, 7vw, 70px);
  line-height: 1.3;
  letter-spacing: .08em;
  margin: 0;
}

.is-title-screen .title-chapter {
  margin: 18px 0 0;
  font-size: 12px;
  letter-spacing: .28em;
  color: #777a72;
}

.is-title-screen .intro .primary-button {
  width: 166px;
  min-width: 166px;
  min-height: 48px;
  justify-content: center;
  margin: 36px auto 0;
  padding: 12px 20px;
  font-size: 14px;
  letter-spacing: .12em;
  border-radius: 3px 2px 4px 2px;
}

/* The collection lives in the native top layer, independent of the game canvas. */
.chapter-button {
  display: block;
  width: min(300px, 100%);
  margin: 14px auto 0;
  padding: 12px 15px;
  border: 1px solid #c9c7be;
  border-radius: 7px;
  background: #ffffff80;
  color: #454a40;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.chapter-button span { display: block; margin-top: 4px; font-size: 11px; color: #7a7e71; }
.chapter-button:hover { background: #fff; border-color: #818875; }
.chapter-button:focus-visible { outline: 2px solid #626d54; outline-offset: 4px; }
.home-trail { display: none; }
.is-home-level .prologue-trail { display: none; }
.is-home-level .home-trail { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.home-trail .trail-stop { white-space: normal; }
.home-trail .trail-stop i { flex-shrink: 0; }
.home-trail .trail-stop small { display: block; font-size: 10px; margin-top: 4px; }
.is-title-screen .home-trail { display: none; }
.home-room-nav { display: none; }
.is-home-level:not(.is-memory):not(.is-title-screen) .home-room-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  align-items: center;
  margin: -4px 0 14px;
  color: #85877e;
  text-align: center;
}
.home-room-nav > span { padding: 7px 8px; border-bottom: 2px solid #dedfd7; }
.home-room-nav strong { font-size: 12px; font-weight: 500; }
.home-room-nav small { display: block; font-size: 10px; margin-top: 3px; }
.home-room-nav b { font-size: 13px; font-weight: 400; }
.home-room-nav .active { color: #353e2e; border-color: #5c6652; background: #eeefe9; }
.home-room-nav .done small::after { content: ' ✓'; }
.home-room-nav p { grid-column: 1 / -1; margin: 0; font-size: 10px; }
.home-kitchen-panel {
  max-width: 500px;
  margin: 10px auto;
  padding: 12px 20px;
  border: 1px solid #c8c4b8;
  border-radius: 4px;
  background: #f3f1e9;
}
.kitchen-game-heading { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kitchen-game-heading strong { font-weight: 500; }
.kitchen-game-heading span { color: #6d715e; font-size: 12px; }
.kitchen-lid-preview { display: block; width: 220px; max-width: 100%; height: 76px; margin: 0 auto; }
.kitchen-rhythm-track { position: relative; height: 28px; margin: 13px 10px 18px; background: #d4d0c5; border-radius: 4px; box-shadow: inset 0 0 0 1px #b1aa9a; }
.kitchen-target-zone {
  position: absolute; left: 34%; width: 32%; top: 0; bottom: 0;
  background: repeating-linear-gradient(120deg,#eee1ac 0 8px,#f8efcd 8px 10px);
  border-left: 3px solid #655e3e; border-right: 3px solid #655e3e;
  box-shadow: 0 0 0 2px #fff8df;
}
.kitchen-rhythm-track i {
  position: absolute; top: -5px; width: 36px; height: 38px; left: 0;
  border-radius: 50%; background: #383f30; outline: 2px solid #fcfbf5; transform: translateX(-50%);
  display: grid; place-items: center; box-shadow: 0 2px 3px #544c3933;
}
.kitchen-rhythm-track i svg { width: 28px; height: 28px; fill: #fff9e9; }
.is-tap-ready .kitchen-target-zone { background: #f9e7a0; box-shadow: 0 0 0 3px #fff5c9,0 0 12px #9a874e55; }
.is-tap-ready .kitchen-rhythm-track i { background: #637149; }
.home-kitchen-panel.is-tap-ready button { background: #647348; box-shadow: 0 0 0 3px #dce2c9; }
.is-tap-miss .kitchen-rhythm-track i { background: #986855; }
.home-kitchen-panel .kitchen-tap-cue { min-height: 16px; margin: 5px 0 0; text-align: center; font-size: 12px; line-height: 16px; color: #756a4f; }
.home-kitchen-panel p { margin: 0 0 12px; font-size: 12px; line-height: 1.7; color: #707267; }
.home-kitchen-panel button {
  display: block; margin: 0 auto; min-width: 150px; min-height: 48px;
  border: 1px solid #535c46; border-radius: 4px; background: #424b38; color: #fffdf5;
  touch-action: manipulation;
}
.home-kitchen-panel button kbd { margin-left: 8px; color: #414a37; }
.is-title-screen .home-kitchen-panel,
.is-memory .home-kitchen-panel { display: none; }
@media(max-width:600px) {
  .is-home-level .home-trail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; }
}
#nextLevelButton:not([hidden]) { margin-bottom: 12px; }
.memory-collected + .memory-collected:not([hidden]) { margin-top: 36px; }

.memory-button {
  display: block;
  min-height: 44px;
  margin: 10px auto 0;
  padding: 10px 20px;
  border: 0;
  background: transparent;
  color: #6d7066;
  font-size: 12px;
  letter-spacing: .16em;
  text-underline-offset: 5px;
}

.memory-button:hover {
  color: #30332b;
  text-decoration: underline;
}

.memory-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border: 1px solid #777365;
  border-radius: 3px 5px 2px 4px;
  background: #f8f4ea;
  color: #35342f;
  box-shadow: 0 18px 70px #24231c40;
}

.memory-dialog::backdrop {
  background: #25251f70;
  backdrop-filter: blur(3px);
}

.memory-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 26px;
  border-bottom: 1px solid #ddd5c6;
  background: #f8f4ea;
}

.memory-header h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: .1em;
}

.memory-close {
  flex: none;
  min-width: 64px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #aaa493;
  border-radius: 3px 2px 4px 2px;
  background: transparent;
  color: #55544b;
  font-size: 12px;
}

.memory-close:hover {
  background: #efeadf;
}

.memory-button:focus-visible,
.memory-close:focus-visible {
  outline: 2px solid #55554d;
  outline-offset: 3px;
}

.memory-content {
  padding: 20px 30px 28px;
}

.memory-count {
  margin: 0 0 22px;
  color: #716d61;
  font-size: 11px;
  letter-spacing: .08em;
}

.memory-empty {
  padding: 4px 0 18px;
  text-align: center;
}

.memory-empty-frame {
  display: grid;
  place-items: center;
  width: 142px;
  height: 168px;
  margin: 0 auto 24px;
  border: 1px dashed #c8c0b0;
  outline: 7px solid #fffdf6;
  background: #f1ede3;
  box-shadow: 1px 3px 10px #564c3212;
  transform: rotate(-3deg);
}

.memory-empty-frame span {
  color: #c2b9a7;
  font: italic 46px Georgia, serif;
}

.memory-empty-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.memory-empty-copy,
.memory-caption p {
  margin: 0;
  color: #746e61;
  font-size: 12px;
  line-height: 1.8;
}

.memory-collected {
  margin: 0;
}

.memory-photo-frame {
  width: min(100%, 390px);
  margin: 0 auto;
  padding: 9px 9px 13px;
  border: 1px solid #e0d7c5;
  background: #fffdf7;
  box-shadow: 2px 5px 13px #574a321a;
  transform: rotate(-1deg);
}

.memory-photo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.memory-photo-error {
  margin: 0;
  padding: 28px 14px;
  color: #756b5d;
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

.memory-caption {
  padding-top: 24px;
  text-align: center;
}

.memory-number {
  color: #7d7362;
  font-size: 10px;
  letter-spacing: .16em;
}

.memory-caption h3 {
  margin: 8px 0 10px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: .06em;
}

.memory-storage-note {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid #ddd5c6;
  color: #746a5a;
  font-size: 11px;
  line-height: 1.8;
}

@media(max-width:420px) {
  .memory-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }
  .memory-header {
    padding: 13px 18px;
  }
  .memory-header h2 {
    font-size: 25px;
  }
  .memory-content {
    padding: 18px 22px 24px;
  }
  .memory-caption h3 {
    font-size: 22px;
  }
  .memory-empty-copy,
  .memory-caption p {
    font-size: 11px;
  }
}

/* Short landscape screens keep the photograph and caption side by side. */
@media(min-width:600px) and (max-height:500px) {
  .memory-dialog {
    width: min(660px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
  }
  .memory-header {
    padding: 10px 22px;
  }
  .memory-header h2 {
    font-size: 25px;
  }
  .memory-content {
    padding: 14px 22px 20px;
  }
  .memory-count {
    margin-bottom: 14px;
  }
  .memory-collected {
    display: grid;
    grid-template-columns: minmax(0, 230px) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
  }
  .memory-photo-frame {
    width: min(100%, calc(100dvh - 155px));
  }
  .memory-caption {
    padding-top: 0;
    text-align: left;
  }
  .memory-empty {
    padding-bottom: 0;
  }
  .memory-empty-frame {
    width: 90px;
    height: 96px;
    margin-bottom: 17px;
  }
}

/* Standalone home minigames: scoped paper UI, never a replacement room layout. */
.home-mini-dialog {
  width: min(600px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #9a907e;
  border-radius: 5px 3px 6px 3px;
  background: #f8f4ea;
  color: #484238;
  box-shadow: 0 16px 60px #29251c35;
}

.home-mini-dialog::backdrop {
  background: #29271f66;
}

.home-mini-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid #ded5c5;
  background: #f8f4ea;
}

.home-mini-header h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(19px, 4vw, 25px);
  font-weight: 500;
}

.home-mini-close,
.home-mini-pause {
  flex-shrink: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #b5ab99;
  border-radius: 3px 2px 4px 2px;
  background: transparent;
  font-size: 12px;
}

.home-mini-actions {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: 6px;
}

.home-mini-instructions {
  margin: 16px 22px 0;
  color: #756b5b;
  font-size: 13px;
  line-height: 1.7;
}

.home-mini-game {
  margin: 16px 22px;
}

.home-mini-board {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid #e1d8c7;
  background: #fcfaf3;
}

.home-mini-ground,
.home-mini-faint {
  fill: none;
  stroke: #b4a995;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.home-mini-faint {
  stroke: #cec5b4;
  stroke-width: 1;
}

.home-mini-target ellipse {
  fill: #e8e0d0;
  stroke: #8b806e;
  stroke-width: 2;
}

.home-mini-target ellipse + ellipse {
  fill: #fcfaf3;
  stroke: #b2a58f;
  stroke-width: 1.3;
}

.home-mini-target text,
.home-mini-svg-label {
  fill: #766b59;
  font: 14px "PingFang SC", sans-serif;
}

.home-mini-shadow {
  fill: #6e625120;
}

.home-mini-ball,
.home-mini-cup,
.home-mini-tap,
.home-mini-drop {
  fill: #e2d9c8;
  stroke: #686052;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.home-mini-ball path,
.home-mini-cup path + ellipse + path {
  fill: none;
  stroke: #9d907a;
  stroke-width: 1.1;
}

.home-mini-drop {
  fill: #c1c0b5;
}

.home-mini-charge-track {
  position: relative;
  height: 22px;
  margin: 17px 0 14px;
  overflow: hidden;
  border: 1px solid #c8beac;
  border-radius: 3px 2px 3px 2px;
  background: #e7e0d2;
}

.home-mini-charge-track > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: #7b7566;
}

.home-mini-charge-safe {
  position: absolute;
  inset: 0 auto 0 0;
  border-right: 1px dashed #6a6150;
  border-left: 1px dashed #6a6150;
  background: repeating-linear-gradient(125deg, #faf7ebcc 0 3px, #b7aa9033 3px 7px);
}

.home-mini-launch,
.home-mini-drop-button {
  min-height: 50px;
  padding: 11px 15px;
  border: 1px solid #6e6657;
  border-radius: 4px 2px 5px 3px;
  background: #5b574b;
  color: #fcfaf1;
  font-size: 14px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.home-mini-launch {
  width: 100%;
}

.home-mini-held {
  background: #77705e;
  box-shadow: inset 0 2px 4px #302b2429;
}

.home-mini-drop-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.home-mini-pairs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-mini-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 108px;
  height: clamp(108px, 20vw, 148px);
  padding: 20px 5px 8px;
  border: 1px solid #b8ac96;
  border-radius: 4px 2px 5px 3px;
  background: repeating-linear-gradient(132deg, #e9e1d2 0 4px, #eee6d8 4px 5px);
  color: #847760;
  touch-action: manipulation;
}

.home-mini-card-number {
  position: absolute;
  top: 7px;
  left: 9px;
  font-size: 11px;
  color: #887b64;
}

.home-mini-card-icon {
  display: block;
  width: min(72px, 85%);
  line-height: 0;
}

.home-mini-card-icon svg {
  width: 100%;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-mini-card-label {
  font-size: 12px;
}

.home-mini-face-up {
  border-color: #8d806a;
  background: #fffdf6;
  color: #625846;
}

.home-mini-card:disabled {
  opacity: 0.75;
}

.home-mini-card.home-mini-matched {
  border-style: dashed;
  background: #e7e5da;
  opacity: 1;
  color: #7b806c;
}

.home-mini-card:not(:disabled):hover,
.home-mini-close:hover,
.home-mini-pause:hover {
  border-color: #726854;
  background-color: #f2eadb;
}

.home-mini-dialog button:focus-visible {
  outline: 2px solid #68614f;
  outline-offset: 3px;
}

.home-mini-feedback {
  min-height: 24px;
  margin: 14px 22px 5px;
  font-size: 13px;
  line-height: 1.65;
  color: #655d4d;
}

.home-mini-progress {
  margin: 0 22px 20px;
  color: #8d816d;
  font-size: 12px;
}

@media (max-width: 380px) {
  .home-mini-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
  }
  .home-mini-header h2 {
    flex-basis: 100%;
    font-size: 20px;
  }
  .home-mini-actions {
    margin-left: auto;
  }
  .home-mini-instructions,
  .home-mini-game {
    margin-left: 14px;
    margin-right: 14px;
  }
  .home-mini-feedback,
  .home-mini-progress {
    margin-left: 14px;
    margin-right: 14px;
  }
  .home-mini-pairs {
    gap: 8px;
  }
  .home-mini-close,
  .home-mini-pause {
    padding-right: 9px;
    padding-left: 9px;
  }
}

@media (max-height: 500px) {
  .home-mini-header {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .home-mini-instructions,
  .home-mini-game {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  .home-mini-card {
    min-height: 88px;
    height: 88px;
  }
  .home-mini-card-icon {
    width: 48px;
  }
  .home-mini-feedback {
    margin-top: 10px;
  }
}

/* Third-chapter close-ups are scoped to their own views and modal state. */
.little-world-mini {
  margin: 12px 22px;
}

.little-world-push-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  width: min(260px, 100%, max(180px, calc(100dvh - 365px)));
  margin: 0 auto;
  padding: 6px;
  border: 1px solid #b4a68e;
  border-radius: 3px 5px 3px 2px;
  background: #e6dccb;
}

.little-world-cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #e4d9c4;
  background: #f9f4e9;
}

.little-world-cell svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.little-world-wall {
  border-color: #b4a68e;
  background: repeating-linear-gradient(135deg, #cbbda6 0 5px, #d6cbb8 5px 6px);
}

.little-world-goal-icon {
  fill: none;
  stroke: #b5a17f;
  stroke-width: 1.7;
}

.little-world-box-icon {
  fill: #d9c7a8;
  stroke: #79654b;
  stroke-width: 1.9;
}

.little-world-cat-icon {
  fill: #f0e9d9;
  stroke: #575347;
  stroke-width: 2.2;
}

.little-world-box-done {
  border-color: #8d977f;
  background: #e6e8d9;
}

.little-world-push-controls,
.little-world-push-actions {
  display: grid;
  gap: 8px;
  width: min(290px, 100%);
  margin: 10px auto 0;
}

.little-world-push-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.little-world-push-actions {
  grid-template-columns: 1fr 1fr;
}

.little-world-push-controls button,
.little-world-push-actions button {
  min-height: 50px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #a4947b;
  border-radius: 4px 2px 5px 3px;
  background: #f5edde;
  color: #655743;
  font-size: 13px;
  touch-action: manipulation;
}

.little-world-push-controls button {
  background: #68614f;
  color: #fffaf0;
  font-size: 21px;
}

.little-world-pounce-holes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 0 12px;
}

.little-world-hole {
  min-width: 0;
  min-height: 130px;
  padding: 12px 5px;
  border: 1px solid #d4c8b2;
  border-radius: 6px 3px 5px 3px;
  background: #f7f0e2;
  color: #89765b;
  touch-action: manipulation;
}

.little-world-hole svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 138px;
  overflow: visible;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.little-world-hole-paper,
.little-world-hole-rim {
  fill: #e2d2b7;
  stroke: #9a8361;
}

.little-world-hole-seam {
  fill: none;
  stroke: #b29b77;
}

.little-world-hole-dark {
  fill: #9b8d78;
  stroke: #8f7d61;
}

.little-world-mouse {
  fill: #cec4b2;
  stroke: #756955;
}

.little-world-mouse-eye {
  fill: #5d5547;
}

.little-world-hole-label {
  display: block;
  margin-top: 8px;
  font-size: 13px;
}

.little-world-mouse-here {
  border-color: #a28b66;
  background: #fff9ed;
}

.little-world-hole:not(:disabled):hover {
  border-color: #857153;
}

.little-world-push-board:focus-visible,
.little-world-mini button:focus-visible {
  outline: 2px solid #756a55;
  outline-offset: 3px;
}

.is-little-world .home-trail {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 600px) {
  .is-little-world .home-trail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .little-world-mini {
    margin-right: 14px;
    margin-left: 14px;
  }
  .little-world-dialog .home-mini-header {
    flex-wrap: nowrap;
  }
  .little-world-dialog .home-mini-header h2 {
    flex-basis: auto;
  }
  .little-world-dialog .home-mini-instructions {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.55;
  }
  .little-world-dialog .home-mini-feedback {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.55;
  }
  .little-world-dialog .home-mini-progress {
    margin-bottom: 14px;
  }
  .little-world-pounce-holes {
    gap: 7px;
  }
}

/* Yarn arrows use their own paper board without changing the other minigames. */
.home-yarn-board {
  width: min(100%, 372px);
  margin: 0 auto;
  border: 0;
  background: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

.home-yarn-shadow {
  fill: #776f60;
  opacity: .07;
}

.home-yarn-paper {
  fill: #f5eddf;
  stroke: #b5a993;
  stroke-width: 1.5;
}

.home-yarn-fibres,
.home-yarn-pencil-edge {
  fill: none;
  stroke: #b3a78f;
  stroke-width: 1.1;
  opacity: .24;
  stroke-linecap: round;
}

.home-yarn-pencil-edge {
  stroke-width: .8;
  opacity: .48;
}

.home-yarn-arrow {
  color: #292929;
}

.home-yarn-arrow > * {
  pointer-events: none;
}

.home-yarn-underlay,
.home-yarn-thread,
.home-yarn-head,
.home-yarn-hit {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-yarn-underlay {
  stroke: #f7f0e4;
  stroke-width: 6;
}

.home-yarn-thread {
  stroke: currentColor;
  stroke-width: var(--yarn-width, 3.25);
}

.home-yarn-head {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.1;
}

.home-yarn-arrow .home-yarn-hit {
  pointer-events: stroke;
  stroke: transparent;
  stroke-width: 22;
  cursor: pointer;
}

.home-yarn-inactive .home-yarn-hit {
  pointer-events: none;
  cursor: default;
}

.home-yarn-arrow:focus { outline: none; }
.home-yarn-arrow:focus-visible .home-yarn-underlay {
  stroke: #b9b9b9;
  stroke-width: 9;
}
.home-yarn-arrow:not(.home-yarn-inactive):hover .home-yarn-thread {
  stroke-width: 4.5;
}

.home-yarn-blocked {
  color: #111;
}
.home-yarn-blocked .home-yarn-thread {
  stroke-dasharray: 3 2;
}

.home-yarn-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.home-yarn-actions button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #b5a68e;
  border-radius: 8px;
  background: #f6eedf;
  color: #625746;
  font-size: 13px;
  touch-action: manipulation;
}

.home-yarn-actions button:focus-visible {
  outline: 2px solid #7c715f;
  outline-offset: 2px;
}

@media (max-width: 380px) {
  .home-yarn-dialog .home-mini-header {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .home-yarn-dialog .home-mini-header h2 {
    flex-basis: auto;
    font-size: 17px;
  }
  .home-yarn-dialog .home-mini-instructions,
  .home-yarn-dialog .home-mini-feedback {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.55;
  }
  .home-yarn-dialog .home-mini-game {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  .home-yarn-dialog .home-mini-progress {
    font-size: 11px;
    margin-bottom: 14px;
  }
}

/* A compact kitchen tray: only the snake modal uses these rules. */
.home-snake-dialog {
  background: #fbfbfb;
  color: #363636;
  border-color: #bdbdbd;
  box-shadow: 0 16px 60px rgba(32, 32, 32, .21);
}

.home-snake-dialog::backdrop {
  background: rgba(32, 32, 32, .35);
}

.home-snake-dialog .home-mini-header {
  background: #fbfbfb;
  border-bottom-color: #dedede;
}

.home-snake-dialog .home-mini-close,
.home-snake-dialog .home-mini-pause {
  background: #ffffff;
  border-color: #aaaaaa;
  color: #414141;
}

.home-snake-dialog .home-mini-instructions,
.home-snake-dialog .home-mini-feedback,
.home-snake-dialog .home-mini-progress {
  color: #666666;
}

.home-snake-dialog button:focus-visible {
  outline-color: #414141;
}

.home-snake-board {
  display: block;
  width: min(100%, 344px);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.home-snake-tray {
  fill: #f1f1f1;
  stroke: #a3a3a3;
  stroke-width: 1.2;
}

.home-snake-floor {
  fill: #ffffff;
  stroke: #777777;
  stroke-width: 1.4;
}

.home-snake-grid,
.home-snake-pencil {
  fill: none;
  stroke: #c9c9c9;
  stroke-width: .7;
  opacity: .55;
}

.home-snake-pencil {
  stroke: #999999;
}

.home-snake-body-border,
.home-snake-body {
  fill: none;
  stroke: #505050;
  stroke-width: 24;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-snake-body {
  stroke: url(#snake-calico-fur);
  stroke-width: 21;
}

.home-snake-belly {
  fill: none;
  stroke: #e9e9e9;
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-snake-belly-glow {
  fill: #d1d1d1;
  fill-opacity: .65;
}

.home-snake-swallowed-food ellipse {
  fill: #606060;
  stroke: #333333;
  stroke-width: .9;
}

.home-snake-swallowed-food path {
  fill: none;
  stroke: #ededed;
  stroke-width: 1.2;
  stroke-linecap: round;
}

.home-snake-head {
  fill: #fafafa;
  stroke: #505050;
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.home-snake-face,
.home-snake-eye {
  fill: none;
  stroke: #303030;
  stroke-width: .85;
  stroke-linecap: round;
}

.home-snake-eye {
  stroke-width: 1.5;
}

.home-snake-nose {
  fill: #333333;
  stroke-width: .4;
}

.home-snake-muzzle {
  fill: #ffffff;
  stroke: none;
}

.home-snake-far-ear,
.home-snake-head-orange {
  fill: #aaaaaa;
}

.home-snake-head-dark {
  fill: #666666;
}

.home-snake-head-orange,
.home-snake-head-dark,
.home-snake-inner-ear {
  stroke: none;
}

.home-snake-inner-ear {
  fill: #d0d0d0;
}

.home-snake-legs {
  fill: #fafafa;
  stroke: #575757;
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.home-snake-legs [data-snake-limb="rear-far"] {
  fill: #b0b0b0;
}

.home-snake-toes {
  fill: none;
  stroke: #a0a0a0;
  stroke-width: .75;
  stroke-linecap: round;
}

.home-snake-tail-border,
.home-snake-tail-fur,
.home-snake-tail-tip,
.home-snake-patch {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-snake-tail-border {
  stroke: #505050;
  stroke-width: 8;
}

.home-snake-tail-fur {
  stroke: #b68e58;
  stroke-width: 5.6;
}

.home-snake-tail-tip {
  stroke: #3f3b34;
  stroke-width: 5.6;
}

.home-snake-patch {
  stroke-width: 8;
}

.home-snake-patch-orange {
  stroke: #b7874f;
}

.home-snake-patch-dark {
  stroke: #403c35;
}

.home-snake-food {
  fill: #f0f0f0;
  stroke: #656565;
  stroke-width: 1.3;
}

.home-snake-food circle {
  fill: #777777;
  stroke-width: .7;
}

.home-snake-obstacle {
  fill: #c4c4c4;
  stroke: #797979;
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.home-snake-obstacle path + path {
  fill: none;
  stroke: #999999;
  stroke-width: .8;
}

.home-snake-failed .home-snake-body {
  stroke: #dddddd;
}

.home-snake-failed .home-snake-head {
  fill: #e2e2e2;
  stroke: #3f3f3f;
}

.home-snake-collision {
  fill: #ffffff;
  stroke: #333333;
  stroke-width: 2.1;
  stroke-linecap: round;
}

.home-snake-actions,
.home-snake-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px auto 0;
}

.home-snake-actions {
  flex-wrap: wrap;
}

.home-snake-actions button,
.home-snake-direction-button {
  min-width: 48px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #aaaaaa;
  border-radius: 8px 10px 7px 9px;
  background: #ffffff;
  color: #454545;
  font-size: 13px;
  touch-action: manipulation;
}

.home-snake-direction-button {
  width: 56px;
  min-height: 48px;
  padding: 4px;
  font-size: 22px;
  user-select: none;
  touch-action: none;
}

.home-snake-actions button:focus-visible,
.home-snake-direction-button:focus-visible {
  outline: 2px solid #414141;
  outline-offset: 3px;
}

.home-snake-actions button:not(:disabled):hover,
.home-snake-direction-button:not(:disabled):hover {
  border-color: #686868;
  background: #ededed;
}

.home-snake-progress,
.home-snake-stage-dots,
.home-snake-food-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.home-snake-progress {
  display: flex;
  gap: 22px;
}

.home-snake-stage-dots i {
  width: 9px;
  height: 9px;
  border: 1px solid #a0a0a0;
  border-radius: 50%;
}

.home-snake-stage-dots .home-snake-stage-current {
  background: #777777;
  outline: 1px solid #c3c3c3;
  outline-offset: 3px;
}

.home-snake-stage-dots .home-snake-stage-done {
  background: #4f4f4f;
  border-color: #4f4f4f;
}

.home-snake-food-count svg {
  width: 26px;
  height: 22px;
  fill: #ececec;
  stroke: #686868;
  stroke-width: 1.3;
}

.home-snake-dialog .home-mini-feedback {
  text-align: center;
  margin-top: 10px;
}

@media (max-width: 380px) {
  .home-snake-dialog .home-mini-header {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .home-snake-dialog .home-mini-header h2 {
    flex-basis: auto;
    font-size: 17px;
  }
  .home-snake-dialog .home-mini-instructions {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.55;
  }
  .home-snake-dialog .home-mini-game {
    margin-top: 8px;
    margin-bottom: 8px;
  }
  .home-snake-board {
    width: min(100%, calc(100dvh - 330px));
  }
  .home-snake-dialog .home-mini-progress {
    margin-bottom: 12px;
  }
}

@media (max-height: 500px) and (min-width: 600px) {
  .home-snake-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 196px;
    align-items: center;
    gap: 8px 16px;
  }
  .home-snake-board {
    grid-row: span 2;
    width: min(100%, calc(100dvh - 195px));
  }
  .home-snake-actions,
  .home-snake-controls {
    margin: 0;
    gap: 4px;
  }
  .home-snake-direction-button {
    min-width: 44px;
    width: 44px;
  }
}
