/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Helvetica Neue", "Hiragino Sans GB", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    touch-action: manipulation;
}

body {
    color: #f5e9cf;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    background:
            radial-gradient(circle at 20% 10%, rgba(196, 158, 85, 0.08), transparent 40%),
            radial-gradient(circle at 80% 90%, rgba(196, 158, 85, 0.05), transparent 40%),
            linear-gradient(160deg, #16140e 0%, #1f1c14 50%, #1a1812 100%);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

input {
    font-family: inherit;
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.88);
    color: #f5e9cf;
    padding: 14px 22px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    z-index: 9999;
    max-width: 80vw;
    text-align: center;
    line-height: 1.5;
    border: 1px solid rgba(196, 158, 85, 0.25);
}
.toast.show { opacity: 1; }

/* ==================== Loading 遮罩 ==================== */
.loading-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.loading-mask .spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(196, 158, 85, 0.2);
    border-top-color: #c49e55;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== Modal 自定义弹窗 ==================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}
.modal-box {
    position: relative;
    width: 80%;
    max-width: 320px;
    background: linear-gradient(160deg, #2a2620 0%, #1f1c14 100%);
    border: 1px solid rgba(196, 158, 85, 0.3);
    border-radius: 12px;
    color: #f5e9cf;
    overflow: hidden;
    animation: modal-in 0.2s ease-out;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(196, 158, 85, 0.1) inset;
}
@keyframes modal-in {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.modal-title {
    padding: 20px 20px 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: #c49e55;
    letter-spacing: 1px;
}
.modal-content {
    padding: 0 20px 20px;
    font-size: 14px;
    text-align: center;
    color: rgba(245, 233, 207, 0.75);
    line-height: 1.6;
    white-space: pre-line;
}
.modal-actions {
    display: flex;
    border-top: 1px solid rgba(196, 158, 85, 0.15);
}
.modal-btn {
    flex: 1;
    height: 48px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #f5e9cf;
    transition: background 0.2s;
}
.modal-cancel {
    color: rgba(245, 233, 207, 0.6);
    border-right: 1px solid rgba(196, 158, 85, 0.15);
}
.modal-confirm {
    color: #c49e55;
    font-weight: 500;
}
.modal-btn:active {
    background: rgba(196, 158, 85, 0.1);
}
