:root {
    --primary-color: #6a0dad;
    --secondary-color: #8a2be2;
    --accent-color: #daa520;
    --dark-color: #4b0082;
    --light-color: #e6e6fa;
    --text-color: #f0e6ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* 顶部滚动字幕样式 */
.scrolling-banner {
    position: fixed; /* 改为 fixed 定位 */
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(90deg, rgba(218, 165, 32, 0.9), rgba(106, 13, 173, 0.9));
    color: white;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--accent-color);
    overflow: hidden;
}

.scrolling-text {
    display: inline-block;
    white-space: nowrap;
    animation: scrollText 20s linear infinite;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes scrollText {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}



body {
    background: linear-gradient(135deg, var(--dark-color), var(--primary-color));
    color: var(--text-color);
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    /* 移除 padding-top */
}

.container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 5px 0 15px;
    min-height: auto;
    gap: 12px;
    margin-top: 40px; /* 添加顶部外边距，为固定横幅留出空间 */
}

header {
    text-align: center;
    width: 100%;
    padding: 5px 0;
}

h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
    color: var(--accent-color);
}

.subtitle {
    font-size: 1.1rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.time-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-block;
    border: 1px solid var(--accent-color);
}


}

/* 问题选择模块样式 */
.question-selection {
    width: 100%;
    margin: 8px 0;
    padding: 12px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(218, 165, 32, 0.3);
}

.question-selection h3 {
    margin-bottom: 12px;
    color: var(--accent-color);
    font-size: 1rem;
    text-align: center;
}

.question-options {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.question-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 5px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.question-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.question-option.selected {
    background: rgba(218, 165, 32, 0.2);
    border-color: var(--accent-color);
}

.option-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.question-option span {
    font-size: 0.85rem;
    font-weight: 500;
}

.selected-question {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: bold;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    display: inline-block;
}

.intro-text {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    padding: 0 15px;
}

.btn-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 5px 0;
}

.draw-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #b8860b);
    color: #fff;
    border: none;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
    padding: 10px;
}

.draw-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.draw-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.draw-btn:disabled {
    background: linear-gradient(135deg, #888, #666);
    cursor: not-allowed;
    opacity: 0.6;
}

.shuffle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 200;
    flex-direction: column;
}

.shuffle-text {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 10px rgba(218, 165, 32, 0.7);
}

.shuffle-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 90%;
    perspective: 1000px;
}

.shuffle-card {
    width: 80px;
    height: 120px;
    background-image: url('../img/card_back.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(218, 165, 32, 0.5);
    transform-style: preserve-3d;
    animation: shuffleCard 2s ease-in-out infinite;
}

@keyframes shuffleCard {
    0%, 100% {
        transform: translateY(0) rotateY(0) scale(1);
        box-shadow: 0 5px 15px rgba(218, 165, 32, 0.5);
    }
    25% {
        transform: translateY(-20px) rotateY(90deg) scale(1.1);
        box-shadow: 0 10px 20px rgba(218, 165, 32, 0.7);
    }
    50% {
        transform: translateY(0) rotateY(180deg) scale(1);
        box-shadow: 0 5px 15px rgba(218, 165, 32, 0.5);
    }
    75% {
        transform: translateY(-20px) rotateY(270deg) scale(1.1);
        box-shadow: 0 10px 20px rgba(218, 165, 32, 0.7);
    }
}

/* 确保结果容器正确显示 */
.results-container {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: flex-start; /* 改为从顶部开始 */
    margin-top: 5px; /* 减少顶部边距 */
}

.results-title {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.user-question-display {
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-weight: bold;
}

.cards-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    gap: 10px;
}

.card-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.card-slot {
    width: 100px;
    height: 160px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 10px;
    border: 2px solid var(--accent-color);
    cursor: pointer;
    transition: transform 0.3s ease;
}

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

.slot-label {
    text-align: center;
    font-weight: bold;
    color: var(--accent-color);
    font-size: 1rem;
}

.card-info {
    text-align: center;
    margin-top: 5px;
    min-height: 40px;
    width: 100%;
}

.card-info-name {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--accent-color);
    margin-bottom: 3px;
}

.card-info-position {
    font-size: 0.8rem;
    color: #ff6347;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px; /* 减少顶部边距 */
    margin-bottom: 10px; /* 添加底部边距 */
}

.action-btn {
    background: rgba(218, 165, 32, 0.2);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(218, 165, 32, 0.3);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    width: 100%;
    max-width: 400px;
    border-radius: 15px;
    padding: 25px;
    position: relative;
    box-shadow: 0 0 30px rgba(218, 165, 32, 0.5);
    border: 2px solid var(--accent-color);
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--accent-color);
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card-image {
    width: 100%;
    height: 200px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 10px 0;
    border-radius: 10px;
    border: 2px solid var(--accent-color);
    background-color: white;
}

.modal-card-name {
    font-size: 1.4rem;
    color: var(--accent-color);
    margin-bottom: 10px;
    text-align: center;
}

