:root {
  color-scheme: light dark;
  --bg: #f5f6f1;
  --surface: #ffffff;
  --surface-soft: #eef1ea;
  --text: #202729;
  --muted: #66706f;
  --line: #d8ddd4;
  --accent: #b63c32;
  --accent-strong: #963026;
  --accent-soft: #f2ddd9;
  --shadow: 0 18px 48px rgb(52 62 53 / 0.12);
  --radius: 8px;
  --max: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a1a;
    --surface: #1f2525;
    --surface-soft: #252d2b;
    --text: #edf0eb;
    --muted: #a7b0ad;
    --line: #39413f;
    --accent: #e16a5d;
    --accent-strong: #f08a7e;
    --accent-soft: #3a2725;
    --shadow: 0 18px 48px rgb(0 0 0 / 0.22);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f1;
  --surface: #ffffff;
  --surface-soft: #eef1ea;
  --text: #202729;
  --muted: #66706f;
  --line: #d8ddd4;
  --accent: #b63c32;
  --accent-strong: #963026;
  --accent-soft: #f2ddd9;
  --shadow: 0 18px 48px rgb(52 62 53 / 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151a1a;
  --surface: #1f2525;
  --surface-soft: #252d2b;
  --text: #edf0eb;
  --muted: #a7b0ad;
  --line: #39413f;
  --accent: #e16a5d;
  --accent-strong: #f08a7e;
  --accent-soft: #3a2725;
  --shadow: 0 18px 48px rgb(0 0 0 / 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  line-height: 1.72;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 20;
  transform: translateY(-160%);
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

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

.brand img {
  width: min(220px, 32vw);
  min-width: 150px;
  height: auto;
  border-radius: var(--radius);
  background: var(--accent);
  padding: 8px 12px;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.top-links a,
.top-links button,
.theme-toggle {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px 11px;
  text-decoration: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.92rem;
}

.theme-toggle {
  white-space: nowrap;
}

.top-links a:hover,
.top-links button:hover,
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  width: min(100%, var(--max));
  margin: 0 auto;
}

.sidebar {
  border-right: 1px solid var(--line);
}

.toc-toggle,
.drawer-head,
.sidebar-overlay {
  display: none;
}

.sidebar-inner {
  position: sticky;
  top: 76px;
  height: calc(100dvh - 76px);
  padding: 28px 22px;
  overflow: auto;
}

.search-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

#guide-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

.search-empty {
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 0.9rem;
}

.toc {
  display: grid;
  gap: 4px;
  margin-top: 22px;
}

.toc a {
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 9px 12px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
}

.toc a:hover,
.toc a.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent-strong);
}

.content {
  min-width: 0;
  padding: 32px clamp(20px, 5vw, 56px) 80px;
}

.doc-section {
  scroll-margin-top: 100px;
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}

.doc-section:first-child {
  padding-top: 24px;
}

.doc-section h2,
.doc-section h3,
.doc-section p {
  margin-top: 0;
}

.doc-section h2 {
  margin-bottom: 14px;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.doc-section h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 24px;
}

.section-heading p,
.lead,
.prose p {
  color: var(--muted);
}

.section-tag {
  width: fit-content;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 9px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.lead {
  max-width: 62ch;
  font-size: 1.06rem;
}

.hero-block {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  gap: clamp(24px, 4vw, 44px);
  align-items: center;
}

.hero-media,
.media-row figure {
  margin: 0;
}

.hero-media img,
.media-row img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.83rem;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.button.primary {
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent-strong);
}

.button:active {
  transform: translateY(1px);
}

.quick-grid,
.metrics,
.compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quick-item,
.metrics article,
.compact-grid div,
.note-box,
.address-block,
.contact-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.quick-item {
  padding: 18px;
}

.quick-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 800;
}

.quick-item p {
  min-height: 82px;
  margin-bottom: 12px;
  color: var(--muted);
}

.quick-item a,
.portal-list a,
.link-columns a,
.sources a,
.source-detail a,
.note-box a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.info-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  gap: 28px;
}

.info-flow.stacked {
  grid-template-columns: 1fr;
}

.fact-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.fact-list div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.fact-list dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.fact-list dd {
  margin: 2px 0 0;
  font-weight: 750;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 26px;
}

.timeline div {
  border-top: 3px solid var(--accent);
  padding-top: 10px;
}

.timeline span {
  display: block;
  color: var(--accent);
  font-weight: 900;
}

.timeline p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.metrics article,
.compact-grid div {
  min-height: 112px;
  padding: 18px;
}

.metrics strong,
.compact-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1;
}

.metrics span,
.compact-grid span {
  color: var(--muted);
  font-size: 0.94rem;
}

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

.link-columns a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 15px;
  text-decoration: none;
}

.link-columns a:hover,
.portal-list a:hover {
  border-color: var(--accent);
}

.note-box {
  margin-top: 18px;
  padding: 18px;
  background: var(--surface-soft);
}

.note-box p {
  margin-bottom: 0;
  color: var(--muted);
}

.note-box p + p,
.note-box p + a {
  display: inline-block;
  margin-top: 10px;
}

