/* ═══════════════════════════════════════════════════════════════════════
   Spirit Familiar Tab
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Egg Hatching Phase ── */
.fam-egg {
    text-align: center; padding: 2.5rem 1.25rem 2rem;
    position: relative; overflow: hidden;
}
/* Subtle top-glow bleed inside the card */
.fam-egg::before {
    content: ''; position: absolute; top: -60%; left: 50%; width: 200%;
    height: 120%; transform: translateX(-50%);
    background: radial-gradient(ellipse, rgba(168, 139, 250, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

.fam-egg__scene {
    position: relative; width: 220px; height: 240px; margin: 0 auto 1.5rem;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    user-select: none; -webkit-user-select: none;
}

/* Outer soft ring */
.fam-egg__ring {
    position: absolute; inset: -40px; border-radius: 50%;
    border: 1px solid rgba(168, 139, 250, 0.08);
    animation: eggRingSpin 20s linear infinite;
    pointer-events: none;
}
.fam-egg__ring::after {
    content: ''; position: absolute; top: 0; left: 50%;
    width: 6px; height: 6px; border-radius: 50%; transform: translate(-50%, -50%);
    background: rgba(168, 139, 250, 0.3);
    box-shadow: 0 0 8px rgba(168, 139, 250, 0.4);
}
@keyframes eggRingSpin { to { transform: rotate(360deg); } }

/* Inner brighter ring */
.fam-egg__ring--inner {
    inset: -20px;
    border-color: rgba(168, 139, 250, 0.05);
    animation-duration: 14s;
    animation-direction: reverse;
}
.fam-egg__ring--inner::after {
    width: 4px; height: 4px;
    background: rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
}

/* Main aura — multi-layered */
.fam-egg__aura {
    position: absolute; inset: -35px; border-radius: 50%;
    background:
        radial-gradient(circle, rgba(168, 139, 250, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 35% 30%, rgba(212, 175, 55, 0.06) 0%, transparent 50%);
    animation: eggPulse 3s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.5s, transform 0.5s;
}
/* Intensify aura as cracks progress (7 stages: 0-6) */
.fam-egg__scene[data-stage="1"] .fam-egg__aura,
.fam-egg__scene[data-stage="2"] .fam-egg__aura { opacity: 0.8; }
.fam-egg__scene[data-stage="3"] .fam-egg__aura {
    background:
        radial-gradient(circle, rgba(168, 139, 250, 0.28) 0%, transparent 55%),
        radial-gradient(circle at 35% 30%, rgba(212, 175, 55, 0.12) 0%, transparent 50%);
    transform: scale(1.05);
}
.fam-egg__scene[data-stage="4"] .fam-egg__aura {
    background:
        radial-gradient(circle, rgba(168, 139, 250, 0.35) 0%, transparent 55%),
        radial-gradient(circle at 35% 30%, rgba(212, 175, 55, 0.18) 0%, transparent 50%);
    transform: scale(1.10);
}
.fam-egg__scene[data-stage="5"] .fam-egg__aura,
.fam-egg__scene[data-stage="6"] .fam-egg__aura {
    background:
        radial-gradient(circle, rgba(168, 139, 250, 0.42) 0%, transparent 55%),
        radial-gradient(circle at 35% 30%, rgba(212, 175, 55, 0.22) 0%, transparent 50%);
    transform: scale(1.18);
}
@keyframes eggPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* Floating particles container */
.fam-egg__particles {
    position: absolute; inset: -30px; pointer-events: none; overflow: hidden;
    border-radius: 50%;
}
.fam-egg__particle {
    position: absolute; border-radius: 50%; opacity: 0;
    animation: eggFloat 4s ease-in-out infinite;
}
@keyframes eggFloat {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 0.7; }
    80% { opacity: 0.4; }
    100% { opacity: 0; transform: translateY(-80px) scale(0); }
}

/* Floor reflection */
.fam-egg__reflect {
    position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
    width: 100px; height: 20px; border-radius: 50%;
    background: radial-gradient(ellipse, rgba(168, 139, 250, 0.12) 0%, transparent 70%);
    filter: blur(4px); pointer-events: none;
    transition: width 0.4s, opacity 0.4s;
}
.fam-egg__scene[data-stage="2"] .fam-egg__reflect,
.fam-egg__scene[data-stage="3"] .fam-egg__reflect {
    width: 130px;
    background: radial-gradient(ellipse, rgba(168, 139, 250, 0.18) 0%, transparent 70%);
}
.fam-egg__scene[data-stage="4"] .fam-egg__reflect,
.fam-egg__scene[data-stage="5"] .fam-egg__reflect,
.fam-egg__scene[data-stage="6"] .fam-egg__reflect {
    width: 150px;
    background: radial-gradient(ellipse, rgba(168, 139, 250, 0.25) 0%, transparent 70%);
}

.fam-egg__img-wrap {
    position: relative; z-index: 2; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s ease;
}
.fam-egg__img-wrap:active { transform: scale(0.96); }
.fam-egg__img {
    width: 180px; height: auto; max-height: 200px;
    object-fit: contain; pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ── Shake intensities (5 levels) ── */
/* Level 1: Gentle wobble */
@keyframes eggWobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
    75% { transform: rotate(-1deg); }
}
.fam-egg__img-wrap--wobble {
    animation: eggWobble 0.45s ease;
}
/* Level 2: Standard shake */
@keyframes eggShake {
    0%, 100% { transform: rotate(0deg); }
    12% { transform: rotate(-6deg) scale(1.02); }
    25% { transform: rotate(5deg) scale(1.02); }
    37% { transform: rotate(-4deg); }
    50% { transform: rotate(4deg); }
    62% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
    87% { transform: rotate(-1deg); }
}
.fam-egg__img-wrap--shake {
    animation: eggShake 0.5s ease;
}
/* Level 3: Hard shake */
@keyframes eggShakeHard {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-10deg) scale(1.03); }
    20% { transform: rotate(9deg) scale(1.04); }
    30% { transform: rotate(-8deg) scale(1.03); }
    40% { transform: rotate(7deg); }
    50% { transform: rotate(-5deg); }
    60% { transform: rotate(4deg); }
    70% { transform: rotate(-3deg); }
    80% { transform: rotate(2deg); }
    90% { transform: rotate(-1deg); }
}
.fam-egg__img-wrap--shake-hard {
    animation: eggShakeHard 0.55s ease;
}
/* Level 4: Rumble */
@keyframes eggRumble {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-3px, 1px) rotate(-8deg) scale(1.04); }
    20% { transform: translate(3px, -1px) rotate(8deg) scale(1.05); }
    30% { transform: translate(-2px, 2px) rotate(-6deg) scale(1.04); }
    40% { transform: translate(2px, -2px) rotate(6deg); }
    50% { transform: translate(-2px, 1px) rotate(-4deg); }
    60% { transform: translate(1px, -1px) rotate(3deg); }
    70% { transform: translate(-1px, 0) rotate(-2deg); }
    80% { transform: translate(1px, 0) rotate(1deg); }
}
.fam-egg__img-wrap--rumble {
    animation: eggRumble 0.55s ease;
}
/* Level 5: Earthquake */
@keyframes eggQuake {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    8% { transform: translate(-5px, 2px) rotate(-12deg) scale(1.06); }
    16% { transform: translate(5px, -3px) rotate(11deg) scale(1.07); }
    24% { transform: translate(-4px, 3px) rotate(-10deg) scale(1.06); }
    32% { transform: translate(4px, -2px) rotate(9deg) scale(1.05); }
    40% { transform: translate(-3px, 2px) rotate(-7deg); }
    48% { transform: translate(3px, -1px) rotate(6deg); }
    56% { transform: translate(-2px, 1px) rotate(-4deg); }
    64% { transform: translate(2px, 0) rotate(3deg); }
    72% { transform: translate(-1px, 0) rotate(-2deg); }
    80% { transform: translate(1px, 0) rotate(1deg); }
}
.fam-egg__img-wrap--quake {
    animation: eggQuake 0.65s ease;
}

