:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --accent: #06b6d4;
    --bg-gradient: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 50%, #ecfeff 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(37, 99, 235, 0.12);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --red: #ef4444;
    --yellow: #f59e0b;
    --green: #22c55e;
    --shadow: 0 4px 24px rgba(37, 99, 235, 0.08);
    --shadow-hover: 0 8px 32px rgba(37, 99, 235, 0.15);
    --radius: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    padding: 30px 20px 20px;
}

header h1 {
    font-size: 2em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.section-header h2 {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-primary);
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.88em;
    margin-bottom: 20px;
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-item label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-item select {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.92em;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
}

.form-item select:hover {
    border-color: var(--primary-light);
}

.form-item select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-item.unselected select {
    color: var(--text-muted);
}

/* Generate Button */
.generate-btn-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.btn {
    padding: 14px 36px;
    border: none;
    border-radius: 12px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-generate {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
}

.btn-copy {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent);
    padding: 6px 16px;
    font-size: 0.85em;
}

.btn-copy:hover {
    background: rgba(6, 182, 212, 0.2);
}

/* Result Card */
.result-card {
    text-align: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(238,242,255,0.9));
    animation: fadeInUp 0.5s ease;
}

.result-card h2 {
    margin-bottom: 20px;
}

.result-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.probability-gauge {
    flex-shrink: 0;
}

.gauge-svg {
    width: 200px;
    height: 200px;
}

.gauge-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 16;
}

.gauge-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 16;
    stroke-linecap: round;
    stroke-dasharray: 534;
    stroke-dashoffset: 534;
    transform: rotate(-90deg);
    transform-origin: 100px 100px;
    transition: stroke-dashoffset 0.8s ease, stroke 0.4s ease;
}

.gauge-fill.red { stroke: var(--red); }
.gauge-fill.yellow { stroke: var(--yellow); }
.gauge-fill.green { stroke: var(--green); }

.gauge-value {
    font-size: 32px;
    font-weight: 800;
    fill: var(--text-primary);
}

.gauge-label {
    font-size: 12px;
    fill: var(--text-muted);
}

.result-info {
    text-align: left;
    min-width: 200px;
}

.result-status {
    font-size: 1.15em;
    font-weight: 700;
    margin-bottom: 12px;
    padding: 10px 18px;
    border-radius: 10px;
    display: inline-block;
}

.result-status.red {
    color: var(--red);
    background: rgba(239, 68, 68, 0.1);
}

.result-status.yellow {
    color: var(--yellow);
    background: rgba(245, 158, 11, 0.1);
}

.result-status.green {
    color: var(--green);
    background: rgba(34, 197, 94, 0.1);
}

/* AI Section */
.ai-section {
    border: 1px solid rgba(6, 182, 212, 0.15);
    animation: fadeInUp 0.5s ease;
}

/* AI Loading */
.ai-loading {
    text-align: center;
    padding: 40px 20px;
}

.ai-loading p {
    color: var(--text-secondary);
    margin-top: 16px;
    font-size: 0.95em;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(6, 182, 212, 0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

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

/* AI Result */
.ai-result {
    padding: 20px;
    background: rgba(6, 182, 212, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(6, 182, 212, 0.1);
}

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

.ai-result-header h3 {
    font-size: 1.05em;
    color: var(--text-primary);
}

.ai-result-content {
    font-size: 0.92em;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.ai-result-content strong {
    color: var(--primary);
}

/* AI Fallback (离线模式) */
.ai-fallback {
    padding: 20px;
    background: rgba(6, 182, 212, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(6, 182, 212, 0.1);
    text-align: center;
}

.ai-fallback-tip {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 16px;
    line-height: 1.6;
}

.ai-fallback-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-copy-prompt {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 12px 24px;
    font-size: 0.95em;
}

.btn-copy-prompt:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

.btn-open-ai {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent);
    padding: 12px 24px;
    font-size: 0.95em;
}

.btn-open-ai:hover {
    background: rgba(6, 182, 212, 0.2);
}

/* Error message */
.error-msg {
    margin-top: 12px;
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 8px;
    color: var(--red);
    font-size: 0.88em;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.82em;
}

footer p {
    margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 640px) {
    body { padding: 12px; }
    .card { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .result-display { flex-direction: column; gap: 20px; }
    .result-info { text-align: center; }
    header h1 { font-size: 1.6em; }
}
