/*
 * 香草镇游戏 HUD
 *
 * 这里仅覆盖游戏运行分支（#petownApp）。登录与 ComingSoon 分支继续使用
 * pet_home.html 内的共享 .pet-app 样式，避免通用选择器改变非游戏页面。
 */

body.lp-hide-site-chrome {
    min-height: 100dvh;
    overflow-x: hidden;
}

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

#petownApp {
    /* Semantic UI aliases: palette tokens stay in pet_home.html; components use these names. */
    --pet-ui-surface: var(--p-paper);
    --pet-ui-surface-muted: var(--p-paper-soft);
    --pet-ui-text: var(--p-ink);
    --pet-ui-text-muted: var(--p-ink-soft);
    --pet-ui-primary: var(--p-accent);
    --pet-ui-warning: var(--p-warm);
    --pet-ui-success: var(--p-ok);
    --pet-ui-danger: var(--p-warn);

    /* Shared control tokens. */
    --pet-control-height: 44px;
    --pet-control-height-lg: 48px;
    --pet-control-padding-x: 16px;
    --pet-control-padding-compact-x: 10px;
    --pet-control-gap: 8px;
    --pet-control-border: 2px solid var(--pet-ui-text);
    --pet-control-radius: 2px;
    --pet-control-shadow: 3px 3px 0 var(--pet-ui-text);
    --pet-control-shadow-hover: 4px 4px 0 var(--pet-ui-text);
    --pet-control-duration: 120ms;

    /* Shared transient and contextual feedback tokens. */
    --pet-feedback-bg: var(--pet-ui-surface);
    --pet-feedback-fg: var(--pet-ui-text);
    --pet-feedback-border: 2px solid var(--pet-ui-text);
    --pet-feedback-radius: 2px;
    --pet-feedback-shadow: 3px 3px 0 var(--pet-ui-text);

    /* Legacy aliases still consumed by inline styles in pet_home.html. */
    --btn-border: var(--pet-ui-text);
    --btn-border-w: 2px;
    --btn-shadow-offset: 3px;
    --btn-radius: var(--pet-control-radius);
    --btn-press-x: 2px;
    --btn-press-y: 2px;
    --btn-press-shadow: 0;
    --btn-min-height: var(--pet-control-height);
    --btn-icon-size: var(--pet-control-height);
    --btn-focus-ring: 0 0 0 3px var(--pet-ui-warning);

    width: 100%;
    min-height: 100dvh;
    overflow-x: clip;
    isolation: isolate;
}

#petownApp .pet-icon-btn--system-menu {
    display: none;
    transition: transform 120ms ease-out, opacity 120ms ease-out;
}

#petownApp :where(
    .pet-btn,
    .pet-back,
    .pet-icon-btn,
    .pet-close,
    .pet-scene-pill,
    [role="button"]
) {
    min-width: 44px;
    min-height: 44px;
}

#petownApp :where(
    .pet-btn,
    .pet-back,
    .pet-icon-btn,
    .pet-close,
    .pet-scene-pill,
    [role="button"]
):focus-visible {
    outline: 2px solid var(--p-ink);
    outline-offset: 2px;
}

/* 地毯热区大于替换家具；焦点跟随可见物体，避免在透明地面勾出空轮廓。 */
#petownApp .pet-indoor-rug {
    position: absolute;
    left: 50%;
    bottom: 8%;
    z-index: 2;
    width: clamp(220px, 48%, 360px);
    aspect-ratio: 11 / 5;
    transform: translateX(-50%);
}

#petownApp .pet-indoor-rug-surface {
    position: absolute;
    inset: 0;
    isolation: isolate;
    overflow: visible;
    background:
        radial-gradient(
            ellipse at 50% 38%,
            color-mix(in srgb, var(--p-paper) 82%, transparent) 0 18%,
            transparent 48%
        ),
        radial-gradient(
            ellipse at center,
            var(--p-paper) 0 25%,
            color-mix(in srgb, var(--p-accent) 18%, var(--p-paper)) 26% 40%,
            var(--p-paper) 41% 56%,
            color-mix(in srgb, var(--p-cool) 24%, var(--p-paper)) 57% 74%,
            color-mix(in srgb, var(--p-warm) 20%, var(--p-paper)) 75% 100%
        );
    border: 3px solid color-mix(in srgb, var(--p-paper-soft) 78%, var(--p-ink-soft));
    border-radius: 50%;
    box-shadow:
        0 4px 0 color-mix(in srgb, var(--p-ink-soft) 32%, transparent),
        0 12px 16px color-mix(in srgb, var(--p-ink) 18%, transparent),
        inset 0 5px 0 color-mix(in srgb, var(--p-paper) 78%, transparent),
        inset 0 -7px 0 color-mix(in srgb, var(--p-ink-soft) 20%, transparent);
    transition: transform 200ms ease-out, box-shadow 200ms ease-out, opacity 120ms ease-out;
}

#petownApp .pet-indoor-rug-surface::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: inherit;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0 3px,
            color-mix(in srgb, var(--p-ink-soft) 13%, transparent) 3px 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0 5px,
            color-mix(in srgb, var(--p-paper) 42%, transparent) 5px 6px
        );
    opacity: 0.32;
}

#petownApp .pet-indoor-rug-surface::after {
    content: '';
    position: absolute;
    right: 12%;
    bottom: 2px;
    left: 12%;
    height: 8px;
    background: color-mix(in srgb, var(--p-ink-soft) 22%, transparent);
    border-radius: 0 0 50% 50%;
}

#petownApp .pet-indoor-rug.pet-indoor-decor:hover {
    transform: translateX(-50%) translateY(-1px) scale(1.02);
}

#petownApp .pet-indoor-rug.pet-indoor-decor:hover .pet-indoor-rug-surface {
    box-shadow:
        0 5px 0 color-mix(in srgb, var(--p-ink-soft) 32%, transparent),
        0 14px 18px color-mix(in srgb, var(--p-ink) 20%, transparent),
        inset 0 5px 0 color-mix(in srgb, var(--p-paper) 78%, transparent),
        inset 0 -7px 0 color-mix(in srgb, var(--p-ink-soft) 20%, transparent);
}

