:root {
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.header {
  text-align: center;
  padding: 40px 0 32px;
}
.header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 0.95rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header .icon { font-size: 1.3rem; }
.card-header h2 { font-size: 1.1rem; font-weight: 600; }
.card-header .badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: var(--warning);
  margin-left: auto;
}
.card-body { padding: 20px 24px; }

.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-label .unit { font-weight: 400; color: var(--text-secondary); font-size: 0.8rem; }
.form-label .required { color: var(--danger); margin-left: 2px; }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fafafa;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }

.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-group label {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 0.88rem; transition: all 0.2s; background: #fafafa; user-select: none;
}
.radio-group label:hover { border-color: var(--primary); }
.radio-group input[type="radio"] { accent-color: var(--primary); }

.row { display: flex; gap: 16px; }
.row > * { flex: 1; }
@media (max-width: 600px) { .row { flex-direction: column; } }

.city-data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.city-data-item { background: #f8fafc; border-radius: 8px; padding: 12px; border: 1px solid var(--border); }
.city-data-item .label { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 4px; }
.city-data-item .value { font-size: 0.95rem; font-weight: 600; }
.city-data-item .detail { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

.score-display { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--primary-light); border-radius: 8px; margin-top: 8px; }
.score-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.score-label { font-size: 0.85rem; color: var(--text-secondary); }

.risk-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 500; }
.risk-极低 { background: #d1fae5; color: #065f46; }
.risk-低 { background: #e0f2fe; color: #075985; }
.risk-中低 { background: #fef3c7; color: #92400e; }
.risk-中高 { background: #fed7aa; color: #9a3412; }
.risk-高 { background: #fecaca; color: #991b1b; }
.risk-极高 { background: #fecaca; color: #7f1d1d; }

.fun-result { padding: 16px; background: linear-gradient(135deg, #fef3c7, #fce7f3); border-radius: 8px; margin-top: 12px; }
.fun-result h4 { font-size: 0.95rem; margin-bottom: 8px; }
.fun-result p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 4px; }

.summary-card { background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-lg); }
.summary-card h2 { font-size: 1.2rem; margin-bottom: 16px; }
.summary-score { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.summary-score .big-number { font-size: 3.5rem; font-weight: 800; line-height: 1; }
.summary-score .big-label { font-size: 0.9rem; opacity: 0.85; }
.summary-verdict { font-size: 1.3rem; font-weight: 700; padding: 10px 20px; border-radius: 8px; display: inline-block; background: rgba(255,255,255,0.2); margin-bottom: 16px; }
.summary-detail { font-size: 0.9rem; opacity: 0.9; line-height: 1.7; }
.summary-detail li { margin-bottom: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 28px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; border: none; font-family: inherit; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-skip { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); padding: 8px 18px; font-size: 0.85rem; font-weight: 500; }

.btn-ai { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; width: 100%; }
.btn-ai:hover { background: linear-gradient(135deg, #6d28d9, #9333ea); }
.btn-ai:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-group { display: flex; gap: 12px; }
.btn-group .btn { flex: 1; }
@media (max-width: 500px) { .btn-group { flex-direction: column; } }

.streaming-container { margin-top: 20px; display: none; }
.streaming-container.active { display: block; }
.streaming-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--primary-light); border-radius: 8px 8px 0 0; font-weight: 600; font-size: 0.9rem; }
.streaming-spinner { width: 18px; height: 18px; border: 2px solid #c7d2fe; border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.streaming-content { padding: 20px; background: #fafafa; border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; min-height: 120px; max-height: 600px; overflow-y: auto; font-size: 0.9rem; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.streaming-content .cursor-blink::after { content: '\25cd'; animation: blink 0.8s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.ai-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; margin-left: 8px; vertical-align: middle; }

.login-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: #f5f5f5; padding: 24px; }
.login-overlay.hidden { display: none; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); padding: 36px 32px; }
.login-hero { text-align: center; margin-bottom: 28px; }
.login-hero h1 { font-size: 1.5rem; font-weight: 700; background: linear-gradient(135deg, #2563eb, #7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-hero p { margin-top: 8px; font-size: 0.9rem; color: #666; }
.login-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 20px; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.85rem; font-weight: 600; color: #1a1a1a; }
.field-input { width: 100%; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.95rem; font-family: inherit; background: #fafafa; transition: border-color 0.2s; }
.field-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); background: #fff; }
.login-error { font-size: 0.85rem; font-weight: 500; color: #dc2626; }
.login-notice { font-size: 0.85rem; font-weight: 500; color: #059669; }
.login-btn { width: 100%; padding: 11px; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.15s; }
.login-btn:hover { background: #1d4ed8; }
.login-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.login-switch { background: transparent; border: none; padding: 0; font-size: 0.88rem; font-weight: 500; font-family: inherit; color: #2563eb; cursor: pointer; text-align: center; }
.login-switch:hover { text-decoration: underline; }
.login-divider { display: flex; align-items: center; gap: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.login-divider-text { font-size: 0.8rem; color: #999; }
.login-skip { width: 100%; padding: 10px; background: #fff; color: #666; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.9rem; font-weight: 500; font-family: inherit; cursor: pointer; transition: background 0.15s; }
.login-skip:hover { background: #f8fafc; }
.login-sso { width: 100%; padding: 10px; background: #fff; color: #7c3aed; border: 1px solid #c4b5fd; border-radius: 8px; font-size: 0.9rem; font-weight: 500; font-family: inherit; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.login-sso:hover { background: #f5f3ff; border-color: #a78bfa; }
.login-sso-primary { background: #7c3aed; color: #fff; border: none; padding: 11px; font-size: 0.95rem; font-weight: 600; }
.login-sso-primary:hover { background: #6d28d9; }
.login-subtitle { font-size: 0.82rem; color: #888; margin: -6px 0 16px; text-align: center; line-height: 1.6; }
.login-skip-subtle { width: 100%; background: transparent; border: none; color: #b0b0b0; font-size: 0.78rem; font-weight: 400; font-family: inherit; cursor: pointer; padding: 10px 0 4px; text-align: center; text-decoration: underline; }
.login-skip-subtle:hover { color: #888; }

.user-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 10px 20px; background: #fff; border-bottom: 1px solid #e2e8f0; font-size: 0.85rem; }
.user-bar .user-email { color: #666; }
.user-bar .logout-btn { padding: 4px 12px; background: transparent; color: #dc2626; border: 1px solid #fecaca; border-radius: 6px; font-size: 0.8rem; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.user-bar .logout-btn:hover { background: #fef2f2; }

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.note { font-size: 0.8rem; color: var(--text-secondary); font-style: italic; margin-top: 6px; }
.toggle-section { display: none; }
.toggle-section.active { display: block; }
.error-msg { color: var(--danger); font-size: 0.8rem; margin-top: 4px; display: none; }