.modal-card-position {
    font-size: 1.1rem;
    color: #ff6347;
    margin-bottom: 12px;
    text-align: center;
    font-weight: bold;
}

.modal-card-type {
    font-size: 1rem;
    margin-bottom: 15px;
    text-align: center;
    opacity: 0.9;
}

.modal-card-meaning {
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-card-description {
    line-height: 1.5;
    font-style: italic;
    opacity: 0.9;
    font-size: 0.95rem;
}

/* 底部版权信息样式 */
.footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 0;
    text-align: center;
    margin-top: 20px;
    border-top: 1px solid rgba(218, 165, 32, 0.3);
    width: 100%;
    border-radius: 15px 15px 0 0;
}

.footer-content {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer p {
    margin: 5px 0;
    color: var(--text-color);
    font-size: 13px;
    opacity: 0.8;
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer a:hover {
    text-decoration: underline;
    opacity: 1;
    text-shadow: 0 0 5px rgba(218, 165, 32, 0.5);
}

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

.floating {
    animation: float 3s ease-in-out infinite;
}

@media (max-width: 480px) {
    .scrolling-banner {
        padding: 6px 0;
    }
    
    .scrolling-text {
        font-size: 12px;
        animation: scrollText 15s linear infinite;
    }
    
    body {
        padding-top: 35px; /* 移动端减少顶部内边距 */
    }
    
    .container {
        margin-top: 30px; /* 移动端减少顶部外边距 */
        gap: 10px;
        padding-bottom: 10px; /* 减少底部内边距 */
    }
    
    .question-options {
        flex-wrap: wrap;
    }
    
    .question-option {
        flex: 0 0 calc(50% - 10px);
        margin-bottom: 10px;
    }
    
    .card-slot {
        width: 90px;
        height: 140px;
    }
    
    h1 {
        font-size: 1.7rem;
    }
    
    .draw-btn {
        width: 110px;
        height: 110px;
        font-size: 1rem;
    }
    
    .question-selection {
        padding: 10px 8px;
        margin: 5px 0;
    }
    
    .question-selection h3 {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }
    
    .question-options {
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .question-option {
        padding: 8px 3px;
        border-radius: 8px;
    }
    
    .option-icon {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }
    
    .question-option span {
        font-size: 0.75rem;
    }
    
    .selected-question {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    /* 移动端底部优化 */
    .footer {
        padding: 12px 0;
        margin-top: 15px;
    }
    
    .footer p {
        font-size: 12px;
    }
    
    .action-buttons {
        margin-top: 12px;
        margin-bottom: 8px;
    }
    
    .results-container {
        margin-top: 3px;
    }
}

/* 针对超小屏幕的额外优化 */
@media (max-width: 360px) {
    .question-option span {
        font-size: 0.6rem;
    }
    
    .option-icon {
        font-size: 0.9rem;
    }
    
    .question-option {
        min-height: 40px;
        padding: 4px 1px;
    }
    
    .question-options {
        gap: 2px;
    }
}

/* AI解答相关样式 */
.ai-loading {
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(218, 165, 32, 0.3);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-result {
    display: none;
}

.ai-reading-content {
    line-height: 1.6;
    text-align: left;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(218, 165, 32, 0.3);
}

.ai-reading-content h3 {
    color: var(--accent-color);
    margin: 15px 0 8px;
    font-size: 1.1rem;
}

.ai-reading-content h4 {
    color: var(--accent-color);
    margin: 12px 0 6px;
    font-size: 1rem;
}

.ai-reading-content p {
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.ai-reading-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-reading-content li {
    margin-bottom: 5px;
}

/* 错误提示样式 */
.ai-error {
    color: #ff6b6b;
    text-align: center;
    padding: 20px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 10px;
    border: 1px solid #ff6b6b;
}

/* 卡片分析样式 */
.card-analysis {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.card-analysis h5 {
    color: var(--accent-color);
    margin-bottom: 8px;
    font-size: 1rem;
}

.card-analysis p {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.ai-note {
    margin-top: 20px;
    padding: 10px;
    background: rgba(218, 165, 32, 0.1);
    border-radius: 5px;
    border: 1px solid rgba(218, 165, 32, 0.3);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

/* AI解读结果提示样式 */
.ai-result-prompt {
    text-align: center;
    padding: 30px 20px;
}

.prompt-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.ai-result-prompt h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.ai-result-prompt p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.prompt-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.primary-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(218, 165, 32, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(218, 165, 32, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border: 1px solid var(--accent-color);
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: rgba(218, 165, 32, 0.1);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .prompt-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .primary-btn, .secondary-btn {
        width: 100%;
        max-width: 250px;
    }
}

/* 倒计时样式 */
.countdown-container {
    text-align: center;
    margin-top: 1rem;
}

.countdown-text {
    font-size: 1.1rem;
    margin: 1rem 0;
    color: #8b5cf6;
    font-weight: bold;
}

.progress-bar {
    width: 80%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    margin: 1rem auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    width: 0%;
    transition: width 1s linear;
    border-radius: 4px;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.secondary-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 0.5rem;
}

.prompt-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}