#petownApp .pet-indoor-rug.is-equipped .pet-indoor-rug-surface {
    opacity: 0;
}

#petownApp .pet-indoor-rug > .pet-indoor-item-sprite {
    width: 112px;
    height: 112px;
}

#petownApp .pet-indoor-rug.pet-indoor-decor:focus-visible {
    outline: none;
}

#petownApp .pet-indoor-rug:not(.is-equipped):focus-visible .pet-indoor-rug-surface {
    box-shadow:
        0 4px 0 color-mix(in srgb, var(--p-ink-soft) 32%, transparent),
        0 12px 16px color-mix(in srgb, var(--p-ink) 18%, transparent),
        inset 0 5px 0 color-mix(in srgb, var(--p-paper) 78%, transparent),
        inset 0 -7px 0 color-mix(in srgb, var(--p-ink-soft) 20%, transparent),
        0 0 0 2px var(--p-paper),
        0 0 0 4px var(--p-ink);
}

#petownApp .pet-indoor-rug.is-equipped:focus-visible > .pet-indoor-item-sprite {
    outline: 2px solid var(--p-ink);
    outline-offset: 4px;
}

#petownApp .pet-scene-pills {
    display: inline-flex;
    align-items: stretch;
    gap: 8px;
    width: max-content;
    max-width: calc(100% - 24px);
    padding: 6px;
    background: var(--p-paper);
    border: 2px solid var(--p-ink);
    border-radius: 2px;
    box-shadow: 4px 4px 0 var(--p-ink);
    transition: opacity 120ms ease-out, visibility 0s linear 120ms;
}

#petownApp .pet-scene-pills-label {
    display: inline-flex;
    align-items: center;
    padding: 0 6px 0 4px;
    color: var(--p-ink-soft);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 11px;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

#petownApp .pet-scene-pill {
    position: relative;
    justify-content: center;
    gap: 7px;
    min-width: 88px;
    min-height: 44px;
    padding: 8px 14px 10px;
    color: var(--p-ink);
    background: var(--p-paper-soft);
    border: 2px solid var(--p-ink);
    border-radius: 2px;
    box-shadow: none;
    font-size: 13px;
    line-height: 1;
    transition: transform 120ms ease-out, background-color 120ms ease-out, color 120ms ease-out;
}

#petownApp .pet-scene-pill:not(.is-active):hover {
    background: var(--p-warm);
    transform: translateY(-1px);
}

#petownApp .pet-scene-pill.is-active {
    color: var(--p-paper);
    background: var(--p-ink);
    box-shadow: inset 0 -4px 0 var(--p-accent);
}

#petownApp .pet-scene-pill:not(.is-active):active {
    transform: translateY(1px);
    box-shadow: none;
}

#petownApp .pet-scene-pill svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

#petownApp .pet-system-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 4px;
}

#petownApp .pet-system-menu .pet-btn {
    min-height: 44px;
    border: 2px solid var(--p-ink);
    border-radius: 2px;
    box-shadow: 4px 4px 0 var(--p-ink);
    transition: transform 120ms ease-out, opacity 120ms ease-out;
}

#petownApp .pet-scene-action {
    position: absolute;
    left: 50%;
    top: 17%;
    z-index: 28;
    max-width: min(560px, calc(100% - 32px));
    padding: 9px 13px;
    transform: translate(-50%, -8px);
    opacity: 0;
    pointer-events: none;
    color: var(--p-ink);
    background: var(--p-paper);
    border: 2px solid var(--p-ink);
    box-shadow: 3px 3px 0 var(--p-ink);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    transition: opacity 120ms ease-out, transform 200ms ease-out;
}

#petownApp .pet-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

#petownApp .pet-cat-interact-target {
    position: absolute;
    z-index: 25;
    width: 128px;
    height: 128px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    cursor: grab;
    background: transparent;
    border: 0;
    border-radius: 2px;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

#petownApp .pet-cat-interact-target:active {
    cursor: grabbing;
}

#petownApp .pet-cat-interact-target:focus-visible {
    outline: 3px dashed var(--p-paper);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px var(--p-ink);
}

#petownApp .pet-scene.is-playing .pet-cat-interact-target {
    pointer-events: none;
}

#petownApp .pet-scene-action.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

#petownApp .pet-scene-action.is-success {
    background: #f3edbd;
}

#petownApp .pet-scene-play {
    position: absolute;
    inset: 0;
    z-index: 22;
    pointer-events: none;
}

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

#petownApp .pet-scene-play-hud {
    position: absolute;
    top: 80px;
    left: 50%;
    z-index: 26;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    width: min(560px, calc(100% - 40px));
    padding: 8px;
    transform: translateX(-50%);
    pointer-events: auto;
    background: var(--p-paper);
    border: 2px solid var(--p-ink);
    box-shadow: 4px 4px 0 var(--p-ink);
}

#petownApp .pet-scene-play-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 11px;
    text-align: center;
}

#petownApp .pet-scene-play-stats span {
    min-width: 0;
    padding: 5px 7px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: var(--p-paper-soft);
    border: 2px solid var(--p-ink);
}

#petownApp .pet-scene-play-stats strong {
    font-variant-numeric: tabular-nums;
}

#petownApp .pet-scene-play-exit {
    min-width: 56px;
    min-height: var(--pet-control-height);
    padding: 6px 10px;
    color: var(--p-ink);
    background: var(--p-paper);
    border: 2px solid var(--p-ink);
    box-shadow: 2px 2px 0 var(--p-ink);
    font: inherit;
    cursor: pointer;
}

#petownApp .pet-scene-play-exit:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

#petownApp .pet-scene-play-progress {
    grid-column: 1 / -1;
    height: 8px;
    overflow: hidden;
    background: var(--p-paper-soft);
    border: 2px solid var(--p-ink);
}

