/* ============================
   tarot.css - 塔罗牌占卜
   统一项目黑白简约风格
   ============================ */

.tarot-page {
    max-width: 600px;
}

.tarot-main {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
}

/* 牌阵选择区 */
.setup-panel {
    text-align: center;
}

.setup-hint {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 1.5rem;
}

.spread-options {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.spread-opt {
    flex: 1;
    border: 2px solid var(--light-border);
    border-radius: 8px;
    padding: 1rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.spread-opt:hover {
    border-color: var(--fg);
}

.spread-opt.selected {
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
}

.spread-name {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 4px;
}

.spread-desc {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 6px;
    line-height: 1.3;
}

.spread-opt.selected .spread-desc {
    color: #ccc;
}

.spread-count {
    font-size: 12px;
    font-weight: bold;
    opacity: 0.8;
}

.question-input {
    text-align: left;
    margin-bottom: 1.5rem;
}

.question-input label {
    display: block;
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: bold;
}

.question-input input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--light-border);
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    color: var(--fg);
    transition: border-color 0.2s;
}

.question-input input:focus {
    outline: none;
    border-color: var(--fg);
}

/* 按钮 */
.btn-main {
    background: var(--fg);
    color: var(--bg);
    border: 2px solid var(--fg);
    padding: 14px;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-main:hover {
    background: var(--bg);
    color: var(--fg);
}

.btn-secondary {
    background: var(--bg);
    color: var(--fg);
    border: 1.5px solid var(--light-border);
    padding: 10px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    margin-top: 1rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--fg);
}

.btn-main:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 操作按钮组（结果区） */
.action-buttons {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1.5px solid var(--light-border);
}

.action-buttons .btn-main {
    display: inline-block;
    width: auto;
    padding: 10px 32px;
    font-size: 15px;
    letter-spacing: 2px;
}

.action-buttons .btn-secondary {
    display: inline-block;
    margin-top: 0;
    margin-left: 10px;
    padding: 10px 28px;
    font-size: 14px;
}

/* 抽牌区 */
.draw-panel {
    text-align: center;
}

.draw-hint {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 1.5rem;
}

.draw-hint span {
    color: var(--fg);
    font-weight: bold;
}

.stage-hint {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 1.5rem;
}

.stage-hint span {
    color: var(--fg);
    font-weight: bold;
}

.deck-area {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.card-deck {
    width: 120px;
    height: 168px;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}

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

.card-deck:active {
    transform: translateY(0);
}

/* 洗牌动画 */
.card-deck.shuffling {
    animation: shuffleAnim 1.5s ease-in-out;
}

@keyframes shuffleAnim {
    0% { transform: translateX(0) rotate(0); }
    20% { transform: translateX(-30px) rotate(-15deg); }
    40% { transform: translateX(30px) rotate(15deg); }
    60% { transform: translateX(-20px) rotate(-10deg); }
    80% { transform: translateX(20px) rotate(10deg); }
    100% { transform: translateX(0) rotate(0); }
}

/* 牌背图案 - 黑白几何 */
.deck-back {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: 2px solid var(--fg);
    background: var(--fg);
    position: relative;
    overflow: hidden;
}

.deck-back::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 60%;
    height: 60%;
    border: 2px solid rgba(255,255,255,0.3);
}

.deck-back::after {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 32px;
    text-align: center;
}

.deck-count {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.deck-count span {
    font-weight: bold;
    color: var(--fg);
}

/* 切牌阶段 */
.cut-piles {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 2rem;
}

.cut-pile {
    cursor: pointer;
    transition: transform 0.2s;
    text-align: center;
}

.cut-pile:hover {
    transform: translateY(-6px);
}

.pile-back {
    width: 80px;
    height: 112px;
    border-radius: 8px;
    border: 2px solid var(--fg);
    background: var(--fg);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.pile-back::after {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
}

.pile-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
}

/* 扇形抽牌 */
.fan-cards {
    position: relative;
    height: 200px;
    margin-bottom: 2rem;
    overflow: visible;
}

.fan-card {
    position: absolute;
    bottom: 0;
    width: 50px;
    height: 90px;
    transform-origin: bottom center;
    transform: rotate(var(--rot, 0deg)) translateY(0);
    transition: transform 0.2s;
    cursor: pointer;
    z-index: 1;
}

.fan-card:hover {
    transform: rotate(var(--rot, 0deg)) translateY(-15px);
    z-index: 10;
}

.fan-card-back {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    border: 1.5px solid var(--fg);
    background: var(--fg);
    position: relative;
    overflow: hidden;
}

.fan-card-back::after {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
}

/* 已抽牌位 */
.drawn-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    min-height: 180px;
    margin-bottom: 1rem;
}

