/* One real scene renderer; HTML keeps accessible controls and existing actions. */
#petownApp .pet-card.pet-scene.uses-3d {
  background: #c0d8ca;
  background-image: none !important;
  isolation: isolate;
}
#petownApp .uses-3d .pet-scene-layer {
  background: none !important;
}
#petownApp .uses-3d::before,
#petownApp .uses-3d::after,
#petownApp .uses-3d .pet-scene-atmosphere,
#petownApp .uses-3d .pet-scene-cloud-layer,
#petownApp .uses-3d .pet-scene-rain-layer,
#petownApp .uses-3d .pet-scene-nature,
#petownApp .uses-3d .pet-scene-tint {
  display: none;
}
#petownApp
  .uses-3d
  .pet-scene-layer
  > :not(.pet-scene-item):not(.pet-pond-control):not(.pet-park-chest):not(
    .pet-scene-away-sign
  ):not(.pet-indoor-away-note) {
  background-image: none;
}
#petownApp .uses-3d .pet-scene-layer > .pet-scene-sky,
#petownApp .uses-3d .pet-scene-layer > .pet-indoor-wall,
#petownApp .uses-3d .pet-scene-layer > .pet-indoor-floor,
#petownApp .uses-3d .pet-scene-layer > .pet-indoor-window {
  visibility: hidden;
}
#petownApp .uses-3d .pet-cat-webgl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
#petownApp .uses-3d #petownCatCanvas {
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  image-rendering: auto;
}
#petownApp .uses-3d .pet-scene-layer {
  z-index: 4;
  pointer-events: none;
}
#petownApp .uses-3d .pet-scene-item,
#petownApp .uses-3d .pet-park-chest,
#petownApp .uses-3d .pet-pond-control {
  pointer-events: auto;
}
#petownApp .uses-3d .pet-scene-item-sprite {
  opacity: 0;
}
#petownApp .uses-3d .pet-scene-item:hover .pet-scene-item-sprite {
  opacity: 0.2;
}
#petownApp .uses-3d .pet-pond-control {
  left: 67%;
  top: 48%;
  right: auto;
  bottom: auto;
  width: 24%;
  height: 18%;
}
#petownApp .uses-3d .pet-scene-pills,
#petownApp .uses-3d .pet-scene-ambient {
  z-index: 8;
}
#petownApp .pet-fishing-entry {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 44px;
  margin: 0;
}
#petownApp .pet-fishing-panel {
  position: absolute;
  z-index: 20;
  right: 20px;
  bottom: 18px;
  width: 350px;
  max-height: calc(100% - 128px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  background: #eee6d5;
  color: #403b30;
  border: 1px solid #9f9c80;
  border-radius: 14px;
  box-shadow: 0 12px 40px #27362930;
}
#petownApp .pet-fishing-panel[hidden] {
  display: none;
}
#petownApp .pet-fishing-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#petownApp .pet-fishing-heading h2 {
  margin: 0;
  font-size: 20px;
}
#petownApp .pet-fishing-panel p {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.5;
}
#petownApp .pet-fishing-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0;
  font-size: 12px;
  color: #5b624c;
}
#petownApp .pet-fishing-meter {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  margin: 6px 0;
}
#petownApp .pet-fishing-meter meter,
#petownApp .pet-fishing-meter progress {
  width: 100%;
  height: 16px;
  accent-color: #5e8062;
}
#petownApp #petFishingReadout {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#petownApp .pet-fish-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
#petownApp .pet-fishing-panel button {
  min-height: 44px;
  white-space: normal;
}
#petownApp #petFishingHold {
  touch-action: none;
  user-select: none;
  flex: 1;
}
#petownApp #petFishingHold.is-held {
  background: #31543c;
  transform: translateY(1px);
}
#petownApp .pet-fishing-basket {
  margin-top: 14px;
  border-top: 1px solid #c5c2ad;
  padding-top: 10px;
}
#petownApp .pet-fishing-basket summary {
  cursor: pointer;
  min-height: 32px;
  font-size: 16px;
}
#petownApp #petFishingBasket {
  max-height: 180px;
  overflow: auto;
}
#petownApp .pet-fish-row {
  padding: 10px 0;
  border-top: 1px solid #d4cfbc;
}
#petownApp .pet-fish-row strong {
  font-size: 16px;
}
#petownApp .pet-fish-row span {
  display: block;
  font-size: 12px;
  color: #67634f;
  margin-top: 3px;
}
#petownApp .pet-cat-render-status {
  z-index: 25;
  pointer-events: none;
}
#petownApp[data-load-state="error"] .pet-cat-render-status {
  display: none;
}
@media (max-width: 1023px) {
  #petownApp .uses-3d {
    min-height: 440px;
  }
  #petownApp .uses-3d.is-fishing {
    min-height: 620px;
  }
  #petownApp .pet-fishing-panel {
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
    max-height: 365px;
    padding: 12px;
  }
  #petownApp .pet-fishing-guide {
    font-size: 12px;
  }
  #petownApp .uses-3d.is-fishing .pet-pond-control {
    top: 24%;
    left: 47%;
    width: 35%;
    height: 14%;
  }
  #petownApp .pet-fishing-basket {
    margin-top: 10px;
  }
}
@media (min-width: 1024px) and (max-height: 760px) {
  #petownApp .pet-fishing-panel {
    max-height: calc(100% - 110px);
  }
}
/* The scene's interactive targets remain in HTML; their objects live in WebGL. */
#petownApp
  .uses-3d
  .pet-scene-layer--outdoor
  > :not(.pet-scene-item):not(.pet-pond-control):not(.pet-scene-fence):not(
    .pet-scene-away-sign
  ),
