:root {
  --mentor-blue: #263da8;
  --mentor-blue-2: #5368df;
  --mentor-orange: #ff6c42;
  --mentor-orange-2: #ff9a61;
  --mentor-ink: #172033;
  --mentor-muted: #73809a;
  --mentor-line: #dfe4ef;
  --mentor-page: #f3f5fa;
}

.teacher-dialog {
  width: min(1080px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  max-height: 94dvh;
  padding: 0;
  border: 0;
  border-radius: 28px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  color: var(--mentor-ink);
  background: var(--mentor-page);
  box-shadow: 0 30px 80px rgba(13, 27, 64, .28);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.teacher-dialog,
.teacher-dialog *,
#teacher-directory-content,
#teacher-detail-content,
.directory-hero,
.directory-main,
.teacher-directory-list,
.teacher-card,
.teacher-card-top,
.teacher-card-identity,
.teacher-detail-hero,
.teacher-detail-identity,
.teacher-detail-shell,
.teacher-detail-panel {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

#teacher-directory-content,
#teacher-detail-content,
.directory-hero,
.directory-main,
.teacher-directory-list,
.teacher-detail-hero,
.teacher-detail-panel {
  width: 100%;
}

.teacher-dialog::backdrop {
  background: rgba(12, 24, 48, .72);
  backdrop-filter: blur(5px);
}

.teacher-dialog .dialog-close,
.teacher-dialog .teacher-dialog-close,
.teacher-dialog .teacher-detail-dialog-close {
  position: absolute;
  z-index: 12;
  top: 22px;
  right: 22px;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 16px;
  color: #fff;
  background: rgba(17, 29, 71, .25);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.directory-hero {
  padding: 54px 72px 46px;
  color: #fff;
  background:
    radial-gradient(circle at 84% 26%, rgba(255,255,255,.16) 0 90px, transparent 92px),
    linear-gradient(135deg, #1d2d8e 0%, #344bbd 52%, #596cde 100%);
}

.directory-kicker,
.teacher-detail-kicker {
  margin: 0 0 10px;
  color: #dfe5ff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .18em;
}

.directory-hero h2 {
  margin: 0;
  font-size: clamp(36px, 6vw, 60px);
  line-height: 1.06;
  letter-spacing: -.04em;
}

.directory-hero > p:not(.directory-kicker) {
  max-width: 720px;
  margin: 18px 0 0;
  color: rgba(255,255,255,.82);
  font-size: 17px;
  line-height: 1.75;
}

.directory-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 670px;
  margin-top: 30px;
  padding: 18px 0;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 18px;
  background: rgba(255,255,255,.1);
}

.directory-stat {
  display: grid;
  place-items: center;
  gap: 4px;
  border-right: 1px solid rgba(255,255,255,.2);
}

.directory-stat:last-child { border-right: 0; }
.directory-stat strong { font-size: 28px; line-height: 1; }
.directory-stat span { color: rgba(255,255,255,.72); font-size: 13px; }

.directory-main {
  padding: 34px 42px 48px;
}

.directory-intro {
  margin-bottom: 22px;
}

.directory-intro h3 {
  margin: 0 0 8px;
  font-size: clamp(25px, 3vw, 34px);
}

.directory-intro p {
  margin: 0;
  color: var(--mentor-muted);
  line-height: 1.65;
}

.teacher-searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 14px;
}

.teacher-searchbar input,
.teacher-filter-group select {
  width: 100%;
  min-width: 0;
  border: 1px solid #d9dfec;
  border-radius: 14px;
  color: var(--mentor-ink);
  background: #fff;
  font: inherit;
}

.teacher-searchbar input {
  min-height: 54px;
  padding: 0 18px;
}

.teacher-filter-toggle,
.teacher-reset-button {
  min-height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--mentor-blue);
  font-weight: 800;
  cursor: pointer;
}

.teacher-filter-panel {
  display: none;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #e1e5ef;
  border-radius: 18px;
  background: #fff;
}

.teacher-filter-panel.active { display: block; }

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

.teacher-filter-panel-head h3 { margin: 0; font-size: 17px; }
.teacher-filter-panel-head .teacher-reset-button { width: auto; padding-inline: 16px; }

.teacher-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.teacher-filter-group {
  display: grid;
  gap: 7px;
}

.teacher-filter-group label {
  color: #6e7990;
  font-size: 13px;
  font-weight: 700;
}

.teacher-filter-group select {
  min-height: 44px;
  padding: 0 12px;
}

.teacher-filter-actions {
  display: flex;
  align-items: end;
}

.teacher-reset-button {
  width: 100%;
  min-height: 44px;
  color: var(--mentor-blue);
  background: #edf0ff;
}

.teacher-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
}

.teacher-result-count {
  color: #68748b;
}

.teacher-result-count strong {
  color: var(--mentor-orange);
  font-size: 22px;
}

.teacher-active-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.teacher-active-filter,
.teacher-tag,
.teacher-gender {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  white-space: nowrap;
}

.teacher-active-filter {
  padding: 5px 10px;
  color: #52607b;
  background: #e8edf7;
  font-size: 12px;
}

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

#teacher-directory .teacher-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--mentor-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(31, 48, 94, .08);
}