.drawn-slot {
    width: 100px;
    height: 140px;
    border: 2px dashed var(--light-border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s;
}

.drawn-slot.filled {
    border-style: solid;
    border-color: var(--fg);
    background: var(--bg);
    cursor: default;
}

.slot-label {
    font-size: 11px;
    color: var(--muted);
    position: absolute;
    bottom: -20px;
    white-space: nowrap;
}

.drawn-slot.filled .slot-label {
    color: var(--fg);
    font-weight: bold;
}

.slot-placeholder {
    font-size: 24px;
    color: var(--light-border);
}

/* 翻牌动画 */
.drawn-slot .card-face {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    animation: card-reveal 0.5s ease-out;
}

@keyframes card-reveal {
    0% { transform: rotateY(90deg); opacity: 0; }
    100% { transform: rotateY(0); opacity: 1; }
}

.card-name {
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 4px;
}

.card-symbol {
    font-size: 32px;
    text-align: center;
    margin-bottom: 6px;
    line-height: 1;
}

.card-num {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}

.card-orientation {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 4px;
}

.card-orientation.upright {
    background: var(--fg);
    color: var(--bg);
}

.card-orientation.reversed {
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--fg);
}

.drawn-slot.reversed .card-face {
    transform: rotate(180deg);
}

.drawn-slot.reversed .card-face .card-orientation {
    transform: rotate(-180deg);
}

/* 解读区 */
.result-panel {
    text-align: center;
}

.question-display {
    text-align: center;
    padding: 10px;
    margin-bottom: 18px;
    border-bottom: 1.5px dashed var(--light-border);
}

.question-display .q-label {
    font-size: 12px;
    color: var(--muted);
    margin-right: 6px;
}

.question-display .q-text {
    font-size: 15px;
    color: var(--fg);
    font-weight: bold;
}

.cards-reading {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.reading-card {
    border: 1.5px solid var(--light-border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    gap: 12px;
    text-align: left;
}

.reading-card .card-visual {
    width: 70px;
    height: 100px;
    border: 1.5px solid var(--fg);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    flex-shrink: 0;
    background: var(--bg);
}

.reading-card .card-visual.reversed {
    transform: rotate(180deg);
}

.reading-card .card-visual .visual-name {
    font-size: 11px;
    font-weight: bold;
    text-align: center;
}

.reading-card .card-visual .visual-num {
    font-size: 9px;
    color: var(--muted);
}

.reading-card .card-visual .visual-symbol {
    font-size: 24px;
    text-align: center;
    margin-bottom: 4px;
    line-height: 1;
}

.reading-card .card-visual .visual-hint {
    font-size: 8px;
    color: var(--muted);
    margin-top: 4px;
    opacity: 0.7;
}

.reading-card .card-visual {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.reading-card .card-visual:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.reading-card .card-info {
    flex: 1;
}

.reading-card .position-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--muted);
    margin-bottom: 4px;
}

.reading-card .card-title {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 6px;
}

.reading-card .card-orient-tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-bottom: 6px;
}

.reading-card .card-orient-tag.upright {
    background: var(--fg);
    color: var(--bg);
}

.reading-card .card-orient-tag.reversed {
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--fg);
}

.reading-card .card-meaning {
    font-size: 13px;
    color: var(--fg);
    line-height: 1.5;
}

.reading-card .card-keywords {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    font-style: italic;
}

