:root {
  --blue-deep: #101536;
  --blue-dark: #1c1551;
  --blue-mid: #44208b;
  --blue-soft: #7130be;
  --blue-pale: #f0ebff;
  --blue-accent: #6d45d8;
  --gold: #ff9a3c;
  --gold-light: #ffd56a;
  --gold-dark: #d66b22;
  --gold-pale: #fff4e8;
  --page: #f4f1f8;
  --panel: #ffffff;
  --ink: #201735;
  --muted: #5d5271;
  --soft-muted: #9a8dab;
  --line: #ebe4f3;
  --line-mid: #d8cbe8;
  --green: #1a7a4a;
  --green-soft: #e6f5ed;
  --amber: #b5730e;
  --amber-soft: #fdf3e0;
  --red: #c0392b;
  --red-soft: #fdecea;
  --shadow: 0 10px 30px rgba(49, 24, 89, .12);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: #e4deec;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a,
button,
input,
select {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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, .18), transparent 160px),
    linear-gradient(180deg, #ede8f4 0, var(--page) 230px),
    var(--page);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue-accent);
  font-size: 12px;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
  font-family: var(--font-serif);
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0 14px;
}

.summary-band div {
  min-width: 0;
  padding: 12px 10px;
  color: var(--blue-mid);
  background: var(--blue-pale);
  border: 1px solid #dfd3f2;
  border-radius: 8px;
}

.summary-band div:nth-child(2) {
  color: var(--green);
  background: var(--green-soft);
  border-color: #d2eadc;
}

.summary-band div:nth-child(3) {
  color: var(--amber);
  background: var(--gold-pale);
  border-color: #f3ddbe;
}

.summary-band strong {
  display: block;
  font-size: 25px;
  line-height: 1;
}

.summary-band span {
  display: block;
  margin-top: 6px;
  color: currentColor;
  opacity: .72;
  font-size: 12px;
  font-weight: 800;
}

.controls {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -14px;
  padding: 10px 14px 12px;
  background: rgba(244, 241, 248, .96);
  border-bottom: 1px solid rgba(235, 228, 243, .9);
  backdrop-filter: blur(10px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(36, 48, 78, .05);
}

.search-box svg {
  flex: 0 0 auto;
  color: var(--muted);
}

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

.filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.chip {
  height: 38px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
}

.chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-mid), var(--blue-soft));
  border-color: var(--blue-accent);
}

.select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.select-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.select-row span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.select-row select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  font-weight: 800;
}

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

.result-head button {
  height: 32px;
  padding: 0 12px;
  color: var(--blue-accent);
  background: var(--blue-pale);
  border: 1px solid #dfd3f2;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

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

.school-card {
  position: relative;
  padding: 14px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.school-main {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.logo-wrap img {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.school-info {
  min-width: 0;
}

.school-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: 0;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 0 8px;
  color: #334155;
  background: #f1f5f9;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

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

.tag.private {
  color: var(--red);
  background: var(--red-soft);
}

.tag.rank {
  color: var(--amber);
  background: var(--amber-soft);
}

.school-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.school-stats div {
  min-width: 0;
  padding: 8px;
  background: #f7f9fc;
  border-radius: 8px;
}

.school-stats strong {
  display: block;
  font-size: 16px;
  line-height: 1.1;
}

.school-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.major-list span {
  max-width: 100%;
  padding: 5px 8px;
  color: #465366;
  background: #f7f9fc;
  border: 1px solid #edf1f6;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.action-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.action-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.primary-link {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-mid), var(--blue-soft));
}

.secondary-link {
  color: var(--ink);
  background: #eef2f7;
}

.secondary-link.disabled {
  color: #a3acb9;
  pointer-events: none;
}

.empty-state {
  padding: 46px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.empty-state span {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.result-consult-dock {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 92;
  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 12px 30px rgba(49, 24, 89, .14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

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

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

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

.dock-consult span {
  display: inline-block;
  transform-origin: center;
  will-change: transform, color, text-shadow;
  animation: dockTextBreath 2.4s ease-in-out infinite;
}

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

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

.dock-dot {
  position: absolute;
  top: 6px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5a5f;
  box-shadow: 0 0 0 3px rgba(255, 90, 95, .13);
  animation: dockDotPulse 1.8s ease-out infinite;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  background: rgba(16, 21, 54, .42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .3s ease, visibility .3s ease;
}

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

.modal-content {
  position: relative;
  width: 90%;
  max-width: 340px;
  padding: 32px 24px;
  text-align: center;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(49, 24, 89, .18);
  transform: translateY(20px) scale(.95);
  transition: transform .4s 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;
  color: var(--soft-muted);
  background: #f4f1fb;
  border: none;
  border-radius: 50%;
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
}

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

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

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

@keyframes dockTextBreath {
  0%,
  100% {
    color: var(--ink);
    text-shadow: 0 0 0 rgba(109, 69, 216, 0);
    transform: scale(1);
  }

  50% {
    color: var(--blue-accent);
    text-shadow: 0 0 8px rgba(109, 69, 216, .24);
    transform: scale(1.07);
  }
}

@keyframes dockDotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 90, 95, .42);
  }

  70% {
    box-shadow: 0 0 0 7px rgba(255, 90, 95, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 90, 95, 0);
  }
}

@media (min-width: 521px) {
  body {
    padding: 18px 0;
  }

  .app-shell {
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(36, 48, 78, .14);
  }
}

@media (max-width: 360px) {
  .action-row {
    grid-template-columns: 1fr;
  }

  .summary-band strong {
    font-size: 22px;
  }
}
