:root {
  --blue-deep: #24233f;
  --blue-dark: #36305f;
  --blue-mid: #5d4aa5;
  --blue-soft: #7b63d2;
  --blue-pale: #f3f0ff;
  --blue-accent: #765fe0;
  --gold: #ff9a3c;
  --gold-light: #ffd56a;
  --gold-pale: #fff4e8;
  --white: #ffffff;
  --bg-page: #f7f5fb;
  --bg-card: #ffffff;
  --border: #eee8f5;
  --border-mid: #ded3ed;
  --text-main: #252238;
  --text-soft: #655c78;
  --text-muted: #9f96ad;
  --green: #1a7a4a;
  --green-pale: #e6f5ed;
  --amber: #b5730e;
  --amber-pale: #fdf3e0;
  --red: #b8433a;
  --red-pale: #fdecea;
  --shadow-sm: 0 4px 12px rgba(49, 24, 89, .045);
  --shadow-md: 0 8px 22px rgba(49, 24, 89, .065);
  --shadow-lg: 0 16px 42px rgba(28, 21, 81, .14);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text-main);
  background: #e4deec;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 98px;
  background:
    radial-gradient(circle at 88% 0%, rgba(255, 154, 60, .14), transparent 160px),
    linear-gradient(180deg, #ede8f4 0, var(--bg-page) 230px),
    var(--bg-page);
}

.app-topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 8px 2px 14px;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-title {
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-size: 31px;
  font-weight: 950;
  line-height: 1.12;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--blue-accent);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.data-stamp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 8px 9px 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, .84);
  font-size: 12px;
  font-weight: 950;
  text-decoration: none;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.data-stamp svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.data-stamp:hover {
  color: var(--blue-accent);
  border-color: rgba(109, 69, 216, .24);
  background: #fff;
}

.search-card {
  position: relative;
  margin-top: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  background: var(--white);
  box-shadow: 0 6px 16px rgba(36, 48, 78, .05);
  overflow: hidden;
}

.search-card::after {
  display: none;
}

.search-kicker {
  display: none;
}

.search-box {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.search-box:focus-within {
  border-color: rgba(109, 69, 216, .32);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(109, 69, 216, .07);
}

.search-box svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--blue-accent);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 850;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.clear-btn,
.drawer-close {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
}

.clear-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

.clear-btn.show {
  opacity: 1;
  pointer-events: auto;
}

.filter-card {
  margin-top: 10px;
  padding: 12px 0 10px;
  border: 1px solid rgba(235, 228, 243, .92);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.filter-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px 10px;
}

.filter-title span:first-child {
  color: var(--blue-deep);
  font-size: 14px;
  font-weight: 950;
}

.filter-title span:last-child {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.filter-row {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 0 14px 9px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.sub-filter {
  padding-top: 10px;
  border-top: 1px solid rgba(235, 228, 243, .9);
}

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f4f1f8;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.chip.active {
  color: var(--blue-accent);
  background: var(--blue-pale);
  border-color: rgba(118, 95, 224, .18);
  box-shadow: none;
}

.chip.sub {
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
}

.chip.sub.active {
  color: var(--blue-accent);
  background: var(--blue-pale);
  border-color: rgba(109, 69, 216, .18);
  box-shadow: none;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 850;
}

.result-meta strong {
  color: var(--blue-accent);
}

.result-meta select,
.school-bar select {
  height: 34px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 850;
  box-shadow: var(--shadow-sm);
}

.major-list {
  display: grid;
  gap: 11px;
}

.load-sentinel {
  display: none;
  width: 100%;
  height: 1px;
  margin: 1px 0 0;
}

.load-sentinel.show {
  display: block;
}

.major-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 88px;
  padding: 15px 14px 15px 16px;
  border: 1px solid rgba(235, 228, 243, .92);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(49, 24, 89, .075);
  text-align: left;
  overflow: hidden;
}

.major-card:active {
  transform: translateY(1px);
}

.major-name {
  margin: 0 0 9px;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 950;
  line-height: 1.25;
}

.major-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 7px;
  background: #f0edf6;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.tag.blue {
  color: var(--blue-accent);
  background: var(--blue-pale);
}

.tag.green {
  color: var(--green);
  background: var(--green-pale);
}

.tag.orange {
  color: var(--text-soft);
  background: #f4f1f8;
}

.score-box {
  min-width: 88px;
  text-align: right;
}

.score-range {
  color: var(--blue-accent);
  font-size: 22px;
  font-weight: 950;
  line-height: 1.1;
}

.score-label {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.empty {
  padding: 44px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--text-muted);
  text-align: center;
  font-weight: 850;
}

.loading-state {
  padding: 28px 18px;
  border: 1px dashed var(--border-mid);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  text-align: center;
}

.loading-state strong {
  display: block;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 950;
}

.loading-state span {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.drawer.show {
  pointer-events: auto;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(16, 21, 54, .44);
  opacity: 0;
  transition: opacity .22s ease;
}

.drawer.show .drawer-mask {
  opacity: 1;
}

.drawer-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 540px);
  max-height: 88vh;
  margin: 0;
  border: 1px solid rgba(235, 228, 243, .96);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: 0 -18px 46px rgba(28, 21, 81, .16);
  transform: translate(-50%, 105%);
  transition: transform .28s cubic-bezier(.2, .82, .2, 1);
  overflow: hidden;
}