#petownApp .pet-scene-play-progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--p-warm);
    transition: width 320ms steps(4);
}

#petownApp .pet-scene-play-guide {
    position: absolute;
    top: 170px;
    left: 50%;
    z-index: 26;
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(430px, calc(100% - 32px));
    padding: 9px 12px;
    transform: translateX(-50%);
    pointer-events: none;
    color: var(--p-ink);
    background: var(--p-paper);
    border: 2px solid var(--p-ink);
    box-shadow: 3px 3px 0 var(--p-ink);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
}

#petownApp .pet-scene-play-guide-icon {
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    color: var(--p-paper);
    background: var(--p-warm);
    border: 2px solid var(--p-ink);
    font-size: 18px;
    line-height: 1;
}

#petownApp .pet-scene-play-guide strong,
#petownApp .pet-scene-play-guide small {
    display: block;
}

#petownApp .pet-scene-play-guide strong {
    margin-bottom: 3px;
    font-size: 12px;
}

#petownApp .pet-scene-play-guide small {
    font-family: 'LXGW WenKai', sans-serif;
    font-size: 12px;
    line-height: 1.35;
}

#petownApp .pet-scene-playfield {
    position: absolute;
    inset: 42% 0 0;
    z-index: 23;
    overflow: hidden;
    pointer-events: none;
}

#petownApp .pet-scene.uses-art-bg .pet-scene-playfield {
    top: 28%;
}

#petownApp .pet-scene-toy {
    pointer-events: auto;
}

#petownApp .pet-scene-play[data-play-mode="laser"] .pet-scene-toy {
    width: 48px;
    height: 48px;
    padding: 0;
    touch-action: none;
    cursor: grab;
    color: var(--p-paper);
    background: transparent;
    border: 0;
    box-shadow: none;
}

#petownApp .pet-scene-play[data-play-mode="laser"] .pet-scene-toy::before {
    content: '';
    position: absolute;
    inset: 11px;
    background: var(--p-warn);
    border: 4px solid var(--p-paper);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--p-ink), 0 0 18px 6px rgba(194, 90, 58, 0.55);
}

#petownApp .pet-scene-play[data-play-mode="laser"] .pet-scene-toy.is-dragging::before {
    cursor: grabbing;
    box-shadow: 0 0 0 3px var(--p-ink), 0 0 24px 9px rgba(194, 90, 58, 0.72);
}

#petownApp .pet-scene-play[data-play-mode="laser"] .pet-scene-toy svg {
    display: none;
}

#petownApp .pet-scene-play[data-play-mode="paper"] .pet-scene-toy {
    width: 48px;
    height: 48px;
    padding: 0;
    touch-action: none;
    cursor: grab;
    color: var(--p-ink-soft);
    background: var(--p-paper);
    border: 3px solid var(--p-ink);
    border-radius: 38% 46% 34% 44% / 42% 36% 48% 38%;
    box-shadow: 3px 3px 0 var(--p-ink);
    transform: rotate(8deg);
    transition: left 520ms steps(8), top 520ms steps(8), transform 120ms ease-out, box-shadow 120ms ease-out;
}

#petownApp .pet-scene-play[data-play-mode="paper"] .pet-scene-toy::before {
    content: '';
    position: absolute;
    inset: 9px;
    border-top: 3px solid var(--p-ink-soft);
    border-left: 3px solid var(--p-ink-soft);
    box-shadow: 7px 7px 0 -4px var(--p-ink-soft);
    transform: rotate(18deg);
}

#petownApp .pet-scene-play[data-play-mode="paper"] .pet-scene-toy svg {
    display: none;
}

#petownApp .pet-scene-play[data-play-mode="paper"] .pet-scene-toy.is-dragging {
    cursor: grabbing;
    transform: scale(1.08) rotate(-8deg);
}

#petownApp .pet-scene-play[data-play-mode="paper"] .pet-scene-toy.is-thrown,
#petownApp .pet-scene-play[data-play-mode="paper"] .pet-scene-toy.is-returning {
    transform: rotate(180deg);
}

#petownApp .pet-scene-toy-callout {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    display: block;
    min-width: 44px;
    padding: 4px 7px;
    transform: translateX(-50%);
    color: var(--p-ink);
    background: var(--p-paper);
    border: 2px solid var(--p-ink);
    box-shadow: 2px 2px 0 var(--p-ink);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    animation: petownToyCallout 560ms steps(2) infinite;
}

#petownApp .pet-scene-toy-callout::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 8px;
    height: 8px;
    transform: translateX(-50%) rotate(45deg);
    background: var(--p-paper);
    border-right: 2px solid var(--p-ink);
    border-bottom: 2px solid var(--p-ink);
}

@keyframes petownToyCallout {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -4px); }
}

#petownApp .pet-scene.is-playing #petownCatCanvas {
    z-index: 24;
}

#petownApp .pet-scene.is-playing .pet-scene-art-bg,
#petownApp .pet-scene.is-playing .pet-scene-layer {
    filter: saturate(0.92) brightness(0.94);
    transition: filter 200ms ease-out;
}

#petownApp.is-playing .pet-action-bar {
    opacity: 0.58;
    pointer-events: none;
}

#petownApp.is-playing .pet-scene-pills {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

#petownApp .pet-toast {
    position: fixed;
    left: 50%;
    bottom: max(104px, calc(env(safe-area-inset-bottom) + 104px));
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    width: max-content;
    max-width: min(460px, calc(100vw - 32px));
    min-height: 48px;
    padding: 10px 14px 10px 10px;
    color: var(--p-ink);
    background: var(--p-paper);
    border: 2px solid var(--p-ink);
    border-radius: 2px;
    box-shadow: 4px 4px 0 var(--p-ink);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    overflow-wrap: anywhere;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(14px);
    transition: opacity 160ms ease-out, transform 160ms ease-out;
}

