* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    color: #5A5A5A;
    position: relative;
    overflow-x: hidden;
    background: #f5f5f7;
    transition: background 3s ease;
    -webkit-overflow-scrolling: touch;
    text-rendering: optimizeSpeed;
}

.home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #FF9A8B, #FF6A88);
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 154, 139, 0.4);
    z-index: 1000;
    transition: all 0.3s;
    display: none;
}

.home-btn.show {
    display: block;
    animation: fadeIn 0.5s;
}

.home-btn:hover {
    transform: scale(1.1) rotate(-10deg);
    box-shadow: 0 6px 20px rgba(255, 154, 139, 0.6);
}

.home-btn:active {
    transform: scale(0.95);
}

.mute-btn {
    position: fixed;
    top: 20px;
    left: 80px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 1000;
    transition: all 0.3s;
    display: block !important;
}

.mute-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.mute-btn:active {
    transform: scale(0.95);
}

.mute-btn.muted {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.star {
    position: fixed;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
    animation: twinkle 3s ease-in-out infinite;
    z-index: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

.cursor-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: trailFade 0.8s ease-out forwards;
}

@keyframes trailFade {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 1000;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    z-index: -1;
    animation: float-blob 20s infinite ease-in-out;
    transition: all 1s ease;
    will-change: transform;
    transform: translateZ(0);
}

@keyframes float-blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
}

.float-pet {
    position: fixed;
    font-size: 2.5em;
    opacity: 0.2;
    pointer-events: none;
    z-index: 0;
    animation: floatPet 25s infinite ease-in-out;
    will-change: transform;
    transform: translateZ(0);
}

@keyframes floatPet {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(40px, -40px) rotate(15deg); }
    50% { transform: translate(-30px, 30px) rotate(-15deg); }
    75% { transform: translate(30px, 40px) rotate(10deg); }
}

.celebrate-emoji {
    position: fixed;
    font-size: 3em;
    z-index: 1000;
    pointer-events: none;
    animation: celebrate 2s ease-out forwards;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

@keyframes celebrate {
    0% { transform: translateY(0) scale(0); opacity: 1; }
    50% { transform: translateY(-100px) scale(1.5); opacity: 1; }
    100% { transform: translateY(-200px) scale(1); opacity: 0; }
}

.firework {
    position: fixed;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    z-index: 1000;
    pointer-events: none;
    animation: firework 1.5s ease-out forwards;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

@keyframes firework {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

.sad-emoji {
    position: fixed;
    font-size: 3em;
    z-index: 1000;
    pointer-events: none;
    animation: sad 2s ease-out forwards;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

@keyframes sad {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(100px) scale(0.5); opacity: 0; }
}

.running-pet {
    position: fixed;
    font-size: 3em;
    z-index: 999;
    cursor: pointer;
    transition: transform 0.2s;
}

.running-pet:hover {
    transform: scale(1.2);
}

@keyframes dogRun1 {
    0% { left: -100px; bottom: 20px; transform: translateY(0) scaleX(1); }
    25% { transform: translateY(-15px) scaleX(1); }
    50% { transform: translateY(0) scaleX(1); }
    75% { transform: translateY(-15px) scaleX(1); }
    100% { left: 110%; bottom: 20px; transform: translateY(0) scaleX(1); }
}

@keyframes dogRun2 {
    0% { left: -100px; bottom: 20px; }
    50% { bottom: 150px; }
    100% { left: 110%; bottom: 20px; }
}

@keyframes dogRun3 {
    0% { left: -100px; bottom: 20px; transform: rotate(0deg); }
    25% { bottom: 100px; transform: rotate(10deg); }
    50% { bottom: 50px; transform: rotate(-10deg); }
    75% { bottom: 120px; transform: rotate(5deg); }
    100% { left: 110%; bottom: 20px; transform: rotate(0deg); }
}



.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.page {
    display: none;
    min-height: 100vh;
    padding: 40px 0;
}

.page.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero {
    text-align: center;
    padding: 60px 20px;
}

.greeting {
    font-size: 1em;
    color: #FF9A8B;
    margin-bottom: 20px;
    animation: fadeInDown 1s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo {
    font-size: 2.5em;
    color: #FF9A8B;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.3s;
}

.logo:hover {
    transform: scale(1.1) rotate(-5deg);
}

.logo:active {
    transform: scale(0.95);
}

.subtitle {
    font-size: 1.1em;
    color: #8B8B8B;
    margin-bottom: 40px;
}

.quiz-hint {
    font-size: 0.85em;
    color: #999;
    margin-top: 15px;
    line-height: 1.6;
}

.card-preview-section {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.card-stack-preview {
    position: relative;
    width: 280px;
    height: 180px;
    cursor: pointer;
    transition: transform 0.3s;
}

.card-stack-preview:hover {
    transform: scale(1.05);
}

.preview-card {
    position: absolute;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transition: all 0.3s;
    backface-visibility: hidden;
}

.preview-card-back {
    height: 180px;
    top: 27px;
    left: 0;
    opacity: 0.6;
    transform: scale(0.95);
    z-index: 1;
}

.preview-card-front {
    height: 180px;
    top: 0;
    left: 0;
    z-index: 2;
    animation: cardBounce 2s ease-in-out infinite;
}

@keyframes cardBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(1deg); }
}

.preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.preview-emoji {
    font-size: 4em;
    margin-bottom: 10px;
}

.preview-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #FF6A88;
    margin-bottom: 5px;
}

.preview-hint {
    font-size: 0.85em;
    color: #999;
}

.btn-card-cta {
    padding: 12px 30px;
    font-size: 1em;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    background: linear-gradient(135deg, #FFD93D 0%, #FFA500 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.3);
    transition: all 0.3s;
}

.btn-card-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.5);
}

.results-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 60px 20px 40px;
}

