/* ─────────────────────────────────────────────────────────────
 * lily_wiki_shared_renderer.css
 *
 * 4 个页面共用的 wiki 引用气泡（WikiCite）样式 + story-card 内嵌渲染。
 *   - /word-wiki 前台
 *   - /lily 前台
 *   - 莉莉 wiki builder
 *   - 词条 wiki builder
 *
 * 必须被 index.html 和 admin.html 同时加载。
 * 修改任何 ww-citation-* 规则前请先确认这一份是 4 处共享的来源，
 * 不要再分散回 style.css / admin-test.css。
 * ───────────────────────────────────────────────────────────── */

/* ── 引用问号锚点 ── */
.ww-citation-anchor {
  width: 13px;
  height: 13px;
  margin: 0 1px 0 0;
  border: 0;
  border-radius: 999px;
  background: #d6dbe3;
  color: #5a6474;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  vertical-align: baseline;
  position: relative;
  top: -0.52em;
  cursor: pointer;
  text-indent: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.ww-citation-anchor:hover,
.ww-citation-anchor:focus-visible {
  background: #c2c9d6;
  color: #24324c;
  box-shadow: 0 0 0 3px rgba(91,141,217,0.12);
  transform: translateY(-1px);
  outline: none;
}

/* ── 气泡容器 ── */
.ww-citation-tooltip {
  position: fixed;
  z-index: 99999;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid rgba(48,62,90,0.14);
  border-radius: 12px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 18px 42px rgba(24,36,58,0.2);
  color: var(--text, #1a1f36);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.ww-citation-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
}

.ww-citation-tooltip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ww-citation-tooltip-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(74,123,189,0.12);
  color: var(--navy, #1e2d4d);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}
.ww-citation-tooltip-mark {
  color: var(--text-muted, #6b7c9e);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}
.ww-citation-tooltip-q,
.ww-citation-tooltip-a {
  font-size: 12px;
  line-height: 1.72;
  color: var(--text, #1a1f36);
  white-space: pre-wrap;
}
.ww-citation-tooltip-jp {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.6;
  color: #8a94a6;
  white-space: pre-wrap;
}
.ww-citation-tooltip-a {
  margin-top: 8px;
}
.ww-citation-tooltip-divider {
  height: 1px;
  margin-top: 10px;
  background: rgba(48,62,90,0.1);
}
.ww-citation-tooltip-loading,
.ww-citation-tooltip-error {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted, #6b7c9e);
}
.ww-citation-tooltip-error {
  color: #c5372f;
}
.ww-citation-tooltip-new {
  font-size: 10px;
  font-weight: 700;
  color: #1f9d4d;
  background: rgba(116,224,124,0.18);
  border-radius: 6px;
  padding: 1px 6px;
}
.ww-citation-tooltip-item.is-jumpable {
  cursor: pointer;
}
.ww-citation-tooltip-item.is-jumpable:hover .ww-citation-tooltip-badge {
  background: var(--accent, #4a7bbd);
  color: #fff;
}
.ww-citation-tooltip-del {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--text-light, #6b7a99);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.ww-citation-tooltip-del:hover {
  background: #fdecec;
  color: #c5372f;
}

/* ── 手游剧情：气泡内嵌 story-card（点击跳转 /game/normal/<dir>） ── */
.ww-citation-story-card {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20,40,70,0.06);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ww-citation-story-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent, #4a7bbd);
  box-shadow: 0 6px 16px rgba(20,40,70,0.14);
}
.ww-citation-story-banner {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #eef2f7;
}
.ww-citation-story-banner-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg,#e8edf4,#dbe3ee);
}
.ww-citation-story-info {
  padding: 6px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ww-citation-story-chapter {
  font-size: 10.5px;
  color: var(--text-light, #6b7a99);
}
.ww-citation-story-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy, #1e2d4d);
  line-height: 1.35;
  word-break: break-word;
}
.ww-citation-story-date {
  font-size: 10.5px;
  color: var(--text-light, #6b7a99);
}

/* 舞台引用卡：上竖版封面（Icon-<简称>-full.png），下舞台全称。点击新窗口开舞台页 */
.ww-citation-stage-card {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  width: 168px;
  max-width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20,40,70,0.06);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ww-citation-stage-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent, #4a7bbd);
  box-shadow: 0 6px 16px rgba(20,40,70,0.14);
}
.ww-citation-stage-cover {
  width: 100%;
  display: block;
  object-fit: cover;
  background: #eef2f7;
}
.ww-citation-stage-card.no-cover {
  /* 封面缺失：卡仍可点，给个浅底占位高度 */
  min-height: 40px;
}
.ww-citation-stage-name {
  padding: 7px 10px 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy, #1e2d4d);
  line-height: 1.4;
  word-break: break-word;
  text-align: center;
}

/* ── [[词条名]] 链接（方括号边角·机能风，4 处共用） ──
   静止：仅左上 + 右下两个 L 形角（类似「」）。
   hover：两个角沿边生长连成完整边框，同时颜色变深——生长与变色都走动画。 */
a.lily-wiki-link-pill {
  position: relative;
  display: inline-block;
  margin: 0 2px;
  padding: 0 5px;
  border-radius: 2px;
  background: rgba(74,123,189,0.12);   /* 浅蓝底 + 黑字，hover 不变 */
  color: var(--text, #1a1f36);
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  text-indent: 0;
  cursor: pointer;
  vertical-align: baseline;
  white-space: nowrap;
  /* box-shadow 用于 hover 时在下方"长出"暗蓝托底；transform 用于上浮 */
  box-shadow: 0 0 0 0 var(--navy, #1e2d4d);
  transition: transform .2s ease, box-shadow .2s ease;
}
/* 两个 L 形角：::before = 左上角，::after = 右下角。
   用 width/height 从短到满做"生长"动画；border 颜色一并过渡。 */
a.lily-wiki-link-pill::before,
a.lily-wiki-link-pill::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--navy, #1e2d4d);
  pointer-events: none;
  transition: width .22s ease, height .22s ease, border-color .18s ease;
}
a.lily-wiki-link-pill::before {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}
a.lily-wiki-link-pill::after {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
}
/* hover：背景不变；整体上浮 + 下方长出暗蓝托底（box-shadow 的 y 偏移即托底高度） */
a.lily-wiki-link-pill:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 0 0 var(--navy, #1e2d4d);
}
/* hover：两角生长成完整暗蓝边框（上浮时仍有边框包裹，不突兀） */
a.lily-wiki-link-pill:hover::before,
a.lily-wiki-link-pill:hover::after {
  width: 100%;
  height: 100%;
  border-color: var(--navy, #1e2d4d);
}

.lily-wiki-link-tooltip {
  position: fixed;
  /* 始终置顶：是 body 直挂的 hover 浮层（pointer-events:none），需盖过字幕轴查看器等高 z 覆盖层(100050) */
  z-index: 100100;
  display: flex;
  gap: 12px;
  background: #fff;
  border: 1px solid rgba(116,139,176,0.22);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(20,40,70,0.18);
  /* 宽度由 3 行 intro 撑开（≈ 14px 字 * 25 字/行）；min 防止太窄 */
  min-width: 360px;
  max-width: 540px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.lily-wiki-link-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.lily-wiki-link-tooltip .lwlt-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #eef2f7;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #637088;
  font-size: 13px;
  font-weight: 700;
}
.lily-wiki-link-tooltip .lwlt-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lily-wiki-link-tooltip .lwlt-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.lily-wiki-link-tooltip .lwlt-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy, #1e2d4d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lily-wiki-link-tooltip .lwlt-intro {
  font-size: 13px;
  color: #303832;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lily-wiki-link-tooltip .lwlt-intro code {
  background: rgba(74,123,189,0.10);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 12px;
}
.lily-wiki-link-tooltip .lwlt-inline-link {
  color: var(--accent, #4a7bbd);
  font-weight: 700;
}
.lily-wiki-link-tooltip .lwlt-empty {
  font-size: 12px;
  color: #a0aabe;
  font-style: italic;
}

/* pill 气泡内的 CHARM story-card */
.ww-charm-card {
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  width: 100%;
}
.ww-charm-card-cover {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 8px;
  background: #eef2f7;
}
.ww-charm-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ww-charm-card-title { font-size: 15px; font-weight: 800; color: var(--navy, #1e2d4d); }
.ww-charm-card-meta { font-size: 12px; color: var(--text-light, #6b7a99); }
.ww-charm-card-ex {
  font-size: 11px; font-weight: 700; color: #b8860b;
  background: rgba(255,215,0,0.14); border-radius: 6px; padding: 1px 7px; align-self: flex-start;
}
.ww-charm-card-intro {
  font-size: 12.5px; color: #303832; line-height: 1.6; margin-top: 2px;
}

/* pill 气泡内的军团 story-card：左头像 + 右标题/所属/评级/队长 */
.ww-legion-card {
  display: flex;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  width: 100%;
  align-items: flex-start;
}
.ww-legion-card-avatar {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; background: #eef2f7;
}
.ww-legion-card-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  color: #637088; font-size: 20px; font-weight: 800;
}
.ww-legion-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ww-legion-card-title { font-size: 16px; font-weight: 800; color: var(--navy, #1e2d4d); }
.ww-legion-card-meta { font-size: 12.5px; color: var(--text-light, #6b7a99); line-height: 1.6; }

/* pill 气泡内的莉莉卡：左侧 1:1 复刻 lily-card（其样式来自 style.css），右侧 Garden/军团/年级/简介(全显) */
.ww-lily-pill {
  display: flex;
  gap: 14px;
  width: 100%;
  align-items: flex-start;
}
.ww-lily-pill-cardbox {
  flex: 0 0 auto;
  text-decoration: none;
  display: block;
}
.ww-lily-pill-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}
.ww-lily-pill-meta {
  font-size: 12.5px;
  color: var(--text-light, #6b7a99);
  line-height: 1.7;
}
.ww-lily-pill-intro {
  font-size: 13px;
  color: #303832;
  line-height: 1.65;
  /* 简介全显，不截断 */
}

/* CHARM 详情「<专机使用者> 专用机体」行：角色头像 + 角色名 pill（同款 hover 气泡 + 点击跳角色页） */
.charm-exclusive-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
a.lily-wiki-link-pill.charm-exclusive-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(74,123,189,0.12);
  flex: 0 0 auto;
}
a.lily-wiki-link-pill.charm-exclusive-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* 头像取不到图：留个浅蓝圆底占位，仍可 hover/点击 */
a.lily-wiki-link-pill.charm-exclusive-avatar.charm-exclusive-avatar-empty {
  background: rgba(74,123,189,0.18);
}
