/* === PET AREA === */
.pet-detail {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 160px;
    width: 100%;
    z-index: 4;
    pointer-events: none;
}
.pet-info {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 3px;
    pointer-events: auto;
    cursor: pointer;
    height: 100%;
    overflow: hidden;
}
.pet-top {
    display: flex;
    gap: 3px;
    height: 70px;
    overflow: hidden;
}
.hunger-bar-vertical {
    width: 14px;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    flex-direction: column-reverse;
}
.hamburger-treasure {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
}
.hunger-fill-vertical {
    width: 100%;
    background: linear-gradient(180deg, rgba(76, 109, 145, .78) 0%, rgba(39, 63, 93, .90) 40%, rgb(0 110 255 / 96%) 100%);
    border-radius: 5px 5px 0 0;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
}
.hunger-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    transform-origin: center;
    font-size: 0.65em;
    color: #ffdd88;
    white-space: nowrap;
    pointer-events: none;
    z-index: 3;
}
.pet-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 70px;
    position: relative;
}
.pet-avatar {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.pet-treasure-bar {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    bottom: 0;
    left: 0;
}
.pet-name {
    font-size: 0.68em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.progress-bar-bg {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bar-treasure {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(180deg, rgba(76, 109, 145, .78) 0%, rgba(39, 63, 93, .90) 40%, rgb(0 110 255 / 96%) 100%);
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 5px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
}
.treasure-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.65em;
    color: #ffdd88;
    z-index: 3;
    position: relative;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    white-space: nowrap;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 87px;
}
.item-img .revive,
.item-img .repair,
.item-img .battery {
    width: 150px;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 5px;
    filter: drop-shadow(-6px 8px 12px rgba(0, 4, 16, 0.6));
}
.card-exp {
    max-width: 87px;
    height: 14px;
    background: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* ====================== PET SPRITE ====================== */
.pet-area {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.pet-alert-box,
.pet-hunger-box,
.pet-sleep-box {
    position: absolute;
    top: var(--pet-alert-top, 0px);
    left: 0;
    width: 50px;
    height: 50px;
    transform: translateX(-50%);
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
    z-index: 3;
}
.pet-alert-box { display: none; }
.pet-hunger-box { display: none; }
.pet-sleep-box { display: flex; }
.pet-alert-box img,
.pet-hunger-box img,
.pet-sleep-box img {
    width: 38px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}
.direction-text {
    color: white;
    font-size: 1em;
    font-family: monospace;
    white-space: nowrap;
}
.treasure-danger {
    border-color: #ff4444 !important;
    background: rgba(220, 20, 60, 0.7) !important;
    color: #fff !important;
}
.treasure-warn {
    border-color: #ffaa00 !important;
    background: rgba(255, 170, 0, 0.25) !important;
}
.treasure-normal {
    border-color: rgba(255, 215, 0, 0.4) !important;
    background: rgba(0, 0, 0, 0.65) !important;
}
.pet-stats-popup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.pet-stats {
    display: flex;
    width: 100%;
    gap: 8px;
}
.stat-data {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}
.stat-slot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 0.9em;
    color: #ddd;
}
.stat-slot .progress {
    height: 10px;
    width: 100%;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    overflow: hidden;
}
.stat-slot .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fd7e14, #ffc107);
    border-radius: 4px;
}
.stat-chart {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}
.stat-chart canvas {
    width: 100%;
    height: 100%;
}
.gif-treasure {
    animation: pop-up 0.5s ease-out forwards;
}
.pet-sprite {
    position: relative;
    width: var(--frame-w);
    height: var(--frame-h);
    background: var(--sprite-url) 0 var(--y-pos, 0) no-repeat;
    background-size: var(--sheet-w) var(--sheet-h);
    will-change: background-position-x;
}
@keyframes pet-anim {
    from { background-position-x: 0; }
    to   { background-position-x: calc(-1 * var(--frame-w) * var(--anim-frames, 1)); }
}
.pet-canvas {
    width: 100%;
    height: 100%;
}
/* === AREA SÓI === */
.wolf-container {
    position: absolute;
    width: 100%;
    bottom: 0;
    padding: 0;
    margin: 0;
    height: 100px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    --pet-alert-top: 10px;
    pointer-events: none;
    z-index: 2;
}
.wolf-house {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100px;
    pointer-events: none;
}
.wolf-house img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
/* === AREA CÁ MẬP === */
.shark-container {
    position: absolute;
    width: 100%;
    height: 200px;
    bottom: -43px;
    z-index: 2;
    padding: 0;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    --pet-alert-top: 80px;
    pointer-events: none;
}
.shark-container canvas {
	display: block;
	width: 100%;
	height: 100%;
	will-change: transform;
	transform: translate3d(0, 0, 0);
	backface-visibility: hidden;
}
.shark-container .pet-sprite {
    position: relative;
}
.shark-container .pet-sprite::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32%;
    background: linear-gradient(to top, rgba(0, 60, 110, 0.14) 0%, rgba(0, 80, 130, 0.06) 50%, transparent 100%);
    pointer-events: none;
    z-index: 1;
    border-radius: 0 0 8px 8px;
}
.shark-mode .menu-area {
	background: transparent !important;
	position: relative;
	z-index: 3;
}
.shark-mode .wall,
.shark-mode .ground,
.shark-mode .bottom-bg {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
}