#teacher-directory .teacher-card.featured {
  border-color: rgba(83,104,223,.5);
  box-shadow: 0 16px 45px rgba(40,61,168,.15);
}

.teacher-card-top {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
}

.teacher-avatar,
.teacher-detail-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--mentor-orange), #ff4778);
  font-weight: 900;
}

.teacher-detail-kicker {
  margin: 0 0 8px;
  color: rgba(255,255,255,.9);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .18em;
}

.teacher-avatar.is-male,
.teacher-card.is-male .teacher-avatar {
  background: linear-gradient(145deg, #1f58be, #48a5f6);
}

.teacher-avatar.is-neutral,
.teacher-card.is-neutral .teacher-avatar {
  background: linear-gradient(145deg, #52637e, #8492a7);
}

.teacher-avatar { width: 68px; height: 68px; font-size: 26px; }
.teacher-card-identity { min-width: 0; }

.teacher-card-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.teacher-card-name-line h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.teacher-gender {
  padding: 3px 8px;
  color: #b35772;
  background: #fff0f4;
  font-size: 12px;
}

.teacher-gender.is-male,
.teacher-card.is-male .teacher-gender {
  color: #1f56ad;
  background: #e8f3ff;
}

.teacher-gender.is-neutral,
.teacher-card.is-neutral .teacher-gender {
  color: #56647a;
  background: #edf1f6;
}

.teacher-card-school {
  overflow: hidden;
  margin: 6px 0 0;
  color: #5f6d83;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-experience {
  display: grid;
  place-items: center;
  min-width: 68px;
  min-height: 62px;
  padding: 8px;
  border-radius: 15px;
  color: #f16c3b;
  background: #fff2ea;
  text-align: center;
}

.teacher-experience strong { display: block; font-size: 20px; line-height: 1; }
.teacher-experience span { font-size: 11px; }

.teacher-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 17px 0 14px;
}

.teacher-tag {
  padding: 5px 9px;
  color: #52617d;
  background: #f0f3f8;
  font-size: 12px;
}

.teacher-tags > span {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: #52617d;
  background: #f0f3f8;
  font-size: 12px;
  max-width: 100%;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.teacher-card-intro {
  display: -webkit-box;
  overflow: hidden;
  min-height: 3.4em;
  margin: 0 0 18px;
  color: #59657a;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.teacher-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.teacher-card-actions button {
  min-height: 46px;
  border: 1px solid #d7dce8;
  border-radius: 13px;
  background: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.teacher-card-actions .teacher-book {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--mentor-blue), var(--mentor-blue-2));
}

.teacher-featured-label {
  position: absolute;
  top: -9px;
  right: 18px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--mentor-orange);
  font-size: 11px;
  font-weight: 800;
}

