/* A small, pointer-transparent stage; only the fox and its controls receive input. */
.fox-world { --actor-width: 224px; --actor-height: 224px; --fox-ground: max(3.5rem, calc(env(safe-area-inset-bottom) + 3rem)); position: fixed; inset: 0; z-index: 61; pointer-events: none; overflow: hidden; color: #302721; font-family: var(--body); }
.fox-world[hidden] { display: none !important; }
.fox-actor { position: absolute; left: 0; bottom: calc(var(--fox-ground) - var(--actor-height) * .08); width: var(--actor-width); height: var(--actor-height); padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; transform: translate3d(var(--fox-x,0px),0,0); -webkit-tap-highlight-color: transparent; }
.fox-actor:focus-visible { outline: 2px dashed #b92b32; outline-offset: 2px; border-radius: 35%; }
.fox-stage-bubble { position: absolute; left: 0; bottom: calc(var(--actor-height) * .94 + var(--fox-ground) + .7rem); width: 15rem; max-width: calc(100vw - 2rem); padding: .85rem 1rem; background: #fffaf1; border: 1px solid #c4ae8a; border-radius: 1rem 1rem 1rem .2rem; font-size: .875rem; line-height: 1.45; box-shadow: 0 6px 24px #3c251b14; transform: translate3d(var(--bubble-x,1rem),0,0); }
.fox-stage-bubble strong { display: block; margin-bottom: .2rem; color: #a42b32; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.fox-stage-bubble p { margin: 0; }
.fox-world__controls { position: absolute; right: max(1rem,env(safe-area-inset-right)); bottom: max(.65rem,env(safe-area-inset-bottom)); display: flex; align-items: center; gap: .5rem; pointer-events: auto; }
.fox-world__controls button, .fox-game-progress { background: #fffaf1; border: 1px solid #c4ae8a; border-radius: 2rem; color: #302721; padding: .65rem .9rem; font-size: .8rem; line-height: 1.2; min-height: 2.5rem; }
.fox-world__controls button { cursor: pointer; }
.fox-world__controls button:hover { background: #eedeaf; }
.fox-game-progress { position: absolute; bottom: .65rem; left: 1rem; }
.fox-bean { position: absolute; left: 0; bottom: 4rem; width: 3.25rem; height: 3.25rem; padding: .4rem; border: 1px solid #ad7936; border-radius: 50%; background: #ffe5a4; box-shadow: 0 0 0 .35rem #fffaf1ba,0 4px 16px #8a54252a; pointer-events: auto; cursor: pointer; transform: translateX(var(--bean-x,20px)); animation: fox-bean-float 1.4s ease-in-out infinite; }
.fox-bean::before { content: ''; display: block; width: 1.3rem; height: 1.95rem; margin: auto; border-radius: 55% 45%; background: #78482f; transform: rotate(34deg); }
.fox-bean::after { content: ''; position: absolute; left: 49%; top: 25%; width: .2rem; height: 1.65rem; background: #e9ba79; border-radius: 50%; transform: rotate(34deg); }
.fox-bean:disabled { pointer-events: none; opacity: .45; }
.fox-companion.is-on-stage .fox-launcher { visibility: hidden; pointer-events: none; }
.fox-play-link { display: flex; width: 100%; align-items: center; justify-content: space-between; margin: .5rem 0 1rem; padding: .8rem 1rem; border-radius: .75rem; border: 1px dashed #bda277; background: #efe1bc; color: #543c23; cursor: pointer; font-size: .9rem; }
.fox-friendship { background: #efe3c6; border-radius: .75rem; padding: .85rem 1rem; margin-bottom: 1rem; }
.fox-friendship strong { display: block; font-size: .9rem; }
.fox-friendship span { font-size: .8rem; color: #74614c; }
.fox-friendship meter { display: block; width: 100%; height: .7rem; margin-top: .5rem; accent-color: #b92b32; }
.fox-life-options { grid-template-columns: 1fr 1fr; }
.fox-life-options .fox-option { display: block; min-height: 3.75rem; text-align: center; padding: .7rem .4rem; font-size: .85rem; }
.fox-life-options .fox-option::after { content: none; }
.fox-activity-preference { display: block; width: 100%; margin-top: 1rem; padding: .75rem; border: 1px solid #c4ae8a; border-radius: .65rem; background: transparent; font-size: .85rem; cursor: pointer; color: #6d4e2b; }
.fox-world.is-reduced *, body.fox-calm .fox-launcher img { animation: none !important; transition: none !important; }
body.menu-open .fox-world { visibility: hidden; }
@keyframes fox-hearts { 0% { opacity: 0; transform: translateY(10px); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes fox-dream { 0%,100% { opacity: .3; transform: translateY(3px); } 50% { opacity: .9; transform: translateY(-4px); } }
@keyframes fox-bean-float { 50% { margin-bottom: .4rem; } }
@media(max-width:55rem) {
  .fox-world { --actor-width: 184px; --actor-height: 184px; }
  .fox-stage-bubble { width: 13.5rem; font-size: .8rem; bottom: calc(var(--actor-height) * .94 + var(--fox-ground) + .7rem); }
  .fox-world__controls { right: .65rem; gap: .35rem; }
  .fox-world__controls button { padding-inline: .7rem; font-size: .75rem; }
  .fox-game-progress { left: .65rem; font-size: .75rem; }
}
@media(prefers-reduced-motion:reduce) { .fox-world *, .fox-bean { animation: none !important; transition: none !important; } }


/* Frame changes are driven by the same clock as travel, never by rotating the whole fox. */
.fox-floor { position: absolute; inset: auto 0 var(--fox-ground); height: 1px; background: linear-gradient(90deg,transparent,#a8834b55 15%,#a8834b55 85%,transparent); box-shadow: 0 5px 10px #75502e0d; }
.fox-live-direction { display: block; width: 100%; height: 100%; transform: scaleX(var(--fox-direction,1)); transform-origin: center bottom; }
.fox-live-art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; transform: scale(.9); transform-origin: 60% 40%; }
.fox-live-frames { display: none; position: absolute; background-repeat: no-repeat; pointer-events: none; }
.fox-actor.has-sprite .fox-live-art { visibility: hidden; }
.fox-actor.has-sprite .fox-live-frames { display: block; }
.fox-actor::before { content: ''; position: absolute; left: var(--fox-shadow-x,60%); transform: translateX(-50%); bottom: 7%; width: 32%; height: 2.5%; border-radius: 50%; background: #3c251b26; filter: blur(2px); }
.fox-live-hearts, .fox-live-sleep { position: absolute; opacity: 0; top: 0; right: 0; color: #b92b32; font: italic 2rem Georgia,serif; }
.fox-actor[data-pose="pet"] .fox-live-hearts, .fox-actor[data-pose="celebrate"] .fox-live-hearts { animation: fox-hearts 1.6s ease-out infinite; }
.fox-actor[data-pose="sleep"] .fox-live-sleep { animation: fox-dream 3s ease-in-out infinite; }
.fox-companion.is-on-stage .fox-hint { visibility: hidden; }
.fox-world[data-activity="drink"] .fox-stage-bubble { border-color: #b89964; }
.fox-world[data-activity="game"] [data-fox-stage-menu] { display: none; }
@media(max-width:35rem) {
  .fox-world__controls button { padding-inline: .65rem; font-size: .72rem; }
  .fox-stage-bubble { max-width: calc(100vw - 1.5rem); }
}

.fox-world__controls button:disabled { cursor: default; opacity: .55; }

.fox-panel[data-view="life"] .fox-kicker { display: none; }
.fox-panel[data-view="life"] .fox-friendship { margin: 1rem 0 0; }
.fox-panel[data-view="life"] h2 { font-size: 1.55rem; }
@media(max-height:700px) {
  .fox-panel[data-view="life"] .fox-panel__body { padding: .85rem; }
  .fox-panel[data-view="life"] .fox-panel__body p { display: none; }
  .fox-panel[data-view="life"] .fox-option { min-height: 3rem; }
}

@media(max-width:47rem) {
  .fox-world:not([hidden]) { background:var(--cream,#f3efe4); pointer-events:auto; }
  .fox-world { --fox-ground:max(4rem,calc(env(safe-area-inset-bottom) + 3rem)); }
  .fox-world::before { content:'Немного времени с мистером Фоксом'; position:absolute; left:1.5rem; right:1.5rem; top:12vh; font-size:1.5rem; font-weight:600; text-align:center; }
}

@media (max-width: 47rem) { body:has(.fox-world:not([hidden])) { overflow: hidden; } }
