/* ============================================
   假如当年考上了 — Web App 样式
   设计: 复古书卷 + 清新校园 | 移动优先
   ============================================ */

:root {
  --primary: #1a3a5c;
  --primary-light: #2d5f8a;
  --accent: #c8985a;
  --accent-light: #e8c98b;
  --bg: #f5f3ef;
  --card: #ffffff;
  --text: #2c2c2c;
  --text-secondary: #6b6b6b;
  --text-light: #999;
  --border: #e8e4dc;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 70px; }
.page { padding: 16px; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Nav Back ---- */
.nav-back { padding: 8px 0 16px; font-size: 15px; color: var(--primary); cursor: pointer; }

/* ---- Tab Bar ---- */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  display: flex; background: #fff; border-top: 1px solid #eee; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 4px; cursor: pointer; color: #999; transition: color 0.2s;
}
.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 22px; }
.tab-text { font-size: 10px; margin-top: 2px; }

/* ---- Hero ---- */
.hero {
  position: relative; margin: -16px -16px 24px; padding: 40px 24px 36px;
  background: linear-gradient(160deg, #1a3a5c 0%, #1d4470 30%, #2a5f8f 60%, #1a3a5c 100%);
  overflow: hidden;
}
.hero-bg {
  position: absolute; top: -80px; right: -60px; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.03) 40%, transparent 70%);
  border-radius: 50%;
}
.hero-bg::after {
  content: ''; position: absolute; bottom: 20px; left: -40px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 60%); border-radius: 50%;
}
/* 浮动背景图片 */
.hero-floaters { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.floater {
  position: absolute; opacity: 0.3;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.35));
  pointer-events: none; user-select: none;
}
.f-1 { right: -2%; top: 5%; width: 120px; animation: drift1 8s ease-in-out infinite; }
.f-2 { right: 18%; top: 50%; width: 85px; animation: drift2 7s ease-in-out 1s infinite; }
.f-3 { left: -2%; top: 8%; width: 95px; animation: drift3 9s ease-in-out 0.5s infinite; }
.f-4 { left: 12%; bottom: 5%; width: 100px; animation: drift4 8s ease-in-out 1.5s infinite; }
.f-5 { right: 35%; top: -5%; width: 75px; animation: drift5 6s ease-in-out 2s infinite; }
.f-6 { left: 55%; bottom: -5%; width: 80px; animation: drift6 7.5s ease-in-out 0.8s infinite; }