.teacher-empty {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border: 1px dashed #cdd5e4;
  border-radius: 18px;
  color: #788399;
  background: #fff;
  text-align: center;
}

.teacher-detail-dialog { width: min(760px, calc(100vw - 40px)); }

.teacher-detail-hero {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 54px 56px 68px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.16) 0 92px, transparent 94px),
    linear-gradient(135deg, var(--mentor-orange) 0%, #ff7a45 56%, var(--mentor-orange-2) 100%);
}

.teacher-detail-hero.is-male {
  background:
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.16) 0 92px, transparent 94px),
    linear-gradient(135deg, #173f98 0%, #2c65d0 56%, #63a3ec 100%);
}

.teacher-detail-hero.is-neutral {
  background:
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.14) 0 92px, transparent 94px),
    linear-gradient(135deg, #37485f 0%, #5e6f88 56%, #8290a4 100%);
}

.teacher-detail-avatar {
  width: 96px;
  height: 96px;
  border: 4px solid rgba(255,255,255,.4);
  background: rgba(195,41,78,.38);
  font-size: 38px;
}

.teacher-detail-avatar.is-male { background: rgba(12, 45, 112, .42); }
.teacher-detail-avatar.is-neutral { background: rgba(31, 44, 61, .38); }

.teacher-detail-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.teacher-detail-name-line h2 {
  min-width: 0;
  margin: 0;
  color: #fff;
  font-size: 34px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.teacher-detail-name-line .teacher-gender { color: #fff; background: rgba(255,255,255,.18); }
.teacher-detail-school {
  margin: 8px 0 0;
  color: rgba(255,255,255,.96);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.teacher-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.teacher-detail-tags .teacher-tag,
.teacher-detail-tags > span {
  color: #fff;
  background: rgba(24, 35, 63, .26);
  border-color: rgba(255,255,255,.28);
  line-height: 1.35;
  white-space: normal;
}

.teacher-detail-hero .teacher-book {
  min-width: 130px;
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  color: var(--mentor-orange);
  background: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.teacher-detail-shell {
  position: relative;
  margin: -32px 28px 30px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(29,45,99,.11);
  overflow: hidden;
}

.teacher-detail-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--mentor-line);
}

.teacher-detail-fact {
  padding: 20px 18px;
  border-right: 1px solid var(--mentor-line);
}

.teacher-detail-fact:last-child { border-right: 0; }
.teacher-detail-fact small { display: block; margin-bottom: 7px; color: #65738a; font-weight: 700; }
.teacher-detail-fact strong { display: block; color: #17263d; line-height: 1.45; }

.teacher-detail-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--mentor-line);
}

.teacher-detail-tabs button {
  min-height: 58px;
  border: 0;
  border-right: 1px solid var(--mentor-line);
  color: #727d91;
  background: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.teacher-detail-tabs button:last-child { border-right: 0; }
.teacher-detail-tabs button.active { color: #fff; background: var(--mentor-orange); }

.teacher-detail-panel {
  min-height: 280px;
  padding: 30px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.detail-info-item {
  padding: 17px;
  border-radius: 14px;
  background: #f7f8fb;
}

.detail-info-item small { display: block; margin-bottom: 5px; color: #65738a; font-weight: 700; }
.detail-info-item strong { color: #17263d; }
.detail-copy { color: #3f4e65; line-height: 1.85; white-space: pre-wrap; }
.detail-list { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.detail-list li {
  position: relative;
  min-height: 54px;
  padding: 15px 17px 15px 52px;
  border: 1px solid #d7deea;
  border-radius: 13px;
  color: #2c3c55;
  background: #f7f9fc;
  line-height: 1.65;
}

.detail-list li::before {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 16px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  color: #14795b;
  background: #dff4eb;
  font-size: 13px;
  font-weight: 900;
  transform: translateY(-50%);
}

.raw-case-source {
  margin: 0;
  color: #3f4b60;
  font-family: inherit;
  line-height: 1.95;
  white-space: pre-wrap;
}

.raw-case-record {
  margin-bottom: 14px;
  padding: 17px;
  border-left: 4px solid var(--mentor-orange);
  border-radius: 0 13px 13px 0;
  background: #fff7f2;
}

.raw-case-record h4 { margin: 0 0 8px; }
.raw-case-record p { margin: 0; color: #59657a; line-height: 1.75; }

@media (max-width: 780px) {
  .teacher-dialog,
  .teacher-detail-dialog {
    inset: 0;
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  .teacher-dialog .dialog-close,
  .teacher-dialog .teacher-dialog-close,
  .teacher-dialog .teacher-detail-dialog-close {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: 14px;
  }

  .directory-hero { padding: 64px 22px 34px; }
  .directory-hero > p:not(.directory-kicker) { font-size: 15px; }
  .directory-stats { margin-top: 22px; }
  .directory-stat strong { font-size: 22px; }
  .directory-main { padding: 24px 16px 38px; }
  .teacher-searchbar { grid-template-columns: 1fr; }
  .teacher-filter-panel { padding: 14px; }
  .teacher-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teacher-result-meta { align-items: flex-start; flex-direction: column; }
  .teacher-active-filters { justify-content: flex-start; }
  .teacher-directory-list { grid-template-columns: 1fr; }
  #teacher-directory .teacher-card { padding: 20px; }

  .teacher-detail-hero {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 72px 18px 52px;
  }

  .teacher-detail-avatar {
    width: 68px;
    height: 68px;
    margin-top: 21px;
    font-size: 27px;
  }

  .teacher-detail-identity { min-width: 0; }
  .teacher-detail-kicker { margin-bottom: 7px; font-size: 11px; }
  .teacher-detail-name-line { gap: 6px; }
  .teacher-detail-name-line h2 { font-size: clamp(22px, 6.5vw, 27px); }
  .teacher-detail-name-line .teacher-gender { padding: 3px 7px; font-size: 11px; }
  .teacher-detail-school { margin-top: 6px; font-size: 14px; }
  .teacher-detail-tags { gap: 5px; margin-top: 9px; }
  .teacher-detail-tags .teacher-tag,
  .teacher-detail-tags > span { padding: 4px 7px; font-size: 11px; }
  .teacher-detail-hero .teacher-book {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 52px;
    margin-top: 8px;
    box-shadow: 5px 6px 0 rgba(13, 34, 58, .94);
  }
  .teacher-detail-shell { margin: -28px 12px 18px; }
  .teacher-detail-facts { grid-template-columns: repeat(2, 1fr); }
  .teacher-detail-fact:nth-child(2) { border-right: 0; }
  .teacher-detail-fact:nth-child(-n+2) { border-bottom: 1px solid var(--mentor-line); }
  .teacher-detail-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow-x: hidden; }
  .teacher-detail-tabs button { min-width: 0; padding: 8px 4px; font-size: 13px; white-space: normal; }
  .teacher-detail-panel { padding: 22px 18px; }
  .detail-info-grid { grid-template-columns: 1fr; }
  .detail-list li { padding: 14px 14px 14px 48px; }
  .detail-list li::before { left: 14px; }
}

@media (max-width: 390px) {
  .directory-stats { grid-template-columns: 1fr; }
  .directory-stat { padding: 10px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.18); }
  .directory-stat:last-child { border-bottom: 0; }
  .teacher-filter-grid { grid-template-columns: 1fr; }
  .teacher-card-top { grid-template-columns: 58px minmax(0,1fr); }
  .teacher-avatar { width: 58px; height: 58px; }
  .teacher-experience { grid-column: 1 / -1; min-height: 48px; grid-auto-flow: column; justify-content: center; gap: 7px; }
  .teacher-card-actions { grid-template-columns: 1fr; }
  .teacher-detail-facts { grid-template-columns: 1fr; }
  .teacher-detail-fact { border-right: 0; border-bottom: 1px solid var(--mentor-line); }
}
