:root {
  --ink: #182126;
  --muted: #66737a;
  --line: #d9dfe1;
  --paper: #f2f4f3;
  --white: #ffffff;
  --teal: #146b70;
  --wine: #8a2f50;
  --gold: #d4a64a;
  --blue: #284f77;
  --shadow: 0 14px 38px rgba(18, 32, 38, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(24, 33, 38, 0.94);
  backdrop-filter: blur(20px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  gap: 24px;
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
}

.nav-right,
.auth-actions {
  display: flex;
  align-items: center;
}

.nav-right {
  justify-content: flex-end;
  gap: 14px;
}

.auth-actions {
  position: relative;
  gap: 7px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-link,
.account-trigger {
  min-height: 36px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.auth-link-primary {
  color: var(--white);
  border-color: var(--wine);
  background: var(--wine);
}

.account-trigger {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  display: grid;
  width: 220px;
  gap: 5px;
  padding: 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.account-menu[hidden] {
  display: none;
}

.account-menu span {
  color: var(--muted);
  font-size: 13px;
}

.account-menu button {
  margin-top: 10px;
  min-height: 38px;
  color: var(--wine);
  border: 1px solid rgba(138, 47, 80, 0.28);
  border-radius: 4px;
  background: #fff7fa;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.brand {
  gap: 12px;
  font-size: 18px;
  color: var(--white);
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-weight: 700;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.nav-links {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav-links a {
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.hero {
  position: relative;
  min-height: clamp(520px, 74vh, 720px);
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #171d20;
}

.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -5%;
  background: url("./assets/go-to-uni-hero.png") center 46% / cover;
  transform: scale(1.04);
  animation: hero-drift 18s ease-in-out infinite alternate;
  will-change: transform;
}

.hero-overlay {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: rgba(13, 20, 24, 0.58);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: var(--gold);
  z-index: 3;
}

@keyframes hero-drift {
  0% {
    transform: scale(1.04) translate3d(-1.2%, -0.8%, 0);
  }

  100% {
    transform: scale(1.12) translate3d(1.3%, 0.7%, 0);
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 116px 0 92px;
  color: var(--white);
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  font-size: 15px;
  line-height: 1.4;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 104px;
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 760px;
  margin: 26px 0 0;
  color: rgba(255, 253, 248, 0.9);
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 24px;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 800;
}

.button.primary {
  color: var(--white);
  background: var(--wine);
}

.button.secondary {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.52);
}

.tools,
.region,
.compare,
.sources {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.tools {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 28px;
  align-items: end;
  padding: 48px 0 40px;
  background: var(--white);
  box-shadow: 0 0 0 100vmax var(--white);
  clip-path: inset(0 -100vmax);
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 42px;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: 0;
}

.filters {
  display: grid;
  grid-template-columns: 1.45fr 0.75fr 0.9fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: #43525a;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8faf9;
  font: inherit;
  font-weight: 650;
}

input:focus,
select:focus {
  outline: 3px solid rgba(12, 111, 117, 0.18);
  border-color: var(--teal);
}

.region {
  padding: 64px 0 10px;
  scroll-margin-top: 88px;
}

.region-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 15px;
  border-bottom: 1px solid #bdc7ca;
}

.region-heading::after {
  content: "";
  width: min(28vw, 260px);
  height: 3px;
  margin-left: auto;
  background: var(--wine);
}

.school-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.school-card {
  display: grid;
  min-height: 390px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--teal);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.school-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 42px rgba(18, 32, 38, 0.13);
}

.card-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.school-card h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.english-name {
  margin: 7px 0 0;
  color: #40515a;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.location {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
}

.rank {
  display: grid;
  width: 106px;
  min-height: 76px;
  place-items: center;
  padding: 8px;
  color: #6f2140;
  border: 1px solid rgba(138, 47, 80, 0.28);
  border-radius: 4px;
  background: #f8edf1;
  text-align: center;
  font-weight: 900;
  line-height: 1.05;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.rank span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--wine);
  opacity: 1;
}

.meta-list {
  display: grid;
  gap: 12px;
  margin: 22px 0 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.meta-item {
  display: grid;
  gap: 4px;
}

.meta-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.meta-value {
  font-size: 14px;
  font-weight: 720;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: end;
  margin-bottom: 18px;
}

.tag {
  padding: 6px 9px;
  color: #264047;
  border: 1px solid rgba(12, 111, 117, 0.16);
  border-radius: 3px;
  background: rgba(12, 111, 117, 0.08);
  font-size: 12px;
  font-weight: 850;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-self: end;
}

.card-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 900;
}

.card-link.apply {
  color: var(--white);
  background: var(--blue);
}

.card-link.department {
  color: #2f4f7d;
  border: 1px solid rgba(47, 79, 125, 0.28);
  background: rgba(47, 79, 125, 0.07);
}

.card-link.dance {
  color: #7a3150;
  border: 1px solid rgba(122, 49, 80, 0.3);
  background: rgba(122, 49, 80, 0.07);
}

.compare {
  padding: 76px 0 32px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--white);
  background: #26343b;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  font-weight: 650;
}

tbody tr:nth-child(even) {
  background: #f6f8f7;
}

tbody tr:hover {
  background: #eef5f4;
}

td a {
  color: var(--teal);
  font-weight: 900;
}

tr:last-child td {
  border-bottom: 0;
}

.sources {
  padding: 52px 0 64px;
  color: #40515a;
  border-top: 1px solid var(--line);
}

.sources p {
  max-width: 860px;
  margin: 0;
  font-size: 15px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px max(16px, calc((100% - 1180px) / 2));
  color: rgba(255, 253, 248, 0.76);
  background: #172026;
  font-size: 13px;
  font-weight: 760;
}

.auth-dialog {
  width: min(440px, calc(100% - 28px));
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 28px 90px rgba(9, 18, 23, 0.32);
}

.auth-dialog::backdrop {
  background: rgba(10, 18, 22, 0.68);
  backdrop-filter: blur(5px);
}

.auth-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 16px;
}

.auth-dialog h2 {
  font-size: 32px;
}

.dialog-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 24px;
  padding: 4px;
  background: #edf1f0;
}

.auth-mode button {
  min-height: 40px;
  color: var(--muted);
  border: 0;
  border-radius: 3px;
  background: transparent;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.auth-mode button[aria-selected="true"] {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 2px 10px rgba(18, 32, 38, 0.08);
}

#authForm {
  display: grid;
  gap: 17px;
  padding: 22px 24px 26px;
}

.phone-fields,
.code-fields {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 9px;
}

.code-fields {
  grid-template-columns: 1fr 126px;
}

.code-fields button,
.auth-submit {
  min-height: 48px;
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.code-fields button {
  color: var(--teal);
  border: 1px solid rgba(20, 107, 112, 0.28);
  background: #f0f8f7;
}

.code-fields button:disabled {
  color: var(--muted);
  cursor: default;
}

.agreement {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 9px;
  font-size: 12px;
  font-weight: 650;
}

.agreement[hidden],
.nickname-field[hidden] {
  display: none;
}

.agreement input {
  width: 17px;
  min-height: 17px;
  margin: 1px 0 0;
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-message.is-error {
  color: #a3273d;
}

.auth-message.is-success {
  color: var(--teal);
}

.auth-submit {
  color: var(--white);
  background: var(--wine);
}

.is-hidden {
  display: none;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 750;
}

@media (max-width: 920px) {
  .tools,
  .filters {
    grid-template-columns: 1fr;
  }

  .school-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero h1 {
    font-size: 76px;
  }
}

@media (max-width: 640px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
    gap: 10px;
  }

  .nav-links {
    width: auto;
    justify-content: flex-start;
  }

  .nav-right {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }

  .auth-actions {
    flex: 0 0 auto;
    padding-left: 8px;
  }

  .auth-link,
  .account-trigger {
    padding: 0 9px;
  }

  .nav-links a {
    padding: 8px 10px;
  }

  .hero {
    min-height: 560px;
  }

  .hero-content {
    padding: 78px 0 72px;
  }

  .hero h1 {
    font-size: 54px;
  }

  .hero-copy {
    font-size: 20px;
  }

  .hero .eyebrow {
    font-size: 14px;
  }

  h2 {
    font-size: 34px;
  }

  .region-heading::after {
    width: 72px;
  }

  .school-grid {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
  }

  .phone-fields,
  .code-fields {
    grid-template-columns: 1fr;
  }

  .code-fields button {
    min-height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero::before {
    animation: none;
    transform: scale(1.06);
  }

  .school-card {
    transition: none;
  }
}
