﻿/* 极致中国风配色方案 */
:root {
    --primary: #C12C2C; /* 故宫红 */
    --primary-light: #E84545;
    --primary-dark: #9A1F1F;
    --secondary: #E6C229; /* 琉璃黄 */
    --accent: #4A6B3D; /* 翡翠绿 */
    --text: #3E2E28; /* 烟墨色 */
    --text-light: #756A65;
    --bg: #FAF6ED; /* 宣纸白 */
    --card-bg: #FFFCF5; /* 玉脂白 */
    --border: #D3B78E; /* 古铜金 */
    --shadow: 0 5px 20px rgba(193, 44, 44, 0.15);
    --radius: 10px;
    --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --gold-light: rgba(230, 194, 41, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Noto Serif SC", "Microsoft YaHei", serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.8;
    padding: 10px;
    margin-top: 30px;
    /* 精致纹理背景 */
    background-image: linear-gradient(rgba(250, 246, 237, 0.9), rgba(250, 246, 237, 0.9)), url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M30,10 Q50,30 70,10 Q90,30 70,50 Q90,70 70,90 Q50,70 30,90 Q10,70 30,50 Q10,30 30,10 Z" fill="none" stroke="%23D3B78E" stroke-width="0.8" stroke-opacity="0.15"/></svg>');
    background-attachment: fixed;
}

/* 主容器 - 宫灯造型 */
.container {
    max-width: 820px;
    margin: 20px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    position: relative;
    border: 1px solid var(--border);
    border-top: 12px solid var(--primary);
    /* 鎏金边框效果 */
    background-clip: padding-box;
    border-image: linear-gradient(to right, var(--primary), var(--secondary), var(--primary)) 1;
    /* 光影效果 */
    background-image: radial-gradient(ellipse at 20% 20%, var(--gold-light) 0%, transparent 25%), radial-gradient(ellipse at 80% 80%, var(--gold-light) 0%, transparent 25%);
}

    .container::before {
        content: '';
        position: absolute;
        top: -12px;
        left: 0;
        width: 100%;
        height: 12px;
        background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 50%, var(--primary) 100%);
        opacity: 0.85;
        z-index: 2;
    }

h1 {
    color: var(--primary-dark);
    text-align: center;
    margin: 15px 0 30px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 3px;
    position: relative;
    padding-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.08);
}

    h1::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 150px;
        height: 4px;
        background: linear-gradient(90deg, transparent 0%, var(--secondary) 50%, transparent 100%);
        border-radius: 2px;
        box-shadow: 0 2px 8px rgba(230, 194, 41, 0.4);
    }

/* 精美表单样式 */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    padding-left: 22px;
    letter-spacing: 0.8px;
}

    label::before {
        content: '✧';
        position: absolute;
        left: 0;
        top: -1px;
        color: var(--secondary);
        font-size: 1.1rem;
        text-shadow: 0 0 5px rgba(230, 194, 41, 0.3);
    }

input,
select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.05rem;
    transition: var(--transition);
    background-color: rgba(255, 253, 248, 0.8);
    color: var(--text);
    font-family: "Noto Serif SC", "Microsoft YaHei", serif;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.05), 0 1px 0 rgba(255,255,255,0.8);
    border-bottom: 2px solid var(--border);
}

    input:focus,
    select:focus {
        border-color: var(--primary);
        outline: none;
        box-shadow: 0 0 0 3px rgba(193, 44, 44, 0.2), inset 0 1px 4px rgba(0,0,0,0.05);
        background-color: white;
        border-bottom-color: var(--primary);
        transform: translateY(-1px);
    }

/* 优雅行布局 */
.row {
    display: flex;
    gap: 5px;
}

    .row .form-group {
        flex: 1;
        position: relative;
    }

