/* 全局样式 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #8e44ad;
    --accent-color: #f1c40f;
    --text-color: #333;
    --light-bg: #f9f9f9;
    --card-bg: #fff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 标题样式 */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

h3 {
    color: var(--secondary-color);
    margin: 1.5rem 0 1rem;
    font-weight: 600;
}

/* 占卜部分样式 */
.divination-section {
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary-color);
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(142, 68, 173, 0.2);
}

/* 牌阵选择样式 */
.spread-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.spread-option {
    background-color: var(--light-bg);
    border-radius: 8px;
    padding: 1.5rem;
    width: 200px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.spread-option:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.spread-option.selected {
    border-color: var(--secondary-color);
    background-color: rgba(142, 68, 173, 0.1);
}

.spread-image {
    height: 100px;
    margin-bottom: 1rem;
    background-color: #eee;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 牌阵图示样式 */
.single-card {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="100" viewBox="0 0 60 100"><rect x="5" y="5" width="50" height="90" rx="3" fill="none" stroke="%238e44ad" stroke-width="2"/><path d="M15,50 L45,50 M30,20 L30,80" stroke="%238e44ad" stroke-width="2" stroke-linecap="round"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.three-card {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="150" height="100" viewBox="0 0 150 100"><rect x="5" y="25" width="40" height="70" rx="3" fill="none" stroke="%238e44ad" stroke-width="2"/><rect x="55" y="5" width="40" height="70" rx="3" fill="none" stroke="%238e44ad" stroke-width="2"/><rect x="105" y="25" width="40" height="70" rx="3" fill="none" stroke="%238e44ad" stroke-width="2"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.celtic-cross {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="150" height="100" viewBox="0 0 150 100"><rect x="45" y="5" width="30" height="50" rx="2" fill="none" stroke="%238e44ad" stroke-width="2"/><rect x="45" y="65" width="30" height="50" rx="2" fill="none" stroke="%238e44ad" stroke-width="2" transform="translate(0, -20)"/><rect x="15" y="35" width="30" height="50" rx="2" fill="none" stroke="%238e44ad" stroke-width="2" transform="rotate(90, 30, 60)"/><rect x="75" y="35" width="30" height="50" rx="2" fill="none" stroke="%238e44ad" stroke-width="2" transform="rotate(90, 90, 60)"/><rect x="105" y="15" width="25" height="40" rx="2" fill="none" stroke="%238e44ad" stroke-width="2"/><rect x="105" y="65" width="25" height="40" rx="2" fill="none" stroke="%238e44ad" stroke-width="2" transform="translate(0, -20)"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.spread-desc {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

/* 按钮样式 */
.btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1.5rem;
    font-weight: 500;
    display: inline-block;
}

.btn:hover {
    background-color: #9b59b6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#start-reading {
    display: block;
    margin: 2rem auto 0;
    font-size: 1.1rem;
    padding: 1rem 2rem;
}

/* 占卜结果部分 */
.reading-section {
    margin-top: 2rem;
}

/* 牌阵布局样式 */
.spread {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.single-card-spread {
    justify-content: center;
}

.three-card-spread {
    justify-content: space-around;
    width: 100%;
}

/* 凯尔特十字牌阵样式 */
.celtic-cross-spread {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 15px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.celtic-cross {
    grid-column: 1 / 3;
    grid-row: 1 / 4;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 10px;
    position: relative;
}

.celtic-staff {
    grid-column: 3 / 5;
    grid-row: 1 / 4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 15px;
}

/* 凯尔特十字牌阵中各个位置的样式 */
.position-0 {
    grid-column: 2;
    grid-row: 2;
    z-index: 2;
}

.position-1 {
    grid-column: 2;
    grid-row: 2;
    z-index: 1;
    transform: rotate(90deg);
}

.position-2 {
    grid-column: 2;
    grid-row: 1;
}

.position-3 {
    grid-column: 2;
    grid-row: 3;
}

.position-4 {
    grid-column: 1;
    grid-row: 2;
}

.position-5 {
    grid-column: 3;
    grid-row: 2;
}

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

.position-label {
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--secondary-color);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none;
}

.reading-question {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 2rem;
    font-style: italic;
}

.welcome-message {
    text-align: center;
    padding: 20px;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 2s linear infinite;
    margin-bottom: 20px;
}

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

.question-display {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f0f0f0;
    border-left: 4px solid #3498db;
}

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin: 2rem 0;
}

.card-tip {
    width: 100%;
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 0.8rem;
    background-color: rgba(142, 68, 173, 0.1);
    border-left: 4px solid var(--secondary-color);
    color: var(--secondary-color);
    font-style: italic;
    border-radius: 5px;
}

.tarot-card {
    width: 120px;
    height: 200px;
    background-color: var(--light-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    position: relative;
    transition: var(--transition);
    perspective: 1000px;
    cursor: pointer;
    margin: 10px;
}

.tarot-card:hover {
    transform: translateY(-10px);
}

.tarot-card.reversed .card-front {
    transform: rotateY(180deg) rotate(180deg);
}

.tarot-card.reversed .card-image {
    transform: rotate(180deg);
}

.tarot-card .card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.tarot-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.tarot-card .card-front,
.tarot-card .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tarot-card .card-front {
    background: linear-gradient(135deg, #8e44ad 0%, #3498db 100%);
    color: white;
    transform: rotateY(180deg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.tarot-card .card-back {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="200" viewBox="0 0 120 200"><rect width="120" height="200" fill="%232c3e50"/><path d="M10,10 L110,10 L110,190 L10,190 Z" fill="none" stroke="%23f1c40f" stroke-width="2"/><circle cx="60" cy="100" r="40" fill="none" stroke="%23f1c40f" stroke-width="2"/><path d="M60,60 L60,140 M30,100 L90,100" stroke="%23f1c40f" stroke-width="2"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-position {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.card-image {
    width: 80px;
    height: 100px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 解读部分 */
.reading-interpretation {
    background-color: var(--light-bg);
    padding: 2rem;
    border-radius: 10px;
    margin-top: 2rem;
}

.card-interpretation {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #ddd;
}

.card-interpretation:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.card-interpretation h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* 关于部分 */
.about-section {
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.about-section p {
    margin-bottom: 1rem;
}

/* 卡片详细信息模态框 */
.card-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close-modal:hover {
    color: var(--secondary-color);
}

.card-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.card-detail-image {
    font-size: 4rem;
    margin-right: 1.5rem;
    background: linear-gradient(135deg, #8e44ad 0%, #3498db 100%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
}

.card-detail-title h3 {
    margin: 0 0 0.5rem 0;
    color: var(--secondary-color);
}

.card-detail-title p {
    margin: 0;
    color: #666;
}

.card-detail-info p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #666;
    font-size: 0.9rem;
}

/* 广告容器样式 */
.ad-container {
    background-color: var(--light-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin: 1.5rem 0;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.ad-label {
    position: absolute;
    top: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    z-index: 1;
}

.ad-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
}

/* 顶部广告位样式 */
.ad-top {
    margin-top: 0;
    margin-bottom: 2rem;
}

/* 底部广告位样式 */
.ad-bottom {
    margin-top: 2rem;
    margin-bottom: 0;
}

/* 侧边浮动广告位样式 */
.ad-sidebar {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 160px;
    z-index: 999;
    margin: 0;
    transform: translateX(200px);
    transition: transform 0.3s ease;
    animation: slideIn 1s forwards;
    animation-delay: 2s;
}

@keyframes slideIn {
    to { transform: translateX(0); }
}

.ad-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ad-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .spread-options {
        flex-direction: column;
        align-items: center;
    }
    
    .spread-option {
        width: 100%;
        max-width: 300px;
    }
    
    .tarot-card {
        width: 100px;
        height: 170px;
    }
    
    .card-image {
        width: 70px;
        height: 100px;
    }
    
    /* 移动设备上的广告样式 */
    .ad-sidebar {
        width: 120px;
        right: 10px;
        bottom: 10px;
    }
    
    .ad-content {
        min-height: 60px;
    }
}