:root {
  --navy: #102a43;
  --blue: #1f5f99;
  --blue-strong: #174f82;
  --sky: #eaf4fb;
  --teal: #128277;
  --green: #e6f6f2;
  --amber: #a75e0b;
  --amber-bg: #fff5df;
  --red: #aa3434;
  --red-bg: #fff0f0;
  --ink: #183247;
  --muted: #647686;
  --line: #d9e3ea;
  --paper: #ffffff;
  --canvas: #f4f7f9;
  --shadow: 0 18px 55px rgba(16, 42, 67, 0.10);
  --radius: 22px;
  --small-radius: 13px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(69, 160, 205, 0.12), transparent 34rem),
    linear-gradient(180deg, #f9fbfc 0, var(--canvas) 34rem);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.6;
}

a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p { margin-top: 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 78px;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(217, 227, 234, 0.85);
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--navy);
  text-decoration: none;
}

.brand img { width: 106px; height: 35px; object-fit: contain; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 1rem; letter-spacing: 0.02em; }
.brand small { margin-top: 0.25rem; color: var(--muted); font-size: 0.76rem; }

.header-chip,
.admin-nav a {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
}

.admin-nav { display: flex; gap: 0.6rem; }
main { width: min(1160px, 92vw); margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  gap: 3.4rem;
  align-items: center;
  padding: 5rem 0 3rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 1.25rem;
  color: var(--navy);
  font-size: clamp(2.15rem, 5vw, 4.25rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

h2 { margin-bottom: 0; color: var(--navy); font-size: 1.45rem; line-height: 1.25; }
h3 { margin-bottom: 0.35rem; color: var(--navy); }
.hero-lead { max-width: 760px; margin-bottom: 1.5rem; color: #445d70; font-size: 1.08rem; }
.notice-stack { display: grid; gap: 0.7rem; }
.notice { margin: 0; padding: 0.8rem 1rem; border-radius: 12px; font-size: 0.92rem; font-weight: 650; }
.primary-notice { border: 1px solid #f1d49a; background: var(--amber-bg); color: #7b4a0e; }
.privacy-notice { border: 1px solid #bfe3db; background: var(--green); color: #17665e; }

.process-card {
  padding: 2rem;
  border: 1px solid rgba(217, 227, 234, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.process-step { display: grid; grid-template-columns: 54px 1fr; gap: 1rem; align-items: center; }
.process-step > span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}
.process-step strong { display: block; color: var(--navy); }
.process-step small { display: block; margin-top: 0.2rem; color: var(--muted); line-height: 1.45; }
.process-line { width: 2px; height: 26px; margin: 0.4rem 0 0.4rem 26px; background: linear-gradient(var(--blue), var(--teal)); }
.future-note { display: grid; gap: 0.2rem; margin-top: 1.25rem; padding: 0.9rem 1rem; border-radius: 12px; background: var(--sky); }
.future-note b { color: var(--blue-strong); font-size: 0.88rem; }
.future-note span { color: #536b7d; font-size: 0.78rem; line-height: 1.5; }

.error-panel {
  margin: 0 auto 1.5rem;
  padding: 1.2rem 1.5rem;
  border: 1px solid #f0baba;
  border-radius: var(--small-radius);
  background: var(--red-bg);
  color: #7c2929;
}
.error-panel ul { margin: 0.45rem 0 0; padding-left: 1.25rem; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

.survey-form { display: grid; gap: 1.35rem; padding: 0 0 5rem; }
.form-section {
  padding: clamp(1.35rem, 3vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 10px 35px rgba(16, 42, 67, 0.055);
}

.section-heading { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.8rem; }
.section-heading > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--sky);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 800;
}
.section-heading p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.94rem; }

.field-grid { display: grid; gap: 1.25rem; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-width { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.field > span,
.fieldset-clean legend { color: var(--navy); font-size: 0.92rem; font-weight: 750; }
.field em,
.fieldset-clean em,
.subsection h3 em,
.conditional-panel h3 em { margin-left: 0.35rem; color: var(--red); font-size: 0.72rem; font-style: normal; font-weight: 700; }
.field small,
.field > span small { color: var(--muted); font-size: 0.78rem; font-weight: 500; }

input, select, textarea {
  width: 100%;
  border: 1px solid #c9d7e1;
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input, select { min-height: 48px; padding: 0 0.85rem; }
textarea { padding: 0.8rem 0.9rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31, 95, 153, 0.12); }
input:disabled, select:disabled, textarea:disabled { background: #f1f4f6; }

.fieldset-clean { margin: 0; padding: 0; border: 0; }
.fieldset-clean legend { margin-bottom: 0.5rem; }
.inline-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.compact-choice { position: relative; display: block; cursor: pointer; }
.compact-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.compact-choice span { display: grid; place-items: center; min-height: 48px; border: 1px solid #c9d7e1; border-radius: 11px; color: var(--navy); font-weight: 750; }
.compact-choice input:checked + span { border-color: var(--blue); background: var(--sky); color: var(--blue-strong); box-shadow: inset 0 0 0 1px var(--blue); }

.dorm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem; }
.dorm-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.dorm-card:hover { transform: translateY(-3px); border-color: #9fbfd4; box-shadow: 0 14px 30px rgba(16, 42, 67, 0.09); }
.dorm-radio { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dorm-card.is-selected,
.dorm-card:has(.dorm-radio:checked) { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(31, 95, 153, 0.18), 0 16px 34px rgba(16, 42, 67, 0.11); }
.dorm-photo-slot { position: relative; height: 210px; overflow: hidden; background: #e8f0f4; }
.dorm-card[data-dorm="shenbei"] .dorm-photo-slot { background: linear-gradient(145deg, #dae9f2, #eef5f8 54%, #d6e3eb); }
.dorm-card[data-dorm="tongzhou"] .dorm-photo-slot { background: linear-gradient(145deg, #d9eee8, #edf7f4 54%, #d2e7e2); }
.dorm-photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  background: #fff !important;
}
.dorm-photo-gallery-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dorm-photo { position: relative; min-width: 0; height: 100%; margin: 0; overflow: hidden; background: #dfe8ed; }
.dorm-photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 260ms ease; }
.dorm-card:hover .dorm-photo img { transform: scale(1.025); }
.dorm-photo-loft img { object-position: center 64%; }
.dorm-photo-bathroom img { object-position: center 52%; }
.dorm-photo-standard img { object-position: center center; }
.dorm-photo-tongzhou-overview img { object-position: 76% center; }
.dorm-photo-tongzhou-wash img { object-position: center 48%; }
.dorm-photo-tongzhou-bunks img { object-position: center 45%; }
.dorm-photo-tongzhou-storage img { object-position: center 44%; }
.dorm-photo figcaption {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  left: 0.35rem;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  background: rgba(13, 36, 52, 0.72);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  backdrop-filter: blur(4px);
}
.photo-count {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 1;
  padding: 0.3rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(13, 36, 52, 0.72);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  backdrop-filter: blur(5px);
}
.photo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: #527083;
}
.photo-placeholder::before {
  content: "";
  width: 68px;
  height: 54px;
  margin: 0 auto 0.8rem;
  border: 2px solid currentColor;
  border-radius: 12px;
  opacity: 0.65;
  background:
    linear-gradient(145deg, transparent 48%, currentColor 49%, currentColor 53%, transparent 54%) 10px 18px / 45px 26px no-repeat,
    radial-gradient(circle, currentColor 0 4px, transparent 5px) 12px 10px / 20px 20px no-repeat;
}
.photo-placeholder span { font-weight: 800; }
.photo-placeholder small { margin-top: 0.1rem; color: var(--muted); font-size: 0.76rem; }
.dorm-card-body { display: grid; gap: 1rem; padding: 1.35rem; }
.dorm-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.card-kicker { margin-bottom: 0.2rem; color: var(--muted); font-size: 0.72rem; }
.dorm-title-row h3 { margin: 0; font-size: 1.35rem; }
.recommend-badge { flex: 0 0 auto; padding: 0.3rem 0.55rem; border-radius: 999px; background: #eef2f4; color: #607381; font-size: 0.7rem; font-weight: 800; }
.dorm-card.grade-recommended .recommend-badge { background: var(--amber-bg); color: #85500f; }
.dorm-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.dorm-facts span { display: flex; flex-direction: column; padding: 0.7rem 0.55rem; text-align: center; }
.dorm-facts span + span { border-left: 1px solid var(--line); }
.dorm-facts b { color: var(--navy); font-size: 0.9rem; }
.dorm-facts small { color: var(--muted); font-size: 0.68rem; }
.address { margin: 0; color: #4f687a; font-size: 0.84rem; font-weight: 700; }
.dorm-card ul { margin: 0; padding-left: 1.2rem; color: #536a7a; font-size: 0.84rem; }
.dorm-card li + li { margin-top: 0.3rem; }
.select-indicator { display: flex; align-items: center; gap: 0.55rem; color: var(--blue); }
.select-indicator i { width: 20px; height: 20px; border: 2px solid #9db0bd; border-radius: 50%; box-shadow: inset 0 0 0 4px #fff; }
.dorm-card.is-selected .select-indicator i,
.dorm-card:has(.dorm-radio:checked) .select-indicator i { border-color: var(--blue); background: var(--blue); }
.select-indicator b { font-size: 0.84rem; }

.subsection { margin-bottom: 1.7rem; }
.subsection > h3 { font-size: 1rem; }
.choice-cards { display: grid; gap: 0.9rem; margin-top: 0.9rem; }
.two-choice-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-card {
  position: relative;
  display: flex;
  gap: 0.85rem;
  min-height: 104px;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: #91b9d5; }
.choice-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-dot { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 0.1rem; border: 2px solid #9db0bd; border-radius: 50%; box-shadow: inset 0 0 0 4px #fff; }
.choice-card strong { display: block; color: var(--navy); }
.choice-card small { display: block; margin-top: 0.35rem; color: var(--muted); line-height: 1.45; }
.choice-card:has(input:checked) { border-color: var(--blue); background: var(--sky); }
.choice-card input:checked + .choice-dot { border-color: var(--blue); background: var(--blue); }
.details-grid { padding-top: 0.2rem; }
.conditional-panel { display: grid; gap: 0.8rem; padding: 1.25rem; border: 1px solid #cddde6; border-radius: 16px; background: #f8fbfc; }
.conditional-panel > h3 { margin: 0; font-size: 1rem; }
.conditional-panel > p { margin: -0.45rem 0 0; color: var(--muted); font-size: 0.85rem; }
.conditional-panel.is-hidden,
.reason-field.is-hidden { display: none; }
.reason-field { margin-top: 0.25rem; }

.confirm-section { border-color: #bddfd7; background: linear-gradient(150deg, #fff 0%, #f1faf7 100%); }
.consent-stack { display: grid; gap: 0.85rem; }
.consent-row { display: flex; gap: 0.8rem; align-items: flex-start; cursor: pointer; }
.consent-row input { flex: 0 0 auto; width: 20px; min-height: 20px; margin-top: 0.15rem; accent-color: var(--teal); }
.privacy-copy { margin: 0.9rem 0 1.5rem 2.8rem; color: var(--muted); font-size: 0.85rem; }

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.72rem 1.25rem;
  border-radius: 11px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.primary-button:hover { border-color: var(--blue-strong); background: var(--blue-strong); }
.primary-button:disabled { border-color: #8ba0af; background: #8ba0af; cursor: wait; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--navy); }
.submit-button { min-width: 180px; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1160px, 92vw);
  margin: 0 auto;
  padding: 1.8rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.success-card, .login-card {
  width: min(650px, 100%);
  margin: 6rem auto;
  padding: clamp(1.8rem, 5vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.success-card h1, .login-card h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.success-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 1rem; border-radius: 50%; background: var(--green); color: var(--teal); font-size: 2rem; font-weight: 900; }
.success-name { color: var(--navy); font-size: 1.1rem; font-weight: 800; }
.success-note { padding: 0.8rem 1rem; border-radius: 10px; background: var(--amber-bg); color: #765019; font-size: 0.84rem; }
.reference { display: flex; flex-direction: column; gap: 0.25rem; margin: 1.5rem 0; padding: 1rem; border-radius: 12px; background: #f5f8fa; }
.reference span { color: var(--muted); font-size: 0.78rem; }
.reference strong { color: var(--navy); letter-spacing: 0.06em; }
.login-card form { display: grid; gap: 1rem; margin-top: 1.5rem; text-align: left; }

.flash-wrap { width: min(700px, 92vw); margin: 1.5rem auto 0; }
.flash { padding: 0.9rem 1rem; border-radius: 10px; }
.flash.error { border: 1px solid #f0baba; background: var(--red-bg); color: var(--red); }

/* Admin */
.admin-body { background: #eef3f6; }
.admin-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; min-width: 0; padding: 3rem 0 5rem; }
.admin-title-row, .panel-heading { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-end; }
.admin-title-row h1 { margin-bottom: 0.4rem; font-size: clamp(2rem, 4vw, 3.2rem); }
.admin-title-row p, .panel-heading p { margin-bottom: 0; color: var(--muted); }
.export-actions { display: flex; gap: 0.65rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.five-stats { grid-template-columns: repeat(5, 1fr); }
.stat-grid article { padding: 1.35rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.stat-grid span { display: block; color: var(--muted); font-size: 0.82rem; }
.stat-grid strong { display: block; margin-top: 0.3rem; color: var(--navy); font-size: 2.25rem; line-height: 1; }
.admin-title-row, .stat-grid, .admin-panel { min-width: 0; }
.admin-panel { padding: 1.4rem; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.panel-heading { margin-bottom: 1rem; }
.panel-heading h2 { font-size: 1.15rem; }
.table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.admin-table thead th { background: #f6f8fa; color: var(--navy); font-size: 0.78rem; white-space: nowrap; }
.admin-table td { font-size: 0.84rem; }
.admin-table td small { display: block; margin-top: 0.25rem; color: var(--muted); }
.compact-table td { font-size: 1rem; font-weight: 750; }
.grade-summary { min-width: 580px; }
.response-table { min-width: 1250px; }
.response-table td:first-child { min-width: 165px; }
.response-table td:nth-child(3), .response-table td:nth-child(6) { max-width: 270px; }
.reference-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.68rem !important; }
.status-pill { display: inline-flex; padding: 0.3rem 0.58rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.status-pill.shenbei { background: var(--sky); color: var(--blue-strong); }
.status-pill.tongzhou { background: var(--green); color: #0f6d64; }
.special-copy { display: block; color: #7c4c0e !important; white-space: pre-wrap; }
.muted-copy { color: var(--muted); }
.filter-bar { display: grid; gap: 0.7rem; align-items: center; margin-bottom: 1rem; }
.accommodation-filters { grid-template-columns: minmax(240px, 1.3fr) repeat(5, minmax(130px, 0.8fr)) auto auto; }
.filter-bar a { text-align: center; }
.empty-state { padding: 1.5rem !important; color: var(--muted); text-align: center !important; }

@media (max-width: 1080px) {
  .five-stats { grid-template-columns: repeat(3, 1fr); }
  .accommodation-filters { grid-template-columns: repeat(3, 1fr); }
  .accommodation-filters input { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 3.5rem; }
  .process-card { max-width: 680px; }
  .dorm-grid { grid-template-columns: 1fr; }
  .dorm-photo-slot { height: 240px; }
  .stat-grid, .five-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-title-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 640px) {
  .site-header { min-height: 68px; padding: 0 4vw; }
  .brand img { width: 82px; height: 30px; }
  .brand strong { font-size: 0.88rem; }
  .brand small { display: none; }
  .header-chip { display: none; }
  main { width: min(94vw, 1160px); }
  .hero { padding: 2.7rem 0 2rem; }
  h1 { font-size: 2.25rem; }
  .hero-lead { font-size: 0.98rem; }
  .process-card, .form-section { border-radius: 17px; }
  .process-card { padding: 1.35rem; }
  .process-step { grid-template-columns: 49px 1fr; gap: 0.8rem; }
  .process-step > span { width: 49px; height: 49px; border-radius: 13px; }
  .process-line { height: 24px; margin-left: 24px; }
  .two-columns, .two-choice-cards { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .section-heading { margin-bottom: 1.35rem; }
  .dorm-photo-slot { height: 185px; }
  .dorm-photo-gallery { gap: 2px; }
  .dorm-photo figcaption { right: 0.2rem; bottom: 0.25rem; left: 0.2rem; padding-inline: 0.15rem; font-size: 0.58rem; }
  .photo-count { top: 0.45rem; right: 0.45rem; }
  .dorm-card-body { padding: 1.05rem; }
  .dorm-title-row { flex-direction: column; gap: 0.5rem; }
  .dorm-facts b { font-size: 0.8rem; }
  .choice-card { min-height: auto; }
  .privacy-copy { margin-left: 0; }
  .site-footer { flex-direction: column; gap: 0.35rem; }
  .stat-grid, .five-stats { grid-template-columns: 1fr 1fr; }
  .stat-grid strong { font-size: 1.8rem; }
  .export-actions { width: 100%; }
  .export-actions a { flex: 1; }
  .accommodation-filters { grid-template-columns: 1fr; }
  .accommodation-filters input { grid-column: auto; }
  .admin-nav a:first-child { display: none; }
}

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