
/* 温暖治愈 + 科技感 + 隐私感 主题样式 */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.warm-bg {
    background: linear-gradient(135deg, #f1f8f4 0%, #f0fdf4 50%, #ecfdf5 100%);
    min-height: 100vh;
}

/* 淡入动画 */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

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

/* 浮动动画 */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes float-delayed {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float-delayed 8s ease-in-out infinite;
    animation-delay: 1s;
}

/* 温暖卡片 */
.warm-card {
    /* 去除背景色 */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.warm-card::before {
    /* 去除背景色 */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    pointer-events: none;
}

.highlight {
    color: #6b8e5a;
}

.progress-bar {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

/* 圆形进度指示器样式 */
.circular-progress {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    stroke: rgba(34, 197, 94, 0.1);
}

.progress-ring {
    stroke-dasharray: 163.36; /* 2 * π * 26 */
    stroke-dashoffset: 163.36;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 题目类型标签样式 */
.question-badge {
    transition: all 0.3s ease;
}

.question-badge.selected {
    background-color: #22c55e; /* 绿色 - 精选题目 */
}

.question-badge.advanced {
    background-color: #f97316; /* 橙色 - 进阶题目 */
}

/* 移动端圆形进度条优化 */
@media (max-width: 768px) {
    .circular-progress {
        width: 50px;
        height: 50px;
    }
    
    .circular-progress circle {
        r: 22;
        stroke-width: 5;
    }
    
    .progress-ring {
        stroke-dasharray: 138.23; /* 2 * π * 22 */
        stroke-dashoffset: 138.23;
    }
    
    /* 移动端进度容器优化 */
    #progress-container {
        margin-bottom: 1rem;
    }
    
    /* 移动端题目数量文字优化 */
    #progress-text {
        font-size: 0.7rem;
    }
    
    /* 移动端题目类型标签优化 */
    #question-type-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
    
    #progress-label {
        font-size: 0.7rem;
    }
    
    /* 移动端百分比文字优化 */
    #progress-percentage {
        font-size: 0.75rem;
    }
    
    /* 移动端进度条高度优化 */
    #progress-bar {
        height: 2px;
    }
    
    .w-full.bg-green-100\/50 {
        height: 2px;
    }
}

.question-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardFadeIn 0.6s ease-out;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 移除答题卡片的浮动效果 */

/* 选项网格布局 - 一行两列 */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* 手机端选项为单列 */
@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 640px) {
    .options-grid {
        gap: 0.625rem;
    }
}

/* 移动端整体布局优化 */
@media (max-width: 768px) {
    /* 容器内边距优化 */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* 进度容器间距优化 */
    #progress-container {
        margin-bottom: 1rem;
    }
    
    /* 题目卡片优化 */
    .question-card {
        padding: 1rem;
        border-radius: 1rem;
    }
    
    /* 选项卡片移动端优化 */
    .option-item {
        padding: 0.75rem;
        min-height: 3rem;
        font-size: 0.875rem;
    }
    
    /* AI 陪伴者提示移动端优化 */
    .inline-flex.items-center p {
        font-size: 0.75rem;
    }
    
    /* 抚慰消息移动端优化 */
    .comfort-message-wrapper {
        max-width: 60%;
        min-height: 2.5rem;
    }
    
    .comfort-message-container {
        padding: 0.5rem 0.75rem;
    }
    
    .comfort-message-container p {
        font-size: 0.75rem;
    }
    
    .comfort-icon {
        font-size: 0.75rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    #progress-container {
        margin-bottom: 0.75rem;
    }
    
    .circular-progress {
        width: 45px;
        height: 45px;
    }
    
    .circular-progress circle {
        r: 20;
        stroke-width: 4;
    }
    
    .progress-ring {
        stroke-dasharray: 125.66; /* 2 * π * 20 */
        stroke-dashoffset: 125.66;
    }
    
    #progress-percentage {
        font-size: 0.7rem;
    }
    
    #progress-text {
        font-size: 0.65rem;
    }
    
    #question-type-badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.6rem;
    }
    
    #progress-label {
        font-size: 0.65rem;
    }
    
    .question-card {
        padding: 0.75rem;
        border-radius: 0.875rem;
    }
    
    .option-item {
        padding: 0.625rem;
        min-height: 2.75rem;
        font-size: 0.8125rem;
    }
    
    .options-grid {
        gap: 0.5rem;
    }
    
    /* AI 陪伴者提示超小屏优化 */
    .inline-flex.items-center p {
        font-size: 0.7rem;
    }
    
    /* 抚慰消息超小屏优化 */
    .comfort-message-wrapper {
        max-width: 65%;
        min-height: 2.25rem;
    }
    
    .comfort-message-container {
        padding: 0.4rem 0.625rem;
    }
    
    .comfort-message-container p {
        font-size: 0.7rem;
    }
    
    .comfort-icon {
        font-size: 0.7rem;
    }
}

/* AI 情绪抚慰消息样式 - 右侧显示，无边框，优化交互，预留固定高度 */
.comfort-message-wrapper {
    max-width: 50%;
    min-height: 2rem; /* 最小高度，允许内容自适应 */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative; /* 确保定位上下文 */
}

#ai-comfort-message {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    animation: comfortFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px) scale(0.95);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

#ai-comfort-message.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
}

.comfort-message-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    max-width: 100%;
    word-wrap: break-word;
    word-break: break-word;
}

#ai-comfort-message p {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.comfort-message-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #22c55e 0%, #10b981 100%);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.comfort-icon {
    animation: heartBeat 1.5s ease-in-out infinite;
    transition: transform 0.3s ease;
}

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

