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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
    --dark-bg: #0f0f1e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #b8b9d0;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, white, transparent),
        radial-gradient(1px 1px at 50px 50px, white, transparent),
        radial-gradient(1px 1px at 80px 10px, white, transparent),
        radial-gradient(2px 2px at 130px 80px, white, transparent);
    background-size: 200px 200px;
    animation: stars 10s linear infinite;
    opacity: 0.3;
}

@keyframes stars {
    from { transform: translateY(0); }
    to { transform: translateY(-200px); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 40px;
    position: relative;
}

.title {
    font-size: 3em;
    font-weight: bold;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite alternate;
    display: inline-block;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.5)); }
    to { filter: drop-shadow(0 0 30px rgba(118, 75, 162, 0.8)); }
}

.ai-badge {
    display: inline-block;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    margin-right: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2em;
    margin-top: 10px;
}

.card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.6s ease-out;
}

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

.section-title {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: var(--text-primary);
    position: relative;
    padding-left: 20px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 30px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.fortune-form {
    display: grid;
    gap: 20px;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.95em;
    font-weight: 500;
}

.label-icon {
    margin-right: 5px;
    font-size: 1.1em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: rgba(20, 20, 35, 0.9);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1em;
    transition: all 0.3s ease;
}

/* 美化 textarea 样式 */
.form-group textarea {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.9em;
    line-height: 1.6;
    resize: vertical;
    min-height: 100px;
}

.form-group select option {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
    padding: 8px;
}

.form-group select option:hover,
.form-group select option:focus {
    background-color: #2d2d44 !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    background: rgba(20, 20, 35, 0.9); /* 保持与未选中时相同的背景色 */
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* input 选中文字时的颜色 */
.form-group input::selection,
.form-group textarea::selection {
    background: rgba(102, 126, 234, 0.3);
    color: #ffffff;
}

.form-group input::-moz-selection,
.form-group textarea::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: #ffffff;
}

/* 自动填充时的背景色 */
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:focus,
.form-group input:-webkit-autofill:active,
.form-group input:-internal-autofill-selected {
    -webkit-box-shadow: 0 0 0 30px rgba(20, 20, 35, 0.9) inset !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: rgba(20, 20, 35, 0.9) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-label:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #667eea;
}

.radio-label input[type="radio"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
}

.radio-label input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: bold;
}

.submit-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-text,
.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.hidden {
    display: none !important;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result-section {
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.result-title {
    font-size: 2em;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.new-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.result-content {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 15px;
    padding: 30px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.loading-animation {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.result-content h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin: 25px 0 15px;
    padding-left: 15px;
    border-left: 3px solid #667eea;
}

.result-content p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.result-content ul {
    list-style: none;
    padding-left: 20px;
    margin: 15px 0;
}

.result-content ul li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
}

.result-content ul li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: #667eea;
}

.lucky-info {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.lucky-info h4 {
    color: #667eea;
    margin-bottom: 10px;
}

/* 日期选择器样式 */
.date-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-select {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='292' height='292'%3e%3cpath fill='%23ffffff' d='M287 69l-136 136-136-136c-9-9-25-9-34 0s-9 25 0 34l153 153c9 9 25 9 34 0l153-153c9-9 9-25 0-34s-25-9-34 0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
}

.date-select option {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
    padding: 10px;
}

.date-select option:hover {
    background-color: #2d2d44 !important;
}

/* 八字排盘样式 */
.bazi-item {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    margin: 5px 0;
    background: rgba(102, 126, 234, 0.1);
    border-left: 3px solid #667eea;
    border-radius: 5px;
}

.bazi-label {
    font-weight: bold;
    color: #667eea;
    min-width: 80px;
    margin-right: 15px;
}

.bazi-value {
    color: #e0e0e0;
    flex: 1;
}

.bazi-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bazi-row strong {
    color: #764ba2;
    margin-right: 10px;
}

/* 改进列表样式 */
.fortune-list {
    list-style: none;
    padding-left: 0;
    margin: 15px 0;
}

.fortune-list li {
    position: relative;
    padding: 10px 10px 10px 30px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.fortune-list li:before {
    content: '▸';
    position: absolute;
    left: 10px;
    color: #667eea;
    font-weight: bold;
}

.fortune-list li:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(5px);
}

/* 优化结果区标题样式 */
.result-section h2 {
    color: #667eea;
    font-size: 1.8em;
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
    text-align: left;
}

.result-section h3 {
    color: #764ba2;
    font-size: 1.4em;
    margin: 20px 0 15px 0;
    padding-left: 10px;
    border-left: 3px solid #764ba2;
}

.result-section p {
    line-height: 1.8;
    margin: 10px 0;
    color: #d0d0d0;
    text-indent: 2em;
}

select option {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
}

.date-select:hover {
    background: rgba(40, 40, 60, 0.95);
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.2);
}

.date-select:focus {
    outline: none;
    background: rgba(30, 30, 50, 0.95);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.date-separator {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 0 5px;
}

.lunar-option {
    margin-top: 10px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 时间选择器样式 */
.time-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.time-select {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='292' height='292'%3e%3cpath fill='%23ffffff' d='M287 69l-136 136-136-136c-9-9-25-9-34 0s-9 25 0 34l153 153c9 9 25 9 34 0l153-153c9-9 9-25 0-34s-25-9-34 0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
}

.time-select option {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
    padding: 10px;
}

.time-select option:hover {
    background-color: #2d2d44 !important;
}

.time-select:hover {
    background: rgba(40, 40, 60, 0.95);
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.2);
}

.time-select:focus {
    outline: none;
    background: rgba(30, 30, 50, 0.95);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.time-or {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.time-input {
    flex: 1;
    min-width: 150px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1em;
    transition: all 0.3s ease;
}

/* 算命类型卡片 */
.fortune-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.type-card {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.type-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.type-content {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.type-card:hover .type-content {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.type-card input[type="radio"]:checked + .type-content {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.type-title {
    font-weight: bold;
    font-size: 1em;
    margin-bottom: 5px;
}

.type-desc {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.disclaimer {
    margin-top: 10px;
    font-size: 0.85em;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .title {
        font-size: 2em;
    }
    
    .card {
        padding: 20px;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .result-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .date-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-select {
        width: 100%;
    }
    
    .fortune-types {
        grid-template-columns: 1fr;
    }
    
    .time-selector {
        flex-direction: column;
        align-items: stretch;
    }
}