/* ============================================
   全局样式与变量定义
   ============================================ */
:root {
    --rice-paper: #F7F5F2;
    --peace-purple: #B5A8B9;
    --self-love-pink: #E5C1C1;
    --protection-gray: #6E6E6E;
    --clarity-blue: #D8DDE3;
    --courage-slate: #8FA3AD;
    --future-champagne: #C8BCA6;
    --confidence-caramel: #D4A574;
    --new-beginnings-pearl: #F5F0E8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--rice-paper);
    color: #2C2C2C;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
}

/* ============================================
   屏幕容器
   ============================================ */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    position: relative;
    animation: fadeIn 0.6s ease-in-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   引导页样式
   ============================================ */
.landing-content {
    text-align: center;
    max-width: 90%;
}

.main-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    color: #2C2C2C;
}

.subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: 400;
    color: #6E6E6E;
    letter-spacing: 0.05em;
}

/* ============================================
   选择页样式 - 扑克牌卡牌模式
   ============================================ */
.selection-content {
    width: 100%;
    max-width: 600px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1rem;
}

/* 卡牌容器 */
.card-container {
    aspect-ratio: 2 / 3;
    perspective: 1000px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 卡牌内部（用于翻转效果） */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-container:hover .card-inner {
    transform: rotateY(10deg) rotateX(5deg);
}

/* 桌面端点击效果（完全翻转） */
@media (hover: hover) and (pointer: fine) {
    .card-container:active .card-inner {
        transform: rotateY(180deg) scale(0.96);
    }
}

/* 移动端长按效果（轻微倾斜，和悬停一样） */
@media (hover: none) and (pointer: coarse) {
    .card-container:active .card-inner {
        transform: rotateY(10deg) rotateX(5deg) scale(0.98);
    }
}

/* 卡牌正面和背面 */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12),
                0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

/* 卡牌正面 */
.card-front {
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.06);
}

/* 卡牌背面 */
.card-back {
    background: var(--card-color, #B5A8B9);
    transform: rotateY(180deg);
    color: white;
}

/* NEW BEGINNINGS 卡牌特殊处理（浅色背景需要深色文字） */
.card-container[data-intention="new-beginnings"] .card-back {
    color: #4A4A4A;
    border: 2px solid rgba(74, 74, 74, 0.2);
}

.card-container[data-intention="new-beginnings"] .card-back-line {
    background: rgba(74, 74, 74, 0.3);
}

/* 点击时翻转 */
.card-container.flipped .card-inner {
    transform: rotateY(180deg) scale(1.02);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 卡牌正面内容 */
.card-emoji {
    font-size: clamp(2.5rem, 8vw, 4rem);
    line-height: 1;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.card-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1rem, 4vw, 1.3rem);
    font-weight: 700;
    color: #2C2C2C;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 0.5rem;
}

.card-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.75rem, 3vw, 0.9rem);
    font-weight: 400;
    color: #8E8E8E;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* 卡牌背面内容 */
.card-back-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.card-back-emoji {
    font-size: clamp(3rem, 10vw, 5rem);
    line-height: 1;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.card-back-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.2rem, 5vw, 1.6rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 1rem;
}

.card-back-line {
    width: 60%;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
}

/* 为每个卡牌设置对应的颜色 */
.card-container[data-intention="peace"] {
    --card-color: var(--peace-purple);
}

.card-container[data-intention="self-love"] {
    --card-color: var(--self-love-pink);
}

.card-container[data-intention="protection"] {
    --card-color: var(--protection-gray);
}

.card-container[data-intention="clarity"] {
    --card-color: var(--clarity-blue);
}

.card-container[data-intention="courage"] {
    --card-color: var(--courage-slate);
}

.card-container[data-intention="future"] {
    --card-color: var(--future-champagne);
}

.card-container[data-intention="confidence"] {
    --card-color: var(--confidence-caramel);
}

.card-container[data-intention="new-beginnings"] {
    --card-color: var(--new-beginnings-pearl);
}

/* 悬停效果 */
.card-container:hover .card-front {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15),
                0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.card-container:hover .card-back {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2),
                0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 点击动画 */
.card-container:active .card-front,
.card-container:active .card-back {
    transform: scale(0.98);
}

/* ============================================
   加载动画页样式
   ============================================ */
.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.breathing-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #B5A8B9 0%, #E5C1C1 100%);
    animation: breathe 2.5s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(181, 168, 185, 0.3);
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

.loading-text {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1rem, 4vw, 1.3rem);
    font-weight: 400;
    color: #6E6E6E;
    letter-spacing: 0.05em;
    line-height: 1.6;
}

/* ============================================
   结果页样式
   ============================================ */
.result-content {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation: cardReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease;
}

/* 移动端触摸反馈 */
.result-card:active {
    transform: scale(0.98);
}