#petownApp .uses-3d .pet-scene-art-bg,
#petownApp .uses-3d .pet-park-art-bg,
#petownApp .uses-3d .pet-indoor-art-bg,
#petownApp .uses-3d .pet-yard-wildlife,
#petownApp .uses-3d .pet-park-sign {
  display: none !important;
}
#petownApp .uses-3d .pet-scene-fence {
  background: none;
  border: 0;
  box-shadow: none;
}
#petownApp .uses-3d .pet-scene-fence::before,
#petownApp .uses-3d .pet-scene-fence::after {
  display: none;
}
#petownApp .uses-3d .pet-scene-fence-item,
#petownApp .uses-3d .pet-indoor-decor {
  pointer-events: auto;
  visibility: visible;
  background: none;
  border: 0;
  box-shadow: none;
  min-width: 44px;
  min-height: 44px;
}
#petownApp .uses-3d .pet-scene-fence-item > *,
#petownApp .uses-3d .pet-indoor-decor > *,
#petownApp .uses-3d .pet-park-chest-box {
  visibility: hidden;
}
#petownApp .uses-3d .pet-indoor-decor::before,
#petownApp .uses-3d .pet-indoor-decor::after,
#petownApp .uses-3d .pet-scene-fence-item::before,
#petownApp .uses-3d .pet-scene-fence-item::after {
  display: none;
}
#petownApp .uses-3d .pet-indoor-decor:hover,
#petownApp .uses-3d .pet-indoor-decor:focus-visible,
#petownApp .uses-3d .pet-scene-fence-item:focus-visible {
  outline: 2px solid #f4e9bd;
  outline-offset: 4px;
  border-radius: 8px;
}
#petownApp .uses-3d .pet-scene-item:hover .pet-scene-item-sprite {
  opacity: 0;
}
#petownApp .uses-3d .pet-pond-ripple {
  display: none;
}
@media (max-width: 1023px) {
  #petownApp .uses-3d,
  #petownApp .uses-3d.is-fishing {
    min-height: 440px;
  }
  #petownApp .pet-fishing-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    max-height: min(58dvh, 400px);
    z-index: 120;
    padding: 12px;
  }
  #petownApp .uses-3d.is-fishing .pet-pond-control {
    top: 48%;
    left: 67%;
    width: 24%;
    height: 18%;
  }
}

#petownApp .pet-fishing-panel [hidden] {
  display: none !important;
}

#petownApp .uses-3d .pet-scene-fence {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#petownApp .uses-3d .pet-scene-item-name {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
#petownApp .uses-3d .pet-park-chest-copy {
  position: absolute;
  top: auto;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
}

/* The projected model bounds define the hit target, including on touch screens. */
#petownApp .uses-3d .pet-park-chest {
  display: block;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}

@media (max-width: 1023px) {
  #petownApp .pet-card.pet-scene.uses-3d,
  #petownApp .pet-card.pet-scene.uses-3d.is-fishing {
    min-height: clamp(320px, 55dvh, 520px);
  }
}
#petownApp .pet-model-credit {
  font-size: 12px;
  line-height: 1.7;
  color: var(--pet-ui-text);
  margin-top: 16px;
}
#petownApp .uses-3d .pet-scene-atmosphere,
#petownApp .uses-3d .pet-scene-cloud-layer,
#petownApp .uses-3d .pet-scene-rain-layer,
#petownApp .uses-3d .pet-scene-nature,
#petownApp .uses-3d .pet-scene-tint {
  display: none !important;
}

/* Recovery must outlive the initial splash, including later context loss. */
#pet-load-error {
  position: fixed;
  z-index: 10001;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

/* Scene controls share the same world projection as the cat and the jetty. */
#petownApp .pet-scene-pill[hidden] { display: none; }
#petownApp .uses-3d .pet-coast-fishing-target {
  position: absolute;
  z-index: 6;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  color: var(--pet-ui-text);
  font: inherit;
}
#petownApp .pet-coast-fishing-target span {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--pet-ui-surface);
  box-shadow: 0 3px 12px #354d3826;
  white-space: nowrap;
  font-size: 14px;
}
#petownApp .pet-coast-fishing-target:hover,
#petownApp .pet-coast-fishing-target:focus-visible {
  outline: 2px solid var(--pet-ui-primary);
  outline-offset: 4px;
  border-radius: 12px;
}

