* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --blue: #026df6;
  --blue-dark: #0157c8;
  --blue-rgb: 2, 109, 246;
  --blue-light: #eaf2ff;
  --text: #1a1a1a;
  --text-2: #666;
  --text-3: #999;
  --line: #ececec;
  --bg: #f4f6fa;
  --radius: 12px;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input,
button,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 30px rgba(20, 60, 120, 0.06);
}

/* ---------- 首屏 ---------- */
.hero {
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue) 45%, var(--blue-dark) 100%);
  color: #fff;
  padding: 26px 22px 96px;
  position: relative;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.95;
  position: relative;
  z-index: 1;
}

.brand .dot {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero h1 {
  font-size: 24px;
  line-height: 1.35;
  margin: 22px 0 8px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.hero p {
  margin: 0;
  font-size: 13px;
  opacity: 0.82;
  position: relative;
  z-index: 1;
}

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(15, 60, 130, 0.09);
}

.card-form {
  margin: -72px 18px 0;
  padding: 22px 20px 24px;
  position: relative;
  z-index: 2;
}

.field-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.picker {
  width: 100%;
  height: 48px;
  border: 1px solid var(--blue);
  background: #fff;
  border-radius: 24px;
  padding: 0 18px;
  text-align: left;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  transition: 0.15s;
}

.picker:active {
  background: rgba(var(--blue-rgb), 0.06);
}

.picker.placeholder {
  color: #9aa7b5;
}

.picker .arrow {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #888;
  border-bottom: 1.5px solid #888;
  transform: rotate(45deg) translate(-2px, -2px);
  flex: none;
  margin-left: 10px;
}

.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 2px;
  margin-top: 30px;
  box-shadow: 0 8px 18px rgba(var(--blue-rgb), 0.3);
  transition: 0.15s;
}

.btn-primary:active {
  transform: scale(0.985);
  box-shadow: 0 4px 12px rgba(var(--blue-rgb), 0.28);
}

.btn-primary:disabled {
  opacity: 0.55;
  box-shadow: none;
}

.tips {
  padding: 26px 22px 40px;
}

.tips h2 {
  font-size: 14px;
  margin: 0 0 10px;
  color: #333;
  font-weight: 600;
}

.tips ol {
  margin: 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.9;
}

.footer {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 18px 0 28px;
}

.badge-year {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: 2px;
}

/* ---------- 通用页头 ---------- */
.page-head {
  background: linear-gradient(160deg, var(--blue), var(--blue) 60%, var(--blue-dark));
  color: #fff;
  padding: 14px 16px 20px;
  position: relative;
}

.page-head .nav {
  display: flex;
  align-items: center;
  height: 30px;
  font-size: 17px;
  font-weight: 600;
}

.back {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  color: #fff;
}

.back i {
  width: 10px;
  height: 10px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
  display: block;
}

.page-head h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 16px 0 4px;
}

.page-head .sub {
  font-size: 13px;
  opacity: 0.85;
}

/* ---------- 底部弹出面板 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: 0.22s;
  z-index: 90;
}

.sheet-mask.show {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  transform: translateY(102%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 91;
  display: flex;
  flex-direction: column;
  max-height: 78vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet.show {
  transform: translateY(0);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  flex: none;
}

.sheet-title {
  font-size: 15px;
  font-weight: 600;
}

.sheet-cancel {
  font-size: 14px;
  color: var(--text-2);
  padding: 4px 2px;
}

.search-wrap {
  padding: 0 16px 10px;
  flex: none;
}

.search-box {
  display: flex;
  align-items: center;
  height: 38px;
  border-radius: 19px;
  background: #f4f6fa;
  padding: 0 14px;
  gap: 8px;
}

.search-box svg {
  flex: none;
}

.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 14px;
  height: 100%;
}

.list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding-bottom: 8px;
}

.opt {
  padding: 13px 16px;
  font-size: 15px;
  border-bottom: 1px solid #f6f6f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.opt:active {
  background: #f7faff;
}

.opt.on {
  color: var(--blue);
  font-weight: 500;
}

.opt small {
  color: var(--text-3);
  font-size: 12px;
  flex: none;
}

.empty {
  padding: 50px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

.loadmore {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 14px;
}

/* ---------- 表单 ---------- */
.form {
  background: #fff;
  margin: 14px 16px 0;
  border-radius: var(--radius);
  padding: 4px 16px;
  box-shadow: 0 4px 16px rgba(15, 60, 130, 0.05);
}

.form-row {
  display: flex;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid #f3f3f3;
  gap: 12px;
}

.form-row:last-child {
  border-bottom: 0;
}