@keyframes drift1 { 0%,100%{transform:translateY(0) rotate(2deg)} 50%{transform:translateY(-10px) rotate(-1deg)} }
@keyframes drift2 { 0%,100%{transform:translateY(0) rotate(-2deg)} 50%{transform:translateY(8px) rotate(1deg)} }
@keyframes drift3 { 0%,100%{transform:translateY(0) rotate(1deg)} 50%{transform:translateY(-6px) rotate(-2deg)} }
@keyframes drift4 { 0%,100%{transform:translateY(0) rotate(-1deg)} 50%{transform:translateY(-8px) rotate(2deg)} }
@keyframes drift5 { 0%,100%{transform:translateY(0) rotate(3deg)} 50%{transform:translateY(6px) rotate(-1deg)} }
@keyframes drift6 { 0%,100%{transform:translateY(0) rotate(-2deg)} 50%{transform:translateY(-5px) rotate(1deg)} }
.hero-content { position: relative; z-index: 1; }
.hero-title {
  font-size: 24px; font-weight: 700; color: #fff; letter-spacing: 1px;
  line-height: 1.4; text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.hero-title .title-humor {
  display: block; font-size: 14px; font-weight: 400; opacity: 0.8;
  margin-top: 4px; letter-spacing: 0; font-style: italic;
}
.hero-subtitle {
  font-size: 13px; color: rgba(255,255,255,0.6); margin-top: 10px;
  line-height: 1.6;
}
.profile-guide {
  display: flex; align-items: center; margin-top: 20px; padding: 14px 18px;
  background: rgba(255,255,255,0.15); border-radius: 10px; cursor: pointer; transition: background 0.2s;
}
.profile-guide:hover { background: rgba(255,255,255,0.22); }
.guide-icon { font-size: 22px; }
.guide-text { flex: 1; font-size: 14px; color: #fff; margin-left: 10px; }
.guide-arrow { font-size: 20px; color: rgba(255,255,255,0.6); }

/* ---- Section ---- */
.section { margin-bottom: 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title { font-size: 18px; font-weight: 700; color: #333; }
.section-more { font-size: 14px; color: var(--text-light); cursor: pointer; }

/* ---- Category Scroll ---- */
.category-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.category-scroll::-webkit-scrollbar { display: none; }
.cat-item {
  display: flex; flex-direction: column; align-items: center; background: #fff;
  border-radius: 14px; padding: 16px 20px; min-width: 85px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform 0.15s; flex-shrink: 0;
}
.cat-item:active { transform: scale(0.95); }
.cat-icon { font-size: 28px; margin-bottom: 4px; }
.cat-name { font-size: 12px; color: #555; white-space: nowrap; }

/* ---- University Card ---- */
.uni-list { display: flex; flex-direction: column; gap: 12px; }
.uni-card {
  position: relative; background: #fff; border-radius: 14px; padding: 16px 18px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s;
}
.uni-card:active { transform: scale(0.98); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-tags { display: flex; gap: 6px; align-items: center; }
.card-stats { font-size: 12px; color: #bbb; }

.card-title { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.card-desc {
  font-size: 13px; color: #888; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5;
}
.card-footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.card-arrow { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 24px; color: #ccc; }

/* ---- Tags ---- */
.tag {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 500;
}
.tag-985 { background: #fde8ec; color: #c41e3a; }
.tag-211 { background: #fef3e2; color: #d4840b; }
.tag-double-first { background: #e8f2fa; color: #2b6f9c; }
.tag-undergraduate { background: #e8f0fe; color: #4a90d9; }
.tag-college { background: #e8f5ee; color: #52a67a; }
.tag-location { background: #f5f3ef; color: #888; }
.campus-tag { font-size: 11px; color: var(--accent); background: #fef8f0; padding: 2px 10px; border-radius: 10px; }
.career-tag { font-size: 11px; color: #4a90d9; background: #e8f0fe; padding: 2px 8px; border-radius: 4px; }

/* ---- Search ---- */
.search-bar { margin-bottom: 12px; }
.search-input-wrap {
  display: flex; align-items: center; background: #fff; border-radius: 10px;
  padding: 10px 14px; box-shadow: var(--shadow);
}
.search-icon { font-size: 18px; margin-right: 8px; }
.search-input { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; }
.search-clear { font-size: 18px; color: #ccc; cursor: pointer; padding: 0 4px; }

/* ---- Filter Tabs ---- */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.f-tab {
  padding: 8px 16px; background: #fff; border-radius: 20px; font-size: 13px;
  color: #666; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.04); transition: all 0.2s;
}
.f-tab.active { color: var(--primary); font-weight: 600; }
.f-tab.selected { color: var(--accent); border: 1px solid var(--accent); }

.filter-panel { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.filter-options { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-opt {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; color: #555;
  background: #f5f5f5; cursor: pointer; transition: all 0.15s;
}
.filter-opt.active { background: #e8f0fe; color: var(--primary); font-weight: 600; }
.filter-actions { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid #f0f0f0; }
.filter-reset { font-size: 13px; color: #999; cursor: pointer; }
.filter-confirm { font-size: 13px; color: var(--primary); font-weight: 600; cursor: pointer; }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.active-tag {
  font-size: 12px; color: var(--accent); background: #fef8f0; padding: 4px 12px; border-radius: 12px; cursor: pointer;
}

/* ---- Quick Toggles ---- */
.quick-toggles { display: flex; gap: 8px; margin-bottom: 10px; }
.q-toggle {
  padding: 6px 14px; border-radius: 16px; font-size: 12px; color: #888;
  background: #f8f8f8; cursor: pointer; transition: all 0.15s; user-select: none;
}
.q-toggle.active { color: #fff; font-weight: 600; }
.q-toggle[data-q="985"].active { background: #c41e3a; }
.q-toggle[data-q="211"].active { background: #d4840b; }
.q-toggle[data-q="双一流"].active { background: #2b6f9c; }

/* ---- Result Count ---- */
.result-count { font-size: 13px; color: #999; margin-bottom: 10px; padding-left: 4px; }

/* ---- Buttons ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 12px 24px; font-size: 15px; font-weight: 500;
  border: none; cursor: pointer; transition: all 0.15s; width: 100%;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; }
.btn-primary:active { opacity: 0.85; }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #fff; }
.btn-accent:active { opacity: 0.85; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }

/* ---- University Detail ---- */
.uni-header { background: #fff; border-radius: 14px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.uni-header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.uni-name { font-size: 24px; font-weight: 700; color: var(--primary); }
.uni-short { display: block; font-size: 14px; color: #999; margin-top: 2px; }
.uni-badges { display: flex; gap: 4px; flex-shrink: 0; }
.uni-meta { margin-bottom: 10px; font-size: 13px; color: #888; display: flex; gap: 12px; }
.uni-brief { font-size: 14px; color: #555; line-height: 1.8; }
.uni-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.major-card { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.major-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.major-name { font-size: 16px; font-weight: 600; }
.major-degree { font-size: 13px; color: #999; }
.major-desc { font-size: 13px; color: #777; line-height: 1.6; margin-bottom: 8px; display: block; }
.major-careers { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.career-label { font-size: 12px; color: #999; }

/* ---- Create Future ---- */
.profile-card, .selected-card { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.profile-line { font-size: 14px; color: #555; margin-bottom: 4px; }
.selected-name { font-size: 20px; font-weight: 700; color: var(--primary); }
.selected-loc, .selected-major { font-size: 13px; color: #888; margin-top: 4px; display: block; }

.option-group { display: flex; gap: 10px; margin-bottom: 20px; }
.option-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; background: #fff;
  border-radius: 12px; padding: 16px 12px; cursor: pointer; border: 2px solid transparent;
  box-shadow: var(--shadow); transition: all 0.2s;
}
.option-item.active { border-color: var(--primary); background: #f5f8fb; }
.option-icon { font-size: 28px; margin-bottom: 6px; }
.option-text { font-size: 13px; color: #555; }

/* ---- Story Options Chips ---- */
.story-options { margin-bottom: 20px; }
.option-row { margin-bottom: 16px; }
.option-row-label { font-size: 13px; color: #888; margin-bottom: 8px; display: block; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
/* ---- Alumni Picker ---- */
.alumni-cats { display: flex; gap: 8px; margin-bottom: 12px; }
.alumni-cat-chip {
  padding: 8px 16px; border-radius: 20px; font-size: 13px; color: #666;
  background: #f5f5f5; cursor: pointer; transition: all 0.2s; user-select: none;
}
.alumni-cat-chip.active { background: var(--accent); color: #fff; font-weight: 600; }
.alumni-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-bottom: 12px; }
.alumni-scroll::-webkit-scrollbar { display: none; }
.alumni-card {
  min-width: 160px; max-width: 200px; background: #fff; border-radius: 12px;
  padding: 14px; cursor: pointer; border: 2px solid transparent;
  box-shadow: var(--shadow); transition: all 0.15s; flex-shrink: 0;
}
.alumni-card:active { transform: scale(0.97); }
.alumni-card.selected { border-color: var(--accent); background: #fef8f0; }
.alumni-name { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.alumni-uni { font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.alumni-desc { font-size: 12px; color: #888; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.picked-alumni {
  padding: 12px 16px; background: #fef8f0; border-radius: 10px; margin-top: 10px;
  font-size: 14px; color: var(--accent); border: 1px solid var(--accent-light);
  text-align: center;
}

.chip {
  padding: 8px 16px; border-radius: 20px; font-size: 13px; color: #666;
  background: #f5f5f5; cursor: pointer; transition: all 0.2s;
  user-select: none; white-space: nowrap;
}
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--primary); color: #fff; font-weight: 600; }
.chip.alt-active { background: var(--accent); color: #fff; font-weight: 600; }
.option-item.active .option-text { color: var(--primary); font-weight: 600; }

/* ---- Generating Overlay ---- */
.gen-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,58,92,0.97); z-index: 999;
  display: flex; justify-content: center; align-items: center; flex-direction: column;
}
.gen-content { text-align: center; padding: 40px; }
.gen-icon { font-size: 64px; display: block; animation: bounce 1s infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-16px)} }
.gen-title { font-size: 22px; color: #fff; font-weight: 600; margin: 24px 0 32px; display: block; }
.gen-bar { width: 260px; height: 6px; background: rgba(255,255,255,0.2); border-radius: 3px; overflow: hidden; margin: 0 auto 16px; }
.gen-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 3px; width: 0%; transition: width 0.3s; }
.gen-hint { font-size: 14px; color: rgba(255,255,255,0.7); }

/* ---- Story Result ---- */
.story-title-wrap { text-align: center; margin: 24px 0 32px; }
.story-title { font-size: 22px; font-weight: 700; color: var(--primary); letter-spacing: 1px; }
.story-divider { width: 50px; height: 3px; background: var(--accent); margin: 12px auto 0; border-radius: 2px; }
.story-section {
  position: relative; padding: 12px 0 20px 28px; border-left: 2px solid var(--border); margin-bottom: 4px;
}
.story-section:last-child { border-left-color: transparent; }
.section-phase { display: flex; align-items: center; margin-bottom: 8px; }
.phase-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  margin-left: -35px; margin-right: 10px; flex-shrink: 0;
}
.phase-label { font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: 1px; }
.section-content { font-size: 15px; color: #3a3a3a; line-height: 2; text-indent: 2em; display: block; }
.story-ending { text-align: center; padding: 32px 0 24px; }
.ending-line { font-size: 14px; color: #999; font-style: italic; }
.ending-note { display: block; margin-top: 8px; font-size: 12px; color: #ccc; }
.disclaimer-note { display: block; margin-top: 6px; font-size: 10px; color: #ddd; font-style: italic; }
.story-actions { display: flex; gap: 10px; padding: 8px 0 32px; }

/* ---- Profile Page ---- */
.form-group { margin-bottom: 18px; }
.form-label { font-size: 14px; color: #666; margin-bottom: 8px; display: block; }
.form-input {
  width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid #e0e0e0;
  font-size: 15px; background: #fafafa;
}
.form-input:focus { outline: none; border-color: var(--primary); background: #fff; }

.gender-options { display: flex; gap: 10px; }
.gender-opt {
  flex: 1; text-align: center; padding: 12px; border-radius: 8px; font-size: 15px;
  background: #f5f5f5; cursor: pointer; border: 2px solid transparent; transition: all 0.15s;
}
.gender-opt.active { background: #e8f0fe; color: var(--primary); border-color: var(--primary); font-weight: 600; }

.region-trigger {
  display: flex; align-items: center; background: #fff; border-radius: 8px;
  padding: 12px 14px; border: 1px solid #e0e0e0; cursor: pointer;
}
.region-trigger span { flex: 1; font-size: 15px; color: #999; }
.region-trigger span.filled { color: #333; }

/* Region Picker Modal */
.region-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 200; display: flex; align-items: flex-end;
}
.region-popup {
  background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 480px;
  margin: 0 auto; max-height: 65vh; display: flex; flex-direction: column;
}
.region-header { display: flex; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f0f0f0; font-size: 15px; }
.region-body { display: flex; height: 360px; }
.region-col { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.region-col:first-child { background: #f8f8f8; }
.region-item {
  padding: 14px 20px; font-size: 14px; color: #555; cursor: pointer; transition: all 0.1s;
}
.region-item.active { color: var(--primary); font-weight: 600; background: #e8f0fe; }

/* ---- Profile Display ---- */
.profile-display { display: flex; align-items: center; }
.profile-avatar {
  width: 60px; height: 60px; border-radius: 50%; background: #f5f3ef;
  display: flex; align-items: center; justify-content: center; margin-right: 14px; font-size: 32px;
}
.profile-info { flex: 1; }
.profile-name { font-size: 17px; font-weight: 600; }
.profile-loc { font-size: 13px; color: #999; margin-top: 2px; }
.edit-link { font-size: 14px; color: var(--primary); cursor: pointer; }

/* ---- Stats Row ---- */
.stats-row { display: flex; gap: 10px; margin: 16px 0; }
.stat-item { flex: 1; text-align: center; background: #fff; border-radius: 12px; padding: 14px; box-shadow: var(--shadow); cursor: pointer; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: #999; margin-top: 2px; }

/* ---- Menu ---- */
.menu-section { background: #fff; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.menu-item {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 18px;
  font-size: 15px; color: #444; cursor: pointer;
}
.menu-item:not(:last-child) { border-bottom: 1px solid #f5f5f5; }
.menu-arrow { font-size: 18px; color: #ccc; }

/* ---- History ---- */
.history-item { background: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); }
.history-title { font-size: 15px; font-weight: 600; display: block; margin-bottom: 4px; }
.history-meta { display: flex; justify-content: space-between; font-size: 12px; color: #999; }

/* ---- Empty State ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; padding: 60px 0; gap: 8px;
  color: #aaa; font-size: 15px;
}
.empty-state span:first-child { font-size: 48px; }

/* ---- Toast ---- */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,0.75); color: #fff; padding: 12px 24px;
  border-radius: 8px; font-size: 14px; z-index: 9999; pointer-events: none;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,-50%) scale(0.9); } }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 0; }

/* ---- Desktop ---- */
@media (min-width: 480px) {
  #app { border-left: 1px solid #eee; border-right: 1px solid #eee; }
  .tab-bar { border-left: 1px solid #eee; border-right: 1px solid #eee; }
}