/* 皇家按钮设计 */
button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 18px;
    width: 100%;
    border-radius: var(--radius);
    font-size: 1.15rem;
    cursor: pointer;
    margin: 35px 0;
    font-weight: 700;
    transition: var(--transition);
    letter-spacing: 2px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(193, 44, 44, 0.4), inset 0 1px 1px rgba(255,255,255,0.3);
    border: 1px solid var(--primary-dark);
    z-index: 1;
}

    button::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
        transition: all 0.7s ease;
        z-index: -1;
    }

    button:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(193, 44, 44, 0.5), inset 0 1px 1px rgba(255,255,255,0.3);
    }

        button:hover::before {
            left: 100%;
        }

    button:active {
        transform: translateY(0);
    }

/* 精美排盘选择器 */
.paipan-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
    overflow: hidden;
    justify-content: space-between;
}

.paipan-option {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 14px 22px;
    border-radius: 50px;
    transition: var(--transition);
    background: rgba(255, 253, 248, 0.9);
    border: 1px solid var(--border);
    flex: 1;
    min-width: 160px;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

    .paipan-option::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, rgba(230, 194, 41, 0.1) 0%, transparent 100%);
        z-index: -1;
    }

    .paipan-option:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 15px rgba(0,0,0,0.15);
        border-color: var(--primary);
        background: white;
    }

    .paipan-option input[type="radio"] {
        appearance: none;
        width: 20px;
        height: 20px;
        border: 2px solid var(--border);
        border-radius: 50%;
        margin: 0;
        position: relative;
        transition: var(--transition);
        cursor: pointer;
        z-index: 2;
        background: white;
    }

        .paipan-option input[type="radio"]:checked {
            border-color: var(--primary);
            background: white;
            box-shadow: 0 0 0 2px rgba(193, 44, 44, 0.2);
        }

            .paipan-option input[type="radio"]:checked::before {
                content: '';
                position: absolute;
                width: 12px;
                height: 12px;
                background: var(--primary);
                border-radius: 50%;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                box-shadow: 0 0 8px var(--primary);
            }

    .paipan-option .label {
        margin-left: 12px;
        font-size: 1.05rem;
        color: var(--text);
        font-weight: 550;
        z-index: 2;
    }

/* 皇家说明区域 */
.instructions {
    margin-top: 35px;
    background: white;
    border-radius: var(--radius);
    padding: 28px;
    border: 1px solid var(--border);
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    background-image: linear-gradient(rgba(255, 252, 245, 0.95), rgba(255, 252, 245, 0.95)), url('data:image/svg+xml;utf8,<svg width="30" height="30" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"><path d="M0,0 L30,0 L30,30 L0,30 Z" fill="none" stroke="%23D3B78E" stroke-width="0.5" stroke-dasharray="3,3" stroke-opacity="0.2"/></svg>');
    overflow: hidden;
}

    .instructions::before {
        content: '';
        position: absolute;
        top: -18px;
        left: 25px;
        background: var(--card-bg);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        border: 1px solid var(--border);
        z-index: 2;
        color: var(--primary);
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    .instructions::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 80px;
        height: 80px;
        background: radial-gradient(circle, var(--gold-light) 0%, transparent 70%);
        z-index: 1;
    }

    .instructions h3 {
        color: var(--primary-dark);
        margin-bottom: 25px;
        text-align: center;
        font-size: 1.4rem;
        position: relative;
        padding-bottom: 12px;
        z-index: 2;
    }

        .instructions h3::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 80px;
            height: 3px;
            background: linear-gradient(90deg, transparent 0%, var(--secondary) 50%, transparent 100%);
            box-shadow: 0 2px 5px rgba(230, 194, 41, 0.3);
        }

    .instructions ul {
        padding-left: 28px;
        position: relative;
        z-index: 2;
    }

    .instructions li {
        margin-bottom: 18px;
        line-height: 1.9;
        color: var(--text);
        font-size: 1rem;
        position: relative;
        text-align: justify;
    }

        .instructions li::before {
            content: '❀';
            color: var(--secondary);
            font-size: 0.9rem;
            display: inline-block;
            width: 1.5em;
            margin-left: -1.5em;
            text-shadow: 0 0 3px rgba(230, 194, 41, 0.3);
        }

    .instructions strong {
        color: var(--primary-dark);
        font-weight: 650;
        background: linear-gradient(transparent 60%, rgba(230, 194, 41, 0.25) 40%);
        padding: 0 3px;
        border-radius: 2px;
    }

