﻿.pet-game {
    position: fixed;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    z-index: 10002;
    pointer-events: none;
    font-family: "Sora", "DM Sans", Arial, sans-serif;
}

.pet-character {
    position: fixed;
    left: 0;
    top: 0;
    width: 96px;
    height: 96px;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #222;
    cursor: grab;
    pointer-events: auto;
    z-index: 2;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.pet-ball {
    position: fixed;
    left: 0;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f7ff9e, #c7e13a 62%, #9dbd18 100%);
    box-shadow: inset 0 -3px 4px rgba(0, 0, 0, 0.18), 0 var(--ball-shadow-y, 4px) var(--ball-shadow-blur, 8px) rgba(0, 0, 0, var(--ball-shadow-alpha, 0.22));
    pointer-events: auto;
    cursor: grab;
    z-index: 10001;
    touch-action: none;
}

.pet-ball.is-carried {
    z-index: 10001;
}

.pet-ball::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%);
}

.pet-ball.is-dragging {
    cursor: grabbing;
}

.pet-character:focus,
.pet-character:focus-visible {
    outline: none;
    box-shadow: none;
}

.pet-character *,
.pet-character img,
.pet-character svg {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.pet-character.is-dragging {
    cursor: grabbing;
    box-shadow: none;
}

.pet-character.is-sleeping {
    opacity: 1;
    filter: none;
}

.pet-character.is-sleeping::after {
    content: "Zzz";
    position: absolute;
    right: -6px;
    top: -10px;
    font-size: 12px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.45);
    letter-spacing: 0.02em;
    pointer-events: none;
    animation: zzz-float 1.4s ease-in-out infinite;
}

@keyframes zzz-float {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.35;
    }
    50% {
        transform: translateY(-6px) scale(1.02);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-12px) scale(1.04);
        opacity: 0.2;
    }
}

.pet-character svg {
    width: 68px;
    height: 68px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.pet-art {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.22)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
    transform-origin: center bottom;
    transform: scaleX(var(--pet-flip, 1)) scale(var(--pet-scale-x, 1), var(--pet-scale-y, 1));
    will-change: transform;
}

.pet-character.is-flipped .pet-art {
    --pet-flip: -1;
}

.pet-character img {
    width: 78px;
    height: 78px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.pet-character.is-sequence {
    background: transparent;
    overflow: visible;
}

.pet-character .pet-seq {
    width: 80px;
    height: 80px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.pet-character.is-sprite {
    background: transparent;
    overflow: hidden;
}

.pet-sprite {
    width: 80px;
    height: 80px;
    background-repeat: no-repeat;
    background-position: var(--sprite-x, 0%) var(--sprite-y, 0%);
    background-size: calc(var(--sprite-cols, 1) * 100%) calc(var(--sprite-rows, 1) * 100%);
    display: block;
    pointer-events: none;
}

.pet-bubble {
    position: fixed;
    left: 0;
    top: 0;
    transform: translate(-50%, -100%) scale(0.95);
    background: rgba(20, 20, 20, 0.92);
    color: #ffffff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 3;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.pet-bubble.is-visible {
    opacity: 1;
    transform: translate(-50%, -110%) scale(1);
}

.pet-controls {
    position: fixed;
    left: 24px;
    bottom: 24px;
    right: auto;
    z-index: 10000;
    width: min(210px, calc(100vw - 48px));
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
    color: #111;
}

.sidebar .pet-controls {
    position: static !important;
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 16px;
    background: #ffffff;
    border: 1px solid var(--line, rgba(0, 0, 0, 0.12));
    border-radius: 16px;
    box-shadow: var(--shadow, 0 12px 26px rgba(15, 23, 20, 0.12));
    z-index: auto;
    pointer-events: auto;
}

.sidebar .pet-controls * {
    pointer-events: auto;
}

.sidebar .pet-controls .pet-controls-header {
    display: none;
}

.sidebar .pet-controls .pet-controls-title {
    font-size: 10px;
    letter-spacing: 0.06em;
}

.sidebar .pet-controls .pet-controls-toggle {
    padding: 0;
    font-size: 18px;
    line-height: 1;
    border-radius: 0;
    background: transparent;
    border: 0;
    color: var(--accent-dark, #14543f);
    font-weight: 700;
    cursor: pointer;
}

.sidebar .pet-controls .pet-controls-body {
    display: block;
    padding: 12px 14px 14px;
}

.sidebar .pet-controls .pet-actions {
    flex-direction: column;
    gap: 8px;
}

.sidebar .pet-controls .pet-actions button {
    width: 100%;
}

.pet-controls.pet-controls-sidebar {
    position: static !important;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 16px;
    background: #ffffff;
    border: 1px solid var(--line, rgba(0, 0, 0, 0.12));
    border-radius: 16px;
    box-shadow: var(--shadow, 0 12px 26px rgba(15, 23, 20, 0.12));
}

.pet-controls.pet-controls-sidebar .pet-controls-header {
    display: none;
}

.pet-controls.pet-controls-sidebar .pet-controls-title {
    font-size: 12px;
    letter-spacing: 0.06em;
}

.pet-controls.pet-controls-sidebar .pet-controls-body {
    display: block;
    padding: 12px 14px 14px;
}

.pet-controls.pet-controls-sidebar .pet-actions {
    flex-direction: column;
    gap: 8px;
}

.pet-controls.pet-controls-sidebar .pet-actions button {
    width: 100%;
}

.pet-controls * {
    box-sizing: border-box;
}

.pet-controls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.pet-controls-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pet-controls-toggle {
    border: 0;
    background: #f1f1f1;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.pet-controls-body {
    padding: 10px;
    display: none;
}

.pet-controls.is-open .pet-controls-body {
    display: block;
}

.pet-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.pet-row.mode-row {
    display: none;
}

.pet-row.follow-row {
    display: none;
}

.pet-row label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #444;
}

.pet-row select,
.pet-row input[type="checkbox"] + span {
    font-size: 13px;
}

.pet-row select {
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 0 8px;
    background: #fff;
}

.pet-row.toggle-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.pet-actions {
    display: flex;
    gap: 8px;
}

.pet-actions button {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
}

.pet-actions button.primary {
    background: #111;
    color: #fff;
    border-color: #111;
}

.pet-actions .sleep-btn {
    display: none;
}

@media (max-width: 720px) {
    .pet-character {
        width: 72px;
        height: 72px;
    }

    .pet-character svg {
        width: 52px;
        height: 52px;
    }

    .pet-character img {
        width: 60px;
        height: 60px;
    }

    .pet-character .pet-seq {
        width: 62px;
        height: 62px;
    }

    .pet-sprite {
        width: 62px;
        height: 62px;
    }

    .pet-controls {
        left: 24px;
        bottom: 24px;
        right: auto;
        width: min(210px, calc(100vw - 48px));
    }

    .pet-controls.pet-controls-sidebar {
        width: 100%;
        margin-top: 14px;
    }
}
