.pet-video-app {
      --room-background: url("/play/pet-play/assets/room-bg.png");
      --text: #2b2119;
      --glass: rgba(255, 250, 238, 0.72);
      --glass-strong: rgba(255, 250, 238, 0.88);
      --border: rgba(75, 55, 38, 0.18);
      --shadow: rgba(41, 30, 21, 0.22);
      --pet-motion-x: 0px;
      --pet-facing: 1;
      --pet-action-scale: 1;
      --pet-action-y: 0px;
    }

    @supports (background-image: image-set(url("/play/pet-play/assets/room-bg.webp") type("image/webp"))) {
      .pet-video-app {
        --room-background: image-set(url("/play/pet-play/assets/room-bg.webp") type("image/webp"), url("/play/pet-play/assets/room-bg.png") type("image/png"));
      }
    }

    .pet-video-app, .pet-video-app * {
      box-sizing: border-box;
    }

    .pet-video-app {
      width: 100%;
      height: 100%;
      margin: 0;
      overflow: hidden;
      overscroll-behavior: none;
      background: #b9c9b6;
      color: var(--text);
      font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
      -webkit-tap-highlight-color: transparent;
      touch-action: none;
    }

    .pet-video-app::before {
      content: "";
      position: absolute;
      inset: 0;
      background:
        linear-gradient(180deg, rgba(255, 250, 238, 0.08), rgba(255, 255, 255, 0.01)),
        var(--room-background) center / cover no-repeat;
      transform: translateZ(0);
    }

    .pet-video-app[data-fallback="true"]::before {
      background:
        linear-gradient(180deg, rgba(255, 250, 238, 0.08), rgba(255, 255, 255, 0.01)),
        var(--room-background) center / cover no-repeat;
    }

    .stage {
      position: absolute;
      inset: 0;
      overflow: hidden;
      isolation: isolate;
      touch-action: none;
    }

    .play-gate {
      appearance: none;
      -webkit-appearance: none;
      min-height: 38px;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 9px 12px;
      background: var(--glass);
      box-shadow: 0 10px 26px var(--shadow);
      color: var(--text);
      font: 700 13px/1.1 system-ui, sans-serif;
      letter-spacing: 0;
      backdrop-filter: blur(16px) saturate(1.08);
      cursor: pointer;
    }

    .play-gate:hover,
    .play-gate:focus-visible {
      outline: 0;
      background: var(--glass-strong);
    }

    .action-panel {
      position: absolute;
      top: max(14px, env(safe-area-inset-top));
      left: max(14px, env(safe-area-inset-left));
      z-index: 22;
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      width: 136px;
    }

    .action-button {
      position: relative;
      min-height: 38px;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 9px 11px;
      background: var(--glass);
      box-shadow: 0 10px 24px rgba(41, 30, 21, 0.18);
      color: var(--text);
      font: 700 12px/1.1 system-ui, sans-serif;
      letter-spacing: 0;
      text-align: left;
      backdrop-filter: blur(16px) saturate(1.08);
      cursor: pointer;
      overflow: hidden;
      transition:
        background 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
    }

    .action-button:hover,
    .action-button:focus-visible {
      outline: 0;
      background: var(--glass-strong);
    }

    .action-button[data-current="true"] {
      background: rgba(255, 250, 238, 0.92);
      border-color: rgba(75, 55, 38, 0.28);
      box-shadow:
        inset 3px 0 0 rgba(75, 55, 38, 0.68),
        0 12px 26px rgba(41, 30, 21, 0.2),
        0 0 0 2px rgba(255, 250, 238, 0.52);
      transform: translateX(2px);
    }

    .action-button[data-queued="true"] {
      background: rgba(255, 228, 168, 0.92);
      border-color: rgba(132, 95, 43, 0.36);
      box-shadow:
        inset 3px 0 0 rgba(202, 133, 36, 0.9),
        0 0 0 0 rgba(255, 214, 126, 0.56),
        0 10px 24px rgba(41, 30, 21, 0.18);
      animation: queuedActionPulse 1.08s ease-in-out infinite;
    }

    @keyframes queuedActionPulse {
      0%,
      100% {
        box-shadow:
          inset 3px 0 0 rgba(202, 133, 36, 0.9),
          0 0 0 0 rgba(255, 214, 126, 0.56),
          0 10px 24px rgba(41, 30, 21, 0.18);
      }

      50% {
        box-shadow:
          inset 3px 0 0 rgba(202, 133, 36, 1),
          0 0 0 5px rgba(255, 214, 126, 0.24),
          0 14px 28px rgba(41, 30, 21, 0.2);
      }
    }

    .action-button[data-manual-only="true"] {
      opacity: 0.82;
    }

    .action-button[data-manual-only="true"][data-current="true"],
    .action-button[data-manual-only="true"][data-queued="true"],
    .action-button[data-manual-only="true"]:hover,
    .action-button[data-manual-only="true"]:focus-visible {
      opacity: 1;
    }

    .pet-canvas {
      position: absolute;
      left: 50%;
      bottom: max(-18px, -2.4vh);
      width: clamp(300px, 48vw, 500px);
      aspect-ratio: 16 / 9;
      transform: translateX(-50%) translateX(var(--pet-motion-x));
      filter:
        drop-shadow(0 18px 20px rgba(35, 24, 16, 0.16))
        saturate(1.01);
      transition: filter 180ms ease;
      z-index: 2;
      will-change: transform;
    }

    .pet-face {
      position: absolute;
      inset: 0;
      opacity: 1;
      transform: translateY(var(--pet-action-y)) scaleX(var(--pet-facing)) scale(var(--pet-action-scale));
      transform-origin: center bottom;
      transition: opacity 180ms ease;
      will-change: transform;
    }

    .pet-video-app[data-active="true"] .pet-canvas {
      filter:
        drop-shadow(0 20px 24px rgba(35, 24, 16, 0.2))
        saturate(1.04);
    }

    .pet-video-app[data-fallback="true"] .pet-canvas {
      filter: none;
    }

    .pet-canvas::before {
      content: "";
      position: absolute;
      left: 50%;
      bottom: 3.6%;
      z-index: 0;
      width: 18%;
      height: 5%;
      border-radius: 50%;
      background: radial-gradient(ellipse at center, rgba(42, 31, 21, 0.3) 0%, rgba(42, 31, 21, 0.16) 44%, rgba(42, 31, 21, 0) 74%);
      filter: blur(4px);
      opacity: 0.78;
      transform: translateX(-50%);
      pointer-events: none;
    }

    .pet-video-app[data-fallback="true"] .pet-canvas::before {
      display: none;
    }

    .pet-video,
    .keyed-video-canvas {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      z-index: 1;
      width: 100%;
      height: 100%;
      object-fit: contain;
      opacity: 0;
      transition: left 720ms cubic-bezier(0.18, 0.72, 0.2, 1), right 720ms cubic-bezier(0.18, 0.72, 0.2, 1);
      pointer-events: none;
    }

    .pet-video[data-active="true"] {
      opacity: 1;
    }

    .keyed-video-canvas {
      opacity: 0;
    }

    .pet-video-app[data-fallback="true"] .pet-video {
      opacity: 0;
    }

    .pet-video-app[data-fallback="true"] .keyed-video-canvas[data-active="true"] {
      opacity: 1;
    }

    .pet-video[data-offset-locked="true"],
    .keyed-video-canvas[data-offset-locked="true"] {
      transition: none;
    }

    .play-gate {
      position: absolute;
      left: 50%;
      bottom: max(20px, env(safe-area-inset-bottom));
      z-index: 24;
      transform: translateX(-50%);
    }

    .play-gate[hidden] {
      display: none;
    }

    .status-dot {
      position: absolute;
      left: max(16px, env(safe-area-inset-left));
      bottom: max(16px, env(safe-area-inset-bottom));
      z-index: 18;
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: rgba(255, 250, 238, 0.72);
      box-shadow: 0 0 0 1px rgba(43, 33, 25, 0.14), 0 8px 18px rgba(43, 33, 25, 0.22);
      opacity: 0.58;
      transition: background 180ms ease, opacity 180ms ease, transform 180ms ease;
      pointer-events: none;
    }

    .pet-video-app[data-active="true"] .status-dot {
      background: #ffe4a8;
      opacity: 0.88;
      transform: scale(1.18);
    }

    @media (max-width: 760px), (hover: none) {

      .play-gate,
      .action-button {
        min-height: 42px;
        padding: 11px 13px;
        font-size: 13px;
      }

      .action-panel {
        top: max(10px, env(safe-area-inset-top));
        left: max(10px, env(safe-area-inset-left));
        width: 132px;
      }

      .pet-canvas {
        bottom: max(16px, env(safe-area-inset-bottom));
        width: min(430px, 98vw);
      }
    }

    @media (max-height: 560px) and (orientation: landscape) {
      .pet-canvas {
        bottom: -11px;
        width: min(410px, 49vw);
      }

      .play-gate,
      .action-button {
        min-height: 36px;
        padding: 8px 11px;
      }

      .action-panel {
        width: 122px;
        gap: 6px;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .pet-video,
      .keyed-video-canvas,
      .pet-canvas,
      .pet-face,
      .status-dot {
        transition: none;
      }

      .action-button[data-queued="true"] {
        animation: none;
      }
    }
.pet-video-app {position:relative;isolation:isolate;width:100%;height:clamp(420px,calc(100svh - 140px),900px);overflow:hidden;}
.pet-video-app[data-mode="ltx"] .pet-canvas {aspect-ratio:20 / 11;bottom:max(6px,env(safe-area-inset-bottom));}
@media (max-width:760px),(hover:none){.pet-video-app[data-mode="ltx"] .pet-canvas{bottom:max(34px,env(safe-area-inset-bottom));}}
@media (max-height:560px) and (orientation:landscape){.pet-video-app[data-mode="ltx"] .pet-canvas{bottom:max(4px,env(safe-area-inset-bottom));}.pet-video-app{height:clamp(340px,calc(100svh - 80px),600px);}}