#petownApp .pet-toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#petownApp .pet-toast-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--p-paper);
    background: var(--p-accent);
    border: 2px solid var(--p-ink);
}

#petownApp .pet-toast-icon svg {
    width: 16px;
    height: 16px;
}

#petownApp .pet-toast-text {
    min-width: 0;
}

#petownApp .pet-scene-item.is-action-target,
#petownApp .pet-indoor-decor.is-action-target {
    animation: petownActionTarget 320ms steps(4) 2;
}

@keyframes petownActionTarget {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

#petownApp .pet-sheet-image {
    opacity: 0;
    transition: opacity 200ms ease-out;
}

#petownApp .pet-sheet-image.is-loaded {
    opacity: 1;
}

#petownApp .pet-expedition-card {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
}

#petownApp .pet-expedition-card.is-locked {
    opacity: 0.5;
}

#petownApp .pet-expedition-card.is-unavailable {
    background: #eee5cf;
}

#petownApp .pet-expedition-image-wrap {
    position: relative;
    min-height: 100px;
    margin: -12px -12px 10px;
    overflow: hidden;
    background: #d9c99e;
    border-bottom: 2px solid var(--p-ink);
}

#petownApp .pet-expedition-image {
    display: block;
    width: 100%;
    height: 112px;
    object-fit: cover;
    filter: saturate(0.72) contrast(1.12) sepia(0.12);
    image-rendering: pixelated;
}

#petownApp .pet-expedition-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#petownApp .pet-expedition-card-copy {
    min-width: 0;
}

#petownApp .pet-expedition-requirement {
    margin-top: 5px;
    color: #a44931;
    font-size: 11px;
    line-height: 1.45;
}

#petownApp .pet-expedition-requirement.is-ready {
    color: #4f6b3c;
}

#petownApp .pet-expedition-card-main .pet-btn {
    flex: 0 0 auto;
    padding: 7px 14px;
    font-size: 13px;
}

#petownApp .pet-expedition-card.is-locked .pet-row-meta {
    color: #a44931;
}

#petownApp .pet-icon-btn--system-menu {
    border: 2px solid var(--p-ink);
    border-radius: 2px;
    box-shadow: 4px 4px 0 var(--p-ink);
}

#petownApp .pet-overlay,
#petownApp .pet-scene-pills,
body.lp-hide-site-chrome .pet-confirm-overlay {
    backdrop-filter: none;
}

#petownApp .pet-overlay {
    padding:
        max(12px, env(safe-area-inset-top))
        max(12px, env(safe-area-inset-right))
        max(12px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
    background: rgba(29, 37, 69, 0.62);
}

#petownApp .pet-overlay-frame {
    width: min(860px, 100%);
    max-height: calc(100dvh - 24px);
    border: 2px solid var(--p-ink);
    border-radius: 2px;
    background: var(--p-paper);
    box-shadow: 4px 4px 0 var(--p-ink);
}

/* overlay 移入 .pet-app 后，清掉 .pet-app .pet-modal 首次命中的双层窗口框。 */
#petownApp .pet-overlay-frame > .pet-modal {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#petownApp .pet-overlay-frame > .pet-modal-head {
    border-bottom: 2px solid var(--p-ink);
    border-radius: 0;
    background: var(--p-paper);
    box-shadow: none;
}

@media (min-width: 1024px) {
    body.lp-hide-site-chrome {
        height: 100dvh;
        overflow: hidden;
    }

    #petownApp {
        position: relative;
        height: 100dvh;
        min-height: 100dvh;
        padding: 0;
        overflow: hidden;
    }

    #petownApp .pet-topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 60;
        max-width: none;
        min-height: 64px;
        margin: 0;
        padding: 12px 20px;
        flex-wrap: nowrap;
        background: transparent;
    }

    #petownApp .pet-topbar .pet-back,
    #petownApp .pet-topbar .pet-icon-btn {
        background: var(--p-paper);
    }

    #petownApp .pet-topbar .pet-title {
        color: var(--p-paper);
        text-shadow: 2px 2px 0 var(--p-night);
    }

    #petownApp .pet-topbar .pet-subtitle {
        color: var(--p-paper-soft);
        text-shadow: 1px 1px 0 var(--p-night);
    }

    #petownApp .pet-shell {
        position: fixed;
        inset: 0;
        display: block;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    #petownApp .pet-card.pet-scene {
        position: fixed;
        inset: 0;
        z-index: 1;
        width: 100vw;
        height: 100dvh;
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    #petownApp .pet-sidebar-stack {
        position: fixed;
        left: 20px;
        top: 84px;
        bottom: 96px;
        z-index: 40;
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 320px;
        padding: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        background: var(--p-paper);
        border: 2px solid var(--p-ink);
        border-radius: 2px;
        box-shadow: 4px 4px 0 var(--p-ink);
        scrollbar-color: var(--p-ink-soft) var(--p-paper-soft);
        scrollbar-width: thin;
    }

    #petownApp .pet-sidebar-stack .pet-card.pet-status {
        position: static;
        flex: 0 0 auto;
        width: auto;
        max-height: none;
        padding: 0;
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    #petownApp .pet-sidebar-stack .pet-bottom-row {
        position: static;
        z-index: auto;
        display: grid;
        flex: 1 1 auto;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        width: auto;
        max-height: none;
        padding: 0;
        overflow: visible;
        background: transparent;
    }

    #petownApp .pet-sidebar-stack .pet-bottom-row .pet-card {
        max-height: none;
        padding: 10px 12px;
        overflow: visible;
        background: var(--p-paper-soft);
        border: 2px solid var(--p-ink);
        border-radius: 2px;
        box-shadow: 2px 2px 0 var(--p-ink);
    }

    #petownApp .pet-action-bar {
        position: fixed;
        left: 50%;
        right: auto;
        bottom: 24px;
        z-index: 50;
        display: flex;
        grid-template-columns: none;
        align-items: center;
        gap: 8px;
        width: max-content;
        max-width: calc(100vw - 40px);
        margin: 0;
        padding: 6px;
        overflow-x: auto;
        transform: translateX(-50%);
        background: var(--p-paper);
        border: 2px solid var(--p-ink);
        border-radius: 2px;
        box-shadow: 4px 4px 0 var(--p-ink);
    }

    #petownApp .pet-action-bar .pet-btn {
        flex: 0 0 auto;
    }

    #petownApp .pet-action-bar #petownFeedBtn,
    #petownApp .pet-action-bar #petownPlayBtn,
    #petownApp .pet-action-bar #petownExpeditionBtn {
        min-width: 96px;
        min-height: 48px;
        padding: 12px 20px;
        font-size: 14px;
    }

    #petownApp .pet-action-bar #petownShopBtn,
    #petownApp .pet-action-bar #petownAlbumBtn,
    #petownApp .pet-action-bar #petownDiaryBtn {
        min-height: 48px;
        padding: 8px 10px;
        font-size: 11px;
    }

    #petownApp .pet-scene-pills {
        position: fixed;
        top: 84px;
        left: 50%;
        right: auto;
        z-index: 55;
        transform: translateX(-50%);
    }
}