/* Burst class (no glow effect — kept for JS compatibility) */
.fam-egg__img-wrap--burst {}

/* Scene pulse class (kept for JS compatibility) */
.fam-egg__scene--pulse {}

/* Crack-shaped particles */
.fam-egg__crack-particle {
    position: absolute; border-radius: 1px; opacity: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(168,139,250,0.6));
    animation: eggCrackFly 0.8s ease-out forwards;
}
@keyframes eggCrackFly {
    0% { opacity: 0.9; transform: rotate(var(--r, 0deg)) translateY(0) scale(1); }
    100% { opacity: 0; transform: rotate(var(--r, 0deg)) translateY(-40px) scale(0.3); }
}

/* Final hatch burst */
@keyframes eggHatch {
    0%  { transform: scale(1); opacity: 1; }
    40% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}
.fam-egg__img-wrap--hatch {
    animation: eggHatch 0.9s ease-out forwards;
}
/* Scene white flash overlay */
@keyframes sceneFlash {
    0% { opacity: 0; }
    30% { opacity: 0.6; }
    100% { opacity: 0; }
}
.fam-egg__flash {
    position: absolute; inset: 0; z-index: 10;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), rgba(168, 139, 250, 0.2));
    border-radius: 50%; pointer-events: none; opacity: 0;
}
.fam-egg__flash--active {
    animation: sceneFlash 0.9s ease-out forwards;
}

.fam-egg__title {
    font-family: var(--font-display); font-size: 1.15rem;
    color: var(--color-text); margin-bottom: 0.25rem;
    letter-spacing: 0.04em;
}
.fam-egg__subtitle {
    font-size: 0.8rem; color: var(--color-text-3);
    letter-spacing: 0.1em; text-transform: uppercase;
    margin-bottom: 0.6rem;
    opacity: 0.7;
}
.fam-egg__hint {
    font-size: 0.95rem; color: var(--color-text-2);
    transition: opacity 0.3s;
    min-height: 1.4em;
}
/* Pulsing hint animation */
@keyframes hintPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
.fam-egg__hint { animation: hintPulse 2.5s ease-in-out infinite; }

/* Progress bar – styled to match the familiar stat bars (hunger/energy/happiness) */
.fam-egg__progress {
    margin-top: 1.25rem; padding: 0 2rem;
}
.fam-egg__progress-bar {
    width: 100%; height: 10px; border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}
.fam-egg__progress-fill {
    height: 100%; width: 0%; border-radius: 4px;
    background: linear-gradient(90deg, #ffb347 0%, #f59e0b 40%, #d97706 100%);
    transition: width 0.4s ease-out;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4), inset 0 -2px 3px rgba(0, 0, 0, 0.2);
    position: relative;
}
/* Cartoonish glare to match stat fill bars */
.fam-egg__progress-fill::after {
    content: '';
    position: absolute; top: 1px; bottom: 1px; left: 2px; width: 40%;
    border-radius: 4px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

/* Divider between egg and text */
.fam-egg__divider {
    width: 40px; height: 1px; margin: 0 auto 1rem;
    background: linear-gradient(90deg, transparent, rgba(168, 139, 250, 0.3), transparent);
}

/* Fade-in for archetype card after hatch */
@keyframes famFadeUp {
    0% { opacity: 0; transform: translateY(24px); }
    100% { opacity: 1; transform: translateY(0); }
}
.fam-choose__card--revealed {
    animation: famFadeUp 0.7s ease-out;
}

/* ── Hatch Card (name your pet after egg cracks) ── */
@keyframes famPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}
.fam-hatch { text-align: center; padding: 2rem 1.25rem; position: relative; }
.fam-hatch__sprite {
    width: 160px; height: 180px; margin: 0 auto 2rem; position: relative;
    overflow: visible;
}
.fam-hatch__sprite .pet-animator__frame {
    width: 120px;
}
/* Baby sprite shown on hatch reveal */
.fam-hatch__baby-img {
    width: 140px; height: auto; max-height: 170px;
    object-fit: contain; pointer-events: none;
    display: block; margin: 0 auto;
    animation: babyBounce 1.2s ease-in-out infinite;
}
@keyframes babyBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.fam-hatch__title {
    font-family: var(--font-display); font-size: 1.1rem;
    color: var(--color-gold); margin-bottom: 0.35rem;
}
.fam-hatch__desc {
    font-size: 0.95rem; color: var(--color-text-2);
    max-width: 320px; margin: 0 auto 1.25rem;
}
.fam-hatch__name-row {
    display: flex; flex-direction: column; gap: 0.75rem; align-items: center;
}
.fam-hatch__name-input { max-width: 240px; text-align: center; }
.fam-hatch__summon-btn { min-width: 180px; }

/* ── Reset button ── */
.fam-reset {
    text-align: center; margin-top: 1.5rem; padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.fam-reset__btn {
    font-size: 0.8rem; padding: 0.4rem 1.2rem;
    color: var(--color-text-3); border-color: rgba(255, 255, 255, 0.08);
}
.fam-reset__btn:hover { color: var(--color-error); border-color: rgba(231, 76, 60, 0.3); }


/* ═══════════════════════════════════════════════════════════════════════
   Familiar Dashboard — Polished Mobile-First Layout
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Top bar: Name + Level | Points ── */
.fam-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem; margin-bottom: 0;
}
.fam-topbar__left {
    display: flex; align-items: baseline; gap: 0.4rem;
}
.fam-topbar__name {
    font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
    color: var(--color-text); letter-spacing: 0.02em;
}
.fam-topbar__level {
    font-family: var(--font-display); font-size: 0.65rem;
    color: var(--color-gold); letter-spacing: 0.08em; text-transform: uppercase;
    background: rgba(212, 175, 55, 0.1); border: 1px solid rgba(212, 175, 55, 0.2);
    padding: 0.15rem 0.5rem; border-radius: 20px;
}
.fam-topbar__right { display: flex; align-items: center; }
.fam-topbar__points {
    display: flex; align-items: center; gap: 0.3rem;
    background: rgba(212, 175, 55, 0.08); border: 1px solid rgba(212, 175, 55, 0.18);
    padding: 0.25rem 0.65rem; border-radius: 20px;
}
.fam-topbar__points-icon { width: 20px; height: 20px; object-fit: contain; }
.fam-topbar__points-count {
    font-family: var(--font-display); font-size: 0.85rem; font-weight: 700;
    color: var(--color-gold);
}
.fam-topbar__points-count--pulse {
    animation: pointsPulse 0.4s ease-out;
}
.fam-topbar__points-count--burst {
    animation: pointsBurst 0.35s ease-out;
}
@keyframes pointsPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #fff; }
    100% { transform: scale(1); }
}
@keyframes pointsBurst {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); text-shadow: 0 0 12px rgba(212,175,55,0.8); }
    100% { transform: scale(1); }
}
/* Points icon burst */
.fam-topbar__points-icon--burst {
    animation: pointsIconBurst 0.35s ease-out;
}
@keyframes pointsIconBurst {
    0% { transform: scale(1); }
    40% { transform: scale(1.5) rotate(15deg); filter: brightness(1.5); }
    100% { transform: scale(1) rotate(0); }
}

/* ── Pet Habitat — full-width nature scene ── */
.fam-habitat {
    position: relative;
    width: 100%;
    min-height: 280px;
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}
.fam-habitat__bg {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 50% 80%, rgba(168, 139, 250, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 20%, rgba(120, 100, 200, 0.08) 0%, transparent 40%),
        linear-gradient(180deg, rgba(25, 20, 50, 0.9) 0%, rgba(15, 12, 35, 0.95) 100%);
    z-index: 0;
}
/* Ground gradient at bottom of habitat */
.fam-habitat__bg::after {
    content: '';
    position: absolute; bottom: 0; left: 0; right: 0; height: 40%;
    background: linear-gradient(180deg, transparent 0%, rgba(168, 139, 250, 0.06) 60%, rgba(168, 139, 250, 0.12) 100%);
    border-radius: 50% 50% 0 0 / 30% 30% 0 0;
}

