/* ============================
   zhibeibei.css - 掷圣杯（掷筊）
   统一项目黑白简约风格 + 传统民俗风
   ============================ */

.zhibeibei-page {
    max-width: 640px;
}

.zhibeibei-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.2rem;
    line-height: 1.6;
}

/* 掷杯礼仪提示 */
.ritual-tip {
    border: 1.5px dashed var(--fg);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 1.2rem;
    text-align: left;
    background: var(--bg);
}

.ritual-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--fg);
}

.rs-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border: 1.5px solid var(--fg);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    font-family: 'KaiTi', 'STKaiti', serif;
}

@media (max-width: 480px) {
    .ritual-step { font-size: 12px; gap: 8px; }
    .rs-num { width: 20px; height: 20px; line-height: 20px; font-size: 11px; }
}

.question-input,
.category-select {
    text-align: left;
    margin-bottom: 1.2rem;
}

.question-input label,
.category-select label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.question-input input,
.category-select select {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--light-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg);
    color: var(--fg);
    box-sizing: border-box;
}

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

/* ===== 按钮 ===== */
.btn-main {
    display: inline-block;
    padding: 10px 32px;
    background: var(--fg);
    color: var(--bg);
    border: 2px solid var(--fg);
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 2px;
}

.btn-main:hover {
    opacity: 0.85;
}

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

.btn-secondary {
    display: inline-block;
    padding: 10px 28px;
    background: var(--bg);
    color: var(--fg);
    border: 2px solid var(--fg);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 10px;
}

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

/* ===== 掷杯动画区 ===== */
.cast-stage {
    text-align: center;
    padding: 16px 0;
}

.stage-hint {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 20px;
}

/* 筊杯容器 */
.bei-area {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 20px;
    min-height: 80px;
    align-items: center;
    perspective: 600px;
}

.bei-wrap {
    width: 80px;
    height: 48px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* 半月形筊杯 */
.bei {
    width: 80px;
    height: 40px;
    border: 2px solid var(--fg);
    box-sizing: border-box;
    position: relative;
    transition: transform 0.2s ease;
}

/* 阴面（平面朝上）- 浅色半月，形如碗 ∪ */
.bei.yin {
    border-radius: 0 0 80px 80px;
    background: var(--bg);
    border-top: none;
    border-bottom-width: 3px;
}

/* 阳面（凸面朝上）- 深色半月，形如拱 ∩ */
.bei.yang {
    border-radius: 80px 80px 0 0;
    background: var(--fg);
    border-bottom: none;
    border-top-width: 3px;
}

/* 翻转动画 */
.bei.flipping {
    animation: beiToss 0.75s ease-in-out;
    background: var(--bg);
    border-radius: 80px 80px 0 0;
    border: 2px solid var(--fg);
}

@keyframes beiToss {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    20% {
        transform: translateY(-90px) rotate(360deg) scale(1.1);
    }
    45% {
        transform: translateY(-130px) rotate(720deg) scale(1.15);
    }
    70% {
        transform: translateY(-70px) rotate(1080deg) scale(1.1);
    }
    100% {
        transform: translateY(0) rotate(1440deg) scale(1);
    }
}

.bei.landed {
    animation: beiLand 0.3s ease-out;
}

@keyframes beiLand {
    0% { transform: translateY(-10px) scale(1.05); }
    60% { transform: translateY(2px) scale(0.97); }
    100% { transform: translateY(0) scale(1); }
}

/* 本次结果 */
.cast-result {
    font-size: 14px;
    color: var(--muted);
    margin: 8px 0 16px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.casting-hint {
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 2px;
}

.cast-result-symbol {
    font-size: 24px;
}

.cast-result-name {
    font-size: 18px;
    font-weight: bold;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 2px;
}

.cast-result-name.sheng { color: var(--fg); }
.cast-result-name.xiao { color: var(--muted); }
.cast-result-name.yin { color: var(--fg); opacity: 0.7; }

.cast-result-desc {
    font-size: 12px;
    color: var(--muted);
}

/* 已掷结果列表 */
.cast-progress {
    margin-top: 16px;
    padding: 12px;
    border: 1.5px solid var(--light-border);
    border-radius: 6px;
    background: var(--bg);
}

.cast-progress-title {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
}

.bei-list {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    flex-wrap: wrap;
}

.bei-list-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 10px;
    border: 1.5px solid var(--fg);
    border-radius: 6px;
    min-width: 80px;
    background: var(--bg);
}

.bei-list-item.sheng {
    border-color: var(--fg);
}

.bei-list-item.xiao {
    border-color: var(--light-border);
    background: var(--hover-bg);
}

.bei-list-item.yin {
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
}

.bei-list-item .bli-num {
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 2px;
}

.bei-list-item.yin .bli-num {
    color: #ccc;
}

.bei-list-item .bli-sym {
    font-size: 18px;
    line-height: 1.2;
}

.bei-list-item .bli-name {
    font-size: 12px;
    font-weight: bold;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 1px;
}

.bei-list-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border: 1.5px dashed var(--light-border);
    border-radius: 6px;
    min-width: 80px;
    font-size: 11px;
    color: var(--muted);
}