.link-pills,
.major-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-pills a,
.major-tags span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.link-pills a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.media-row {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.media-row.reverse {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.78fr);
}

.media-row.reverse figure {
  order: 2;
}

.compact-grid {
  margin-top: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.service-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.service-strip div {
  min-height: 112px;
  background: var(--surface);
  padding: 16px;
}

.service-strip span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.service-strip strong {
  color: var(--text);
  font-size: 0.98rem;
}

.split-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.split-list.roomy {
  margin-top: 20px;
}

.split-list div {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
}

.split-list p {
  color: var(--muted);
}

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

.address-block {
  padding: 20px;
}

.address-block p {
  color: var(--muted);
}

.portal-list {
  display: grid;
  gap: 8px;
}

.portal-list a {
  display: grid;
  grid-template-columns: minmax(140px, 0.32fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
  text-decoration: none;
}

.portal-list span {
  color: var(--accent);
  font-weight: 800;
}

.portal-list strong {
  color: var(--muted);
  font-weight: 600;
}

.contact-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 16px;
  padding: 16px;
}

.contact-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.sources ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
}

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

.rule-grid article,
.source-detail,
.major-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rule-grid article {
  padding: 18px;
}

.rule-grid p {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

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

th {
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
}

td {
  color: var(--muted);
}

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

.source-detail {
  margin-top: 18px;
  overflow: hidden;
}

.source-detail summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--accent);
  font-weight: 800;
}

.source-detail summary:hover {
  background: var(--accent-soft);
}

.detail-body {
  border-top: 1px solid var(--line);
  padding: 16px;
  color: var(--muted);
}

.detail-body p:last-child {
  margin-bottom: 0;
}

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

.major-group {
  padding: 0;
}

.major-group summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 850;
}

.major-group summary span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.major-group[open] summary {
  border-bottom: 1px solid var(--line);
}

.major-group .major-tags {
  padding: 14px 16px 10px;
}

.major-group > a {
  display: inline-block;
  margin: 0 16px 16px;
  color: var(--accent-strong);
  font-weight: 800;
}

.phone-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.phone-grid span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
  color: var(--text);
}

.wechat-modal[hidden] {
  display: none;
}

.wechat-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, var(--text) 42%, transparent);
}

.wechat-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.modal-x {
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.modal-x:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.wechat-copy {
  padding-right: 18px;
}

.wechat-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.wechat-copy p {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.qr-card {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
}

.qr-slot {
  aspect-ratio: 1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background-color: var(--surface);
  background-image:
    url("./freshman-wechat-qr.png"),
    linear-gradient(45deg, color-mix(in srgb, var(--accent) 16%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--accent) 16%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--accent) 16%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--accent) 16%, transparent) 75%);
  background-position:
    center,
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-repeat: no-repeat, repeat, repeat, repeat, repeat;
  background-size: contain, 20px 20px, 20px 20px, 20px 20px, 20px 20px;
}

.qr-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

body.modal-open {
  overflow: hidden;
}

.is-hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 980px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .header-actions {
    width: 100%;
    align-items: stretch;
  }

  .top-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .theme-toggle {
    flex: 0 0 auto;
  }

  .layout {
    display: block;
  }

  .toc-toggle {
    position: fixed;
    left: 0;
    bottom: 18px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 76px;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--accent);
    box-shadow: var(--shadow);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0;
    writing-mode: vertical-rl;
  }

  .toc-toggle:hover {
    background: var(--accent-strong);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    background: color-mix(in srgb, var(--text) 38%, transparent);
  }

  .sidebar-overlay[hidden] {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: min(90dvw, 360px);
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-inner {
    position: static;
    height: 100dvh;
    padding: 18px;
    overflow: auto;
  }

  .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
  }

  .drawer-head strong {
    font-size: 1rem;
  }

  .drawer-close {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--accent-strong);
    cursor: pointer;
    padding: 7px 10px;
    font-weight: 800;
  }

  .toc {
    display: grid;
    overflow: visible;
    gap: 4px;
    margin-top: 18px;
    padding-bottom: 24px;
  }

  .toc a {
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  body.toc-open {
    overflow: hidden;
  }

  .hero-block,
  .info-flow,
  .media-row,
  .media-row.reverse,
  .arrival-grid,
  .split-list,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .media-row.reverse figure {
    order: 0;
  }

  .quick-grid,
  .metrics,
  .link-columns,
  .compact-grid,
  .service-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .wechat-panel {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 40px);
    overflow: auto;
  }

  .wechat-copy {
    padding-right: 36px;
  }

  .qr-card {
    width: min(260px, 100%);
  }
}

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

  .brand img {
    width: 190px;
  }

  .content {
    padding: 20px 16px 60px;
  }

  .doc-section {
    padding: 34px 0;
  }

  .quick-grid,
  .metrics,
  .link-columns,
  .compact-grid,
  .service-strip,
  .timeline {
    grid-template-columns: 1fr;
  }

  .quick-item p {
    min-height: auto;
  }

  .portal-list a {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

  .header-actions {
    flex-direction: column;
  }

  .theme-toggle {
    width: fit-content;
  }

  .wechat-panel {
    padding: 20px;
  }

  .wechat-copy {
    padding-right: 28px;
  }
}