/* Stat orbs — floating in habitat */
.fam-habitat__stats {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; justify-content: center; gap: 1.25rem;
    padding: 0.75rem 1rem; z-index: 5;
}
.fam-stat-orb {
    display: flex; flex-direction: column; align-items: center;
    width: 48px;
}
/* Ring container — holds icon centered inside */
.fam-stat-orb__ring-wrap {
    position: relative; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.fam-stat-orb img {
    width: 20px; height: 20px; object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
    position: relative; z-index: 2;
}
.fam-stat-orb__ring {
    position: absolute; inset: 0;
    width: 40px; height: 40px; z-index: 1;
}
.fam-stat-orb__ring circle {
    fill: none; stroke-width: 3; stroke-linecap: round;
    transform: rotate(-90deg); transform-origin: 50% 50%;
}
.fam-stat-orb__ring-bg {
    stroke: rgba(255, 255, 255, 0.08);
}
.fam-stat-orb__ring-fill {
    stroke-dasharray: 100.53; /* 2 * PI * 16 */
    stroke-dashoffset: 20; /* default ~80% filled */
    transition: stroke-dashoffset 0.6s ease-out;
}
.fam-stat-orb__ring-fill--hunger { stroke: #f59e0b; filter: drop-shadow(0 0 4px rgba(245,158,11,0.4)); }
.fam-stat-orb__ring-fill--happy { stroke: #c084fc; filter: drop-shadow(0 0 4px rgba(192,132,252,0.4)); }
.fam-stat-orb__ring-fill--energy { stroke: #38bdf8; filter: drop-shadow(0 0 4px rgba(56,189,248,0.4)); }

.fam-stat-orb__val {
    font-family: var(--font-display); font-size: 0.6rem;
    color: var(--color-text-2); letter-spacing: 0.04em;
    margin-top: 2px;
}

/* Scene (pet area) centered in habitat */
.fam-habitat__scene {
    position: relative; z-index: 2;
    width: 100%; height: 200px;
    margin-top: 50px;
}
.fam-habitat__aura {
    position: absolute; inset: -30px; border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 139, 250, 0.12) 0%, transparent 65%);
    animation: famPulse 4s ease-in-out infinite;
    transition: opacity 0.5s;
}
.fam-habitat__sprite {
    position: relative; z-index: 1;
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    overflow: visible;
}
.fam-habitat__mood {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    z-index: 5; font-size: 0.65rem; color: var(--color-text-3);
    display: flex; align-items: center; gap: 4px;
    background: rgba(0,0,0,0.3); padding: 0.15rem 0.6rem; border-radius: 12px;
    backdrop-filter: blur(4px);
}

/* ── Pet Animator (layered sprite renderer) ── */
.pet-animator {
    width: 100%; height: 100%;
    position: relative;
}
.pet-animator__layers {
    position: relative; width: 100%; height: 100%;
}
.pet-animator__frame {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 140px; height: auto;
    max-height: 170px;
    object-fit: contain;
    pointer-events: none;
    image-rendering: auto;
}
/* Gentle idle bob — slow and subtle */
@keyframes petBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
.pet-animator[data-state="idle"] .pet-animator__layers {
    animation: petBob 3.5s ease-in-out infinite;
}
/* Walk bounce */
@keyframes petWalkBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.pet-animator[data-state="walk"] .pet-animator__layers {
    animation: petWalkBounce 0.35s ease-in-out infinite;
}
/* Happy pop */
@keyframes petHappyPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.12); }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}
.pet-animator[data-state="happy"] .pet-animator__layers {
    animation: petHappyPop 0.6s ease-out;
}
/* Sad droop */
.pet-animator[data-state="sad"] .pet-animator__layers {
    transform: translateY(3px);
    filter: brightness(0.85) saturate(0.8);
    transition: transform 0.5s, filter 0.5s;
}
/* Sleep sway */
@keyframes petSleepSway {
    0%, 100% { transform: rotate(0deg) translateY(2px); }
    50% { transform: rotate(-3deg) translateY(0); }
}
.pet-animator[data-state="sleep"] .pet-animator__layers {
    animation: petSleepSway 3s ease-in-out infinite;
    filter: brightness(0.75);
}
/* Celebrate burst */
@keyframes petCelebrate {
    0% { transform: scale(1) rotate(0); }
    25% { transform: scale(1.15) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(5deg); }
    75% { transform: scale(1.15) rotate(-3deg); }
    100% { transform: scale(1) rotate(0); }
}
.pet-animator[data-state="celebrate"] .pet-animator__layers {
    animation: petCelebrate 0.8s ease-out;
}

/* Flip sprite for walking right */
.fam-sprite--flip .pet-animator__layers {
    transform: scaleX(-1);
}