@media (max-width: 1023px) {
    body.lp-hide-site-chrome {
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #petownApp {
        min-height: 100dvh;
        padding: 0;
        overflow-x: clip;
    }

    #petownApp .pet-topbar {
        position: relative;
        z-index: 60;
        max-width: none;
        width: 100%;
        margin: 0;
        padding:
            max(12px, env(safe-area-inset-top))
            max(12px, env(safe-area-inset-right))
            12px
            max(12px, env(safe-area-inset-left));
        background: var(--p-paper);
        border-bottom: 2px solid var(--p-ink);
    }

    #petownApp .pet-shell {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto auto;
        gap: 12px;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    #petownApp .pet-card.pet-scene {
        position: relative;
        inset: auto;
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        height: auto;
        min-height: 56dvh;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
        box-shadow: none;
    }

    #petownApp .pet-sidebar-stack {
        display: contents;
    }

    #petownApp .pet-sidebar-stack > .pet-status {
        grid-column: 1;
        grid-row: 3;
        min-width: 0;
        margin-left: max(12px, env(safe-area-inset-left));
        margin-right: max(12px, env(safe-area-inset-right));
    }

    #petownApp .pet-sidebar-stack > .pet-action-bar {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        z-index: 40;
        display: grid;
        grid-column: 1;
        grid-row: 2;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 8px;
        width: auto;
        max-width: none;
        margin-left: max(12px, env(safe-area-inset-left));
        margin-right: max(12px, env(safe-area-inset-right));
        padding: 6px;
        transform: none;
        background: var(--p-paper);
        border: 2px solid var(--p-ink);
        border-radius: 2px;
        box-shadow: 4px 4px 0 var(--p-ink);
    }

    #petownApp .pet-sidebar-stack > .pet-bottom-row {
        position: static;
        display: grid;
        grid-column: 1;
        grid-row: 4;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        min-width: 0;
        margin-left: max(12px, env(safe-area-inset-left));
        margin-right: max(12px, env(safe-area-inset-right));
        margin-bottom: max(16px, env(safe-area-inset-bottom));
    }

    #petownApp .pet-scene-pills {
        top: 12px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    #petownApp .pet-toast {
        bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
        max-width: calc(100vw - 24px);
    }
}

@media (max-width: 640px) {
    #petownApp .pet-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    #petownApp .pet-topbar-left {
        flex-wrap: nowrap;
        min-width: 0;
    }

    #petownApp .pet-title-group {
        min-width: 0;
    }

    #petownApp .pet-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #petownApp .pet-subtitle {
        display: none;
    }

    #petownApp .pet-actions-top {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    #petownApp .pet-actions-top .pet-icon-btn {
        width: 100%;
        min-width: 44px;
        min-height: 44px;
        padding: 6px 8px;
    }

    #petownApp #petownMenuBtn {
        display: inline-flex;
        min-width: 44px;
        min-height: 44px;
    }

    #petownApp .pet-sidebar-stack > .pet-action-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    #petownApp .pet-action-bar #petownFeedBtn,
    #petownApp .pet-action-bar #petownPlayBtn,
    #petownApp .pet-action-bar #petownExpeditionBtn {
        width: 100%;
        min-width: 0;
        min-height: 48px;
        padding: 8px 4px;
    }

    #petownApp #petownShopBtn,
    #petownApp #petownAlbumBtn,
    #petownApp #petownDiaryBtn {
        display: none;
    }

    #petownApp .pet-status {
        padding: 14px;
    }

    #petownApp .pet-system-menu {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    #petownApp .pet-scene-play-hud {
        top: 68px;
        width: calc(100% - 24px);
        grid-template-columns: minmax(0, 1fr) auto;
    }

    #petownApp .pet-scene-play-stats {
        gap: 4px;
        font-size: 10px;
    }

    #petownApp .pet-scene-play-stats span {
        padding: 5px 3px;
    }

    #petownApp .pet-scene-action {
        top: 24%;
        font-size: 11px;
    }

    #petownApp .pet-scene-pills {
        gap: 6px;
        max-width: calc(100% - 20px);
        padding: 5px;
    }

    #petownApp .pet-scene-pills-label {
        padding-right: 2px;
        font-size: 10px;
    }

    #petownApp .pet-scene-pill {
        min-width: 76px;
        padding-right: 10px;
        padding-left: 10px;
    }

    #petownApp .pet-scene-play-guide {
        top: 146px;
        width: calc(100% - 24px);
    }

    #petownApp .pet-expedition-card-main {
        align-items: flex-end;
    }

    #petownApp .pet-expedition-card-main .pet-btn,
    #petownApp .pet-expedition-card-main .pet-row-meta {
        max-width: 92px;
        white-space: normal;
        text-align: center;
    }
}

