:root {
  --brand: #ff526f;
  --brand-dark: #e94462;
  --brand-soft: #fff0f3;
  --coral: #ef7474;
  --green: #35c529;
  --ink: #202124;
  --muted: #767982;
  --line: #ececf2;
  --panel: #ffffff;
  --page: #f5f6f8;
  --shadow: 0 8px 26px rgba(30, 36, 58, .07);
}

* { box-sizing: border-box; }

html { background: #dde0e7; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: #dde0e7;
}

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

.prototype-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--page);
  box-shadow: 0 0 36px rgba(31, 36, 50, .12);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  min-height: 74px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  color: #fff;
  background: linear-gradient(135deg, #ff607c 0%, #f94767 100%);
}

.site-header h1 { margin: 0; font-size: 18px; text-align: center; }
.site-header p { margin: 4px 0 0; font-size: 11px; text-align: center; opacity: .88; }

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,.12);
  font-size: 28px;
  line-height: 1;
}

main { padding: 12px 12px 94px; }

.specialty-section,
.qa-section {
  padding: 18px 14px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 { margin: 0; font-size: 21px; line-height: 1.25; }

.specialty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.specialty-item {
  position: relative;
  display: grid;
  grid-template-rows: 50px auto;
  justify-items: center;
  align-items: center;
  gap: 6px;
  min-height: 96px;
  padding: 9px 4px 8px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 20px;
  color: #433438;
  background: #fff1e7;
  text-align: center;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.specialty-item:nth-child(2) { background: #ffe5e8; }
.specialty-item:nth-child(3) { background: #e8f4fb; }
.specialty-item:nth-child(4) { background: #e9f3df; }
.specialty-item:nth-child(5) { background: #f2eaf9; }
.specialty-item:nth-child(6) { background: #fff2cf; }
.specialty-item:nth-child(1) { --icon-accent: #e7798d; --icon-soft: #ffe2e7; --icon-base: #fff7f8; }
.specialty-item:nth-child(2) { --icon-accent: #dc7892; --icon-soft: #ffe0e8; --icon-base: #fff6f8; }
.specialty-item:nth-child(3) { --icon-accent: #6fa9bd; --icon-soft: #dff2f8; --icon-base: #f5fbfd; }
.specialty-item:nth-child(4) { --icon-accent: #78a96c; --icon-soft: #e1f0dc; --icon-base: #f7fbf5; }
.specialty-item:nth-child(5) { --icon-accent: #9879b2; --icon-soft: #ecdef5; --icon-base: #fbf7fd; }
.specialty-item:nth-child(6) { --icon-accent: #c69351; --icon-soft: #ffebbd; --icon-base: #fffbf1; }

.specialty-item:active { transform: scale(.97); }
.specialty-item.is-active {
  border-color: #ff7188;
  color: #8e3345;
  box-shadow: 0 8px 20px rgba(255, 82, 111, .14);
}
.specialty-item.is-active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  width: 24px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}

.specialty-copy { position: relative; z-index: 2; display: block; }
.specialty-copy strong { font-size: 13px; line-height: 1.25; white-space: nowrap; }

.specialty-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 15px;
  color: #62565a;
  background: linear-gradient(145deg, #fff 0%, var(--icon-base) 100%);
  box-shadow: 0 7px 16px rgba(66, 53, 58, .1), inset 0 1px 0 #fff;
}

.specialty-icon svg {
  display: block;
  width: 36px;
  height: 36px;
  overflow: visible;
  color: #62565a;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.specialty-icon svg .icon-soft { fill: var(--icon-soft); }
.specialty-icon svg .icon-accent { fill: var(--icon-accent); stroke: var(--icon-accent); }
.specialty-icon svg .icon-accent-line { stroke: var(--icon-accent); stroke-width: 2.2; }
.specialty-icon::before,
.specialty-icon::after {
  display: none;
}

.more-button {
  flex: 0 0 auto;
  padding: 7px 3px 7px 10px;
  border: 0;
  color: var(--brand-dark);
  background: transparent;
  font-size: 13px;
}

.advisor-section { margin-top: 22px; }
.advisor-heading { margin-bottom: 12px; }
.advisor-list { display: grid; gap: 12px; }

.advisor-card {
  overflow: hidden;
  border: 1px solid #e1e1f2;
  border-radius: 19px;
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(30, 36, 58, .055);
}

.advisor-main {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  padding: 14px 16px 12px;
}

.avatar {
  position: relative;
  width: 62px;
  height: 62px;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff7f6 0%, var(--avatar-a) 52%, var(--avatar-b) 100%);
  box-shadow: 0 0 0 1px #dfe1f2, 0 5px 12px rgba(47, 54, 86, .15);
}

.avatar::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 20px;
  width: 23px;
  height: 25px;
  border-radius: 47% 47% 46% 46%;
  background: #f5c6a6;
  box-shadow: -5px -5px 0 2px #493b3e;
}

.avatar::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -16px;
  left: 8px;
  height: 39px;
  border-radius: 50% 50% 0 0;
  background: #4d596d;
}

.avatar.has-photo {
  border: 0;
  background: #fff;
  box-shadow: none;
}

.avatar.has-photo::before,
.avatar.has-photo::after { display: none; }

.avatar.has-photo img {
  display: block;
  width: 155%;
  height: 155%;
  object-fit: cover;
  transform: translate(-18%, -18%);
}

.advisor-copy { position: relative; min-width: 0; padding-left: 10px; }
.advisor-copy::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: #ee6e73;
}
.advisor-name-row { display: flex; align-items: center; gap: 7px; }
.advisor-name { margin: 0; font-size: 17px; }
.certified {
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  background: #7784e9;
  font-size: 10px;
}

.advisor-role { margin: 5px 0 8px; color: #555963; font-size: 12px; }
.advisor-field { display: flex; align-items: center; gap: 5px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; white-space: nowrap; }
.field-chip {
  display: inline-block;
  max-width: calc(100% - 58px);
  margin: 0;
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 999px;
  color: #ef666c;
  background: #fff0f0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-chip.primary { color: #ef666c; background: #fff0f0; }

.advisor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 16px;
}

.card-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-size: 19px;
}
.card-button.certificate { background: var(--coral); }
.card-button.case { background: var(--green); }
.card-button:active { filter: brightness(.94); }

.real-case-section { margin-top: 22px; }
.real-case-section .section-heading { margin-bottom: 12px; padding: 0 2px; }
.real-case-list { display: grid; gap: 12px; }
.real-case-card { padding: 16px 15px 14px; border: 1px solid #dfe1ef; border-radius: 17px; background: #fff; box-shadow: 0 5px 17px rgba(30, 36, 58, .045); }
.real-case-meta { display: flex; gap: 8px; color: #737783; font-size: 11px; }
.real-case-card h3 { margin: 14px 0 12px; color: #16191f; font-size: 15px; line-height: 1.55; }
.real-case-card > p { margin: 0; color: #555963; font-size: 12px; line-height: 1.8; }
.real-case-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; color: #777b86; font-size: 11px; }
.real-case-footer button { flex: 0 0 auto; padding: 3px 0 3px 8px; border: 0; color: #4860db; background: transparent; font-size: 12px; }

.qa-section { margin-top: 22px; }
.text-button { border: 0; color: var(--brand); background: transparent; font-size: 12px; }
.qa-list { display: grid; gap: 12px; }
.qa-card { padding: 15px; border-radius: 15px; background: #f5f5f6; }
.qa-question { margin: 0; font-size: 16px; line-height: 1.5; }
.qa-answer {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 12px;
  color: #42454c;
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.qa-meta { display: flex; gap: 14px; padding-top: 10px; border-top: 1px solid #dddde0; color: #96989f; font-size: 11px; }
.qa-meta .solved { color: #21b777; }
.qa-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; margin-top: 12px; }
.qa-button { min-height: 39px; border: 1px solid var(--brand); border-radius: 999px; color: var(--brand); background: #fff; font-size: 12px; }
.qa-button.primary { color: #fff; background: var(--brand); }

.bottom-actions {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: .92fr 1.42fr;
  gap: 11px;
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 9px 13px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid #ececf1;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px);
}
.bottom-action {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}
.bottom-action span { margin-right: 5px; font-size: 18px; vertical-align: -1px; }
.case-entry { background: #f06b80; }
.wechat-entry { background: #42bd25; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(20, 22, 28, .42);
}

.bottom-sheet {
  position: fixed;
  right: 0;
  bottom: 40px;
  left: 0;
  z-index: 31;
  width: min(100%, 430px);
  max-height: min(85vh, calc(100vh - 24px));
  margin: 0 auto;
  padding: 14px 20px max(22px, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -18px 46px rgba(26, 30, 42, .2);
}
.sheet-cert-img {
  margin: 12px 0;
  text-align: center;
}
.sheet-cert-img img {
  display: block;
  max-width: 100%;
  max-height: 42vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
  object-fit: contain;
  cursor: zoom-in;
}
.sheet-cert-tip {
  margin: 6px 0 0;
  color: #92949b;
  font-size: 11px;
  text-align: center;
}

/* 证书全屏放大 / 旋转查看 */
.cert-viewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: rgba(12, 14, 20, .94);
}
.cert-viewer[hidden] { display: none !important; }
.cert-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
}
.cert-viewer-actions {
  display: flex;
  gap: 8px;
}
.cert-viewer-btn {
  min-width: 40px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  font-size: 13px;
  font-weight: 600;
}
.cert-viewer-btn:active { background: rgba(255, 255, 255, .28); }
.cert-viewer-stage {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  min-height: 0;
}
.cert-viewer-canvas {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  height: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 8px 12px 16px;
}
.cert-viewer-rotator {
  position: relative;
  display: block;
  flex: 0 0 auto;
}
.cert-viewer-stage img {
  display: block;
  max-width: min(100%, calc(100vw - 24px));
  max-height: calc(100vh - 110px);
  width: auto;
  height: auto;
  border-radius: 4px;
  object-fit: contain;
  transform-origin: center center;
  transition: transform .2s ease;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}
.cert-viewer-stage img.is-zoomed {
  max-width: none;
  max-height: none;
  cursor: grab;
  transition: none;
}
.cert-viewer-stage img.is-zoomed:active {
  cursor: grabbing;
}
.cert-viewer-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 14px max(14px, env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  text-align: center;
}
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 16px; border-radius: 4px; background: #d9dadd; }
.sheet-close { position: absolute; top: 16px; right: 18px; width: 32px; height: 32px; border: 0; border-radius: 50%; color: #777; background: #f2f2f4; font-size: 22px; }
.sheet-kicker { color: var(--brand); font-size: 12px; font-weight: 700; }
.bottom-sheet h2 { margin: 6px 0 10px; font-size: 21px; }
.bottom-sheet p { margin: 0; color: #575a62; font-size: 14px; line-height: 1.7; }
.sheet-meta { margin: 14px 0; padding: 11px 12px; border-radius: 12px; color: #6a6d75; background: #f6f6f8; font-size: 12px; line-height: 1.6; }
.sheet-primary { width: 100%; min-height: 44px; border: 0; border-radius: 12px; color: #fff; background: var(--brand); font-weight: 700; }

.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  z-index: 50;
  max-width: min(330px, calc(100% - 40px));
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(31, 34, 42, .88);
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

[hidden] { display: none !important; }

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .prototype-shell { min-height: calc(100vh - 48px); border-radius: 26px; overflow: hidden; }
  .site-header { position: relative; }
}

@media (max-width: 355px) {
  .specialty-grid { gap: 6px; }
  .specialty-item { min-height: 92px; padding-right: 2px; padding-left: 2px; }
  .specialty-copy strong { font-size: 12px; }
  .advisor-main { grid-template-columns: 58px 1fr; gap: 10px; padding-right: 12px; }
  .avatar { width: 58px; height: 58px; }
  .bottom-actions { gap: 7px; padding-right: 8px; padding-left: 8px; }
  .bottom-action { font-size: 12px; }
}

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