/* Shake feedback when tapping sleeping pet */
.fam-sprite--shake {
    animation: petSleepShake 0.4s ease-out;
}
@keyframes petSleepShake {
    0%   { transform: translateX(0); }
    15%  { transform: translateX(-4px) rotate(-1deg); }
    30%  { transform: translateX(4px) rotate(1deg); }
    45%  { transform: translateX(-3px); }
    60%  { transform: translateX(3px); }
    75%  { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

.fam-sprite--wiggle {
    animation: petWiggle 0.6s ease-in-out;
}
@keyframes petWiggle {
    0%   { transform: translateX(0) rotate(0); }
    15%  { transform: translateX(-3px) rotate(-2deg); }
    30%  { transform: translateX(3px) rotate(2deg); }
    45%  { transform: translateX(-2px) rotate(-1.5deg); }
    60%  { transform: translateX(2px) rotate(1.5deg); }
    75%  { transform: translateX(-1px) rotate(-0.5deg); }
    100% { transform: translateX(0) rotate(0); }
}

/* ═══════════════════════════════════════════════════════════════════════
   Companion Sprites
   ═══════════════════════════════════════════════════════════════════════ */
.companion-sprite {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    /* No default transition — JS state machine handles movement directly */
}
.companion-sprite__img {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: auto;
}

/* Cat (Mochi) — ground level, offset to bottom-right of pet center */
.companion-sprite--ground {
    bottom: 2px;
    left: calc(50% + 50px);
    width: 38px;
}
/* Ghost (Lumie) — floating, offset above-left of pet center */
.companion-sprite--floating {
    top: 15%;
    left: calc(50% - 55px);
    width: 34px;
}
/* Gentle bob for ghost when not orbiting (fallback) */
.companion-sprite--floating .companion-sprite__img {
    animation: companionBob 2.5s ease-in-out infinite;
}
@keyframes companionBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* Mirror companion when pet flips */
.fam-sprite--flip .companion-sprite--ground {
    left: calc(50% - 70px);
}
.fam-sprite--flip .companion-sprite--floating {
    left: calc(50% + 35px);
}

/* Stage companion (inside feed/play/butterfly animation stages) */
.stage-companion {
    transition: left 1.5s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.3s ease;
}

/* Responsive scaling */
@media (min-width: 500px) {
    .companion-sprite--ground { width: 46px; left: calc(50% + 55px); }
    .companion-sprite--floating { width: 40px; }
}
@media (min-width: 768px) {
    .companion-sprite--ground { width: 52px; left: calc(50% + 60px); }
    .companion-sprite--floating { width: 46px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Care Action Pills (row below habitat)
   ═══════════════════════════════════════════════════════════════════════ */
.fam-care-row {
    display: flex; gap: 0.5rem; padding: 0 0.5rem; margin-bottom: 0.75rem;
    justify-content: center;
}
.fam-care-pill {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 50px;
    background: rgba(168, 139, 250, 0.08);
    border: 1.5px solid rgba(168, 139, 250, 0.2);
    color: var(--color-text);
    font-family: var(--font-display);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative; overflow: hidden;
}
.fam-care-pill:hover {
    background: rgba(168, 139, 250, 0.15);
    border-color: rgba(168, 139, 250, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 139, 250, 0.15);
}
.fam-care-pill:active { transform: scale(0.95) translateY(0); }
.fam-care-pill__icon { display: flex; align-items: center; }
.fam-care-pill__icon img { width: 26px; height: 26px; object-fit: contain; }
.fam-care-pill__label {
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
}
/* Cooldown state */
.fam-care-pill--cooldown {
    pointer-events: auto; border-color: rgba(168, 139, 250, 0.08);
}
.fam-care-pill--cooldown .fam-care-pill__icon,
.fam-care-pill--cooldown .fam-care-pill__label {
    opacity: 0;
}
.fam-care-pill--maxed {
    opacity: 0.35; border-color: rgba(255,255,255,0.05);
    pointer-events: none;
}
.fam-care-pill__cooldown {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 0.65rem; color: rgba(255,255,255,0.5);
    background: rgba(10, 10, 15, 0.85); border-radius: 50px;
    letter-spacing: 0.06em; z-index: 3;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════
   Quick Nav Grid (icon tiles)
   ═══════════════════════════════════════════════════════════════════════ */
.fam-nav-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem; padding: 0 0.5rem; margin-bottom: 0.75rem;
}
.fam-nav-tile {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 0.65rem 0.25rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.fam-nav-tile:hover {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.fam-nav-tile:active { transform: scale(0.93); }
.fam-nav-tile__icon { display: flex; align-items: center; justify-content: center; }
.fam-nav-tile__icon img { width: 32px; height: 32px; object-fit: contain; }
.fam-nav-tile__label {
    font-family: var(--font-display); font-size: 0.55rem;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--color-text-3);
}

/* ═══════════════════════════════════════════════════════════════════════
   Goals Card (polished)
   ═══════════════════════════════════════════════════════════════════════ */
.fam-goals-card {
    background: rgba(20, 20, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px; padding: 1rem 1rem 0.75rem;
    margin: 0 0.25rem 0.75rem;
}
.fam-goals-card__header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.6rem;
}
.fam-goals-card__title-row {
    display: flex; align-items: center; gap: 0.4rem;
}
.fam-goals-card__title-row img { width: 22px; height: 22px; object-fit: contain; }
.fam-goals-card__title {
    font-family: var(--font-display); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--color-text);
}
.fam-goals-card__add-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(168, 139, 250, 0.12);
    border: 1.5px solid rgba(168, 139, 250, 0.25);
    transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}
.fam-goals-card__add-btn:hover {
    background: rgba(168, 139, 250, 0.2);
    border-color: rgba(168, 139, 250, 0.4);
}
.fam-goals-card__add-btn img { width: 18px; height: 18px; object-fit: contain; }

.fam-goals-card__list { min-height: 30px; }

/* ═══════════════════════════════════════════════════════════════════════
   View Switching & Sub-page Layout
   ═══════════════════════════════════════════════════════════════════════ */
.fam-view { display: none; }
.fam-view--active { display: block; }

/* Sub-page header (back arrow + title) */
.fam-subpage-header {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.5rem 0.75rem;
}
.fam-back-pill {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-2);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.fam-back-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--color-text);
}
.fam-back-pill:active { transform: scale(0.9); }
.fam-back-pill svg { display: block; }

.fam-subpage-header__title {
    font-family: var(--font-display); font-size: 0.85rem;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--color-text);
}
.fam-subpage-header__points {
    margin-left: auto;
    font-family: var(--font-display); font-size: 0.7rem;
    color: var(--color-gold); letter-spacing: 0.04em;
    background: rgba(212, 175, 55, 0.08); border: 1px solid rgba(212, 175, 55, 0.18);
    padding: 0.2rem 0.6rem; border-radius: 20px;
}
.fam-subpage-header__count {
    margin-left: auto;
    font-family: var(--font-display); font-size: 0.6rem;
    color: var(--color-text-3); letter-spacing: 0.04em;
}

