/* ===== 铜币主题色 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background: #1a1410;
    color: #e8ddd0;
    font-family: 'Segoe UI', 'Noto Serif SC', system-ui, serif;
    padding: 20px 16px 40px;
    min-height: 100vh;
    background-image: radial-gradient(ellipse at 50% 0%, #2a1f18 0%, #1a1410 70%);
}
.container {
    max-width: 720px;
    margin: 0 auto;
}
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: #1a1410;
}
::-webkit-scrollbar-thumb {
    background: #c88a3c;
    border-radius: 4px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid #6b4c2a;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}
.header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.header h1 .coin-icon {
    color: #c88a3c;
    font-size: 26px;
}
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    background: transparent;
    border: 1px solid #6b4c2a;
    color: #e8ddd0;
    padding: 7px 18px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    letter-spacing: 0.3px;
}
.btn:hover {
    border-color: #c88a3c;
    color: #f0e6d8;
    background: rgba(200, 138, 60, 0.08);
}
.btn-primary {
    background: #c88a3c;
    border-color: #c88a3c;
    color: #1a1410;
    font-weight: 500;
}
.btn-primary:hover {
    background: #d4a04c;
    border-color: #d4a04c;
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-secondary {
    border-color: #6b4c2a;
}
.btn-secondary:hover {
    background: rgba(200, 138, 60, 0.12);
    border-color: #c88a3c;
}
.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}
.btn-danger {
    border-color: #8c4c3c;
    color: #d4a090;
}
.btn-danger:hover {
    border-color: #b06050;
    color: #f0c0b0;
    background: rgba(176, 96, 80, 0.08);
}

.card {
    background: #241e1a;
    border-radius: 16px;
    border: 1px solid #3d2e22;
    padding: 22px 24px 26px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.card-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title .badge {
    font-size: 11px;
    color: #c88a3c;
    background: rgba(200, 138, 60, 0.12);
    padding: 2px 10px;
    border-radius: 12px;
    border: 1px solid rgba(200, 138, 60, 0.2);
}
.card-sub {
    font-size: 13px;
    color: #a0907f;
    margin-bottom: 14px;
    line-height: 1.5;
}

.question-input {
    width: 100%;
    background: #120e0c;
    border: 1px solid #3d2e22;
    border-radius: 10px;
    padding: 14px 16px;
    color: #e8ddd0;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 72px;
    transition: border-color 0.25s;
    line-height: 1.6;
}
.question-input:focus {
    outline: none;
    border-color: #c88a3c;
    box-shadow: 0 0 0 3px rgba(200, 138, 60, 0.12);
}
.question-input::placeholder {
    color: #6a5f52;
    font-size: 14px;
}

.mode-toggle {
    display: flex;
    gap: 8px;
    margin: 8px 0 4px;
    background: #120e0c;
    border-radius: 10px;
    padding: 4px;
    border: 1px solid #3d2e22;
}
.mode-toggle .btn {
    flex: 1;
    text-align: center;
    border: none;
    border-radius: 8px;
    padding: 9px 8px;
    font-size: 13px;
    background: transparent;
    color: #a0907f;
}
.mode-toggle .btn.active {
    background: #c88a3c;
    color: #1a1410;
}
.mode-toggle .btn:hover:not(.active) {
    color: #e8ddd0;
    background: rgba(200, 138, 60, 0.08);
}

/* ===== 抛硬币区域 ===== */
.coin-area {
    text-align: center;
    padding: 12px 0 10px;
}
.coin-step {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 4px;
    letter-spacing: 1px;
}
.coin-step .sub {
    font-size: 14px;
    color: #a0907f;
    font-weight: 400;
}
.coin-step .highlight {
    color: #c88a3c;
}

