/* ═══════════════════════════════════════════════
   VIRTUAL PET
═══════════════════════════════════════════════ */

.pet-wrap {
    max-width: 400px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: opacity 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    overscroll-behavior: none;
}

.pet-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

/* ── HUD ── */

.pet-hud {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    width: 100%;
}

.pet-hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.pet-hud-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pet-hud-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--accent, #6366f1);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

.pet-hud-meta {
    display: flex;
    gap: 0.75rem;
}

.pet-hud-coins { font-size: 0.78rem; color: var(--text2, #334155); white-space: nowrap; }

/* ── Shared mono/muted ── */

.pet-hud-coins,
.pet-hud-age,
.pet-hud-weight,
.pet-hud-meta,
.pet-msg,
.pet-stat-val,
.pet-game-round,
.pet-game-score,
.pet-gmenu-cost,
.pet-shop-desc,
.qr-timer,
.bj-label {
    font-family: var(--font-mono, monospace);
    font-size: 0.72rem;
    color: var(--muted, #64748b);
}

.pet-msg,
.pet-game-round,
.pet-game-score { text-align: center; }
.pet-msg        { min-height: 1.2rem; }
.pet-stat-val   { color: var(--text2, #334155); text-align: right; }

/* ── Shared bold title ── */

.pet-shop-name,
.pet-gmenu-name,
.pet-dead-name,
.pet-modal-title { font-weight: 700; color: var(--text, #0f172a); }

.pet-modal-title       { font-size: 0.95rem; text-align: center; margin: 0; }
.pet-modal-title small { font-weight: 400; color: var(--muted, #64748b); }
.pet-shop-name         { font-size: 0.78rem; }
.pet-gmenu-name        { font-size: 0.85rem; }
.pet-dead-name         { font-size: 1.1rem; margin: 0; }

/* ── Shared muted body text ── */

.pet-dead-text,
.pet-adopt-text,
p:not([class]) {
    font-size: 0.85rem;
    color: var(--muted, #64748b);
    text-align: center;
    line-height: 1.6;
    margin: 0;
}

/* ── Pet display ── */

.pet-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-height: 80px;
}

.pet-face {
    font-size: 3.2rem;
    line-height: 1;
    text-align: center;
    user-select: none;
    animation: petBounce 2s ease-in-out infinite;
}

.pet-face--egg   { animation: petWobble 2.5s ease-in-out infinite; }
.pet-face--sleep { animation: petSleep 3s ease-in-out infinite; }
.pet-face--sick  { animation: petShake 0.4s ease-in-out infinite; }
.pet-face--dead  { animation: none; opacity: 0.5; }

@keyframes petBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes petWobble {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(5deg); }
    75%      { transform: rotate(-5deg); }
}
@keyframes petSleep {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(0.95); opacity: 0.7; }
}
@keyframes petShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-3px); }
    75%      { transform: translateX(3px); }
}

.pet-poops { font-size: 1.1rem; min-height: 1.4rem; letter-spacing: 0.1em; }

.pet-msg.is-urgent {
    color: var(--accent, #6366f1);
    font-weight: 600;
    animation: petPulse 1s ease-in-out infinite;
}

@keyframes petPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ── Stats ── */

.pet-stats { width: 100%; display: flex; flex-direction: column; gap: 0.4rem; }

.pet-stat {
    display: grid;
    grid-template-columns: 4.5rem 1fr 2.5rem;
    align-items: center;
    gap: 0.6rem;
}

.pet-stat--hearts { grid-template-columns: 4.5rem 1fr; }
.pet-stat-label   { font-size: 0.78rem; font-weight: 600; color: var(--muted, #64748b); text-align: right; }
.pet-hearts       { display: flex; gap: 0.3rem; }
.pet-heart        { font-size: 1.1rem; line-height: 1; }
.pet-heart--full  { color: #ef4444; }
.pet-heart--empty { color: var(--border, #e2e8f0); }

.pet-bar       { height: 10px; background: var(--bg3, #f1f5f9); border-radius: 5px; overflow: hidden; border: 1px solid var(--border, #e2e8f0); }
.pet-bar-fill  { height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.pet-bar--disc { background: #8b5cf6; }

/* ── Actions ── */

.pet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    width: 100%;
}

.pet-act {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.4rem 0.2rem;
    justify-content: center;
    white-space: nowrap;
    min-width: 0;
}

.pet-act:disabled { opacity: 0.3; pointer-events: none; }

/* ── Modals ── */

.pet-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    z-index: 10;
    border-radius: var(--radius-lg, 12px);
}

.pet-modal-box {
    background: var(--bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 92%;
    max-width: 320px;
    max-height: 85dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pet-modal-cancel { color: var(--muted, #64748b); font-size: 0.78rem; }
.pet-name-input   { max-width: 220px; text-align: center; }

/* ── Shop ── */

.pet-shop-tabs { display: flex; gap: 0.25rem; }

.pet-tab {
    flex: 1;
    font-size: 0.68rem;
    padding: 0.35rem 0.2rem;
    background: var(--bg3, #f1f5f9);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-sm, 6px);
    color: var(--muted, #64748b);
    cursor: pointer;
    text-align: center;
    font-family: var(--font-base, sans-serif);
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.pet-tab.is-active { background: var(--accent, #6366f1); color: #fff; border-color: var(--accent, #6366f1); }

.pet-shop-list            { display: flex; flex-direction: column; }
.pet-shop-item            { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0; border-bottom: 1px solid var(--border, #e2e8f0); }
.pet-shop-item:last-child { border-bottom: none; }
.pet-shop-info            { flex: 1; min-width: 0; }

.pet-shop-buy {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-sm, 6px);
    background: var(--bg2, #f8fafc);
    color: var(--text, #0f172a);
    cursor: pointer;
    font-family: var(--font-mono, monospace);
    transition: background 0.15s;
}

.pet-shop-buy:hover:not(:disabled) { background: var(--bg3, #f1f5f9); }
.pet-shop-buy:disabled             { opacity: 0.35; cursor: not-allowed; }

/* ── Game menu ── */

.pet-game-menu  { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.pet-gmenu-info { display: flex; flex-direction: column; gap: 0.1rem; }
.pet-gmenu-icon { font-size: 1.5rem; flex-shrink: 0; line-height: 1; }

.pet-game-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
}

.pet-game-menu-btn:disabled { opacity: 0.35; pointer-events: none; }

/* ── Slot machine ── */

.slot-reels { display: flex; justify-content: center; gap: 0.5rem; padding: 0.5rem 0; }

.slot-reel {
    font-size: 2.2rem;
    width: 3.2rem;
    height: 3.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg3, #f1f5f9);
    border: 2px solid var(--border, #e2e8f0);
    border-radius: var(--radius-sm, 6px);
}

.slot-reel--spin { animation: slotSpin 0.12s linear infinite; }
.slot-reel--stop { animation: slotStop 0.25s cubic-bezier(0.2,1.4,0.4,1); }

@keyframes slotSpin {
    0%, 100% { transform: scaleY(1); }
    40%      { transform: scaleY(0.7); }
}
@keyframes slotStop {
    0%   { transform: translateY(-10px) scaleY(0.8); }
    60%  { transform: translateY(3px) scaleY(1.05); }
    100% { transform: translateY(0) scaleY(1); }
}

/* ── Minigame ── */

.pet-game-status {
    min-height: 8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pet-game-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}
.pet-game-actions .btn { flex: 1; justify-content: center; }

.pet-game-prompt       { font-size: 3rem; text-align: center; padding: 0.75rem 0; user-select: none; }
.pet-game-btns         { display: flex; gap: 0.5rem; }
.pet-game-btn          { flex: 1; justify-content: center; }
.pet-game-result       { text-align: center; padding: 0.5rem 0; }
.pet-game-result-face  { font-size: 2.5rem; margin-bottom: 0.25rem; }
.pet-game-result-mini  { font-size: 1.5rem; text-align: center; padding: 0.25rem 0; }
.pet-game-result-label { font-size: 0.9rem; font-weight: 600; color: var(--text, #0f172a); margin-bottom: 0.25rem; }

/* ── Blackjack ── */

.bj-section  { margin-bottom: 0.6rem; text-align: center; }
.bj-label    { font-weight: 600; margin-bottom: 0.3rem; }
.bj-label b  { font-size: 1rem; color: var(--text, #0f172a); font-family: var(--font-base, sans-serif); margin-left: 0.25rem; }
.bj-hand     { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }

.bj-card--new                       { animation: bjDeal 0.22s ease backwards; }
.bj-hand .bj-card--new:nth-child(1) { animation-delay: 0.00s; }
.bj-hand .bj-card--new:nth-child(2) { animation-delay: 0.18s; }
.bj-hand .bj-card--new:nth-child(3) { animation-delay: 0.36s; }
.bj-hand .bj-card--new:nth-child(4) { animation-delay: 0.54s; }

@keyframes bjDeal {
    from { transform: translateY(-16px) scale(0.75); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.bj-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 3.2rem;
    background: var(--bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--text, #0f172a);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    line-height: 1.2;
}

.bj-card b       { font-size: 0.85rem; }
.bj-card--red    { color: #ef4444; }
.bj-card--hidden { background: var(--accent, #6366f1); border-color: var(--accent, #6366f1); color: #fff; font-size: 1.3rem; }

/* ── QR Multiplayer ── */

.qr-code                    { display: flex; justify-content: center; padding: 0.5rem 0; }
.qr-code canvas, .qr-code img {
    max-width: min(256px, 100%);
    width: 100%;
    background: #fff;
    padding: 10px;
    border-radius: var(--radius-sm, 6px);
    box-sizing: content-box;
}

.qr-fallback {
    display: block;
    word-break: break-all;
    font-size: 0.55rem;
    background: var(--bg3, #f1f5f9);
    border-radius: var(--radius-sm, 6px);
    padding: 0.5rem;
    text-align: center;
}

.qr-timer     { text-align: center; min-height: 1.2rem; }
.qr-pin-hint  { text-align: center; font-size: 0.75rem; color: var(--muted, #64748b); margin: 0.4rem 0 0.15rem; }
.qr-pin-error { text-align: center; font-size: 0.75rem; color: #ef4444; margin: 0.15rem 0; }
.qr-pin-display {
    font-size: 2.4rem;
    font-family: var(--font-mono, monospace);
    font-weight: 700;
    letter-spacing: 0.25em;
    text-align: center;
    padding: 0.5rem 0 0.75rem;
    color: var(--text, #0f172a);
}

.qr-scan-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: var(--radius-sm, 6px);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-scan-wrap video { width: 100%; height: 100%; object-fit: cover; }

/* ── Mobile ── */

@media (max-width: 767px) {
    body:has(.pet-wrap) .site-header,
    body:has(.pet-wrap) .site-footer { display: none; }
}