/* ── First adoption: focused creation flow ── */
#petownApp .pet-overlay[data-kind="adoption"] .pet-overlay-frame {
    width: min(960px, 100%);
}

#petownApp #petownOverlayClose[hidden] {
    display: none !important;
}

#petownApp .pet-adoption {
    display: grid;
    gap: 16px;
    color: var(--pet-ui-text);
}

#petownApp .pet-adoption-intro {
    position: relative;
    display: grid;
    gap: 8px;
    padding-right: 240px;
}

#petownApp .pet-adoption-eyebrow,
#petownApp .pet-first-meeting-eyebrow {
    margin: 0;
    color: var(--pet-ui-primary);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 12px;
    letter-spacing: 0.04em;
}

#petownApp .pet-adoption-lead {
    margin: 0;
    color: var(--pet-ui-text-muted);
    font-family: 'LXGW WenKai', serif;
    font-size: 14px;
}

#petownApp .pet-adoption-exit {
    position: absolute;
    top: 0;
    right: 0;
}

#petownApp .pet-adoption-progress,
#petownApp .pet-adoption-mobile-actions,
#petownApp #petownAdoptBack {
    display: none;
}

#petownApp .pet-adoption-step {
    min-width: 0;
}

#petownApp .pet-adoption-step-head {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
}

#petownApp .pet-adoption-step-head h3,
#petownApp .pet-first-meeting-card h2 {
    margin: 0;
    color: var(--pet-ui-text);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 16px;
    font-weight: normal;
    line-height: 1.5;
}

#petownApp .pet-adoption-step-head p {
    margin: 0;
    color: var(--pet-ui-text-muted);
    font-family: 'LXGW WenKai', serif;
    font-size: 12px;
    line-height: 1.5;
}

#petownApp .pet-adoption-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

#petownApp .pet-adoption-grid .pet-tile {
    min-width: 0;
    padding: 8px;
}

#petownApp .pet-adoption-grid .pet-tile-art {
    height: 112px;
    aspect-ratio: auto;
}

#petownApp .pet-adoption-grid .pet-tile[aria-pressed="true"] {
    outline: 2px solid var(--pet-ui-text);
    outline-offset: 2px;
}

#petownApp .pet-adoption-details {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr);
    gap: 12px 16px;
    padding-top: 16px;
    border-top: 2px solid var(--pet-ui-text-muted);
}

#petownApp .pet-adoption-details > .pet-adoption-step-head,
#petownApp .pet-adoption-details > .pet-form-error,
#petownApp .pet-adoption-details > .pet-adoption-submit-row {
    grid-column: 1 / -1;
}

#petownApp .pet-adoption-selection {
    grid-column: 1;
    grid-row: 2 / span 2;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    align-items: center;
    align-self: start;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    background: var(--pet-ui-surface-muted);
    border: 2px solid var(--pet-ui-text);
}

#petownApp .pet-adoption-selection[hidden] {
    display: none;
}

#petownApp .pet-adoption-selection-art {
    display: grid;
    place-items: center;
    width: 80px;
    height: 80px;
    overflow: hidden;
    background: var(--pet-ui-surface);
    border: 2px solid var(--pet-ui-text);
    image-rendering: pixelated;
}

#petownApp .pet-adoption-selection-art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

#petownApp .pet-adoption-selection span,
#petownApp .pet-adoption-selection strong {
    display: block;
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-weight: normal;
}

#petownApp .pet-adoption-selection span {
    margin-bottom: 8px;
    color: var(--pet-ui-text-muted);
    font-size: 11px;
}

#petownApp .pet-adoption-selection strong {
    color: var(--pet-ui-text);
    font-size: 16px;
}

#petownApp .pet-adoption-field,
#petownApp .pet-adoption-fieldset {
    grid-column: 2;
    min-width: 0;
}

#petownApp .pet-adoption-field {
    display: grid;
    gap: 8px;
}

#petownApp .pet-adoption-field label,
#petownApp .pet-adoption-fieldset legend {
    color: var(--pet-ui-text);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 14px;
}

#petownApp .pet-adoption-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

#petownApp .pet-adoption-fieldset:disabled {
    opacity: 0.55;
}

#petownApp .pet-adoption-fieldset legend span {
    color: var(--pet-ui-danger);
    font-size: 11px;
}

#petownApp .pet-adoption-field .pet-input {
    width: 100%;
    min-height: 44px;
}

#petownApp .pet-field-hint,
#petownApp .pet-field-error,
#petownApp .pet-form-error {
    margin: 0;
    font-family: 'LXGW WenKai', serif;
    font-size: 12px;
    line-height: 1.5;
}

#petownApp .pet-field-hint {
    color: var(--pet-ui-text-muted);
}

#petownApp .pet-field-error,
#petownApp .pet-form-error {
    color: var(--pet-ui-danger);
}

#petownApp .pet-form-error {
    padding: 12px;
    background: var(--pet-ui-surface-muted);
    border: 2px solid var(--pet-ui-danger);
}

#petownApp .pet-gender-tile:has(input:focus-visible) {
    outline: 2px solid var(--pet-ui-text);
    outline-offset: 3px;
}

#petownApp .pet-adoption-submit-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#petownApp .pet-adoption-submit-row .pet-btn {
    min-width: 180px;
}

/* ── First meeting: player-paced scene dialog ── */
#petownApp .pet-first-meeting {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: end center;
    padding:
        max(24px, env(safe-area-inset-top))
        max(24px, env(safe-area-inset-right))
        max(48px, env(safe-area-inset-bottom))
        max(24px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--p-night) 48%, transparent);
}

#petownApp .pet-first-meeting-card {
    display: grid;
    gap: 12px;
    width: min(560px, 100%);
    padding: 24px;
    color: var(--pet-ui-text);
    background: var(--pet-ui-surface);
    border: 2px solid var(--pet-ui-text);
    box-shadow: 4px 4px 0 var(--pet-ui-text);
}

