/* 塔羅牌占卜樣式 */

/* 容器 */
.tarot-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    font-family: 'Microsoft JhengHei', 'PingFang TC', sans-serif;
}

/* 標題區 */
.tarot-header {
    text-align: center;
    margin-bottom: 30px;
}

.tarot-header h1 {
    font-size: 2.5rem;
    color: #5a4a8a;
    margin-bottom: 10px;
}

.tarot-header .subtitle {
    font-size: 1.1rem;
    color: #666;
}

/* 設定面板 */
.settings-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.settings-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-label {
    color: #fff;
    font-size: 1.1rem;
    width: 120px;
    font-weight: 500;
}

.settings-select {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-select option {
    background: #fff;
    color: #333;
}

.settings-select:hover {
    background: rgba(255, 255, 255, 1);
}

.settings-select:focus {
    outline: none;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.5);
}

/* 按鈕 */
.btn-draw {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
}

.btn-draw:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.5);
}

.btn-draw:active {
    transform: translateY(0);
}

.btn-reveal {
    padding: 14px 40px;
    margin: 30px auto 0;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 30px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.btn-reveal:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.5);
}

.btn-reset {
    padding: 12px 30px;
    margin: 20px auto 0;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-text {
    font-size: 1rem;
}

/* 抽牌區域 */
.cards-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.position-titles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.position-title {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

/* 牌卡網格 */
.cards-grid {
    display: grid;
    gap: 20px;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

/* 單張牌 */
.cards-grid.spread-0 {
    grid-template-columns: repeat(1, 1fr);
    padding: 60px 20px;
}

/* 三張牌 */
.cards-grid.spread-1 {
    grid-template-columns: repeat(3, 1fr);
}

/* 五張牌 */
.cards-grid.spread-2 {
    grid-template-columns: repeat(5, 1fr);
}

/* 凱爾特十字架 */
.cards-grid.spread-3 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas:
        ". . center . ."
        ". past present future"
        ". . advice outcome";
    gap: 15px;
}

.cards-grid.spread-3 .card-wrapper:nth-child(1) {
    grid-area: center;
}

.cards-grid.spread-3 .card-wrapper:nth-child(2) {
    grid-area: past;
}

.cards-grid.spread-3 .card-wrapper:nth-child(3) {
    grid-area: present;
}

.cards-grid.spread-3 .card-wrapper:nth-child(4) {
    grid-area: future;
}

.cards-grid.spread-3 .card-wrapper:nth-child(5) {
    grid-area: advice;
}

.cards-grid.spread-3 .card-wrapper:nth-child(6) {
    grid-area: outcome;
}

.cards-grid.spread-3 .card-wrapper:nth-child(7) {
    grid-area: outcome;
}

/* 做決定 */
.cards-grid.spread-4 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
}

/* 想法與心靈 */
.cards-grid.spread-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* 中方塊 */
.cards-grid.spread-6 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas:
        ". . present . ."
        ". past future ."
        ". advice outcome ."
        ". observable influence foundation";
}

/* 牌卡卡片 */
.card-wrapper {
    perspective: 1000px;
}

.card {
    width: 120px;
    height: 180px;
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    cursor: pointer;
}

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

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 牌背（未翻開） */
.card-back {
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.card-back::before {
    content: '🔮';
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

/* 牌面（已翻開） */
.card-front {
    background: #fff;
    transform: rotateY(180deg);
    z-index: 1;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 翻開狀態 */
.card.flipped .card-inner {
    transform: rotateY(180deg);
}

/* 已揭示的牌 */
.card.revealed .card-front {
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* 牌名稱標籤 */
.card-name {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card.revealed .card-name {
    opacity: 1;
}

/* 揭示結果容器 */
.reveal-container {
    text-align: center;
    margin-top: 20px;
}

/* 解讀結果區 */
.result-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(195, 207, 226, 0.3);
}

.result-title {
    font-size: 1.8rem;
    color: #2d3436;
    margin-bottom: 20px;
    text-align: center;
}

.result-summary {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
}

.result-cards {
    display: grid;
    gap: 20px;
}

.result-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.result-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.result-card-position {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.result-card-name {
    font-size: 1.2rem;
    color: #2d3436;
    font-weight: 700;
}

.result-card-body {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.result-card-image {
    flex-shrink: 0;
    width: 120px;
}

.result-card-image img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.result-card-content {
    flex: 1;
    min-width: 0;
}

.result-card-interp {
    line-height: 1.7;
    color: #555;
}

.result-card-interp strong {
    color: #2d3436;
    font-weight: 600;
}

.result-card-interp em {
    color: #999;
}

/* 配額提示 */
.quota-info {
    text-align: center;
    margin-top: 20px;
}

.quota-text {
    color: #666;
    font-size: 1rem;
}

#quota-count {
    color: #f5576c;
    font-weight: 700;
    font-size: 1.2rem;
}

/* 加載遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #fff;
    font-size: 1.2rem;
    margin-top: 20px;
}

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

/* 響應式 */
@media (max-width: 768px) {
    .tarot-container {
        padding: 15px;
        margin: 20px auto;
    }

    .settings-panel {
        padding: 20px;
    }

    .settings-row {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-label {
        width: 100%;
        margin-bottom: 8px;
    }

    .cards-grid.spread-2 {
        grid-template-columns: repeat(3, 1fr);
    }

    .cards-grid.spread-3 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-areas:
            ". center ."
            ". past future"
            ". advice outcome";
    }

    .cards-grid.spread-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .card {
        width: 90px;
        height: 135px;
    }

    .result-card-body {
        flex-direction: column;
        align-items: center;
    }

    .result-card-image {
        width: 100px;
    }
}