/* 综合解读 */
.reading-summary {
    background: var(--hover-bg);
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.reading-summary h3 {
    font-size: 15px;
    margin-bottom: 0.5rem;
}

.reading-summary p {
    font-size: 13px;
    color: var(--fg);
    line-height: 1.6;
}

/* 响应式 */
@media (max-width: 480px) {
    .tarot-main { padding: 1rem; }

    .spread-options {
        flex-direction: column;
        gap: 8px;
    }

    .spread-opt {
        padding: 0.8rem;
    }

    .card-deck { width: 100px; height: 140px; }
    .deck-back::after { font-size: 26px; }

    .drawn-slot { width: 80px; height: 112px; }
    .drawn-slot .card-name { font-size: 11px; }
    .drawn-slot .card-num { font-size: 10px; }
    .drawn-slot .card-symbol { font-size: 26px; }

    .reading-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .reading-card .card-visual {
        width: 60px;
        height: 84px;
    }

    .cut-piles { gap: 12px; }
    .pile-back { width: 65px; height: 91px; }

    .fan-card { width: 42px; height: 76px; }
    .fan-card-back::after { font-size: 14px; }
    .fan-cards { height: 170px; }

    .detail-content { width: 92%; padding: 1.2rem; }
    .detail-symbol { font-size: 40px; }
    .detail-title { font-size: 18px; }
    /* 历史记录移动端适配 */
    .history-time { min-width: 80px; font-size: 10px; }
    .history-symbols { font-size: 14px; }
    .history-question { max-width: 120px; }
}

/* 牌意详情弹窗 */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-content {
    background: var(--bg);
    border: 2px solid var(--fg);
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.detail-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

/* ===== 历史记录区 ===== */
.history-section {
    margin-top: 18px;
    padding: 12px;
    border: 1.5px solid var(--light-border);
    border-radius: 8px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-header h3 {
    font-size: 13px;
    font-weight: bold;
    color: var(--muted);
    margin: 0;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.history-list {
    max-height: 220px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--light-border);
    font-size: 12px;
    cursor: pointer;
    flex-wrap: wrap;
}

.history-item:hover {
    background: rgba(0,0,0,0.04);
}

.history-item:last-child {
    border-bottom: none;
}

.history-time {
    color: var(--muted);
    font-size: 11px;
    min-width: 100px;
}

.history-symbols {
    font-size: 16px;
    letter-spacing: 2px;
    line-height: 1;
}

.history-sym {
    display: inline-block;
    margin-right: 2px;
}

.history-sym.reversed {
    transform: rotate(180deg);
    display: inline-block;
    opacity: 0.7;
}

.history-name {
    flex: 1;
    color: var(--fg);
    font-weight: bold;
    min-width: 80px;
}

.history-luck {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    font-size: 10px;
    font-weight: normal;
    color: var(--muted);
    border: 1px solid var(--light-border);
    border-radius: 6px;
}

.history-question {
    color: var(--muted);
    font-size: 11px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-empty {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 16px;
}

.detail-close:hover {
    color: var(--fg);
}

.detail-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1.5px solid var(--light-border);
}

.detail-symbol {
    font-size: 48px;
    margin-bottom: 8px;
    line-height: 1;
}

.detail-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 4px;
}

.detail-type {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

.detail-orient {
    display: inline-block;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 3px;
}

.detail-orient.upright {
    background: var(--fg);
    color: var(--bg);
}

.detail-orient.reversed {
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--fg);
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--muted);
    margin-bottom: 4px;
}

.detail-keywords,
.detail-meaning,
.detail-position,
.detail-upright,
.detail-reversed-text {
    font-size: 14px;
    color: var(--fg);
    line-height: 1.5;
}

.detail-keywords {
    font-weight: bold;
}

/* 图片预览弹窗 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-content {
    text-align: center;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.image-modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

.image-modal-content img {
    max-width: 100%;
    border: 2px solid #fff;
    border-radius: 8px;
}

.image-modal-hint {
    color: #fff;
    font-size: 13px;
    margin-top: 12px;
}