.form-row > label {
  width: 84px;
  flex: none;
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.form-row > label em {
  color: #f5222d;
  font-style: normal;
  margin-right: 2px;
}

.form-row .val {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 15px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0;
}

.form-row .val.placeholder {
  color: #b6bfc9;
}

.form-row .val .arrow {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #c2c8d0;
  border-bottom: 1.5px solid #c2c8d0;
  transform: rotate(45deg) translate(-2px, -2px);
  flex: none;
  margin-left: 10px;
}

.form-row .val .txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  height: 54px;
  background: transparent;
  font-size: 15px;
}

.form-row input::placeholder {
  color: #b6bfc9;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.code-btn {
  flex: none;
  font-size: 13px;
  color: var(--blue);
  padding: 14px 0 14px 10px;
  margin: -14px 0;
  border-left: 1px solid #eee;
  white-space: nowrap;
}

.code-btn:disabled {
  color: #b6bfc9;
}

.form-tip {
  margin: 12px 20px 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
}

.code-hint {
  margin: 0 20px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7e6;
  border: 1px solid #ffe0a3;
  font-size: 12px;
  color: #a8651a;
  line-height: 1.6;
}

.code-hint[hidden] {
  display: none;
}

.code-hint b {
  font-size: 14px;
  letter-spacing: 1px;
}

.pad {
  padding: 0 16px;
}

/* ---------- 结果页 ---------- */
.summary {
  background: #fff;
  margin: -12px 16px 0;
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  z-index: 2;
  box-shadow: 0 6px 20px rgba(15, 60, 130, 0.07);
}

.summary .k {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.summary .v {
  font-size: 20px;
  font-weight: 600;
  color: #111;
  line-height: 1.4;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  background: #f4f6fa;
  color: var(--text-2);
}

.chip.blue {
  background: var(--blue-light);
  color: var(--blue);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 22px 18px 10px;
}

.section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--blue);
}

.group {
  background: #fff;
  margin: 0 16px 12px;
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: 0 3px 14px rgba(15, 60, 130, 0.05);
}

.group-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tag {
  flex: none;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  padding: 2px 7px;
  border-radius: 4px;
  margin-top: 2px;
  line-height: 1.6;
}

.group-name {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.5;
  flex: 1;
  min-width: 0;
}

.group-name .collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toggle {
  font-size: 12px;
  color: var(--blue);
  margin-top: 6px;
  display: inline-block;
}

.subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.subj {
  font-size: 11px;
  color: #0f6e56;
  background: #e8f8f2;
  padding: 3px 8px;
  border-radius: 4px;
}

.group-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #f0f0f0;
}

.group-foot .n {
  font-size: 12px;
  color: var(--text-3);
}

.btn-ghost {
  height: 32px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--blue);
  color: var(--blue);
  font-size: 13px;
  background: #fff;
}

.btn-ghost:active {
  background: var(--blue-light);
}

/* ---------- 院校页 ---------- */
.school {
  background: #fff;
  margin: 0 16px 10px;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 3px 14px rgba(15, 60, 130, 0.05);
}

.school-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.school-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
  min-width: 0;
}

.nature {
  flex: none;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.6;
}

.nature.gong {
  color: #0f6e56;
  background: #e8f8f2;
}

.nature.min {
  color: #854f0b;
  background: #fdf3e3;
}

.nature.du {
  color: #534ab7;
  background: #eeedfe;
}

.school-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 6px;
}

.metrics {
  display: flex;
  margin-top: 12px;
  background: #fafbfd;
  border-radius: 8px;
  padding: 10px 0;
}

.metric {
  flex: 1;
  text-align: center;
  position: relative;
}

.metric + .metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: #eef0f4;
}

.metric b {
  display: block;
  font-size: 17px;
  font-weight: 600;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.metric span {
  font-size: 11px;
  color: var(--text-3);
}

.stat-bar {
  display: flex;
  gap: 10px;
  margin: 0 16px 12px;
}

.stat {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 3px 14px rgba(15, 60, 130, 0.05);
}

.stat b {
  display: block;
  font-size: 19px;
  color: var(--blue);
  font-weight: 600;
}

.stat span {
  font-size: 11px;
  color: var(--text-3);
}

.sort-bar {
  display: flex;
  gap: 8px;
  margin: 0 16px 10px;
  align-items: center;
}

.sort-bar .lbl {
  font-size: 12px;
  color: var(--text-3);
  margin-right: 2px;
}

.sort-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 14px;
  background: #fff;
  color: var(--text-2);
  border: 1px solid #e8ecf2;
}

.sort-btn.on {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 8px;
  max-width: 76vw;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
  z-index: 200;
  line-height: 1.5;
}

#toast.show {
  opacity: 1;
  visibility: visible;
}

.fade-in {
  animation: fadeIn 0.32s ease both;
}

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