@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ========== 全局变量 ========== */
:root {
    --bg-light: #fef9f2;
    --bg-paper: #fffdf9;
    --sand: #e6dfd3;
    --stone: #a48d76;
    --dark-earth: #4a3b2c;
    --tea-green: #cbd5b0;
    --ink: #2c3e4f;
    --highlight: #c77e4a;
    --shadow-sm: 0 8px 24px rgba(0,0,0,0.05);
    --shadow-md: 0 12px 32px rgba(0,0,0,0.08);
    --radius-lg: 32px;
    --radius-md: 24px;
    --radius-sm: 16px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #fef5e6;
    font-family: 'Inter', sans-serif;
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 20% 40%, rgba(200, 170, 130, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

.gradio-container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    transition: var(--transition);
}

.gradio-container > *:not(footer) {
    background: rgba(255, 253, 250, 0.95);
    backdrop-filter: blur(2px);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(200, 180, 150, 0.4);
}

.gradio-container > *:not(footer):hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 4rem;
    font-weight: 600;
    letter-spacing: 3px;
    color: var(--dark-earth);
    text-align: center;
    margin-bottom: 0.25rem;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.05);
    line-height: 1.2;
}

h2, h3, h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    color: var(--dark-earth);
}

h2 {
    font-size: 2rem;
    border-left: 4px solid var(--stone);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

h4 {
    font-size: 1.2rem;
    color: var(--stone);
    background: rgba(164, 141, 118, 0.1);
    display: inline-block;
    padding: 0.25rem 1.2rem;
    border-radius: 40px;
    margin: 0.5rem 0 1.5rem 0;
    border: 1px solid var(--sand);
    font-weight: 500;
}

/* 表单紧凑布局 - 居中，宽度足够容纳四列 */
.form-compact {
    max-width: 900px;
    margin: 0 auto 1.5rem auto;
}

/* 四列布局 */
.form-row.four-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* 响应式：小屏幕时变为两列 */
@media (max-width: 700px) {
    .form-row.four-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机屏幕时变为一列 */
@media (max-width: 480px) {
    .form-row.four-columns {
        grid-template-columns: 1fr;
    }
}

.form-compact .form-group {
    min-width: 0;
}

.form-compact .radio-group {
    gap: 1rem;
    flex-wrap: wrap;
}

.generate-wrapper {
    text-align: center;
    margin-top: 1rem;
}

/* 输入框样式 */
input, select, textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--sand);
    border-radius: 0;
    padding: 0.7rem 0.2rem;
    font-size: 1rem;
    color: var(--ink);
    transition: var(--transition);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-bottom-color: var(--highlight);
}

/* 单选按钮组 */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.8rem;
    margin-top: 0.3rem;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

.radio-group input[type="radio"] {
    width: auto;
    accent-color: var(--stone);
}

/* 按钮 */
button, .primary-btn {
    background: linear-gradient(135deg, var(--ink) 0%, #1f3e4c 100%);
    color: white;
    border: none;
    border-radius: 60px;
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: inline-block;
    text-align: center;
}

button:hover, .primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #1f3e4c 0%, #0f2e3a 100%);
}

/* 报告输出框 - 居中放大 */
.report-box-large {
    min-height: 500px;
    max-height: 650px;
    font-size: 1rem;
    line-height: 1.6;
    padding: 2rem;
    margin: 2rem auto;
    background: #fffef9;
    border-radius: 28px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.08);
    border: 1px solid #e6dfd3;
    width: 90%;
    max-width: 1000px;
    overflow-y: auto;
}

/* 支付区域统一窄样式 - 居中 */
.payment-section {
    max-width: 550px;
    margin: 0 auto;
    text-align: center;
}

.paypal-container {
    margin: 1rem 0;
    min-height: 100px;
}

.manual-verify {
    border-top: 1px solid #e0d6cc;
    border-bottom: 1px solid #e0d6cc;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 248, 240, 0.5);
    border-radius: 24px;
}

.manual-verify h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.verify-input-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.verify-input-group input {
    flex: 1;
    min-width: 200px;
    border: 1px solid #d4c2af;
    border-radius: 40px;
    padding: 0.5rem 1rem;
    background: white;
}

.verify-input-group button {
    background: var(--stone, #a48d76);
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.verify-input-group button:hover {
    background: var(--highlight, #c77e4a);
}

/* 标签页样式 */
.tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--sand);
    padding-bottom: 0.5rem;
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--stone);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 60px;
}

