/* FTLC Stroke Families — shared styles for every data-driven family instance. */
.ftlc-stroke-family-preview {
  margin: 0;
  background: linear-gradient(160deg, #f4f6ff 0%, #fdfcff 64%, #f1f4ff 100%);
  color: #212949;
  font-family: "Noto Sans SC", "Microsoft YaHei", Inter, system-ui, -apple-system, sans-serif;
}

.ftlc-stroke-family-preview__shell {
  min-width: 0;
}

.ftlc-stroke-family-preview__stack {
  display: grid;
  gap: 34px;
  padding: 24px 0 48px;
}

.ftlc-stroke-family,
.ftlc-stroke-family * {
  box-sizing: border-box;
}

.ftlc-stroke-family {
  --ftlc-page: #f6f7ff;
  --ftlc-surface: #fff;
  --ftlc-ink: #212949;
  --ftlc-muted: #737e9f;
  --ftlc-purple: #6558df;
  --ftlc-purple-2: #5149c9;
  --ftlc-blue: #e3ecff;
  --ftlc-pale: #f3f2ff;
  --ftlc-border: #e0e5f7;
  --ftlc-accent: #ee4975;
  --ftlc-shadow: 0 18px 48px rgba(50, 58, 135, .06);
  --ftlc-clue-max-width: 840px;
  position: relative;
  min-width: 0;
  color: var(--ftlc-ink);
  background: linear-gradient(160deg, #f4f6ff 0%, #fdfcff 64%, #f1f4ff 100%);
  font-family: "Noto Sans SC", "Microsoft YaHei", Inter, system-ui, -apple-system, sans-serif;
}

.ftlc-stroke-family[data-family="shu"] {
  --ftlc-clue-max-width: 720px;
}

.ftlc-stroke-family button {
  font: inherit;
}

.ftlc-stroke-family button:focus-visible,
.ftlc-stroke-family [tabindex]:focus-visible {
  outline: 3px solid #988dfa;
  outline-offset: 3px;
}

.ftlc-stroke-family__state {
  max-width: 760px;
  margin: 32px auto;
  padding: 22px 26px;
  border: 1px solid var(--ftlc-border);
  border-radius: 18px;
  background: #fff;
  color: #566381;
  text-align: center;
  box-shadow: var(--ftlc-shadow);
}

.ftlc-stroke-family[data-ftlc-state="error"] .ftlc-stroke-family__state {
  border-color: #efb6c4;
  color: #9c2946;
  background: #fff7f9;
}

.ftlc-stroke-family__page {
  max-width: 1400px;
  margin: auto;
  padding: 28px 30px 76px;
}

.ftlc-stroke-family__map-card {
  padding: 22px 24px;
  border: 1px solid var(--ftlc-border);
  border-radius: 27px;
  background: var(--ftlc-surface);
  box-shadow: var(--ftlc-shadow);
}

.ftlc-stroke-family__panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  gap: 16px;
  flex-wrap: wrap;
}

.ftlc-stroke-family__family-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0;
  color: #17224b;
  font-size: clamp(29px, 3vw, 36px);
  font-weight: 850;
  line-height: 1.32;
  letter-spacing: -.02em;
}

.ftlc-stroke-family__family-en {
  color: #7b83aa;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: 0;
  white-space: nowrap;
}