/* 华丽加载动画 */
#loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(250, 246, 237, 0.2);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 70px;
    height: 70px;
    border: 5px solid rgba(193, 44, 44, 0.1);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 25px;
    box-shadow: 0 0 20px rgba(193, 44, 44, 0.2);
    position: relative;
}

    .spinner::after {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        border: 4px solid transparent;
        border-top-color: var(--secondary);
        border-radius: 50%;
        animation: spin 1.5s linear infinite;
        opacity: 0.8;
    }

.loading-text {
    color: var(--primary-dark);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
}

    .loading-text::after {
        content: '...';
        position: absolute;
        animation: dots 1.5s infinite;
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%, 100% {
        content: '...';
    }
}

/* ================= 响应式设计 ================= */
@media (max-width: 768px) {
    .container {
        margin: 10px auto;
        padding: 10px;
    }

    input, select {
        padding: 6px 8px;
        font-size: 14px;
    }

    .form-group {
        margin-bottom: 5px;
    }

    label {
        margin-bottom: -2px;
        font-size: 15px;
    }

    h1 {
        font-size: 1.7rem;
        padding-bottom: 5px;
        margin: -5px 0 5px;
    }

    button {
        margin: 10px 0;
    }

    .paipan-option input[type="radio"] {
        width: 10px;
        height: 10px;
    }

        .paipan-option input[type="radio"]:checked::before {
            width: 8px;
            height: 8px;
        }

    .paipan-selector {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        gap: 5px;
    }

    .paipan-option {
        min-width: unset;
        padding: 1px 1px;
        flex-shrink: 1;
    }

        .paipan-option .label {
            font-size: 0.7rem;
            margin-left: 8px;
        }

    .instructions li {
        font-size: 14px;
    }

    .instructions h3 {
        margin-top: -5px;
    }
}

/* ================= 苹果手机专属优化 ================= */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px !important;
    }

    label, input, select, button {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }

    button, input, select {
        -webkit-appearance: none;
        border-radius: var(--radius);
    }
}

/* 480px以下设备优化 */
@media (max-width: 480px) {
    input, select {
        padding: 12px 15px !important;
        min-height: 44px;
        line-height: 1.4;
    }

    label {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }

    button {
        padding: 16px !important;
        font-size: 18px !important;
        min-height: 50px;
    }

    .paipan-selector {
        grid-auto-flow: row !important;
        gap: 8px;
    }

    .paipan-option {
        padding: 12px 15px !important;
    }

    .container {
        padding: 15px !important;
        margin: 0px !important;
        border-top-width: 8px !important;
    }

    h1 {
        font-size: 1.5rem !important;
        letter-spacing: 1px !important;
        margin-bottom: 20px !important;
    }

    .spinner {
        width: 50px !important;
        height: 50px !important;
    }

    body {
        margin-top: 43px;
        position: fixed;
        width: 100%;
    }
}

/* 全面屏安全区域处理 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    button {
        margin-bottom: calc(35px + env(safe-area-inset-bottom)) !important;
    }
}

/* Safari专属修复 */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    select:focus, textarea:focus, input:focus {
        font-size: 16px !important;
    }
}

@media not all and (min-resolution:.001dpcm) {
    @supports (-webkit-appearance:none) {
        input, select {
            padding: 13px 16px !important;
        }
    }
}

/* 终极滚动修复方案 */
html, body {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

    body.fixed-scroll-fix {
        /* 用于覆盖其他fixed定位 */
        position: relative !important;
        overflow: auto !important;
    }

/* 移除所有可能阻止滚动的容器限制 */
div, section, main, article {
    max-height: none !important;
    overflow: visible !important;
}