/* ===== 结果区 ===== */
.result-panel {
    animation: fadeIn 0.5s ease;
}

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

.question-display {
    text-align: center;
    padding: 10px;
    margin-bottom: 16px;
    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;
}

.question-display .q-cat {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--light-border);
    border-radius: 8px;
}

/* 三次结果汇总 */
.three-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.three-result-item {
    text-align: center;
    padding: 10px 6px;
    border: 1.5px solid var(--fg);
    border-radius: 8px;
    background: var(--bg);
}

.three-result-item.sheng {
    border-color: var(--fg);
}

.three-result-item.xiao {
    border-color: var(--light-border);
    background: var(--hover-bg);
}

.three-result-item.yin {
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
}

.three-result-item .tri-num {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}

.three-result-item.yin .tri-num {
    color: #ccc;
}

.three-result-item .tri-sym {
    font-size: 26px;
    line-height: 1.2;
    margin-bottom: 2px;
}

.three-result-item .tri-name {
    font-size: 15px;
    font-weight: bold;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.three-result-item .tri-desc {
    font-size: 10px;
    line-height: 1.5;
    color: var(--muted);
}

.three-result-item.yin .tri-desc {
    color: #bbb;
}

/* 综合判断 */
.combined-box {
    border: 2px solid var(--fg);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg);
    text-align: center;
}

.combined-title {
    font-size: 22px;
    font-weight: bold;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.combined-luck {
    display: inline-block;
    padding: 2px 12px;
    font-size: 12px;
    color: var(--fg);
    border: 1px solid var(--fg);
    border-radius: 10px;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.combined-desc {
    font-size: 13px;
    line-height: 1.8;
    color: var(--fg);
    text-align: left;
}

/* 宜忌 */
.combined-yiji {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    text-align: left;
}

.yj-item {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1.5px solid var(--fg);
    border-radius: 6px;
    background: var(--bg);
}

.yj-yi {
    border-color: #1a7f37;
}

.yj-ji {
    border-color: #b23a3a;
}

.yj-label {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
}

.yj-yi .yj-label {
    background: #1a7f37;
}

.yj-ji .yj-label {
    background: #b23a3a;
}

.yj-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--fg);
    flex: 1;
}

@media (max-width: 480px) {
    .yj-item { padding: 6px 8px; gap: 6px; }
    .yj-label { width: 18px; height: 18px; line-height: 18px; font-size: 11px; }
    .yj-text { font-size: 11px; line-height: 1.5; }
}

/* 分类建议 */
.advice-box {
    border: 1.5px dashed var(--fg);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: rgba(0,0,0,0.02);
}

.advice-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: 1px;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
}

.advice-text {
    font-size: 13px;
    line-height: 1.8;
    color: var(--fg);
}

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

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

.history-title {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--muted);
}

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

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

.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: 14px;
    letter-spacing: 1px;
}

.history-sym {
    margin-right: 1px;
}

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

.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;
}

.history-clear {
    margin-top: 8px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
}

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

.history-clear .btn-view-all {
    color: var(--fg);
}

/* ===== 移动端适配 ===== */
@media (max-width: 480px) {
    .zhibeibei-main {
        padding: 1rem;
    }

    .bei-area {
        gap: 20px;
    }

    .bei-wrap {
        width: 68px;
        height: 42px;
    }

    .bei {
        width: 68px;
        height: 34px;
    }

    .bei.yin {
        border-radius: 0 0 68px 68px;
    }

    .bei.yang {
        border-radius: 68px 68px 0 0;
    }

    .bei.flipping {
        border-radius: 68px 68px 0 0;
    }

    .three-results {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .three-result-item {
        display: flex;
        align-items: center;
        gap: 10px;
        text-align: left;
        padding: 10px 12px;
    }

    .three-result-item .tri-num {
        min-width: 50px;
        margin-bottom: 0;
    }

    .three-result-item .tri-sym {
        font-size: 22px;
        margin-bottom: 0;
    }

    .three-result-item .tri-name {
        min-width: 50px;
        margin-bottom: 0;
    }

    .three-result-item .tri-desc {
        flex: 1;
        font-size: 11px;
    }

    .bei-list-item {
        min-width: 70px;
        padding: 5px 8px;
    }

    .bei-list-empty {
        min-width: 70px;
    }

    .btn-main,
    .btn-secondary {
        padding: 10px 22px;
        font-size: 14px;
        letter-spacing: 1px;
    }

    .btn-secondary {
        margin-left: 6px;
    }

    .combined-title {
        font-size: 20px;
    }

    .history-time {
        min-width: 86px;
    }

    .history-question {
        max-width: 120px;
    }
}