/* Sub-page card wrapper */
.fam-subpage-card {
    background: rgba(20, 20, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px; padding: 1rem;
    margin: 0 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   Category Tabs (shared by shop & inventory)
   ═══════════════════════════════════════════════════════════════════════ */
.fam-tab-row {
    display: flex; gap: 0.3rem; margin-bottom: 0.75rem;
}
.fam-tab {
    flex: 1; padding: 0.45rem 0.25rem;
    border: 1.5px solid rgba(167, 139, 250, 0.12);
    border-radius: 50px; background: transparent; color: var(--color-text-3);
    font-family: var(--font-display); font-size: 0.55rem; text-transform: uppercase;
    letter-spacing: 0.05em; cursor: pointer; transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.fam-tab:hover { border-color: rgba(167, 139, 250, 0.3); color: var(--color-text-2); }
.fam-tab--active {
    border-color: rgba(167, 139, 250, 0.5);
    background: rgba(167, 139, 250, 0.12);
    color: var(--color-text);
}
/* Legacy class alias */
.fam-shop__tab { /* keeping for JS compat */ }
.fam-shop__tab--active { /* keeping for JS compat */ }

/* Shop grid */
.fam-shop__grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
}
.fam-shop__item {
    display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
    padding: 0.75rem 0.25rem; border-radius: var(--radius);
    border: 1.5px solid rgba(167, 139, 250, 0.15);
    background: rgba(167, 139, 250, 0.04);
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent; cursor: pointer; position: relative;
}
.fam-shop__item:hover { border-color: rgba(167, 139, 250, 0.35); background: rgba(167, 139, 250, 0.08); }
.fam-shop__item:active { transform: scale(0.95); }
.fam-shop__item--owned { border-color: rgba(76, 175, 80, 0.3); background: rgba(76, 175, 80, 0.06); }
.fam-shop__item--owned::after {
    content: 'OWNED'; position: absolute; top: 4px; right: 4px;
    font-family: var(--font-display); font-size: 0.4rem; text-transform: uppercase;
    padding: 1px 4px; border-radius: 3px;
    background: rgba(76, 175, 80, 0.2); color: #4caf50; letter-spacing: 0.04em;
}
.fam-shop__item--empty {
    border-style: dashed; border-color: rgba(167, 139, 250, 0.1);
    background: transparent; pointer-events: none; min-height: 90px;
}
.fam-shop__item-icon img { width: 48px; height: 48px; object-fit: contain; }
.fam-shop__item-name {
    font-family: var(--font-display); font-size: 0.6rem;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-2);
}
.fam-shop__item-cost {
    font-family: var(--font-display); font-size: 0.55rem;
    color: var(--color-gold);
}

/* ── Rarity badge (top-left of item card) ── */
.fam-shop__item-rarity {
    position: absolute; top: 4px; left: 4px;
    font-family: var(--font-display); font-size: 0.38rem; text-transform: uppercase;
    padding: 1px 5px; border-radius: 3px; letter-spacing: 0.05em;
    pointer-events: none;
}
.fam-shop__item-rarity--common    { background: rgba(160,160,170,0.15); color: #9e9eaa; }
.fam-shop__item-rarity--uncommon  { background: rgba(76,175,80,0.15);  color: #66bb6a; }
.fam-shop__item-rarity--epic      { background: rgba(156,39,176,0.18); color: #ce93d8; }
.fam-shop__item-rarity--legendary { background: rgba(255,183,0,0.18);  color: #ffc107; }

/* ── Rarity border glow on item cards ── */
.fam-shop__item--common {
    border-color: rgba(160,160,170,0.18);
}
.fam-shop__item--uncommon {
    border-color: rgba(76,175,80,0.3);
    box-shadow: 0 0 6px rgba(76,175,80,0.08);
}
.fam-shop__item--epic {
    border-color: rgba(156,39,176,0.3);
    box-shadow: 0 0 8px rgba(156,39,176,0.12);
}
.fam-shop__item--legendary {
    border-width: 2px;
    border-color: rgba(255,183,0,0.45);
    box-shadow: 0 0 12px rgba(255,183,0,0.15), inset 0 0 8px rgba(255,183,0,0.04);
    background: linear-gradient(135deg, rgba(255,183,0,0.06) 0%, rgba(167,139,250,0.04) 100%);
}
.fam-shop__item--legendary:hover {
    border-color: rgba(255,183,0,0.6);
    box-shadow: 0 0 16px rgba(255,183,0,0.22), inset 0 0 12px rgba(255,183,0,0.06);
}
.fam-shop__item--epic:hover {
    border-color: rgba(156,39,176,0.5);
    box-shadow: 0 0 12px rgba(156,39,176,0.18);
}
.fam-shop__item--uncommon:hover {
    border-color: rgba(76,175,80,0.5);
    box-shadow: 0 0 8px rgba(76,175,80,0.15);
}

/* ── Rarity filter pills ── */
.fam-rarity-filters {
    display: flex; gap: 0.35rem; padding: 0.5rem 0 0.25rem;
    flex-wrap: wrap; justify-content: center;
}
.fam-rarity-pill {
    font-family: var(--font-display); font-size: 0.5rem; text-transform: uppercase;
    letter-spacing: 0.06em; padding: 4px 10px; border-radius: 20px;
    border: 1.5px solid rgba(167,139,250,0.15); background: rgba(167,139,250,0.04);
    color: var(--color-text-2); cursor: pointer;
    transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}
.fam-rarity-pill:hover { background: rgba(167,139,250,0.1); }
.fam-rarity-pill--active {
    background: rgba(167,139,250,0.15); border-color: rgba(167,139,250,0.4);
    color: var(--color-text);
}
.fam-rarity-pill--common    { border-color: rgba(160,160,170,0.2); color: #9e9eaa; }
.fam-rarity-pill--uncommon  { border-color: rgba(76,175,80,0.2);  color: #66bb6a; }
.fam-rarity-pill--epic      { border-color: rgba(156,39,176,0.2); color: #ce93d8; }
.fam-rarity-pill--legendary { border-color: rgba(255,183,0,0.25); color: #ffc107; }
.fam-rarity-pill--common.fam-rarity-pill--active    { background: rgba(160,160,170,0.12); border-color: rgba(160,160,170,0.4); }
.fam-rarity-pill--uncommon.fam-rarity-pill--active   { background: rgba(76,175,80,0.12);  border-color: rgba(76,175,80,0.45); }
.fam-rarity-pill--epic.fam-rarity-pill--active       { background: rgba(156,39,176,0.12); border-color: rgba(156,39,176,0.45); }
.fam-rarity-pill--legendary.fam-rarity-pill--active  { background: rgba(255,183,0,0.12);  border-color: rgba(255,183,0,0.5); }

/* ── Rarity divider (gap between filtered and rest) ── */
.fam-shop__rarity-divider {
    grid-column: 1 / -1;
    height: 1px;
    margin: 0.5rem 0;
    background: linear-gradient(90deg, transparent, rgba(167,139,250,0.15) 30%, rgba(167,139,250,0.15) 70%, transparent);
}

/* Shop purchase modal */
.shop-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.shop-modal {
    background: rgba(20, 20, 35, 0.95); border-radius: 24px;
    border: 1.5px solid rgba(167, 139, 250, 0.2);
    padding: 2rem 1.5rem; max-width: 300px; width: 90%; text-align: center;
    box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 60px rgba(168, 139, 250, 0.08);
    backdrop-filter: blur(12px);
}
.shop-modal__preview { margin-bottom: 0.75rem; }
.shop-modal__preview img { width: 80px; height: 80px; object-fit: contain; }
.shop-modal__title {
    font-family: var(--font-display); font-size: 0.9rem; color: var(--color-text);
    margin: 0 0 0.35rem;
}
.shop-modal__rarity {
    display: inline-block; font-family: var(--font-display); font-size: 0.5rem;
    text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px;
    border-radius: 4px; margin-bottom: 0.4rem;
}
.shop-modal__rarity--common    { background: rgba(160,160,170,0.15); color: #9e9eaa; }
.shop-modal__rarity--uncommon  { background: rgba(76,175,80,0.15);  color: #66bb6a; }
.shop-modal__rarity--epic      { background: rgba(156,39,176,0.18); color: #ce93d8; }
.shop-modal__rarity--legendary { background: rgba(255,183,0,0.18);  color: #ffc107; }
.shop-modal__desc {
    font-size: 0.7rem; color: var(--color-text-3); margin: 0 0 0.5rem;
}
.shop-modal__price {
    font-family: var(--font-display); font-size: 0.75rem; color: var(--color-gold);
    margin: 0 0 1rem;
}
.shop-modal__actions { display: flex; gap: 0.5rem; }
.shop-modal__btn {
    flex: 1; padding: 0.65rem; border-radius: 14px; border: none;
    font-family: var(--font-display); font-size: 0.7rem; cursor: pointer;
    text-transform: uppercase; letter-spacing: 0.06em;
    transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}
.shop-modal__btn--cancel {
    background: rgba(255,255,255,0.06); color: var(--color-text-3);
    border: 1px solid rgba(255,255,255,0.08);
}
.shop-modal__btn--cancel:hover { background: rgba(255,255,255,0.12); }
.shop-modal__btn--buy {
    background: linear-gradient(135deg, #a88bfa, #7c5ce0); color: #fff;
    box-shadow: 0 4px 16px rgba(168, 139, 250, 0.25);
}
.shop-modal__btn--buy:hover { filter: brightness(1.1); box-shadow: 0 6px 24px rgba(168, 139, 250, 0.35); }

/* ── Purchase celebration modal ── */
.celebrate-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.3s ease;
}
.celebrate-modal__confetti {
    position: absolute; inset: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
}
.celebrate-modal {
    position: relative; z-index: 1;
    background: rgba(20, 20, 35, 0.96); border-radius: 28px;
    border: 2px solid rgba(167, 139, 250, 0.35);
    padding: 2rem 1.75rem 1.5rem; max-width: 320px; width: 90%; text-align: center;
    box-shadow: 0 16px 64px rgba(0,0,0,0.6), 0 0 80px rgba(168, 139, 250, 0.12);
    animation: celebratePopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes celebratePopIn {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.celebrate-modal__sparkle {
    font-size: 2rem; margin-bottom: 0.25rem;
    animation: celebratePulse 1.2s ease-in-out infinite;
}
@keyframes celebratePulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
}
.celebrate-modal__preview { margin-bottom: 0.75rem; }
.celebrate-modal__preview img {
    width: 96px; height: 96px; object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(168, 139, 250, 0.3));
    animation: celebrateFloat 2s ease-in-out infinite;
}
@keyframes celebrateFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.celebrate-modal__title {
    font-family: var(--font-display); font-size: 1.1rem;
    background: linear-gradient(135deg, #fbbf24, #f472b6, #a78bfa);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; margin: 0 0 0.25rem;
}
.celebrate-modal__item {
    font-family: var(--font-display); font-size: 0.8rem;
    color: var(--color-text); margin: 0 0 1.25rem;
}
.celebrate-modal__actions {
    display: flex; flex-direction: column; gap: 0.5rem;
}
.celebrate-modal__btn {
    width: 100%; padding: 0.7rem; border-radius: 14px; border: none;
    font-family: var(--font-display); font-size: 0.7rem; cursor: pointer;
    text-transform: uppercase; letter-spacing: 0.06em;
    transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}
.celebrate-modal__btn--equip {
    background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1a2e;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.3);
    font-size: 0.75rem;
}
.celebrate-modal__btn--equip:hover {
    filter: brightness(1.1); box-shadow: 0 6px 24px rgba(251, 191, 36, 0.4);
}
.celebrate-modal__btn--ok {
    background: rgba(255,255,255,0.08); color: var(--color-text-3);
    border: 1px solid rgba(255,255,255,0.1);
}
.celebrate-modal__btn--ok:hover { background: rgba(255,255,255,0.15); }

/* Inventory equip / summon button */
.inv-slot__equip-btn {
    position: absolute; bottom: 0; left: 0; right: 0;
    font-family: var(--font-display); font-size: 0.5rem; text-transform: uppercase;
    padding: 5px 0; border: none; cursor: pointer;
    letter-spacing: 0.05em; transition: all 0.2s;
    border-radius: 0 0 8px 8px;
    width: 100%; text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.inv-slot__equip-btn--equip {
    background: linear-gradient(135deg, #a88bfa, #7c5ce0); color: #fff;
}
.inv-slot__equip-btn--equip:active {
    background: linear-gradient(135deg, #9577ed, #6a4bc8);
}
.inv-slot__equip-btn--unequip {
    background: rgba(244, 67, 54, 0.25); color: #f44336;
}
.inv-slot__equip-btn--unequip:active {
    background: rgba(244, 67, 54, 0.4);
}
.inv-slot--equipped {
    border-color: rgba(167, 139, 250, 0.5) !important;
    background: rgba(167, 139, 250, 0.1) !important;
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.2);
}
.inv-slot--equipped::before {
    content: 'EQUIPPED'; position: absolute; top: 3px; right: 3px;
    font-family: var(--font-display); font-size: 0.35rem; text-transform: uppercase;
    padding: 1px 4px; border-radius: 3px; z-index: 1;
    background: rgba(167, 139, 250, 0.25); color: #a88bfa; letter-spacing: 0.04em;
}

/* Placeholder text for coming-soon panels */
.fam-placeholder {
    text-align: center; padding: 2rem 1rem;
    font-size: 0.85rem; color: var(--color-text-3);
    font-style: italic;
}

/* ── Legacy display names (kept for compat) ── */
.fam-display__name {
    font-family: var(--font-display); font-size: 1rem; color: var(--color-text);
    line-height: 1.2;
}
.fam-display__level {
    font-family: var(--font-display); font-size: 0.6rem;
    letter-spacing: 0.08em; text-transform: uppercase;
    padding: 0.15rem 0.5rem; border-radius: 10px;
    background: rgba(212, 175, 55, 0.12); color: var(--color-gold);
}
.fam-display__mood { display: none; }

/* ── Legacy stat bars (care sub-page) ── */
.fam-stats--side {
    display: flex; flex-direction: row; gap: 0.5rem;
    align-items: flex-end; flex-shrink: 0;
}
.fam-stat--vertical {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.fam-stat__icon { flex-shrink: 0; line-height: 1; display: flex; align-items: center; }
.fam-stat__icon img { width: 22px; height: 22px; object-fit: contain; }
.fam-stat__bar--vert {
    width: 20px; height: 130px; position: relative;
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.05);
    overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end;
}
.fam-stat__fill {
    width: 100%; border-radius: 8px;
    transition: height 0.6s ease;
    position: relative;
}
.fam-stat__fill::after {
    content: '';
    position: absolute; top: 3px; bottom: 3px; left: 2px; width: 40%;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}
.fam-stat__fill--hunger {
    background: linear-gradient(180deg, #ffb347 0%, #f59e0b 40%, #d97706 100%);
    box-shadow: 0 0 8px rgba(245,158,11,0.4), inset 0 -2px 3px rgba(0,0,0,0.2);
}
.fam-stat__fill--happiness {
    background: linear-gradient(180deg, #f9a8d4 0%, #f472b6 40%, #db2777 100%);
    box-shadow: 0 0 8px rgba(244,114,182,0.4), inset 0 -2px 3px rgba(0,0,0,0.2);
}
.fam-stat__fill--energy {
    background: linear-gradient(180deg, #93c5fd 0%, #60a5fa 40%, #2563eb 100%);
    box-shadow: 0 0 8px rgba(96,165,250,0.4), inset 0 -2px 3px rgba(0,0,0,0.2);
}
.fam-stat__val {
    font-family: var(--font-display); font-size: 0.55rem;
    color: var(--color-text-2); text-align: center;
}

/* Legacy points badge (keeping for JS compat) */
.fam-points {
    display: flex; align-items: center; justify-content: center; gap: 0.2rem;
}
.fam-points__icon { display: flex; align-items: center; }
.fam-points__icon img { width: 20px; height: 20px; object-fit: contain; }
.fam-points__count {
    font-family: var(--font-display); font-size: 1.1rem;
    color: var(--color-gold); font-weight: 700;
    transition: transform 0.3s ease;
}
.fam-points__count--pulse { animation: pointsPulse 0.5s ease; }
.fam-points__count--burst { animation: pointsBurst 0.35s ease-out; }
.fam-points__icon--burst { animation: pointsIconBurst 0.35s ease-out; }
.fam-points__label {
    font-family: var(--font-display); font-size: 0.6rem;
    color: var(--color-text-3); text-transform: uppercase; letter-spacing: 0.06em;
}

/* Care Actions — grid (sub-page) */
.fam-care__grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem;
}
.fam-care__btn {
    display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
    padding: 0.4rem 0.15rem; border-radius: var(--radius-sm);
    border: 1.5px solid rgba(212, 175, 55, 0.1);
    background: rgba(212, 175, 55, 0.03);
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent; position: relative;
    aspect-ratio: 1; justify-content: center;
}
.fam-care__btn:hover { border-color: rgba(212, 175, 55, 0.25); background: rgba(212, 175, 55, 0.06); }
.fam-care__btn:active { transform: scale(0.95); }
.fam-care__btn--maxed {
    opacity: 0.35; pointer-events: none;
    border-color: rgba(46, 204, 113, 0.2);
}
.fam-care__btn--premium { border-color: rgba(167, 139, 250, 0.2); }
.fam-care__btn--premium:hover { border-color: rgba(167, 139, 250, 0.4); background: rgba(167, 139, 250, 0.06); }
.fam-care__btn-icon { line-height: 1; display: flex; align-items: center; justify-content: center; }
.fam-care__btn-icon img { width: 28px; height: 28px; object-fit: contain; }
.fam-care__btn-label {
    font-family: var(--font-display); font-size: 0.55rem;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-2);
}
.fam-care__btn-uses {
    font-family: var(--font-display); font-size: 0.5rem;
    color: var(--color-text-3); letter-spacing: 0.04em;
}
.fam-care__btn-cost {
    font-family: var(--font-display); font-size: 0.5rem;
    color: var(--color-gold); letter-spacing: 0.04em;
}
.fam-care__btn-cooldown {
    font-family: var(--font-display); font-size: 0.6rem; font-weight: 600;
    color: #e74c3c; letter-spacing: 0.04em;
    margin-top: 2px;
    animation: cooldown-pulse 2s ease-in-out infinite;
}
@keyframes cooldown-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.fam-care__btn--cooldown {
    opacity: 0.7; pointer-events: auto; cursor: default;
    border-color: rgba(231, 76, 60, 0.25);
    background: rgba(231, 76, 60, 0.04);
}
.fam-care__btn--cooldown .fam-care__btn-icon img {
    filter: grayscale(0.6) brightness(0.7);
}
.fam-care__btn--cooldown .fam-care__btn-label {
    color: var(--color-text-3);
}

/* Daily Progress */
.fam-progress__streak {
    margin-left: auto; font-size: 0.8rem; color: var(--color-gold);
    display: inline-flex; align-items: center; gap: 4px;
}
.fam-progress__streak img { width: 16px; height: 16px; object-fit: contain; }
.fam-progress__bar-wrap { display: flex; align-items: center; gap: 0.75rem; }
.fam-progress__bar {
    flex: 1; height: 10px; border-radius: 5px;
    background: rgba(255, 255, 255, 0.06); overflow: hidden;
}
.fam-progress__fill {
    height: 100%; border-radius: 5px;
    background: linear-gradient(90deg, var(--color-gold-dark), var(--color-gold-light));
    transition: width 0.6s ease;
}
.fam-progress__pct {
    font-family: var(--font-display); font-size: 0.7rem;
    color: var(--color-gold); min-width: 32px; text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════
   Task / Goal Items (polished, prominent)
   ═══════════════════════════════════════════════════════════════════════ */
.fam-tasks__add-btn { margin-left: auto; }
.fam-tasks__list,
.fam-goals-card__list { display: flex; flex-direction: column; gap: 0.4rem; }

.fam-task {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.65rem 0.65rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    position: relative;
}
.fam-task:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}
.fam-task:active { transform: scale(0.99); }

.fam-task__emoji {
    font-size: 1.2rem; flex-shrink: 0; width: 28px; text-align: center; line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.fam-task__check {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid rgba(168, 139, 250, 0.3);
    background: transparent; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    font-size: 0.7rem; color: transparent;
}
.fam-task__check:hover {
    border-color: rgba(168, 139, 250, 0.6);
    background: rgba(168, 139, 250, 0.1);
    transform: scale(1.1);
}
.fam-task--done .fam-task__check {
    background: linear-gradient(135deg, rgba(168, 139, 250, 0.3), rgba(212, 175, 55, 0.3));
    border-color: var(--color-gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}
.fam-task__check img { width: 16px; height: 16px; object-fit: contain; }

.fam-task__body { flex: 1; min-width: 0; }
.fam-task__text {
    font-size: 0.9rem; color: var(--color-text);
    transition: opacity 0.2s; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.3;
}
.fam-task--done .fam-task__text { opacity: 0.4; text-decoration: line-through; }
.fam-task--done {
    background: rgba(168, 139, 250, 0.04);
    border-color: rgba(168, 139, 250, 0.1);
}

.fam-task__bar {
    height: 3px; border-radius: 2px; margin-top: 0.3rem;
    background: rgba(255, 255, 255, 0.06); overflow: hidden;
}
.fam-task__bar-fill {
    height: 100%; border-radius: 2px; width: 0%;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.fam-task__meta {
    display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0;
}
.fam-task__xp {
    font-family: var(--font-display); font-size: 0.6rem;
    color: var(--color-gold); letter-spacing: 0.04em;
    background: rgba(212, 175, 55, 0.08);
    padding: 0.1rem 0.4rem; border-radius: 8px;
}
.fam-task__edit-btn {
    width: 24px; height: 24px; border: none; background: none;
    color: var(--color-text-3); cursor: pointer; padding: 0;
    font-size: 0.8rem; opacity: 0; transition: opacity 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.fam-task:hover .fam-task__edit-btn { opacity: 1; }
.fam-task__edit-btn:hover { color: var(--color-gold); }

.fam-tasks__empty {
    text-align: center; padding: 2rem 1rem;
    font-size: 0.85rem; color: var(--color-text-3);
    font-style: italic;
}

/* Task Modal */
.fam-modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.fam-modal {
    background: var(--color-surface); border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: var(--radius-lg); padding: 1.5rem;
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column; gap: 0.85rem;
    max-height: 85vh; overflow-y: auto;
}
.fam-modal__title {
    font-family: var(--font-display); font-size: 0.85rem;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-gold);
    text-align: center;
}
.fam-modal__field { display: flex; flex-direction: column; }
.fam-modal__label {
    font-family: var(--font-display); font-size: 0.6rem;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-3);
    margin-bottom: 0.35rem;
}
.fam-modal__select {
    width: 100%; padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: var(--radius-sm); color: var(--color-text);
}

/* Emoji Picker */
.fam-modal__emoji-row { position: relative; }
.fam-modal__emoji-preview {
    width: 44px; height: 44px; font-size: 1.4rem;
    border: 1.5px solid rgba(212, 175, 55, 0.15); border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s;
}
.fam-modal__emoji-preview:hover { border-color: rgba(212, 175, 55, 0.3); }
.fam-modal__emoji-grid {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.2rem;
    padding: 0.5rem; margin-top: 0.35rem;
    background: rgba(20, 20, 35, 0.95); border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: var(--radius-sm); max-height: 160px; overflow-y: auto;
}
.fam-modal__emoji-option {
    width: 32px; height: 32px; font-size: 1.1rem; border: none;
    background: transparent; border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.fam-modal__emoji-option:hover { background: rgba(212, 175, 55, 0.1); }
.fam-modal__emoji-option--active { background: rgba(212, 175, 55, 0.2); }

/* Color Picker */
.fam-modal__color-row { display: flex; align-items: center; gap: 0.75rem; }
.fam-modal__color-input {
    width: 44px; height: 34px; padding: 0; border: 1.5px solid rgba(212, 175, 55, 0.15);
    border-radius: var(--radius-sm); cursor: pointer; background: transparent;
}
.fam-modal__color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.fam-modal__color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.fam-modal__color-hex {
    font-family: monospace; font-size: 0.8rem; color: var(--color-text-2);
}

/* Time Input */
.fam-modal__time-input {
    width: 120px; padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: var(--radius-sm); color: var(--color-text);
    font-family: var(--font-body); font-size: 0.9rem;
}

/* XP Range Slider */
.fam-modal__range {
    width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
    background: rgba(255, 255, 255, 0.08); border-radius: 3px; outline: none;
    margin-top: 0.35rem;
}
.fam-modal__range::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px;
    border-radius: 50%; background: var(--color-gold);
    cursor: pointer; border: 2px solid var(--color-bg);
}

/* Modal Actions */
.fam-modal__actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.25rem; }
.fam-modal__delete-btn {
    margin-right: auto; color: var(--color-error);
    border-color: rgba(231, 76, 60, 0.2);
}
.fam-modal__delete-btn:hover { background: rgba(231, 76, 60, 0.1); border-color: rgba(231, 76, 60, 0.4); }

/* ── Floating XP popup (WoW-style) ── */
.fam-xp-float {
    z-index: 9999; pointer-events: none;
    font-family: var(--font-display);
    font-size: 1rem; font-weight: 700;
    color: var(--color-gold);
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.6), 0 1px 3px rgba(0,0,0,0.5);
    transform: translate(-50%, 0);
    opacity: 0;
    transition: none;
    white-space: nowrap;
}
.fam-xp-float--active {
    opacity: 1;
    animation: xpFloatUp 1.4s ease-out forwards;
}
@keyframes xpFloatUp {
    0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    20% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -60px) scale(0.9); }
}

/* ── Familiar responsive ── */
@media (max-width: 374px) {
    .fam-habitat { min-height: 240px; }
    .fam-habitat__scene { height: 170px; margin-top: 40px; }
    .fam-topbar__name { font-size: 1rem; }
    .fam-care-row { gap: 0.3rem; }
    .fam-care-pill { padding: 0.4rem 0.65rem; }
    .fam-care-pill__icon img { width: 22px; height: 22px; }
    .fam-care-pill__label { font-size: 0.6rem; }
    .fam-nav-grid { gap: 0.35rem; }
    .fam-nav-tile { padding: 0.5rem 0.2rem; }
    .fam-nav-tile__icon img { width: 26px; height: 26px; }
    .fam-goals-card { padding: 0.75rem; }
    .fam-stat-orb__ring-wrap { width: 34px; height: 34px; }
    .fam-stat-orb__ring { width: 34px; height: 34px; }
    .fam-stat-orb img { width: 16px; height: 16px; }
}
@media (min-width: 768px) {
    .fam-habitat { min-height: 360px; border-radius: 28px; }
    .fam-habitat__scene { height: 260px; margin-top: 60px; }
    .fam-topbar__name { font-size: 1.3rem; }
    .fam-care-pill { padding: 0.65rem 1.25rem; }
    .fam-care-pill__label { font-size: 0.75rem; }
    .fam-nav-grid { max-width: 400px; margin-left: auto; margin-right: auto; }
    .fam-goals-card { max-width: 500px; margin-left: auto; margin-right: auto; }
    .fam-stat-orb__ring-wrap { width: 48px; height: 48px; }
    .fam-stat-orb__ring { width: 48px; height: 48px; }
    .fam-stat-orb img { width: 26px; height: 26px; }
}

/* ── Shooting Star + Burst Animation ── */
.fam-shooting-star {
    will-change: left, top, transform;
}
.fam-shooting-star__trail {
    width: 4px; height: 4px; border-radius: 50%;
    background: rgba(212,175,55,0.5);
    box-shadow: 0 0 8px rgba(212,175,55,0.4);
    will-change: opacity;
}
.fam-points__count--burst {
    animation: ptsBurst 0.5s ease-out;
}
.fam-points__icon--burst {
    animation: ptsIconBurst 0.5s ease-out;
}
@keyframes ptsBurst {
    0%   { transform: scale(1); color: inherit; }
    30%  { transform: scale(1.5); color: #d4af37; }
    100% { transform: scale(1); color: inherit; }
}
@keyframes ptsIconBurst {
    0%   { transform: scale(1); filter: none; }
    30%  { transform: scale(1.4); filter: drop-shadow(0 0 8px rgba(212,175,55,0.9)); }
    100% { transform: scale(1); filter: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   INVENTORY (BAG) — WoW-style grid of item slots
   ═══════════════════════════════════════════════════════════════════════ */
.inv-count {
    margin-left: auto;
    font-family: var(--font-display);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.4);
}
.inv-bag {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0.75rem;
    background: rgba(15, 12, 30, 0.5);
    border-radius: 12px;
    border: 1.5px solid rgba(167, 139, 250, 0.12);
}
.inv-slot {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1.5px solid rgba(167, 139, 250, 0.15);
    background: rgba(167, 139, 250, 0.04);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
    padding: 6px 4px 28px;
}
.inv-slot:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.3);
    transform: scale(1.04);
}
.inv-slot:active { transform: scale(0.96); }
.inv-slot--empty {
    padding: 0;
}
.inv-slot--empty::after {
    content: '';
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.06);
}
.inv-slot--filled {
    border-color: rgba(212, 175, 55, 0.2);
    background: rgba(212, 175, 55, 0.06);
}
.inv-slot__img {
    width: 80%;
    height: auto;
    max-height: 70%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(167, 139, 250, 0.3));
}
.inv-slot__name {
    font-family: var(--font-display); font-size: 0.5rem;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--color-text-2); margin-top: 2px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-align: center; padding: 0 2px;
}
.inv-slot__qty {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-family: var(--font-display);
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Rarity borders on inventory slots */
.inv-slot--rarity-common {
    border-color: rgba(160,160,170,0.18);
}
.inv-slot--rarity-uncommon {
    border-color: rgba(76,175,80,0.3);
    background: rgba(76,175,80,0.04);
    box-shadow: 0 0 5px rgba(76,175,80,0.06);
}
.inv-slot--rarity-epic {
    border-color: rgba(156,39,176,0.3);
    background: rgba(156,39,176,0.04);
    box-shadow: 0 0 6px rgba(156,39,176,0.1);
}
.inv-slot--rarity-legendary {
    border-width: 2px;
    border-color: rgba(255,183,0,0.45);
    background: linear-gradient(135deg, rgba(255,183,0,0.06) 0%, rgba(167,139,250,0.04) 100%);
    box-shadow: 0 0 10px rgba(255,183,0,0.12), inset 0 0 6px rgba(255,183,0,0.04);
}
.inv-slot--rarity-legendary:hover {
    border-color: rgba(255,183,0,0.6);
    box-shadow: 0 0 14px rgba(255,183,0,0.2);
}
.inv-slot--rarity-epic:hover {
    border-color: rgba(156,39,176,0.5);
    box-shadow: 0 0 10px rgba(156,39,176,0.16);
}

/* Rarity badge inside inventory slot (top-left) */
.inv-slot__rarity {
    position: absolute; top: 3px; left: 3px;
    font-family: var(--font-display); font-size: 0.35rem; text-transform: uppercase;
    padding: 1px 4px; border-radius: 3px; letter-spacing: 0.04em;
    pointer-events: none; z-index: 1;
}
.inv-slot__rarity--common    { background: rgba(160,160,170,0.15); color: #9e9eaa; }
.inv-slot__rarity--uncommon  { background: rgba(76,175,80,0.15);  color: #66bb6a; }
.inv-slot__rarity--epic      { background: rgba(156,39,176,0.18); color: #ce93d8; }
.inv-slot__rarity--legendary { background: rgba(255,183,0,0.18);  color: #ffc107; }

@media (max-width: 374px) {
    .inv-bag { gap: 6px; padding: 0.5rem; }
}
@media (min-width: 520px) {
    .inv-bag { gap: 12px; padding: 1rem; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Tutorial Overlay System
   ═══════════════════════════════════════════════════════════════════════ */

/* Full-screen dark overlay */
.tutorial-overlay {
    position: fixed; inset: 0; z-index: 99990;
    background: rgba(0, 0, 0, 0.7);
    animation: tutorialFadeIn 0.4s ease;
}
.tutorial-overlay--exiting {
    animation: tutorialFadeOut 0.4s ease forwards;
}
.tutorial-overlay--no-target {
    display: flex; align-items: center; justify-content: center;
}
@keyframes tutorialFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tutorialFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Spotlighted element punches through the overlay */
.tutorial-spotlight {
    position: relative;
    z-index: 99991 !important;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.7),
                0 0 20px rgba(167, 139, 250, 0.5),
                0 0 40px rgba(167, 139, 250, 0.2);
    border-radius: 12px;
    animation: tutorialPulse 2s ease-in-out infinite;
}
@keyframes tutorialPulse {
    0%, 100% { box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.7),
                            0 0 15px rgba(167, 139, 250, 0.4),
                            0 0 30px rgba(167, 139, 250, 0.15); }
    50%      { box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.7),
                            0 0 25px rgba(167, 139, 250, 0.6),
                            0 0 50px rgba(167, 139, 250, 0.25); }
}

/* Tooltip bubble */
.tutorial-tooltip {
    position: fixed;
    z-index: 99992;
    width: 88%; max-width: 340px;
    background: rgba(30, 24, 60, 0.98);
    border: 1.5px solid rgba(167, 139, 250, 0.5);
    border-radius: 16px;
    padding: 1.1rem 1.2rem 0.9rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),
                0 0 20px rgba(167, 139, 250, 0.15);
    animation: tutorialTooltipIn 0.35s ease;
}
.tutorial-tooltip--center {
    position: relative !important;
    top: auto !important; bottom: auto !important;
    left: auto !important; right: auto !important;
    transform: none !important;
    margin: 0 auto;
}
@keyframes tutorialTooltipIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tutorial-tooltip--center {
    animation-name: tutorialTooltipCenterIn;
}
@keyframes tutorialTooltipCenterIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.tutorial-tooltip__title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: #ede6ff;
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}
.tutorial-tooltip__text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.45;
    margin-bottom: 0.8rem;
}
.tutorial-tooltip__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tutorial-tooltip__dots {
    display: flex; gap: 5px;
}
.tutorial-tooltip__dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.2);
    transition: background 0.3s;
}
.tutorial-tooltip__dot--active {
    background: #a88bfa;
    box-shadow: 0 0 6px rgba(167, 139, 250, 0.5);
}
.tutorial-tooltip__btn {
    font-family: var(--font-display);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 6px 18px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(135deg, #a88bfa, #7c5ce0);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.tutorial-tooltip__btn:hover {
    background: linear-gradient(135deg, #b99dff, #8b6bef);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}
.tutorial-tooltip__btn:active {
    transform: scale(0.95);
}
.tutorial-tooltip__skip {
    position: absolute;
    top: 8px; right: 10px;
    font-family: var(--font-display);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.35);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    -webkit-tap-highlight-color: transparent;
}
.tutorial-tooltip__skip:hover {
    color: rgba(255, 255, 255, 0.6);
}