/* A light paper HUD leaves the garden as the focal point. */
#petownApp .pet-topbar {
  background: var(--pet-ui-surface);
  background-image: var(--pet-material-paper);
  border-bottom: var(--pet-paper-border);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--p-ink) 8%, transparent);
}
#petownApp .pet-profile-heading {
  background: var(--pet-ui-surface-muted);
  box-shadow: none;
  border-radius: 12px;
}
#petownApp .pet-scene-pills,
#petownApp .pet-scene-ambient {
  border: var(--pet-paper-border);
  box-shadow: var(--pet-shadow-sm);
  border-radius: 16px;
}
#petownApp .pet-fishing-panel {
  background: var(--pet-ui-surface);
  color: var(--pet-ui-text);
  border: var(--pet-paper-border);
  box-shadow: var(--pet-shadow-lg);
}
@media (min-width: 1024px) {
  #petownApp .pet-sidebar-stack {
    width: 312px;
    padding: 16px;
    border: var(--pet-paper-border);
    border-radius: 20px;
    box-shadow: var(--pet-shadow);
  }
  #petownApp .pet-status-brief { margin: 8px 0; }
  #petownApp .pet-sidebar-stack > .pet-bottom-row {
    left: 348px;
  }
  #petownApp .pet-home-links .pet-btn {
    flex-direction: row;
    min-height: 44px;
    gap: 4px;
  }
  #petownApp .pet-home-links .pet-pixel-icon {
    width: 20px;
    height: 20px;
  }
}
@media (max-width: 1023px) {
  #petownApp .pet-action-bar .pet-pixel-icon {
    width: 32px;
    height: 32px;
  }
}
@media (min-width: 1024px) and (max-height: 800px) {
  #petownApp { --pet-desktop-hud-top: 88px; }
  #petownApp .pet-sidebar-stack { padding: 12px; gap: 4px; }
  #petownApp .pet-profile-avatar.pet-avatar-frame { width: 48px; height: 48px; }
  #petownApp .pet-companion { margin: 4px 0; font-size: 12px; }
  #petownApp .pet-status-brief { margin: 8px 0; }
  #petownApp .pet-sidebar-stack .pet-brief-status { font-size: 14px; }
  #petownApp .pet-bars { gap: 8px; }
  #petownApp .pet-growth { margin-top: 4px; padding-top: 4px; font-size: 12px; }
  #petownApp .pet-growth p { margin-top: 0; }
  #petownApp .pet-action-bar :is(#petownFeedBtn, #petownPlayBtn, #petownExpeditionBtn) { min-height: 92px; }
  #petownApp .pet-action-bar .pet-pixel-icon { width: 28px; height: 28px; }
  #petownApp .pet-home-summary { padding-top: 4px; font-size: 12px; }
  #petownApp .pet-home-links { margin: 0; }
  #petownApp .pet-mobile-drawer-trigger { min-height: 44px; padding: 8px; }
}
/* Targets become available only when their matching scene art has loaded. */
#petownApp .uses-3d.is-scene-loading #petownCatCanvas,
#petownApp .uses-3d.is-scene-loading .pet-scene-layer {
  pointer-events: none;
}
#petownApp .uses-3d.is-scene-loading .pet-scene-item,
#petownApp .uses-3d.is-scene-loading .pet-pond-control,
#petownApp .uses-3d.is-scene-loading .pet-coast-fishing-target {
  visibility: hidden !important;
}

/* A short landscape phone keeps the cat and care actions alongside each other. */
@media (max-width: 639px) and (max-height: 700px) {
  #petownApp:not(.is-playing) .pet-card.pet-scene.uses-3d {
    height: 50dvh;
    min-height: 320px;
  }
}
@media (min-width: 640px) and (max-width: 1023px) and (max-height: 500px) {
  #petownApp .pet-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 288px;
    gap: 8px;
    padding: 8px;
  }
  #petownApp:not(.is-playing) .pet-card.pet-scene.uses-3d,
  #petownApp:not(.is-playing) .pet-card.pet-scene.uses-3d.is-fishing {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: calc(100dvh - 82px);
    min-height: 260px;
    margin: 0;
  }
  #petownApp .pet-sidebar-stack {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    max-height: calc(100dvh - 82px);
    overflow-y: auto;
  }
  #petownApp .pet-care-panel { padding: 8px; }
  #petownApp .pet-care-panel .pet-bars { grid-template-columns: 1fr; gap: 4px; }
  #petownApp .pet-bar-row { white-space: nowrap; }
  #petownApp .pet-fishing-panel {
    left: auto;
    right: 8px;
    width: min(330px, 52vw);
    max-height: calc(100dvh - 82px);
  }
}