.match-card-stack {
    position: relative;
    width: 90%;
    max-width: 380px;
    margin: 20px auto;
    height: 520px;
}

.match-card {
    position: absolute;
    width: 100%;
    background: linear-gradient(135deg, #FFE5E5 0%, #FFF0F0 100%);
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    padding: 30px 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backface-visibility: hidden;
    transform: translateZ(0);
    touch-action: pan-y;
}

.match-card:focus {
    outline: 3px solid #FF9A8B;
    outline-offset: 2px;
}

.match-card[data-index="0"] {
    z-index: 3;
    top: 0;
    animation: cardEntrance 0.7s ease-out;
}

.match-card[data-index="1"] {
    z-index: 2;
    top: 80px;
    opacity: 0.7;
    transform: scale(0.95);
}

.match-card[data-index="2"] {
    z-index: 1;
    top: 100px;
    opacity: 0.4;
    transform: scale(0.9);
}

@keyframes cardEntrance {
    0% { transform: scale(0.8) translateY(-30px); opacity: 0; }
    60% { transform: scale(1.05) translateY(0); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.match-card-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    object-fit: cover;
    border: 4px solid #FFE5D9;
    box-shadow: 0 4px 12px rgba(255, 154, 139, 0.3);
    display: block;
}

.match-card-name {
    font-size: 1.8em;
    font-weight: 700;
    color: #FF6A88;
    text-align: center;
    margin-bottom: 15px;
}

.match-card-score {
    font-size: 2.5em;
    font-weight: 800;
    color: #FF9A8B;
    text-align: center;
    margin-bottom: 20px;
}

.match-card-score span {
    font-size: 0.5em;
    color: #999;
}

.match-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.match-card-tag {
    background: #FFE5D9;
    color: #FF6A88;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.match-card-hint {
    text-align: center;
    color: #999;
    font-size: 0.85em;
    margin-top: 20px;
}

.match-card.swiping-left {
    transform: translateX(-120%) rotate(-20deg);
    opacity: 0;
}

.match-card.swiping-right {
    transform: translateX(120%) rotate(20deg);
    opacity: 0;
}

.transition-card {
    background: linear-gradient(135deg, #FFD93D 0%, #FFA500 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.transition-card-emoji {
    font-size: 4em;
    margin-bottom: 20px;
}

.transition-card-text {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 10px;
}

.transition-card-hint {
    font-size: 1em;
    opacity: 0.9;
}

.pet-illustration {
    font-size: 5em;
    margin: 40px 0;
}

.pet-icon {
    display: inline-block;
    margin: 0 20px;
    animation: float 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 5px 10px rgba(255, 154, 139, 0.3));
}

.pet-icon:hover {
    transform: scale(1.3) rotate(15deg);
    filter: drop-shadow(0 8px 15px rgba(255, 154, 139, 0.5));
}

.pet-icon:nth-child(2) {
    animation-delay: 1.5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    font-size: 1.1em;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #FF9A8B 0%, #FF6A88 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 154, 139, 0.4);
    animation: btnBreath 2s ease-in-out infinite;
}

@keyframes btnBreath {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 154, 139, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(255, 154, 139, 0.7); }
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 154, 139, 0.6);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-effect 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-effect {
    to { transform: scale(4); opacity: 0; }
}

.btn-secondary {
    background: white;
    color: #FF9A8B;
    border: 2px solid #FF9A8B;
    margin-top: 20px;
}

.btn-more {
    padding: 15px 40px;
    font-size: 1.1em;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    background: linear-gradient(135deg, #FF9A8B 0%, #FF6A88 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 154, 139, 0.4);
    margin: 20px auto;
    display: block;
    position: relative;
    overflow: hidden;
}

.btn-more::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s;
}

.btn-more:hover::before {
    left: 100%;
}

.btn-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 154, 139, 0.6);
}