.coin-container {
    display: flex;
    justify-content: center;
    gap: 36px;
    margin: 8px 0 16px;
    perspective: 1200px;
    min-height: 120px;
    align-items: flex-end;
    padding-bottom: 10px;
}
.coin-wrapper {
    width: 76px;
    height: 76px;
    position: relative;
    cursor: default;
    transition: transform 0.3s;
}
.coin-3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    border-radius: 50%;
    transition: none;
}
.coin-3d.throw-1 {
    animation: throwCoin1 3.2s cubic-bezier(0.2, 0.7, 0.3, 1.0) forwards;
}
.coin-3d.throw-2 {
    animation: throwCoin2 3.3s cubic-bezier(0.25, 0.65, 0.35, 1.05) forwards;
}
.coin-3d.throw-3 {
    animation: throwCoin3 3.1s cubic-bezier(0.18, 0.75, 0.28, 1.02) forwards;
}
@keyframes throwCoin1 {
    0% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    18% {
        transform: translateY(-35px) rotateX(360deg) rotateY(120deg) rotateZ(25deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    40% {
        transform: translateY(-78px) rotateX(720deg) rotateY(240deg) rotateZ(-15deg);
        animation-timing-function: cubic-bezier(0.0, 0.0, 0.58, 1.0);
    }
    75% {
        transform: translateY(-78px) rotateX(1080deg) rotateY(360deg) rotateZ(10deg);
        animation-timing-function: cubic-bezier(0.0, 0.0, 0.58, 1.0);
    }
    /* ===== 落地阶段（回弹拉长） ===== */
    82% {
        transform: translateY(-2px) rotateX(1440deg) rotateY(540deg) rotateZ(-5deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    90% {
        transform: translateY(-25px) rotateX(1460deg) rotateY(555deg) rotateZ(-2deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    95% {
        transform: translateY(-5px) rotateX(1480deg) rotateY(565deg) rotateZ(-1deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    100% {
        transform: translateY(0) rotateX(var(--final-x, 0deg)) rotateY(var(--final-y, 0deg)) rotateZ(var(--final-z, 0deg));
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
}
@keyframes throwCoin2 {
    0% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    18% {
        transform: translateY(-40px) rotateX(-320deg) rotateY(150deg) rotateZ(-30deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    40% {
        transform: translateY(-82px) rotateX(-640deg) rotateY(300deg) rotateZ(20deg);
        animation-timing-function: cubic-bezier(0.0, 0.0, 0.58, 1.0);
    }
    75% {
        transform: translateY(-82px) rotateX(-960deg) rotateY(450deg) rotateZ(-15deg);
        animation-timing-function: cubic-bezier(0.0, 0.0, 0.58, 1.0);
    }
    /* ===== 落地阶段（回弹拉长） ===== */
    82% {
        transform: translateY(-3px) rotateX(-1280deg) rotateY(600deg) rotateZ(10deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    90% {
        transform: translateY(-30px) rotateX(-1310deg) rotateY(615deg) rotateZ(5deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    95% {
        transform: translateY(-6px) rotateX(-1330deg) rotateY(625deg) rotateZ(3deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    100% {
        transform: translateY(0) rotateX(var(--final-x, 0deg)) rotateY(var(--final-y, 0deg)) rotateZ(var(--final-z, 0deg));
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
}
@keyframes throwCoin3 {
    0% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    18% {
        transform: translateY(-32px) rotateX(400deg) rotateY(-140deg) rotateZ(35deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    40% {
        transform: translateY(-72px) rotateX(800deg) rotateY(-280deg) rotateZ(-20deg);
        animation-timing-function: cubic-bezier(0.0, 0.0, 0.58, 1.0);
    }
    75% {
        transform: translateY(-72px) rotateX(1200deg) rotateY(-420deg) rotateZ(15deg);
        animation-timing-function: cubic-bezier(0.0, 0.0, 0.58, 1.0);
    }
    /* ===== 落地阶段（回弹拉长） ===== */
    82% {
        transform: translateY(-2px) rotateX(1560deg) rotateY(-560deg) rotateZ(-8deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    90% {
        transform: translateY(-22px) rotateX(1590deg) rotateY(-575deg) rotateZ(-4deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    95% {
        transform: translateY(-4px) rotateX(1610deg) rotateY(-585deg) rotateZ(-2deg);
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
    100% {
        transform: translateY(0) rotateX(var(--final-x, 0deg)) rotateY(var(--final-y, 0deg)) rotateZ(var(--final-z, 0deg));
        animation-timing-function: cubic-bezier(0.33, 0.0, 0.67, 1.0);
    }
}

/* 硬币两面（纯图片，无额外文字） */
.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    border: 2px solid #6b4c2a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 -3px 12px rgba(0, 0, 0, 0.3);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.coin-face.front {
    transform: rotateY(0deg);
}
.coin-face.back {
    transform: rotateY(180deg);
}

.coin-thickness {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    backface-visibility: hidden;
    pointer-events: none;
    z-index: 0;
}

/* 厚度层本身的铜色（边缘立体感） */
.coin-thickness::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #b08860, #7a5a3a);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.6);
    z-index: 0;
}

/* 方孔覆盖层 - 只覆盖中间方孔区域，让方孔变暗 */
.coin-thickness::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: #1a1410;  /* 背景色，让方孔看起来镂空 */
    border-radius: 2px;
    z-index: 1;
}

/* 硬币正反面放在厚度层之上 */
.coin-face {
    z-index: 1;
}

.coin-placeholder {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2px dashed #4d3e32;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4d3e32;
    font-size: 28px;
    background: rgba(18, 14, 12, 0.5);
    font-family: 'Noto Serif SC', serif;
}

.coin-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}
.coin-actions .btn {
    padding: 10px 32px;
    font-size: 16px;
    min-width: 140px;
}
.manual-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.manual-options .btn {
    padding: 8px 16px;
    font-size: 13px;
    min-width: 64px;
}
.manual-options .btn.selected {
    background: #c88a3c;
    border-color: #c88a3c;
    color: #1a1410;
}
.manual-hint {
    font-size: 12px;
    color: #6a5f52;
    margin-top: 2px;
    letter-spacing: 0.5px;
}
.manual-hint .yang {
    color: #c88a3c;
}
.manual-hint .yin {
    color: #a0907f;
}

.result-hint {
    font-size: 14px;
    color: #a0907f;
    min-height: 24px;
    margin-top: 4px;
}
.result-hint .gold {
    color: #c88a3c;
}

/* ===== 爻位记录 ===== */
.yao-record {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 0 4px;
}
.yao-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 16px;
    border-radius: 6px;
    background: rgba(18, 14, 12, 0.4);
    width: 100%;
    max-width: 340px;
    justify-content: center;
    border: 1px solid transparent;
    transition: all 0.4s;
    opacity: 0.25;
}
.yao-row.done {
    border-color: #6b4c2a;
    opacity: 1;
}
.yao-row .label {
    font-size: 12px;
    color: #a0907f;
    min-width: 36px;
    text-align: right;
}
.yao-row .yao-line {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    letter-spacing: 4px;
    min-width: 80px;
    font-family: 'Noto Serif SC', 'Courier New', monospace;
    transition: color 0.4s;
    font-weight: 400;
    line-height: 1.2;
}
.yao-row .yao-line .dong-mark {
    color: #c88a3c;
    font-size: 16px;
    margin-left: 4px;
    font-weight: 600;
}
.yao-row .yao-line .yin-line {
    display: inline-block;
    width: 32px;
    height: 3px;
    background: #e8ddd0;
    border-radius: 2px;
    margin: 0 2px;
}
.yao-row .yao-line .yin-line + .yin-line {
    margin-left: 6px;
}
.yao-row .yao-line .yang-line {
    display: inline-block;
    width: 72px;
    height: 3px;
    background: #e8ddd0;
    border-radius: 2px;
}
.yao-row .yao-line .yang-line.dong-color {
    background: #c88a3c;
}
.yao-row .yao-line .yin-line.dong-color {
    background: #c88a3c;
}

.yao-row .status {
    font-size: 12px;
    color: #6a5f52;
    min-width: 48px;
}
.yao-row .status.dong {
    color: #c88a3c;
}
.progress-text {
    text-align: center;
    font-size: 13px;
    color: #6a5f52;
    margin-top: 4px;
}

/* ===== 结果展示 ===== */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 10px 0 14px;
}
.result-item {
    background: #120e0c;
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid #3d2e22;
}
.result-item .label {
    font-size: 11px;
    color: #a0907f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.result-item .value {
    font-size: 18px;
    font-weight: 500;
    margin-top: 2px;
    font-family: 'Noto Serif SC', serif;
}
.result-item .value .gold {
    color: #c88a3c;
}

.result-yao-detail {
    background: #120e0c;
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid #3d2e22;
    margin: 10px 0 14px;
}
.result-yao-detail .row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-family: 'Noto Serif SC', monospace;
    padding: 3px 0;
}
.result-yao-detail .row .label {
    font-size: 12px;
    color: #a0907f;
    min-width: 36px;
    text-align: right;
}
.result-yao-detail .row .dong-mark {
    color: #c88a3c;
    font-size: 14px;
    margin-left: 4px;
}
.result-yao-detail .row .yao-display {
    min-width: 80px;
    text-align: center;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

.copy-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    justify-content: center;
}
.copy-area .btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
    padding: 11px 18px;
    font-size: 14px;
}

/* ===== 弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open {
    display: flex;
}
.modal-box {
    background: #241e1a;
    border: 1px solid #6b4c2a;
    border-radius: 20px;
    padding: 28px 32px 24px;
    max-width: 560px;
    width: 92%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    position: relative;
}
.modal-box .close-btn {
    position: absolute;
    top: 12px;
    right: 18px;
    background: none;
    border: none;
    color: #8a7a68;
    font-size: 26px;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-box .close-btn:hover {
    color: #e8ddd0;
}
.modal-box h3 {
    font-size: 18px;
    margin-bottom: 4px;
}
.modal-box .sub {
    color: #a0907f;
    font-size: 13px;
    margin-bottom: 14px;
}
.history-item {
    background: #120e0c;
    border: 1px solid #3d2e22;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.history-item:hover {
    border-color: #c88a3c;
    background: #1a1410;
}
.history-item .h-time {
    font-size: 12px;
    color: #6a5f52;
    margin-bottom: 2px;
}
.history-item .h-question {
    font-size: 14px;
    color: #e8ddd0;
    font-weight: 500;
}
.history-item .h-gua {
    font-size: 13px;
    color: #a0907f;
}
.history-item .h-del {
    float: right;
    color: #6f4e4e;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}
.history-item .h-del:hover {
    color: #d4a0a0;
}
.history-empty {
    color: #5a4f42;
    text-align: center;
    padding: 30px 0;
    font-size: 14px;
}

.platform-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 16px;
}
.platform-grid .btn {
    flex: 1;
    min-width: 70px;
    text-align: center;
    padding: 8px 12px;
    background: #120e0c;
    border-color: #3d2e22;
}
.platform-grid .btn:hover {
    border-color: #c88a3c;
    background: #1a1410;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #241e1a;
    border: 1px solid #c88a3c;
    color: #e8ddd0;
    padding: 11px 26px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}
.text-center {
    text-align: center;
}
.text-gold {
    color: #c88a3c;
}
.text-muted {
    color: #a0907f;
}
.text-sm {
    font-size: 13px;
}
.mt-8 {
    margin-top: 8px;
}
.mb-8 {
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 20px;
    }
    .card {
        padding: 16px 14px 18px;
    }
    .coin-wrapper {
        width: 60px;
        height: 60px;
    }
    .coin-placeholder {
        width: 60px;
        height: 60px;
        font-size: 22px;
    }
    .coin-container {
        gap: 16px;
        min-height: 100px;
    }
    .result-grid {
        grid-template-columns: 1fr;
    }
    .copy-area .btn {
        min-width: 100%;
    }
    .modal-box {
        padding: 20px 18px 18px;
    }
    .yao-row {
        max-width: 100%;
        padding: 4px 10px;
        gap: 10px;
    }
    .yao-row .yao-line .yang-line {
        width: 50px;
    }
    .yao-row .yao-line .yin-line {
        width: 22px;
    }
}