.drawer.show .drawer-sheet {
  transform: translate(-50%, 0);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 10px auto 4px;
  border-radius: 99px;
  background: #d8cbe8;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 14px;
  border-bottom: 1px solid rgba(235, 228, 243, .86);
  background: linear-gradient(180deg, #fff 0%, #fcfaff 100%);
}

.drawer-code {
  color: var(--blue-accent);
  font-size: 12px;
  font-weight: 950;
}

.drawer-head h1 {
  margin: 4px 0 9px;
  color: var(--blue-deep);
  font-size: 23px;
  line-height: 1.2;
}

.drawer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drawer-close {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  background: #f4f1f8;
  font-size: 24px;
}

.detail-switch {
  display: flex;
  gap: 20px;
  padding: 10px 18px 0;
  background: #fff;
}

.detail-switch button {
  position: relative;
  height: 38px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 950;
}

.detail-switch button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 99px;
  background: transparent;
}

.detail-switch .active {
  color: var(--blue-deep);
}

.detail-switch .active::after {
  background: var(--blue-accent);
}

.detail-panel {
  display: none;
  overflow-y: auto;
  padding: 8px 18px 24px;
}

.detail-panel.active {
  display: block;
}

.intro-block {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.intro-block h2 {
  margin: 0 0 8px;
  color: var(--blue-deep);
  font-size: 15px;
}

.intro-block p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.78;
}

.school-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 10px;
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 850;
}

.enroll-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 11px;
  scrollbar-width: none;
}

.enroll-row::-webkit-scrollbar {
  display: none;
}

.enroll-chip {
  flex: 0 0 auto;
  min-height: 31px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 850;
}

.enroll-chip.active {
  color: #fff;
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.school-list {
  display: grid;
  gap: 9px;
}

.school-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.school-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.school-name {
  color: var(--blue-deep);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.28;
}

.school-score {
  flex: 0 0 auto;
  color: var(--blue-accent);
  font-size: 18px;
  font-weight: 950;
}

.school-remark {
  margin-top: 7px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.school-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.back-top {
  position: fixed;
  right: calc(50% - min(250px, 50vw) + 14px);
  bottom: 84px;
  display: none;
  z-index: 57;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue-accent);
  box-shadow: 0 10px 20px rgba(109, 69, 216, .18);
  font-size: 18px;
  font-weight: 950;
}

.back-top.show {
  display: block;
}

body.drawer-open {
  overflow: hidden;
}

.result-consult-dock {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(0);
  z-index: 58;
  display: none;
  align-items: center;
  width: min(288px, calc(100vw - 40px));
  height: 56px;
  padding: 6px 10px;
  border: 1px solid rgba(216, 203, 232, .78);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 22px rgba(49, 24, 89, .09);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .22s ease, opacity .22s ease;
}

.result-consult-dock.show {
  display: flex;
}

body.dock-hidden .result-consult-dock,
body.dock-scrolling .result-consult-dock {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(74px);
}

.dock-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  text-decoration: none;
}

.dock-action:hover,
.dock-action:focus,
.dock-action:visited {
  color: var(--text-soft);
  text-decoration: none;
}

.dock-action svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.dock-home {
  flex: 0 0 72px;
}

.dock-consult {
  flex: 1;
  color: var(--text-main);
}

.dock-consult span {
  display: inline-block;
  transform-origin: center;
  animation: dockTextBreath 2.4s ease-in-out infinite;
}

.dock-divider {
  width: 1px;
  height: 22px;
  margin: 0 10px 0 4px;
  background: var(--border);
}

.dock-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, .10);
}

@keyframes dockTextBreath {
  0%, 100% {
    color: var(--text-main);
    transform: scale(1);
  }
  50% {
    color: var(--blue-accent);
    transform: scale(1.025);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 21, 54, .36);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  width: min(90vw, 340px);
  padding: 32px 24px;
  border: 1px solid rgba(235, 228, 243, .96);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(16, 21, 54, .16);
  text-align: center;
  transform: translateY(18px) scale(.96);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}

.modal-overlay.show .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted);
  background: #f4f1f8;
}

.modal-qr-title {
  margin-bottom: 20px;
  color: var(--blue-deep);
  font-size: 18px;
  font-weight: 900;
}

.modal-qr-img {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(49, 24, 89, .08);
  margin-bottom: 16px;
}

.modal-qr-tip {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.site-footer {
  display: grid;
  gap: 5px;
  margin: 22px 4px 0;
  padding: 12px 0 2px;
  color: var(--text-muted);
  text-align: center;
}

.site-footer strong {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 950;
}

.site-footer span {
  font-size: 11px;
  font-weight: 750;
  line-height: 1.5;
}

@media (min-width: 920px) {
  .drawer-sheet {
    left: auto;
    right: max(24px, calc((100vw - 520px) / 2 - 548px));
    bottom: 24px;
    width: 520px;
    max-height: calc(100vh - 48px);
    border: 1px solid var(--border);
    border-radius: 24px;
    transform: translateX(110%);
  }

  .drawer.show .drawer-sheet {
    transform: translateX(0);
  }
}