@keyframes comfortFadeIn {
    0% {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
    60% {
        opacity: 0.8;
        transform: translateX(-2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .comfort-message-wrapper {
        max-width: 60%;
        min-height: 2rem;
        align-items: flex-start; /* 顶部对齐，适应多行文字 */
    }
    
    #ai-comfort-message {
        align-items: flex-start;
    }
    
    #ai-comfort-message p {
        font-size: 0.75rem;
        line-height: 1.4;
        white-space: normal; /* 允许换行 */
    }
    
    .comfort-message-container {
        padding: 0.5rem 0.75rem;
    }
    
    .comfort-message-container > div {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .comfort-message-wrapper {
        max-width: 70%; /* 手机端增加宽度 */
        min-height: 2rem;
        align-items: flex-start;
    }
    
    #ai-comfort-message {
        align-items: flex-start;
    }
    
    .comfort-message-container {
        padding: 0.5rem 0.625rem;
    }
    
    #ai-comfort-message p {
        font-size: 0.7rem;
        line-height: 1.4;
        white-space: normal; /* 允许换行 */
    }
    
    .comfort-icon {
        font-size: 0.75rem;
        margin-top: 0.125rem; /* 图标顶部对齐 */
    }
    
    .comfort-message-container > div {
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* 选项卡片样式 - 温暖治愈风格，紧凑设计 */
.option-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(34, 197, 94, 0.15);
    border-radius: 0.875rem;
    padding: 0.875rem 1rem;
    min-height: 4rem;
    height: auto; /* 允许内容决定高度 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box; /* 确保边框包含在高度内 */
}

.option-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #22c55e 0%, #10b981 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.option-item:hover {
    /* 移除浮动效果，只保留颜色和边框变化 */
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(240, 253, 244, 0.95);
}

.option-item:hover::before {
    opacity: 1;
}

.option-item:active {
    /* 移除transform，避免布局变化，使用opacity代替 */
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
    background: rgba(220, 252, 231, 0.95);
    border-color: #22c55e;
}

/* 选中状态样式 - 温暖高亮 */
.option-item.selected {
    background: linear-gradient(135deg, #22c55e 0%, #10b981 100%) !important;
    color: white !important;
    /* 移除浮动效果，使用相同的阴影范围避免布局变化 */
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35) !important;
    border-color: #22c55e !important;
    border-width: 2px !important; /* 确保边框宽度不变 */
    position: relative;
    padding: 0.875rem 1rem !important; /* 确保内边距不变 */
}

.option-item.selected::before {
    opacity: 1 !important;
    width: 4px !important;
    background: rgba(255, 255, 255, 0.3) !important;
}

.option-item.selected::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    color: #22c55e;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    animation: checkmarkAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.option-item.selected h4,
.option-item.selected p {
    color: white !important;
}

.option-item.selected .option-dot {
    background-color: white !important;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

@keyframes checkmarkAppear {
    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;
    }
}

/* 选中状态动画 */
.option-item.selected {
    animation: selectedPulse 0.6s ease-in-out;
}

@keyframes selectedPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
    .option-item {
        transition: all 0.2s ease;
        padding: 0.75rem 0.875rem;
        min-height: 3.5rem;
        font-size: 0.875rem;
    }
    
    .option-item:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
    }
    
    .option-item:active {
        /* 移除transform，避免布局变化 */
        opacity: 0.9;
        background: rgba(220, 252, 231, 0.95);
        border-color: #22c55e;
        box-shadow: 0 2px 12px rgba(34, 197, 94, 0.25);
    }
    
    /* 移动端选项选中状态已移除浮动效果 */
    
    .option-item.selected:active {
        /* 移除transform，避免布局变化 */
        opacity: 0.95;
    }
    
    .options-grid {
        gap: 0.5rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
    .option-item {
        padding: 0.625rem 0.75rem;
        min-height: 3rem;
        font-size: 0.8125rem;
    }
    
    .options-grid {
        gap: 0.5rem;
    }
}

.option-button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.option-button:hover {
    /* 移除浮动效果 */
    box-shadow: 0 10px 25px rgba(143, 188, 143, 0.3);
    border-color: #8fbc8f;
}

.option-button.selected {
    background: #8fbc8f;
    color: white;
    /* 移除浮动效果 */
    box-shadow: 0 10px 25px rgba(143, 188, 143, 0.4);
    border-color: #8fbc8f;
    position: relative;
}

.option-button.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #8fbc8f;
    opacity: 0.1;
    z-index: -1;
}

.option-button.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 12px;
    background: white;
    color: #8fbc8f;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: checkmarkAppear 0.3s ease-in-out;
}

.option-button.selected {
    animation: selectedPulse 0.5s ease-in-out;
}

@keyframes selectedPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

.result-card {
    animation: fadeInUp 0.8s ease-out;
}

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

.type-badge {
    background: #8fbc8f;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    display: inline-block;
    margin: 0.5rem;
}

.dimension-bar {
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    overflow: hidden;
}

.dimension-fill {
    height: 100%;
    background: #8fbc8f;
    transition: width 1s ease-in-out;
}

.result-badge {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.result-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 触摸反馈优化 */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* 移动端按钮优化 */
@media (max-width: 768px) {
    button, a {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .score-display {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .result-summary {
        padding: 16px 20px;
    }
    
    .bg-gray-50, .bg-orange-50, .bg-indigo-50 {
        padding: 16px 20px;
    }
}
