/* ===== Design System (from theyuanxi.cn) ===== */
:root {
  --color-bg: #fdfcf8;
  --color-bg-secondary: #f5f2ec;
  --color-bg-tertiary: #ede9e0;
  --color-surface: #fff;
  --color-border-light: #e8e4d9;
  --color-separator: #ede9e0;
  --color-text-primary: #1a2744;
  --color-text-secondary: #6b7280;
  --color-text-tertiary: #9ca3af;
  --color-accent: #c9922a;
  --color-accent-hover: #b8811e;
  --color-accent-light: rgba(201,146,42,0.1);
  --color-navy: #1a2744;
  --color-navy-hover: #243560;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --font: -apple-system, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-display: -apple-system, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 980px;
  --shadow-sm: 0 1px 4px rgba(26,39,68,0.06);
  --shadow-md: 0 4px 16px rgba(26,39,68,0.08);
  --shadow-lg: 0 8px 32px rgba(26,39,68,0.1);
  --gradient-prob: linear-gradient(90deg, #1a2744 0%, #c9922a 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizelegibility; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--color-bg); color: var(--color-text-primary); line-height: 1.5; }
a { color: inherit; text-decoration: inherit; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===== Layout ===== */
.container { max-width: 680px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }

/* ===== Nav ===== */
.apple-nav {
  z-index: 100;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border-light);
  background: rgba(253,252,248,0.92);
  position: sticky; top: 0;
}
.nav-inner { max-width: 1040px; margin: 0 auto; padding: 0 20px; height: 52px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-size: 17px; font-weight: 700; color: var(--color-text-primary); display: flex; align-items: center; gap: 6px; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-link { font-size: 14px; color: var(--color-text-secondary); padding: 8px 14px; border-radius: var(--radius-pill); transition: background .15s; }
.nav-link:hover { background: var(--color-bg-secondary); color: var(--color-text-primary); }
@media (max-width: 380px) { .nav-link-hide-xs { display: none !important; } }

/* ===== Buttons ===== */
.btn-primary {
  background: var(--color-navy); color: #fff; border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; border: none;
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  padding: 13px 24px; transition: background .15s, transform .1s;
}
.btn-primary:hover:not(:disabled) { background: var(--color-navy-hover); }
.btn-primary:active:not(:disabled) { transform: scale(.97); }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; }

.btn-secondary {
  background: var(--color-bg-secondary); color: var(--color-text-primary);
  border-radius: var(--radius-pill); font-size: 15px; font-weight: 500; cursor: pointer;
  -webkit-tap-highlight-color: transparent; border: none;
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  padding: 13px 24px; transition: background .15s, transform .1s;
}
.btn-secondary:hover { background: var(--color-bg-tertiary); }
.btn-secondary:active { transform: scale(.97); }

.btn-ghost {
  color: var(--color-accent); border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 500; cursor: pointer;
  -webkit-tap-highlight-color: transparent; background: transparent; border: none;
  display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; transition: background .15s;
}
.btn-ghost:hover { background: var(--color-accent-light); }

/* ===== Inputs ===== */
.apple-input {
  background: var(--color-bg-secondary); border-radius: var(--radius-md); width: 100%;
  border: 1.5px solid transparent; outline: none; padding: 14px 16px; font-size: 17px;
  transition: border-color .15s, background .15s;
}
.apple-input::placeholder { color: var(--color-text-tertiary); }
.apple-input:focus { border-color: var(--color-accent); background: var(--color-surface); }

.apple-select {
  background: var(--color-bg-secondary); border-radius: var(--radius-md); width: 100%;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236e6e73'/%3E%3C/svg%3E");
  background-position: right 14px center; background-repeat: no-repeat;
  border: 1.5px solid transparent; outline: none; padding: 14px 40px 14px 16px; font-size: 16px;
  transition: border-color .15s;
}
.apple-select:focus { border-color: var(--color-accent); }

/* ===== Cards ===== */
.apple-card {
  background: var(--color-surface); border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
}
.apple-card-elevated {
  background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.apple-divider { background: var(--color-border-light); border: none; height: 1px; }

/* ===== Badges ===== */
.badge { border-radius: var(--radius-sm); letter-spacing: .02em; align-items: center; padding: 2px 8px; font-size: 11px; font-weight: 600; display: inline-flex; }
.badge-985 { color: #991b1b; background: #fef2f2; border: 1px solid #fca5a5; }
.badge-211 { color: #92400e; background: #fffbeb; border: 1px solid #fcd34d; }
.badge-syl { color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; }
.badge-plain { background: var(--color-bg-secondary); color: var(--color-text-secondary); border: 1px solid var(--color-border-light); }
.badge-gem { color: #92400e; border: 1px solid var(--color-accent); background: #fffbeb; }
.badge-cold { color: #164e63; background: #ecfeff; border: 1px solid #a5f3fc; }

/* ===== Hero ===== */
.hero-section {
  flex-direction: column; justify-content: center; align-items: center;
  min-height: 100vh; padding: 80px 20px 60px; display: flex; position: relative;
}
@media (max-width: 640px) { .hero-section { min-height: auto; padding: 72px 16px 48px; } }
.hero-kicker { font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--color-accent); font-weight: 600; margin-bottom: 16px; }
.hero-title { font-family: var(--font-display); font-size: clamp(28px, 6vw, 52px); font-weight: 700; letter-spacing: -1px; line-height: 1.1; text-align: center; margin-bottom: 16px; }
.hero-sub { font-size: 17px; color: var(--color-text-secondary); text-align: center; max-width: 480px; margin: 0 auto 12px; line-height: 1.6; }
.hero-form { max-width: 420px; margin: 28px auto 0; display: flex; flex-direction: column; gap: 12px; }
.hero-form-row { display: flex; gap: 10px; }
.hero-form-row > * { flex: 1; }
.subject-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.subject-btn { padding: 12px 8px; border-radius: var(--radius-md); border: 1.5px solid var(--color-border-light); background: var(--color-bg-secondary); font-size: 14px; cursor: pointer; transition: all .15s; text-align: center; }
.subject-btn.selected { border-color: var(--color-accent); background: var(--color-accent-light); color: var(--color-accent); font-weight: 600; }

/* ===== Stats strip ===== */
.data-strip { flex-wrap: wrap; justify-content: center; align-items: center; gap: 24px; display: flex; }
.stat-item { text-align: center; }
.stat-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--color-text-primary); }
.stat-label { font-size: 13px; color: var(--color-text-tertiary); margin-top: 2px; }

/* ===== Section ===== */
.section { padding: 80px 20px; }
@media (max-width: 640px) { .section { padding: 56px 16px; } }
.section-label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--color-accent); font-weight: 600; margin-bottom: 8px; }
.section-h2 { font-family: var(--font-display); font-size: clamp(22px, 5vw, 34px); font-weight: 700; letter-spacing: -.3px; line-height: 1.15; }
.section-sub { font-size: 16px; color: var(--color-text-secondary); margin-top: 8px; }

/* ===== Feature grid ===== */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .feature-grid { grid-template-columns: 1fr; gap: 8px; } }
.feature-card { padding: 28px 24px; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }
.feature-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.feature-desc { font-size: 14px; color: var(--color-text-secondary); line-height: 1.6; }

/* ===== Comparison table ===== */
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th { padding: 16px 12px; font-size: 14px; font-weight: 600; text-align: left; border-bottom: 1px solid var(--color-separator); }
.compare-table td { padding: 14px 12px; font-size: 14px; border-bottom: 1px solid var(--color-separator); line-height: 1.5; }
.compare-table td:first-child { font-weight: 500; color: var(--color-text-tertiary); white-space: nowrap; }
.compare-bad { color: var(--color-danger); }
.compare-good { color: var(--color-success); }

/* ===== Step cards ===== */
.step-card { padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--color-navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }

/* ===== Data source grid ===== */
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .source-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .source-grid { grid-template-columns: 1fr; } }
.source-card { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.source-icon { font-size: 28px; }
.source-title { font-size: 14px; font-weight: 600; }
.source-desc { font-size: 12px; color: var(--color-text-tertiary); line-height: 1.5; }

/* ===== Testimonials ===== */
.testimonial-section { position: relative; }
.testimonial-track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 0 16px; scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth; }
.testimonial-track::-webkit-scrollbar { display: none; }
.testimonial-card { flex: 0 0 clamp(280px, 78vw, 330px); scroll-snap-align: start; padding: 22px 24px; display: flex; flex-direction: column; }
.tc-avatar { width: 44px; height: 44px; border-radius: 50%; color: #fff; font-size: 18px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tc-header { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.tc-name { font-size: 14px; font-weight: 600; }
.tc-meta { font-size: 11px; color: var(--color-text-tertiary); }
.tc-stars { margin-left: auto; color: #FFB800; font-size: 11px; letter-spacing: 1px; flex-shrink: 0; }
.tc-text { font-size: 14px; color: var(--color-text-secondary); line-height: 1.75; }

/* ===== Scroll arrows ===== */
.t-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--color-separator);
  background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); color: var(--color-text-primary);
  font-size: 24px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1); transition: background .15s, transform .15s;
}
.t-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.08); }
.t-arrow-left { left: 4px; }
.t-arrow-right { right: 4px; }
@media (max-width: 600px) { .t-arrow { display: none; } }