.tab-button:hover {
    color: var(--highlight);
    background: rgba(199, 126, 74, 0.1);
}

.tab-button.active {
    color: var(--highlight);
    background: rgba(199, 126, 74, 0.15);
    font-weight: 600;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* 页脚 */
footer {
    text-align: center;
    color: #b7aa9b;
    font-size: 0.8rem;
    margin-top: 2rem;
    padding: 1rem;
    border-top: 1px solid var(--sand);
    width: 100%;
}

footer details {
    margin-bottom: 0.5rem;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

footer details summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--stone);
    transition: var(--transition);
}

footer details summary:hover {
    color: var(--highlight);
}

/* 解锁提示 */
.unlock-tip {
    background: #fff3e0;
    border-left: 4px solid var(--highlight);
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #8b5a2b;
}

/* ========== 五行知识库细节样式 ========== */
details {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--sand);
    padding: 0.5rem 0;
    transition: var(--transition);
}

details[open] {
    background: rgba(203, 181, 144, 0.05);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
}

details summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--dark-earth);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    list-style: none;
    position: relative;
    padding-left: 1.5rem;
}

details summary::before {
    content: "▶";
    position: absolute;
    left: 0;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

details[open] summary::before {
    transform: rotate(90deg);
}

details div {
    padding: 0.5rem 0 0.5rem 1.5rem;
    background: transparent;
    margin-top: 0.5rem;
    border-left: 2px solid var(--sand);
    color: #4a3b2c;
}

.element-selector {
    display: flex;
    gap: 1.2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    justify-content: center;
}

.element-selector label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(164, 141, 118, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 40px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.element-selector label:hover {
    background: rgba(164, 141, 118, 0.2);
    border-color: var(--sand);
}

.element-selector input[type="radio"] {
    width: auto;
    accent-color: var(--stone);
}

.element-detail-box {
    background: #fefaf5;
    border-radius: var(--radius-md);
    padding: 1.2rem;
    margin-top: 1rem;
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.6;
    border: 1px solid var(--sand);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* 能量商店卡片 */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.shop-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--sand);
}

.shop-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--stone);
}

.shop-img {
    font-size: 4rem;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(203, 181, 144, 0.2);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.shop-card:hover .shop-img {
    transform: scale(1.02);
}

.shop-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    margin: 0.5rem 0;
}

.price {
    font-weight: 600;
    color: var(--highlight);
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

.interest-btn {
    background: var(--ink);
    color: white;
    border: none;
    border-radius: 60px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.interest-btn:hover {
    background: var(--highlight);
    transform: translateY(-2px);
}

.interest-msg {
    text-align: center;
    margin-top: 1rem;
    padding: 0.5rem;
    background: #e9f0e6;
    border-radius: 60px;
    color: #2c5e2e;
}

/* 名人案例 */
.celebrity-reading {
    background: #fefaf5;
    border-radius: var(--radius-md);
    padding: 1.2rem;
    margin-top: 1rem;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    border: 1px solid var(--sand);
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

#celebrity-select {
    max-width: 300px;
    margin: 1rem auto;
    display: block;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }
    .gradio-container > *:not(footer) {
        padding: 1.2rem;
    }
    h1 {
        font-size: 2.5rem;
    }
    h2 {
        font-size: 1.6rem;
    }
    .tab-button {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    .form-compact {
        max-width: 100%;
    }
    
/* 报告输出框 - 居中放大，保留换行 */
.report-box-large {
    min-height: 500px;
    max-height: 650px;
    font-size: 1rem;
    line-height: 1.6;
    padding: 2rem;
    margin: 2rem auto;
    background: #fffef9;
    border-radius: 28px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.08);
    border: 1px solid #e6dfd3;
    width: 90%;
    max-width: 1000px;
    overflow-y: auto;
    white-space: pre-wrap;   /* 保留换行符和空格 */
    word-wrap: break-word;   /* 防止长单词溢出 */
}
    .payment-section {
        max-width: 100%;
    }
    .shop-grid {
        grid-template-columns: 1fr;
    }
    .element-selector {
        gap: 0.8rem;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .gradio-container > *:not(footer) {
        padding: 1.5rem;
    }
    h1 {
        font-size: 3rem;
    }
    .shop-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.copy-btn {
    background: var(--stone, #a48d76);
    color: white;
    border: none;
    border-radius: 40px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.copy-btn:hover {
    background: var(--highlight, #c77e4a);
    transform: translateY(-1px);
}