.btn-random {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    padding: 10px 25px;
    font-size: 0.9em;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    white-space: nowrap;
}

.btn-random:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.btn-secondary:hover {
    background: #FF9A8B;
    color: white;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    margin-bottom: 40px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF9A8B, #FF6A88, #FFD93D, #FF9A8B);
    background-size: 200% 100%;
    transition: width 0.3s ease;
    border-radius: 10px;
    animation: progressFlow 2s linear infinite;
}

@keyframes progressFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.quiz-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.question-title {
    font-size: 1.5em;
    color: #FF9A8B;
    margin-bottom: 30px;
}

.name-input {
    width: 100%;
    padding: 15px;
    font-size: 1em;
    border: 2px solid #FFE5D9;
    border-radius: 10px;
    margin-bottom: 20px;
    outline: none;
    transition: all 0.3s;
}

.name-input:focus {
    border-color: #FF9A8B;
    box-shadow: 0 0 20px rgba(255, 154, 139, 0.2);
    transform: scale(1.02);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option {
    padding: 20px;
    background: #FFF5E4;
    border: 2px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 154, 139, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.option:hover::before {
    width: 300px;
    height: 300px;
}

.quiz-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.skip-btn {
    background: #E0E0E0;
    color: #666;
    padding: 12px 30px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.skip-btn:hover {
    background: #D0D0D0;
}

.back-btn {
    background: #FFE5D9;
    color: #FF6A88;
    padding: 12px 30px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.back-btn:hover {
    background: #FFD0C4;
    transform: translateX(-2px);
}

.option:hover {
    border-color: #FF9A8B;
    transform: translateX(5px);
}

.section-title {
    text-align: center;
    font-size: 1.8em;
    color: #FF9A8B;
    margin-bottom: 40px;
}

.top-matches {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.pet-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

.pet-card:hover {
    box-shadow: 0 15px 40px rgba(255, 154, 139, 0.3);
}

.pet-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
}

.pet-header-content {
    display: flex;
    flex-direction: column;
    width: calc(100% - 175px);
}

.pet-avatar {
    font-size: 4em;
}

.pet-info h3 {
    font-size: 1.5em;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #FF9A8B, #FF6A88, #FFD700, #FF9A8B, #FF6A88);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: nameShine 2s linear infinite;
}

@keyframes nameShine {
    to { background-position: 200% center; }
}

.pet-breed {
    color: #8B8B8B;
    font-size: 0.9em;
}

.pet-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    background: #FFE5D9;
    color: #FF6A88;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    transition: all 0.3s;
    cursor: default;
}

.tag:hover {
    background: #FF6A88;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 106, 136, 0.3);
}

.pet-description {
    color: #6B6B6B;
    line-height: 1.7;
    margin-bottom: 12px;
    font-size: 0.95em;
}

.pet-summary {
    font-weight: bold;
    font-size: 1.05em;
    color: #FF6A88;
    margin-bottom: 15px;
    line-height: 1.6;
    max-width: calc(100% - 175px);
}

.ai-report {
    background: #FFF5E4;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #FF9A8B;
    color: #5A5A5A;
    line-height: 1.7;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.page-header {
    font-size: 2.2em;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(90deg, #FF9A8B, #FF6A88, #FFD700, #FF9A8B);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.swipe-guide {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    animation: guideFloat 2s ease-in-out infinite;
}

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

.guide-content {
    text-align: center;
    color: #FF6A88;
    font-weight: 600;
}

.guide-icon {
    font-size: 2em;
    margin-bottom: 5px;
    animation: guideIcon 1.5s ease-in-out infinite;
}

.guide-content:nth-child(1) .guide-icon {
    animation-delay: 0s;
}

.guide-content:nth-child(2) .guide-icon {
    animation-delay: 0.5s;
}

.guide-content:nth-child(3) .guide-icon {
    animation-delay: 1s;
}

@keyframes guideIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.guide-content p {
    margin: 0;
    font-size: 0.9em;
}

.card-stack {
    position: relative;
    height: 550px;
    margin: 40px 0;
    overflow: visible;
}

.card-stack::-webkit-scrollbar {
    display: none;
}

.swipe-card {
    position: absolute;
    width: 100%;
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 25px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    cursor: grab;
    animation: cardAppear 0.4s ease-out;
    scrollbar-width: none;
    -ms-overflow-style: none;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    -webkit-perspective: 1000;
    perspective: 1000;
    contain: layout style paint;
}

.swipe-card * {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

.swipe-card::-webkit-scrollbar {
    display: none;
}

@keyframes cardAppear {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes cardSwipeLeft {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate3d(-150%, 0, 0) rotate(-30deg); opacity: 0; }
}

@keyframes cardSwipeRight {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate3d(150%, 0, 0) rotate(30deg); opacity: 0; }
}

.card-disappear {
    animation: cardDisappear 0.5s ease-out forwards !important;
}

@keyframes cardDisappear {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.7); opacity: 0; }
}

.slot-machine {
    animation: slotSpin 0.1s linear infinite;
}

@keyframes slotSpin {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

.slot-result {
    animation: slotReveal 1s ease-out forwards;
}

@keyframes slotReveal {
    0% { transform: scale(0) rotate(180deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(0deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.pet-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 154, 139, 0.3), 0 0 40px rgba(255, 154, 139, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.8);
    position: absolute;
    right: 25px;
    top: 25px;
    transition: transform 0.3s ease;
    cursor: pointer;
    animation: petBlink 5s ease-in-out infinite;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    loading: lazy;
}

@keyframes petBlink {
    0%, 95%, 100% { transform: scale(1); }
    97% { transform: scale(0.95, 1.05); }
}

.pet-image:hover {
    transform: scale(1.1) rotate(5deg);
    animation: none;
}

.pet-match-reason {
    background: rgba(255, 215, 0, 0.1);
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 0.95em;
    color: #666;
    border-left: 3px solid #FFD700;
    line-height: 1.6;
}

.pet-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #FF6A88;
    font-weight: 600;
}

.swipe-card:active {
    cursor: grabbing;
}

.swipe-hint {
    display: flex;
    justify-content: space-between;
    color: #8B8B8B;
    font-size: 0.9em;
    margin-bottom: 20px;
}

.swipe-hint span {
    animation: hintPulse 2s ease-in-out infinite;
}

.swipe-hint span:first-child {
    animation-delay: 0s;
}

.swipe-hint span:last-child {
    animation-delay: 1s;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.card-actions {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.btn-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: visible;
}

.btn-like {
    background: linear-gradient(135deg, #FF9A8B, #FF6A88);
    box-shadow: 0 4px 15px rgba(255, 106, 136, 0.4);
    animation: heartBeat 1.5s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    10% { transform: scale(1.1); }
    20% { transform: scale(1); }
}

.btn-skip {
    background: #E0E0E0;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.heart-particle {
    position: fixed;
    font-size: 1.5em;
    pointer-events: none;
    z-index: 1000;
    animation: heartFloat 2s ease-out forwards;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

@keyframes heartFloat {
    0% { transform: translate3d(0, 0, 0) scale(0) rotate(0deg); opacity: 1; }
    50% { transform: translate3d(0, -100px, 0) scale(1.5) rotate(180deg); opacity: 1; }
    100% { transform: translate3d(0, -200px, 0) scale(0.5) rotate(360deg); opacity: 0; }
}

.btn-text {
    background: none;
    border: none;
    color: #FF9A8B;
    cursor: pointer;
    font-size: 1em;
    text-decoration: underline;
}

.btn-favorites {
    position: relative;
    background: linear-gradient(135deg, #FFE5D9 0%, #FFF0F0 100%);
    border: 3px solid #FF9A8B;
    border-radius: 50px;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #FF6A88;
    transition: all 0.3s;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(255, 154, 139, 0.3);
}

.btn-favorites:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 154, 139, 0.5);
    border-color: #FF6A88;
}

.dog-body {
    font-size: 1.2em;
    animation: dogWalk 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes dogWalk {
    0%, 100% { transform: translateX(0) scaleX(1); }
    25% { transform: translateX(-3px) scaleX(0.95); }
    50% { transform: translateX(0) scaleX(1.05); }
    75% { transform: translateX(3px) scaleX(0.95); }
}

.btn-text-content {
    white-space: nowrap;
}

.btn-skip-all {
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 35px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-skip-all::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-skip-all:hover::before {
    left: 100%;
}

.btn-skip-all:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.btn-skip-all:active {
    transform: translateY(-1px) scale(1.02);
}

.skip-icon {
    font-size: 1.3em;
    animation: flash 1.5s ease-in-out infinite;
}

.skip-icon:first-child {
    animation-delay: 0s;
}

.skip-icon:last-child {
    animation-delay: 0.75s;
}

@keyframes flash {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, rgba(255, 154, 139, 0.95), rgba(255, 106, 136, 0.95));
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(255, 154, 139, 0.4);
    backdrop-filter: blur(10px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: toastBounce 0.5s ease;
}

@keyframes toastBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 15px;
        max-width: 100%;
    }
    
    .logo { 
        font-size: 1.8em; 
    }
    
    .subtitle {
        font-size: 1em;
        margin-bottom: 30px;
    }
    
    .pet-illustration { 
        font-size: 3.5em;
        margin: 30px 0;
    }
    
    .quiz-content { 
        padding: 20px;
    }
    
    .question-title {
        font-size: 1.3em;
    }
    
    .option {
        padding: 15px;
        font-size: 0.95em;
    }
    
    .header-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .page-header {
        font-size: 1.5em;
    }
    
    .btn-random {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    .card-stack {
        height: 480px;
        margin: 20px 0;
    }
    
    .swipe-card {
        max-height: 450px;
        padding: 20px;
    }
    
    .pet-image {
        width: 100px;
        height: 100px;
        right: 20px;
        top: 20px;
    }
    
    .pet-header-content {
        width: calc(100% - 120px);
    }
    
    .pet-info h3 {
        font-size: 1.3em;
    }
    
    .pet-summary {
        font-size: 0.9em;
        max-width: calc(100% - 120px);
        line-height: 1.5;
    }
    
    .pet-description {
        font-size: 0.9em;
    }
    
    .pet-match-reason {
        font-size: 0.9em;
        padding: 10px 12px;
    }
    
    .ai-report {
        font-size: 0.9em;
        padding: 12px;
    }
    
    .card-actions {
        gap: 20px;
        margin-bottom: 15px;
    }
    
    .btn-icon {
        width: 60px;
        height: 60px;
        font-size: 1.8em;
    }
    
    .favorites-grid { 
        grid-template-columns: 1fr;
    }
    
    .pet-card {
        padding: 20px;
    }
    
    .swipe-hint {
        font-size: 0.85em;
    }
    
    .toast {
        font-size: 0.9em;
        padding: 12px 20px;
        bottom: 20px;
    }
    
    .running-pet {
        font-size: 2.5em;
    }
    
    .float-pet {
        font-size: 2em;
        opacity: 0.15;
    }
    
    .bg-blob {
        filter: blur(60px);
        opacity: 0.3;
        animation-duration: 25s;
    }
    
    .home-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
        top: 15px;
        left: 15px;
    }
    
    .swipe-guide {
        gap: 15px;
        padding: 15px;
        margin: 15px 0;
    }
    
    .guide-icon {
        font-size: 1.5em;
    }
    
    .guide-content p {
        font-size: 0.8em;
    }
    
    .btn-favorites {
        padding: 12px 20px;
        font-size: 0.9em;
    }
    
    .dog-body {
        font-size: 1em;
    }
    
    .btn-skip-all {
        padding: 12px 25px;
        font-size: 0.9em;
        gap: 8px;
    }
    
    .skip-icon {
        font-size: 1.2em;
    }
    
    .mute-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
        top: 15px;
        left: 70px;
    }
    
    .card-preview-section {
        margin-top: 40px;
    }
    
    .card-stack-preview {
        width: 240px;
        height: 160px;
    }
    
    .preview-card-back {
        height: 160px;
        top: 24px;
    }
    
    .preview-card-front {
        height: 160px;
    }
    
    .preview-emoji {
        font-size: 3em;
    }
    
    .preview-name {
        font-size: 1em;
    }
    
    .results-container {
        padding: 80px 15px 40px;
    }
    
    .match-card-stack {
        height: 480px;
        width: 95%;
        max-width: 350px;
    }
    
    .match-card {
        padding: 25px 15px;
    }
    
    .match-card-avatar {
        width: 100px;
        height: 100px;
    }
    
    .match-card-name {
        font-size: 1.5em;
    }
    
    .match-card-score {
        font-size: 2em;
    }
    
    .match-card-tag {
        font-size: 0.85em;
        padding: 5px 12px;
    }
    
    .transition-card-emoji {
        font-size: 3em;
    }
    
    .transition-card-text {
        font-size: 1.2em;
    }
}

.signature {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 0.9em;
    color: #FF9A8B;
    opacity: 0.5;
    font-family: 'Brush Script MT', cursive;
    z-index: 999;
    pointer-events: none;
    background: linear-gradient(90deg, transparent 0%, #FF9A8B 50%, transparent 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shine 3s linear infinite;
}

.copyright {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 0.75em;
    color: #FF9A8B;
    opacity: 0.6;
    z-index: 999;
    pointer-events: none;
    background: linear-gradient(90deg, transparent 0%, #FF9A8B 50%, transparent 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