#petownApp .pet-first-meeting-line {
    min-height: 48px;
    margin: 0;
    color: var(--pet-ui-text);
    font-family: 'LXGW WenKai', serif;
    font-size: 16px;
    line-height: 1.6;
}

#petownApp .pet-first-meeting-step {
    margin: 0;
    color: var(--pet-ui-text-muted);
    font-family: 'Pixelify Sans', sans-serif;
    font-size: 12px;
    text-align: right;
}

#petownApp .pet-first-meeting-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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

@media (max-width: 640px) {
    #petownApp .pet-overlay[data-kind="adoption"] {
        padding: 0;
    }

    #petownApp .pet-overlay[data-kind="adoption"] .pet-overlay-frame {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
        box-shadow: none;
    }

    #petownApp .pet-overlay[data-kind="adoption"] .pet-modal {
        padding: 16px;
        overscroll-behavior: contain;
    }

    #petownApp .pet-adoption-intro {
        padding-right: 0;
    }

    #petownApp .pet-adoption-exit {
        position: static;
        width: 100%;
        margin-top: 4px;
    }

    #petownApp .pet-adoption-progress {
        position: sticky;
        top: 0;
        z-index: 2;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 8px;
        background: var(--pet-ui-surface);
        border: 2px solid var(--pet-ui-text);
    }

    #petownApp .pet-adoption-progress span {
        min-width: 0;
        padding: 8px;
        color: var(--pet-ui-text-muted);
        font-family: 'Zpix', 'Pixelify Sans', sans-serif;
        font-size: 12px;
        text-align: center;
    }

    #petownApp .pet-adoption-progress span.is-active {
        color: var(--pet-ui-text);
        background: var(--pet-ui-warning);
    }

    #petownApp .pet-adoption-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    #petownApp .pet-adoption-grid .pet-tile-art {
        height: 88px;
        aspect-ratio: auto;
    }

    #petownApp .pet-adoption-grid .pet-tile p {
        display: -webkit-box;
        min-height: 36px;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    #petownApp .pet-adoption-mobile-actions {
        position: sticky;
        bottom: 0;
        display: block;
        margin: 12px -16px -16px;
        padding: 12px 16px max(16px, env(safe-area-inset-bottom));
        background: var(--pet-ui-surface);
        border-top: 2px solid var(--pet-ui-text);
    }

    #petownApp .pet-adoption[data-step="choose"] .pet-adoption-details,
    #petownApp .pet-adoption[data-step="details"] .pet-adoption-choose {
        display: none;
    }

    #petownApp .pet-adoption-details {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 0;
        border-top: 0;
    }

    #petownApp .pet-adoption-details > *,
    #petownApp .pet-adoption-field,
    #petownApp .pet-adoption-fieldset,
    #petownApp .pet-adoption-selection {
        grid-column: 1;
        grid-row: auto;
    }

    #petownApp .pet-adoption-selection {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    #petownApp .pet-adoption-selection-art {
        width: 64px;
        height: 64px;
    }

    #petownApp .pet-adoption-submit-row {
        display: grid;
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
        gap: 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    #petownApp .pet-adoption-submit-row .pet-btn,
    #petownApp #petownAdoptBack {
        display: inline-flex;
        min-width: 0;
        width: 100%;
    }

    #petownApp .pet-first-meeting {
        padding:
            max(16px, env(safe-area-inset-top))
            max(16px, env(safe-area-inset-right))
            max(24px, env(safe-area-inset-bottom))
            max(16px, env(safe-area-inset-left));
    }

    #petownApp .pet-first-meeting-card {
        gap: 12px;
        padding: 16px;
    }

    #petownApp .pet-first-meeting-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    #petownApp .pet-first-meeting-actions [data-first-meeting-next] {
        grid-column: 1 / -1;
    }
}

@media (min-width: 769px) and (max-height: 640px) {
    #petownApp .pet-scene-play-hud {
        top: 24px;
    }

    #petownApp .pet-scene-play-guide {
        top: 112px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #petownApp .pet-scene-play[data-play-mode="laser"] .pet-scene-toy,
    #petownApp .pet-scene-play[data-play-mode="paper"] .pet-scene-toy {
        transition: none !important;
        animation: none !important;
    }

    #petownApp .pet-icon-btn--system-menu,
    #petownApp .pet-action-bar,
    #petownApp .pet-system-menu,
    #petownApp .pet-overlay,
    #petownApp .pet-overlay-frame {
        transition: none !important;
        animation: none !important;
    }

    #petownApp .pet-system-menu .pet-btn {
        transition: none !important;
        animation: none !important;
    }

    #petownApp .pet-first-meeting,
    #petownApp .pet-first-meeting-card {
        animation: none !important;
        transition: none !important;
    }

    #petownApp .pet-scene-action,
    #petownApp .pet-scene-play-progress span,
    #petownApp .pet-sheet-image {
        transition: none !important;
    }

    #petownApp .pet-scene-item.is-action-target,
    #petownApp .pet-indoor-decor.is-action-target,
    #petownApp .pet-scene-toy-callout {
        animation: none !important;
    }
}

/* ── Shared controls and feedback: docs/wiki/design/petown-ui.md ── */
#petownApp :where(
    .pet-btn,
    .pet-back,
    .pet-icon-btn,
    .pet-close,
    .pet-scene-play-exit
) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--pet-control-gap);
    min-width: var(--pet-control-height);
    min-height: var(--pet-control-height);
    padding: 8px var(--pet-control-padding-x);
    color: var(--pet-ui-text);
    background: var(--pet-ui-surface);
    border: var(--pet-control-border);
    border-radius: var(--pet-control-radius);
    box-shadow: var(--pet-control-shadow);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    font-size: 14px;
    font-weight: normal;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition:
        color var(--pet-control-duration) ease-out,
        background-color var(--pet-control-duration) ease-out,
        box-shadow var(--pet-control-duration) ease-out,
        transform var(--pet-control-duration) ease-out,
        opacity var(--pet-control-duration) ease-out;
}