/* 桌面端悬停效果（仅在大屏幕上显示） */
@media (hover: hover) and (pointer: fine) {
    .result-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 32px rgba(0, 0, 0, 0.12);
    }
    
    .result-card:hover .result-card-color-bar {
        width: 8px;
        transition: width 0.3s ease;
    }
    
    .result-card::after {
        content: 'Tap to explore →';
        position: absolute;
        bottom: 1rem;
        right: 1.5rem;
        font-family: 'Montserrat', sans-serif;
        font-size: 0.75rem;
        color: #8E8E8E;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .result-card:hover::after {
        opacity: 1;
    }
}

.result-card-content {
    position: relative;
    z-index: 2;
}

.result-card-color-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    background: var(--result-color, #B5A8B9);
    z-index: 1;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

/* 移动端：颜色条带更明显，添加脉冲动画提示 */
@media (hover: none) and (pointer: coarse) {
    .result-card-color-bar {
        width: 8px;
        animation: pulseHint 2s ease-in-out infinite;
    }
    
    @keyframes pulseHint {
        0%, 100% {
            opacity: 1;
            box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
        }
        50% {
            opacity: 0.8;
            box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
        }
    }
    
    /* 添加移动端提示文字 */
    .result-card::before {
        content: 'Tap to explore';
        position: absolute;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        font-family: 'Montserrat', sans-serif;
        font-size: 0.85rem;
        color: #8E8E8E;
        opacity: 0.7;
        pointer-events: none;
        animation: fadeInOut 3s ease-in-out infinite;
    }
    
    @keyframes fadeInOut {
        0%, 100% {
            opacity: 0.7;
        }
        50% {
            opacity: 0.4;
        }
    }
}

/* 晕染动画 */
.result-card.animating .result-card-color-bar {
    width: 100% !important;
    opacity: 0.2;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
}

.result-card.animating .result-card-content {
    animation: fadeOut 0.5s ease forwards;
    position: relative;
    z-index: 3;
}

.result-card.animating::after {
    opacity: 0;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes cardReveal {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.result-product {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #2C2C2C;
}

.result-message {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.1rem, 4vw, 1.4rem);
    font-weight: 400;
    line-height: 1.6;
    color: #4A4A4A;
    font-style: italic;
}

.cta-section {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.cta-text {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.95rem, 3.5vw, 1.1rem);
    font-weight: 600;
    color: #2C2C2C;
    line-height: 1.5;
}

.feedback-text {
    margin-top: 1rem;
}

.feedback-text p {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.85rem, 3vw, 1rem);
    color: #8E8E8E;
    font-weight: 400;
}

.view-results-button-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.view-results-button {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.9rem, 3.5vw, 1rem);
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #B5A8B9 0%, #E5C1C1 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(181, 168, 185, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.view-results-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(181, 168, 185, 0.4);
}

.view-results-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(181, 168, 185, 0.3);
}

/* ============================================
   结果展示页样式
   ============================================ */
.results-content {
    width: 100%;
    max-width: 800px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.results-header {
    text-align: center;
}

.results-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    font-weight: 700;
    color: #2C2C2C;
    margin-bottom: 0.5rem;
}

.results-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    color: #6E6E6E;
    font-weight: 400;
}

.chart-container {
    width: 100%;
    height: 400px;
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.results-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.9rem, 3vw, 1rem);
    color: #6E6E6E;
    font-weight: 400;
}

.stat-value {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    color: #2C2C2C;
    font-weight: 600;
}

.back-button-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.back-button {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.9rem, 3.5vw, 1rem);
    font-weight: 600;
    color: #6E6E6E;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 0.75rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.back-button:hover {
    background: #F7F5F2;
    border-color: rgba(0, 0, 0, 0.15);
}

.back-button:active {
    transform: scale(0.98);
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 480px) {
    .screen {
        padding: 1.5rem 1rem;
    }
    
    .selection-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .card-front,
    .card-back {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .result-card {
        padding: 2rem 1.5rem;
        padding-bottom: 3.5rem; /* 为移动端提示文字留出空间 */
    }
    
    .result-card-color-bar {
        width: 8px;
    }
}

@media (min-width: 768px) {
    .selection-content {
        grid-template-columns: repeat(3, 1fr);
        max-width: 800px;
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .selection-content {
        grid-template-columns: repeat(3, 1fr);
        max-width: 900px;
        gap: 2.5rem;
    }
    
    .card-container:hover .card-inner {
        transform: rotateY(15deg) rotateX(8deg) scale(1.05);
    }
}

/* 结果展示页响应式 */
@media (max-width: 480px) {
    .chart-container {
        height: 300px;
        padding: 1rem;
    }
    
    .results-content {
        padding: 1.5rem 1rem;
    }
    
    .results-stats {
        padding: 1rem;
    }
}

@media (min-width: 768px) {
    .chart-container {
        height: 450px;
    }
}

@media (min-width: 768px) {
    .selection-content {
        max-width: 600px;
    }
    
    .result-content {
        max-width: 600px;
    }
}

/* ============================================
   触摸设备优化
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .selection-button {
        -webkit-tap-highlight-color: transparent;
    }
    
    .selection-button:active {
        transform: scale(0.98);
    }
}


