:root {
  --bg: #f2ecdf;
  --bg-soft: #edf3ed;
  --paper: rgba(255, 252, 246, 0.88);
  --paper-strong: rgba(255, 255, 255, 0.9);
  --ink: #143247;
  --muted: #6c8290;
  --line: rgba(20, 50, 71, 0.11);
  --deep: #143247;
  --deep-2: #1a6a83;
  --green: #0e8f74;
  --amber: #d58a2f;
  --blue: #5978ca;
  --danger: #c85e57;
  --shadow: 0 22px 56px rgba(12, 32, 44, 0.12);
  --safe-bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(14, 143, 116, 0.14), transparent 22%),
    radial-gradient(circle at 88% 10%, rgba(213, 138, 47, 0.12), transparent 20%),
    radial-gradient(circle at 88% 84%, rgba(89, 120, 202, 0.1), transparent 18%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: none;
  background: none;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top, 0px) 14px calc(env(safe-area-inset-bottom, 0px) + 16px);
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 10px;
  padding: 14px 0 12px;
  background: linear-gradient(180deg, rgba(242, 236, 223, 0.94) 0%, rgba(242, 236, 223, 0.82) 80%, rgba(242, 236, 223, 0) 100%);
  backdrop-filter: blur(16px);
}

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--green);
  background: rgba(14, 143, 116, 0.08);
}

#headerTitle {
  font-family: "Songti SC", "STSong", serif;
  font-size: 18px;
  line-height: 1.2;
}

.icon-btn {
  height: 38px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  cursor: pointer;
}

.main-stage {
  padding-bottom: calc(var(--safe-bottom) + 8px);
}

.page {
  display: none;
  animation: fade-in 180ms ease;
}

.page.active {
  display: block;
}

.hero-card,
.panel,
.metric-card,
.profile-chip,
.bottom-nav,
.modal,
.sheet {
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 22px;
  border-radius: 28px;
  margin-bottom: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 80% 22%, rgba(255, 255, 255, 0.14), transparent 28%),
    linear-gradient(145deg, rgba(20, 50, 71, 0.98), rgba(26, 106, 131, 0.92));
}

.hero-card h1,
.hero-card h2 {
  margin: 0 0 10px;
  font-family: "Songti SC", "STSong", serif;
  line-height: 1.12;
}

.hero-card h1 {
  font-size: 32px;
}

.hero-card h2 {
  font-size: 28px;
}

.hero-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.84);
}

.hero-badge {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.hero-card-compact {
  padding-bottom: 18px;
}

.panel {
  padding: 16px;
  border-radius: 24px;
  margin-bottom: 12px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-head strong {
  font-size: 15px;
}

.panel-head span {
  font-size: 12px;
  color: var(--muted);
}

.entry-grid,
.score-grid,
.profile-grid {
  display: grid;
  gap: 10px;
}

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

.entry-card,
.profile-chip {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
  cursor: pointer;
}

.entry-card strong,
.profile-chip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.entry-card span,
.profile-chip span,
.detail-block span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(14, 143, 116, 0.36);
  box-shadow: 0 0 0 4px rgba(14, 143, 116, 0.08);
}

.choice-row {
  display: flex;
  gap: 8px;
}

.choice {
  flex: 1;
  padding: 12px 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.choice.active {
  color: var(--green);
  border-color: rgba(14, 143, 116, 0.28);
  background: linear-gradient(135deg, rgba(14, 143, 116, 0.12), rgba(89, 120, 202, 0.08));
}

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

.score-item {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.score-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.score-item input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  outline: none;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  padding: 15px 12px;
  border-radius: 20px;
  text-align: center;
}

.metric-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 24px;
}

.metric-card span {
  font-size: 12px;
  color: var(--muted);
}

.result-metrics {
  margin-top: 6px;
}

.list-line,
.school-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 18px;
}

.list-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  margin-bottom: 10px;
}

.list-line strong,
.school-card strong,
.detail-block strong {
  display: block;
  margin-bottom: 5px;
}

.list-line p,
.school-card p,
.detail-block p,
.modal-head p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.75;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  background: rgba(20, 50, 71, 0.06);
}

.chip-warm {
  color: #fff;
  background: linear-gradient(135deg, var(--amber), #c55f42);
}

.segment-row {
  display: flex;
  gap: 8px;
  margin: 4px 0 12px;
}

.segment-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.segment-btn.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--deep), var(--deep-2));
}

.school-card {
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
}

.school-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.risk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.risk-hit {
  background: linear-gradient(135deg, #cc6a36, #b9544b);
}

.risk-mid {
  background: linear-gradient(135deg, var(--green), var(--deep-2));
}

.risk-safe {
  background: linear-gradient(135deg, var(--blue), #6a74c4);
}

.sticky-actions {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
  display: grid;
  gap: 10px;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(242, 236, 223, 0) 0%, rgba(242, 236, 223, 0.85) 28%, rgba(242, 236, 223, 0.98) 100%);
}

.sticky-actions-inline {
  position: static;
  background: transparent;
  padding-top: 0;
  margin-top: 14px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 18px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--deep-2));
  box-shadow: 0 14px 36px rgba(14, 143, 116, 0.24);
}

.secondary-btn {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.ghost-btn {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 432px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 24px;
  backdrop-filter: blur(16px);
}

.nav-item {
  min-height: 54px;
  border-radius: 16px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.nav-item.active {
  color: var(--green);
  background: rgba(14, 143, 116, 0.08);
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(10, 19, 28, 0.4);
  backdrop-filter: blur(6px);
  z-index: 30;
}

.overlay.show {
  display: block;
}

.sheet,
.modal {
  position: fixed;
  left: 50%;
  width: min(calc(100% - 28px), 432px);
  z-index: 31;
}

.sheet {
  bottom: 0;
  transform: translateX(-50%) translateY(102%);
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  border-radius: 28px 28px 0 0;
  transition: transform 180ms ease;
}

.sheet.show {
  transform: translateX(-50%) translateY(0);
}

.sheet-handle {
  width: 56px;
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 50, 71, 0.14);
  margin: 0 auto 14px;
}

.sheet-head,
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-block {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  margin-bottom: 10px;
}

.modal {
  top: 50%;
  transform: translateX(-50%) translateY(-46%) scale(0.96);
  padding: 18px;
  border-radius: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-50%) scale(1);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  transform: translateX(-50%) translateY(16px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(20, 50, 71, 0.94);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all 180ms ease;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