.ftlc-stroke-family__family-count {
  color: #858bad;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.ftlc-stroke-family__path-info {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 34px;
  max-width: 55%;
  gap: 8px;
  overflow: hidden;
  padding: 7px 13px;
  border: 1px solid #e5e8ff;
  border-radius: 999px;
  background: #f2f3ff;
  color: var(--ftlc-purple-2);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ftlc-stroke-family__path-info[hidden] {
  display: none !important;
}

.ftlc-stroke-family__map-viewport {
  overflow: auto;
  overscroll-behavior-x: contain;
  margin-top: 18px;
  border: 1px solid #e9eaf8;
  border-radius: 22px;
  background: radial-gradient(ellipse at 60% 37%, rgba(108, 97, 222, .052), transparent 67%), #fafbff;
  scrollbar-color: #bab9eb #f4f5ff;
  scrollbar-width: thin;
}

.ftlc-stroke-family__canvas {
  position: relative;
  isolation: isolate;
}

.ftlc-stroke-family__edges {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ftlc-stroke-family__edge {
  fill: none;
  stroke: #cbd0e8;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .18s, stroke-width .18s, opacity .18s;
}

.ftlc-stroke-family__edge.is-active {
  stroke: var(--ftlc-purple);
  stroke-width: 4.5;
}

.ftlc-stroke-family__node {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  width: 232px;
  height: 105px;
  padding: 8px;
  border: 1.5px solid #e1e4f4;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 15px rgba(49, 52, 124, .04);
  transition: background .17s, box-shadow .17s, transform .17s, border-color .17s;
}

.ftlc-stroke-family__node:hover,
.ftlc-stroke-family__node:focus-within {
  z-index: 3;
  border-color: #8d86ef;
  box-shadow: 0 14px 28px rgba(76, 68, 153, .1);
  transform: translateY(-2px);
}

.ftlc-stroke-family__node--root {
  border-color: #6256dd;
  background: linear-gradient(145deg, #6e61e8, #564bd3);
  color: white;
  box-shadow: 0 10px 25px #6558df28;
}

.ftlc-stroke-family__node.is-selected {
  z-index: 2;
  border-color: #6757e3;
  background: #efecff;
  box-shadow: 0 8px 28px #6259d421;
}

.ftlc-stroke-family__node--root.is-selected {
  background: linear-gradient(145deg, #7164eb, #5347cf);
}

.ftlc-stroke-family__node-main {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 100%;
  gap: 10px;
  padding: 3px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.ftlc-stroke-family__node-main img {
  flex: none;
  width: 70px;
  height: 70px;
  border-radius: 12px;
  background: white;
  object-fit: contain;
}

.ftlc-stroke-family__node-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
  padding-bottom: 7px;
}

.ftlc-stroke-family__node-name {
  font-size: 16px;
  font-weight: 780;
  white-space: nowrap;
}

.ftlc-stroke-family__node-pinyin {
  color: #7d86a9;
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  white-space: normal;
}

.ftlc-stroke-family__node--root .ftlc-stroke-family__node-pinyin {
  color: #ebeaff;
}

.ftlc-stroke-family__node-sound {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: #f3f4ff;
  color: #6b68b1;
  cursor: pointer;
}

.ftlc-stroke-family__node-sound:hover {
  background: #e5e2ff;
  color: #5141d5;
}

.ftlc-stroke-family__node--root .ftlc-stroke-family__node-sound {
  background: #8479f4;
  color: white;
}

.ftlc-stroke-family__memory-mark {
  position: absolute;
  top: 7px;
  right: 10px;
  width: 17px;
  height: 17px;
  color: #8b81e8;
}

.ftlc-stroke-family__alias-info {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #b4aef4;
  border-radius: 50%;
  background: #f2f0ff;
  color: #6255c9;
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}

.ftlc-stroke-family__alias-info--node {
  position: absolute;
  z-index: 3;
  top: 6px;
  right: 29px;
  width: 16px;
  height: 16px;
  font-size: 11px;
}

.ftlc-stroke-family__alias-info--modal {
  flex: none;
  margin-left: 5px;
}

.ftlc-stroke-family__mobile-tree {
  display: none;
}

.ftlc-stroke-family__mobile-branch {
  position: relative;
}

.ftlc-stroke-family__mobile-tree > .ftlc-stroke-family__mobile-branch > .ftlc-stroke-family__node {
  margin-bottom: 8px;
}

.ftlc-stroke-family__mobile-children {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 8px;
  margin-left: 13px;
  padding-left: 10px;
  border-left: 2px solid #d2d5ef;
}

.ftlc-stroke-family__mobile-children .ftlc-stroke-family__mobile-branch::before {
  position: absolute;
  top: 42px;
  left: -10px;
  width: 10px;
  height: 2px;
  background: #d2d5ef;
  content: "";
}

.ftlc-stroke-family__node--mobile {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  height: 88px;
}

.ftlc-stroke-family__node--mobile .ftlc-stroke-family__node-main img {
  width: 60px;
  height: 60px;
}

.ftlc-stroke-family__backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(24, 28, 59, .50);
  backdrop-filter: blur(4px);
}

.ftlc-stroke-family__backdrop.is-open {
  display: grid;
}

.ftlc-stroke-family__modal {
  position: relative;
  width: min(920px, 100%);
  max-height: min(850px, 92dvh);
  overflow: auto;
  padding: 29px 32px 27px;
  border-radius: 27px;
  background: white;
  box-shadow: 0 27px 90px #141a4955;
}

.ftlc-stroke-family__close {
  position: absolute;
  top: 21px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f2f2fa;
  color: #5f6790;
  cursor: pointer;
}

.ftlc-stroke-family__modal-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 46px 4px 0;
  font-size: 25px;
  font-weight: 800;
}

.ftlc-stroke-family__modal-icon {
  display: inline-flex;
  color: #675be2;
}

.ftlc-stroke-family__modal-en {
  margin: 0 0 10px;
  color: #8b92b1;
  font-size: 13px;
}

.ftlc-stroke-family__memory-grid {
  display: grid;
  grid-template-columns: repeat(var(--memory-count, 3), minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}

.ftlc-stroke-family__memory-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 12px 17px;
  border: 1.5px solid #e4e5f6;
  border-radius: 21px;
  background: #fafbff;
  opacity: .62;
  transition: opacity .28s, transform .28s, background .28s, box-shadow .28s, border-color .28s;
}

.ftlc-stroke-family__memory-step.is-current {
  border-color: #897af0;
  background: #f1efff;
  box-shadow: 0 7px 20px #6f63df15;
  opacity: 1;
  transform: translateY(-3px);
}

.ftlc-stroke-family__memory-step.is-past {
  opacity: .77;
}

.ftlc-stroke-family__memory-step.is-target {
  z-index: 1;
  border: 3px solid #6857e7;
  background: linear-gradient(145deg, #ebe9ff, #e5e1ff);
  box-shadow: 0 13px 33px rgba(91, 75, 214, .24), 0 0 0 5px rgba(106, 88, 222, .075);
  opacity: 1;
  transform: scale(1.055);
}

.ftlc-stroke-family__memory-step.is-target.is-pulsing {
  animation: ftlc-stroke-family-pulse-final .78s ease-out 1;
}

@keyframes ftlc-stroke-family-pulse-final {
  0% { box-shadow: 0 0 0 0 rgba(104, 89, 222, .43); }
  55% { box-shadow: 0 0 0 12px rgba(104, 89, 222, .05); }
  100% { box-shadow: 0 13px 33px rgba(91, 75, 214, .24), 0 0 0 5px rgba(106, 88, 222, .075); }
}

.ftlc-stroke-family__memory-index {
  align-self: flex-start;
  color: #8e94b4;
  font-size: 11px;
  font-weight: 700;
}

.ftlc-stroke-family__memory-step.is-target .ftlc-stroke-family__memory-index {
  color: #5e4cdd;
}

.ftlc-stroke-family__memory-step img {
  width: 100%;
  height: 138px;
  border-radius: 14px;
  background: white;
  object-fit: contain;
}

.ftlc-stroke-family__memory-labels {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 4px;
}

.ftlc-stroke-family__memory-name {
  color: #25294d;
  font-size: 20px;
  font-weight: 850;
  white-space: nowrap;
}

.ftlc-stroke-family__memory-pinyin {
  min-height: 29px;
  color: #8086a6;
  font-size: 12px;
  text-align: center;
}

.ftlc-stroke-family__memory-step.is-target .ftlc-stroke-family__memory-name {
  color: #5846d8;
}

.ftlc-stroke-family__memory-foot {
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 54px;
  margin-top: 16px;
}

.ftlc-stroke-family .ftlc-stroke-family__replay {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 11px 25px;
  border: 0;
  border-radius: 999px;
  background: var(--ftlc-purple);
  color: white;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 7px 16px #6658d82a;
  cursor: pointer;
}

.ftlc-stroke-family__replay:hover {
  background: #5145cc;
}

.ftlc-stroke-family__replay.is-ready {
  display: inline-flex;
}

.ftlc-stroke-family__clues[hidden],
.ftlc-stroke-family__alias-popover[hidden] {
  display: none !important;
}

.ftlc-stroke-family__clues {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e7e9f6;
}

.ftlc-stroke-family__clue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ftlc-stroke-family__clue-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.ftlc-stroke-family__clue-title strong {
  color: #1c2850;
  font-size: 17px;
}

.ftlc-stroke-family__clue-title span {
  color: #818baa;
  font-size: 12px;
}

.ftlc-stroke-family__clue-cards {
  display: grid;
  grid-template-columns: repeat(var(--clue-count, 2), minmax(0, 1fr));
  gap: 13px;
  max-width: var(--ftlc-clue-max-width);
  margin: 0 auto;
}

.ftlc-stroke-family__clue-card {
  display: flex;
  align-items: center;
  min-height: 180px;
  gap: 15px;
  padding: 13px 15px;
  border: 1px solid #dfe4f6;
  border-radius: 18px;
  background: linear-gradient(160deg, #fafaff, #f4f6ff);
}

.ftlc-stroke-family__clue-illustration {
  display: grid;
  place-items: center;
  flex: none;
  width: 125px;
  height: 125px;
  overflow: hidden;
  border: 1px solid #e6e8f7;
  border-radius: 15px;
  background: white;
}

.ftlc-stroke-family__clue-illustration img {
  display: block;
  width: 100%;
  height: 100%;
}

.ftlc-stroke-family__clue-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 5px;
}

.ftlc-stroke-family__clue-text strong {
  color: #273455;
  font-size: 22px;
}

.ftlc-stroke-family__clue-pinyin {
  color: #6562c8;
  font-size: 13px;
  font-weight: 700;
}

.ftlc-stroke-family__clue-cn {
  margin-top: 4px;
  color: #606e8b;
  font-size: 12px;
  line-height: 1.5;
}

.ftlc-stroke-family__clue-en {
  color: #8591a6;
  font-size: 12px;
  line-height: 1.5;
}

.ftlc-stroke-family__clue-cards[data-count="3"] .ftlc-stroke-family__clue-card {
  gap: 10px;
  padding: 10px;
}

.ftlc-stroke-family__clue-cards[data-count="3"] .ftlc-stroke-family__clue-illustration {
  width: 100px;
  height: 100px;
}

.ftlc-stroke-family__clue-cards[data-count="3"] .ftlc-stroke-family__clue-text strong {
  font-size: 19px;
}

.ftlc-stroke-family__alias-popover {
  position: relative;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid #dddafa;
  border-radius: 12px;
  background: #f4f3ff;
  color: #4b46a2;
  font-size: 13px;
  font-weight: 680;
}

.ftlc-stroke-family__alias-line span {
  display: block;
  margin-top: 4px;
  color: #747da2;
  font-size: 12px;
  font-weight: 450;
}

.ftlc-stroke-family__toast {
  position: fixed;
  z-index: 10001;
  bottom: 20px;
  left: 50%;
  display: none;
  max-width: min(420px, 90vw);
  padding: 11px 18px;
  border-radius: 12px;
  background: #253057;
  color: white;
  font-size: 13px;
  box-shadow: 0 12px 25px #15163345;
  transform: translateX(-50%);
}

.ftlc-stroke-family__toast.is-visible {
  display: block;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__page {
  padding: 15px 13px 45px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__map-card {
  padding: 19px 12px 22px;
  border-radius: 20px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__panel-heading {
  min-height: 58px;
  gap: 9px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__family-title {
  gap: 7px 11px;
  font-size: 26px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__family-en {
  font-size: 13px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__family-count {
  font-size: 12px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__path-info {
  width: auto;
  max-width: 100%;
  min-height: 30px;
  margin-left: auto;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__map-viewport {
  display: none;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__mobile-tree {
  display: block;
  margin-top: 16px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__modal {
  padding: 23px 17px 19px;
  border-radius: 20px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__modal-title {
  font-size: 21px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__close {
  top: 13px;
  right: 13px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-step {
  position: relative;
  flex-direction: row;
  align-items: center;
  min-height: 104px;
  gap: 11px;
  padding: 10px 13px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-step img {
  flex: none;
  width: 86px;
  height: 82px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-index {
  position: absolute;
  top: 8px;
  right: 11px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-labels {
  align-items: flex-start;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-name {
  font-size: 18px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-pinyin {
  min-height: 0;
  font-size: 12px;
  text-align: left;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-step.is-target {
  transform: scale(1.018);
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__memory-foot {
  min-height: 50px;
  margin-top: 10px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__clues {
  margin-top: 15px;
  padding-top: 13px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__clue-cards {
  grid-template-columns: 1fr;
  max-width: 100%;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__clue-card {
  min-height: 120px;
  gap: 12px;
  padding: 9px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__clue-illustration,
.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__clue-cards[data-count="3"] .ftlc-stroke-family__clue-illustration {
  width: 108px;
  height: 108px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__clue-text strong {
  font-size: 19px;
}

.ftlc-stroke-family[data-layout="compact"] .ftlc-stroke-family__alias-info--node {
  top: 8px;
  right: 33px;
}

@media (prefers-reduced-motion: reduce) {
  .ftlc-stroke-family *,
  .ftlc-stroke-family *::before,
  .ftlc-stroke-family *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