@media (hover: hover) and (pointer: fine) {
    #petownApp :where(
        .pet-btn,
        .pet-back,
        .pet-icon-btn,
        .pet-close,
        .pet-scene-play-exit
    ):not(:disabled):not(.pet-btn--pending):hover {
        background: var(--pet-ui-surface-muted);
        box-shadow: var(--pet-control-shadow-hover);
        transform: translate(-1px, -1px);
    }
}

#petownApp :where(
    .pet-btn,
    .pet-back,
    .pet-icon-btn,
    .pet-close,
    .pet-scene-play-exit
):not(:disabled):not(.pet-btn--pending):active {
    box-shadow: none;
    transform: translate(2px, 2px);
}

#petownApp :where(
    .pet-btn,
    .pet-icon-btn,
    .pet-close,
    .pet-scene-play-exit
):disabled,
#petownApp .pet-btn.pet-btn--pending,
#petownApp [aria-disabled="true"] {
    color: var(--pet-ui-text-muted);
    background: var(--pet-ui-surface-muted);
    box-shadow: 2px 2px 0 var(--pet-ui-text-muted);
    opacity: 0.52;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

#petownApp :where(
    .pet-btn,
    .pet-back,
    .pet-icon-btn,
    .pet-close,
    .pet-scene-play-exit,
    .pet-sheet-target-clear,
    .pet-slot-chip
):focus-visible {
    outline: 2px solid var(--pet-ui-text);
    outline-offset: 3px;
}

#petownApp .pet-btn.primary,
#petownApp .pet-btn.buy-btn {
    color: var(--pet-ui-text);
    background: var(--pet-ui-primary);
}

#petownApp .pet-btn.secondary,
#petownApp .pet-btn.remove-btn {
    color: var(--pet-ui-text);
    background: var(--pet-ui-surface);
}

#petownApp .pet-btn.warn,
#petownApp .pet-btn.move-btn {
    color: var(--pet-ui-text) !important;
    background: var(--pet-ui-warning) !important;
}

#petownApp .pet-btn.danger {
    color: var(--pet-ui-surface);
    background: var(--pet-ui-danger);
}

#petownApp .pet-btn.equip-btn {
    color: var(--pet-ui-text);
    background: var(--pet-ui-success);
}

#petownApp .pet-btn.equipped-btn:disabled {
    color: var(--pet-ui-surface);
    background: var(--pet-ui-text);
    box-shadow: none;
    opacity: 1;
}

#petownApp .pet-sheet-tabs .pet-btn.is-active {
    color: var(--pet-ui-surface);
    background: var(--pet-ui-text);
    box-shadow: inset 0 -4px 0 var(--pet-ui-primary), var(--pet-control-shadow);
}

#petownApp .pet-icon-btn.pet-sound-off {
    color: var(--pet-ui-text);
    background: var(--pet-ui-warning);
}

#petownApp .pet-btn--block {
    width: 100%;
}

#petownApp .pet-btn--large {
    min-height: var(--pet-control-height-lg);
    padding: 12px 20px;
    font-size: 16px;
}

#petownApp .pet-icon-btn--compact {
    min-height: var(--pet-control-height);
    height: var(--pet-control-height);
    padding-right: var(--pet-control-padding-compact-x);
    padding-left: var(--pet-control-padding-compact-x);
    font-size: 12px;
}

#petownApp .pet-btn--mt-sm {
    margin-top: 8px;
}

#petownApp .pet-btn--mt-md {
    margin-top: 12px;
}

#petownApp :where(.pet-sheet-target-clear, .pet-slot-chip) {
    min-height: var(--pet-control-height);
    color: var(--pet-ui-text);
    background: var(--pet-ui-surface);
    border: var(--pet-control-border);
    border-radius: var(--pet-control-radius);
    box-shadow: 2px 2px 0 var(--pet-ui-text);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
    cursor: pointer;
    transition:
        background-color var(--pet-control-duration) ease-out,
        box-shadow var(--pet-control-duration) ease-out,
        transform var(--pet-control-duration) ease-out;
}

#petownApp .pet-slot-chip.is-target {
    color: var(--pet-ui-surface);
    background: var(--pet-ui-text);
    box-shadow: inset 0 -4px 0 var(--pet-ui-primary);
}

@media (hover: hover) and (pointer: fine) {
    #petownApp :where(.pet-sheet-target-clear, .pet-slot-chip):not(.is-target):hover {
        background: var(--pet-ui-surface-muted);
        box-shadow: var(--pet-control-shadow);
        transform: translate(-1px, -1px);
    }
}

#petownApp :where(.pet-sheet-target-clear, .pet-slot-chip):not(.is-target):active {
    box-shadow: none;
    transform: translate(2px, 2px);
}

#petownApp :where(
    .pet-toast,
    .pet-scene-action,
    .pet-scene-play-guide,
    .pet-indoor-away-note
) {
    color: var(--pet-feedback-fg);
    background: var(--pet-feedback-bg);
    border: var(--pet-feedback-border);
    border-radius: var(--pet-feedback-radius);
    box-shadow: var(--pet-feedback-shadow);
    font-family: 'Zpix', 'Pixelify Sans', sans-serif;
}

#petownApp .pet-scene-action.is-success {
    background: var(--pet-ui-success);
}

#petownApp .pet-toast[data-tone="success"] .pet-toast-icon {
    background: var(--pet-ui-success);
}

#petownApp .pet-toast[data-tone="warning"] .pet-toast-icon {
    color: var(--pet-ui-text);
    background: var(--pet-ui-warning);
}

#petownApp .pet-toast[data-tone="error"] .pet-toast-icon {
    background: var(--pet-ui-danger);
}

@media (max-width: 640px) {
    #petownApp :where(
        .pet-btn,
        .pet-back,
        .pet-icon-btn,
        .pet-close,
        .pet-scene-play-exit,
        .pet-sheet-target-clear,
        .pet-slot-chip
    ) {
        min-height: var(--pet-control-height);
    }
}