/* ===== Progress bar ===== */
.apple-progress { background: var(--color-bg-tertiary); border-radius: var(--radius-pill); height: 4px; overflow: hidden; }
.apple-progress-fill { border-radius: var(--radius-pill); background: var(--color-accent); height: 100%; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ===== Skeleton ===== */
.skeleton { background: linear-gradient(90deg, var(--color-bg-secondary) 25%, var(--color-bg-tertiary) 50%, var(--color-bg-secondary) 75%); border-radius: var(--radius-sm); background-size: 200% 100%; animation: 1.4s infinite shimmer; }
@keyframes shimmer { 0% { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ===== Spinner ===== */
.spinner { border: 2px solid var(--color-separator); border-top-color: var(--color-accent); border-radius: 50%; width: 16px; height: 16px; display: inline-block; animation: .7s linear infinite spin; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--color-separator); padding: 24px 20px; display: flex; justify-content: center; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer a { font-size: 13px; color: var(--color-text-secondary); }
.footer a:hover { color: var(--color-text-primary); }

/* ===== Modal ===== */
.modal-overlay { backdrop-filter: blur(8px); z-index: 1000; background: rgba(0,0,0,0.45); justify-content: center; align-items: flex-end; display: none; position: fixed; inset: 0; }
.modal-overlay.show { display: flex; }
@media (min-width: 640px) { .modal-overlay { align-items: center; } }
.modal-sheet { background: var(--color-surface); border-radius: 20px 20px 0 0; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
@media (min-width: 640px) { .modal-sheet { border-radius: 20px; } }

/* ===== Focus ===== */
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ===== Search page ===== */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 8px 16px; border-radius: var(--radius-pill); border: 1px solid var(--color-border-light); background: var(--color-surface); font-size: 14px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.chip.active { background: var(--color-navy); color: #fff; border-color: var(--color-navy); }
.chip:hover:not(.active) { background: var(--color-bg-secondary); }

.school-list { display: flex; flex-direction: column; gap: 10px; }
.school-card { padding: 16px 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: box-shadow .15s; }
.school-card:hover { box-shadow: var(--shadow-md); }
.school-info { flex: 1; min-width: 0; }
.school-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.school-meta { font-size: 12px; color: var(--color-text-tertiary); display: flex; gap: 12px; flex-wrap: wrap; }
.school-badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* ===== Compare page ===== */
.compare-card { border: 1px solid var(--color-separator); border-radius: 14px; overflow: hidden; }
.compare-card table { width: 100%; border-collapse: collapse; }
.compare-card th { background: var(--color-bg-secondary); padding: 14px 12px; font-size: 14px; font-weight: 600; text-align: center; border-bottom: 1px solid var(--color-separator); }
.compare-card td { padding: 12px; font-size: 14px; text-align: center; border-bottom: 1px solid var(--color-separator); }
.compare-card td:first-child { text-align: left; font-weight: 500; color: var(--color-text-tertiary); white-space: nowrap; }
@media (max-width: 480px) { .compare-card { font-size: 11px !important; } .compare-card td { padding: 7px 10px !important; } }

/* ===== Result cards ===== */
.result-card { padding: 20px; margin-bottom: 12px; }
.result-card-header { display: flex; align-items: flex-start; gap: 16px; }
.result-card-right { display: flex; align-items: center; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-light); }
.prob-bar { width: 80px; height: 6px; background: var(--color-bg-tertiary); border-radius: var(--radius-pill); overflow: hidden; }
.prob-bar-fill { height: 100%; border-radius: var(--radius-pill); transition: width .6s; }

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.font-display { font-family: var(--font-display); }
.font-serif { font-family: var(--font-serif); }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-48 { margin-top: 48px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; } .justify-center { justify-content: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.hidden { display: none; }
