/* ===========================================================
 *  MSC·幻天屿·知识图鉴 Wiki - style.Df6MsZto.css v7
 *  v7: 历史记录横排 + 图片占位符兼容 + 点击错误自恢复
 * =========================================================== */

:root {
  --bg: #fafafa;
  --surface: #fff;
  --text: #1d1d1f;
  --text2: #86868b;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent: #b0b0b0;
  --border: rgba(0, 0, 0, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --font:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", Helvetica, sans-serif;
}
body.dark {
  --bg: #000;
  --surface: #0a0a0a;
  --text: #fff;
  --text2: #888;
  --text-primary: #fff;
  --text-secondary: #888;
  --border: #1c1c1e;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("/watermark-tile.jpg");
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.3;
  pointer-events: none;
  z-index: 999;
}
body > * {
  position: relative;
  z-index: 1;
}
body.dark::before {
  opacity: 0.3;
}

.hidden {
  display: none !important;
}

/* ===== 首页顶部栏 ===== */
.header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  align-items: center;
  padding: 0 40px;
  gap: 16px;
}
body.dark .header {
  background: var(--surface);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.header-logo img {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  object-fit: contain;
}
.header-brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.3px;
}
.header-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text2);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}
.header-sp {
  flex: 1;
}
.theme-btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-btn:hover {
  background: rgba(128, 128, 128, 0.1);
  transform: scale(1.05);
}

/* ===== 首页主体 ===== */
#homeView {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.home-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 28px 48px;
  text-align: center;
}
.home-hero-logo {
  height: 80px;
  width: 80px;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}
.home-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 10px;
}
.home-desc {
  font-size: 20px;
  color: var(--text2);
  line-height: 1.6;
  max-width: 400px;
  margin-bottom: 36px;
}

.home-search {
  width: 100%;
  max-width: 420px;
  margin-bottom: 20px;
}
.home-input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font-size: 16px;
  font-family: var(--font);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  box-sizing: border-box;
}
.home-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 149, 0, 0.12);
}
.home-btn {
  width: 100%;
  max-width: 420px;
  height: 56px;
  background: #ff9500;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 149, 0, 0.3);
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}
.home-btn:hover {
  background: #ff9f0a;
  box-shadow: 0 6px 18px rgba(255, 149, 0, 0.34);
}
.home-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.home-btn:active {
  transform: scale(0.98);
  background: #e68600;
}
.home-error {
  font-size: 12px;
  color: #ff3b30;
  margin-top: 6px;
  min-height: 18px;
}

.home-section-label {
  font-size: 11px;
  color: var(--text2);
  margin: 4px 0;
  text-align: center;
}
.home-examples {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 4px;
}
.chip {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}
.chip:hover {
  background: var(--surface);
  border-color: var(--text2);
  color: var(--text);
}

/* ===== 历史记录 — 右侧面板，和 Plant 页面一致 ===== */

.history-panel {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  z-index: 150;
  display: flex;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
  overflow: visible;
  pointer-events: none;
}
.history-panel.open {
  width: var(--panel-width, 400px);
  pointer-events: auto;
}
.history-panel.collapsed {
  --panel-width: 48px;
  width: 48px;
  pointer-events: auto;
}
.history-panel.collapsed .history-panel-inner {
  visibility: hidden;
  opacity: 0;
}
.history-panel-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 28px;
  height: 56px;
  background: #ff9500;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  transition: all 0.2s ease;
  z-index: 160;
  writing-mode: horizontal-tb;
  box-shadow: 2px 0 12px rgba(255, 149, 0, 0.3);
  pointer-events: auto;
}
.history-panel-toggle:hover {
  background: #34c759;
  box-shadow: -2px 0 12px rgba(52, 199, 89, 0.3);
}
.history-panel.collapsed .history-panel-toggle {
  display: none;
}
.history-panel-inner {
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-width: 200px;
}
.history-panel-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.history-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.history-panel-clear {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.history-panel-clear:hover {
  background: rgba(255, 59, 48, 0.2);
  transform: scale(1.1);
}
.history-panel-collapsed-toggle {
  position: absolute;
  top: 50%;
  right: -28px;
  transform: translateY(-50%);
  width: 28px;
  height: 52px;
  background: #ff9500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  transition: all 0.2s ease;
  z-index: 200;
  box-shadow: -2px 2px 8px rgba(255, 149, 0, 0.3);
  pointer-events: auto;
}
.history-panel-collapsed-toggle:hover {
  background: #34c759;
  box-shadow: -2px 2px 8px rgba(52, 199, 89, 0.3);
}
.history-panel.collapsed .history-panel-toggle {
  display: none;
}
.history-panel.collapsed .history-panel-collapsed-toggle {
  display: flex;
  right: 0;
  left: auto;
  border-radius: 8px 0 0 8px;
  z-index: 200;
}
.history-panel-grid {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-content: start;
}
.history-panel-grid::-webkit-scrollbar {
  width: 4px;
}
.history-panel-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
.history-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 168px;
}
.history-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.history-card-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 168px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    var(--bg);
}
.history-card-img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.02), transparent 58%);
  pointer-events: none;
}
.history-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
  background: transparent;
}
.history-card-img.is-placeholder {
  opacity: 0;
}
.history-card:hover .history-card-img {
  transform: scale(1.05);
}
.history-card-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: linear-gradient(180deg, rgba(20,20,24,0), rgba(20,20,24,0.78) 42%, rgba(20,20,24,0.92));
}
.history-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}
.history-card-tab {
  font-size: 10px;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.12);
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
.history-card-tab[data-tab="wiki"] {
  color: #8dc2ff;
  background: rgba(10, 132, 255, 0.18);
}
.history-card-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  font-size: 11px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 5;
}
.history-card:hover .history-card-delete {
  display: flex;
}
.history-card-delete:hover {
  background: #ff3b30;
  transform: scale(1.15);
}
.history-empty {
  width: 100%;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  grid-column: 1 / -1;
}
body.dark .history-panel-inner {
  background: #1c1c1e;
}
body.dark .history-card {
  background: #2c2c2e;
  border-color: var(--border);
}
body.dark .history-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}
body.dark .history-card-info {
  background: linear-gradient(180deg, rgba(8,8,10,0), rgba(8,8,10,0.82) 42%, rgba(8,8,10,0.94));
}

/* ===== 搜索页顶部栏 — v5: 标题+提示 inline 在左右之间 ===== */
.explore-header {
  display: flex;
  align-items: center;
  height: 56px;
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  padding: 0 40px;
  z-index: 50;
  position: sticky;
  top: 0;
}
body.dark .explore-header {
  background: var(--bg);
}

/* 左侧组：logo + 返回按钮 */
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.header-left .header-logo-img {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  object-fit: contain;
}
.header-left .header-logo-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.explore-nav-btn {
  width: 30px;
  height: 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.15s;
  flex-shrink: 0;
}
.explore-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.explore-nav-btn:not(:disabled):hover {
  background: var(--surface);
  border-color: var(--text2);
}

/* v5: 中间区域 */
.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  overflow: auto;
}

.explore-query {
  position: static;
  transform: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: auto;
  text-overflow: ellipsis;
}

.click-hint-inline {
  position: static;
  transform: none;
  bottom: auto;
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  overflow: auto;
  text-overflow: ellipsis;
  max-width: 160px;
  opacity: 0.75;
  animation: breathe 2.5s ease-in-out infinite;
}
@keyframes breathe {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.9;
  }
}
.hint-desktop {
  display: inline;
}
.hint-mobile {
  display: none;
}

/* 右侧组：前进 + 主题 */
.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== 搜索页主体 ===== */
#exploreView {
  height: calc(100dvh - 56px);
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.explore-content {
  flex: 1;
  display: flex !important;
  overflow: hidden;
  min-height: 0;
}

/* 左侧主图区 — v6: 图片锚定左上角，无留白，随容器缩放填满 */
.explore-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.poster-frame {
  position: absolute;
  inset: 0;
  background: #f5f5f5;
  border-radius: 0;
  overflow: auto;
  padding: 0;
  margin: 0;
}
.poster-image {
  display: block;
  width: 100%;
  height: auto;
  min-width: 100%;
  cursor: pointer;
}
.poster-image.is-pending-placeholder {
  opacity: 0;
}
/* v7: 占位图和空src都保持可见（透明PNG），不隐藏 */
.poster-image[src=""] {
  visibility: hidden;
}

.infograph-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}
.infograph-overlay.hidden {
  display: none;
}
.infograph-overlay-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.infograph-title-card {
  max-width: min(52%, 420px);
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(7, 11, 18, 0.78);
  color: #fff;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.infograph-title-zh {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}
.infograph-title-en {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}
.infograph-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 42%;
}
.infograph-meta-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
}
.infograph-labels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-self: flex-end;
  width: min(680px, 100%);
}
.infograph-label-group {
  display: grid;
  gap: 10px;
}
.infograph-label-group.secondary {
  align-self: end;
}
.infograph-label-card {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: #111;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}
.infograph-label-head {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}
.infograph-label-sub {
  margin-top: 2px;
  font-size: 10px;
  color: rgba(17, 17, 17, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.infograph-label-value {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(17, 17, 17, 0.82);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.infograph-label-card.slot-summary_zh,
.infograph-label-card.slot-summary_en {
  min-height: 112px;
}
.infograph-label-card.slot-region,
.infograph-label-card.slot-era,
.infograph-label-card.slot-usage {
  border-top: 3px solid rgba(61, 132, 223, 0.9);
}
.infograph-label-card.slot-trait,
.infograph-label-card.slot-category {
  border-left: 4px solid rgba(255, 179, 71, 0.92);
}
.infograph-label-card.slot-related {
  background: rgba(255, 248, 236, 0.94);
}
body.dark .infograph-meta-chip,
body.dark .infograph-label-card {
  background: rgba(14, 18, 26, 0.84);
  color: #f5f5f5;
}
body.dark .infograph-label-sub,
body.dark .infograph-label-value {
  color: rgba(245, 245, 245, 0.72);
}
body.dark .infograph-label-card.slot-related {
  background: rgba(38, 28, 12, 0.88);
}
.infograph-overlay.scene-taxonomy .infograph-labels {
  width: min(760px, 100%);
}
.infograph-overlay.scene-taxonomy .infograph-label-group.primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.infograph-overlay.scene-taxonomy .infograph-label-card.primary {
  min-height: 102px;
}
.infograph-overlay.scene-structure .infograph-labels {
  width: min(760px, 100%);
}
.infograph-overlay.scene-structure .infograph-label-group.primary .infograph-label-card {
  border-left: 4px solid rgba(255, 179, 71, 0.9);
}
.infograph-overlay.scene-mechanism .infograph-label-group.primary .infograph-label-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(232,241,255,0.88));
}
.infograph-overlay.scene-mechanism .infograph-label-card.slot-summary_zh,
.infograph-overlay.scene-mechanism .infograph-label-card.slot-summary_en {
  min-height: 128px;
}
.infograph-overlay.scene-context .infograph-labels {
  width: min(760px, 100%);
}
.infograph-overlay.scene-context .infograph-label-group.primary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.infograph-overlay.scene-context .infograph-label-card.primary {
  border-radius: 999px;
  padding: 10px 14px;
}
.infograph-overlay.scene-context .infograph-label-head {
  font-size: 11px;
}
.infograph-overlay.scene-comparison .infograph-labels {
  width: min(820px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.infograph-overlay.scene-comparison .infograph-label-group {
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
}
.infograph-overlay.scene-comparison .infograph-label-group.primary {
  border: 1px solid rgba(255, 255, 255, 0.32);
}
.infograph-overlay.scene-comparison .infograph-label-group.secondary {
  border: 1px solid rgba(255, 179, 71, 0.45);
}
.infograph-overlay.scene-comparison .infograph-label-card.slot-related,
.infograph-overlay.scene-comparison .infograph-label-card.slot-source {
  border-top: 3px solid rgba(255, 255, 255, 0.45);
}
body.dark .infograph-overlay.scene-mechanism .infograph-label-group.primary .infograph-label-card {
  background: linear-gradient(135deg, rgba(14,18,26,0.9), rgba(24,34,48,0.86));
}
body.dark .infograph-overlay.scene-comparison .infograph-label-group {
  background: rgba(10, 14, 20, 0.36);
}

/* 点击区域 */
.click-zone {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  color: #fff;
  font-size: 11px;
  z-index: 2;
}

/* ===== 加载遮罩 ===== */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  z-index: 10;
}
.loading-overlay.loading-overlay-dark {
  background: rgba(8, 12, 18, 0.86);
}
body.dark .loading-overlay {
  background: rgba(0, 0, 0, 0.85);
}
.loading-overlay.loading-overlay-dark .loading-text {
  color: #fff;
}
.loading-overlay.loading-overlay-dark .loading-sub {
  color: rgba(255, 255, 255, 0.76);
}
.loading-overlay.loading-overlay-dark .loading-bar-outer {
  background: rgba(255, 255, 255, 0.18);
}
.loading-overlay.loading-overlay-dark .loading-bar-inner {
  background: #fff;
}

.loading-spinner {
  margin-bottom: 12px;
}
.spinner-logo {
  height: 56px;
  width: 56px;
  border-radius: 18px;
  object-fit: fill;
  animation: logo-breathe 2s ease-in-out infinite;
}
@keyframes logo-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

.loading-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.loading-sub {
  font-size: 15px;
  color: var(--text2);
  margin-top: 8px;
}
.loading-bar {
  margin-top: 12px;
}
.loading-bar-outer {
  width: 56px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.loading-bar-inner {
  height: 100%;
  width: 45%;
  background: var(--accent);
  border-radius: 3px;
  animation: loadbar 1.5s ease-in-out infinite;
}
@keyframes loadbar {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

/* ===== v7: 错误提示 — 覆盖在图片区域中央，带关闭能力 ===== */
.explore-error {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(220, 53, 69, 0.95);
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  z-index: 9999;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: none;
}
.explore-sidebar.collapsed {
  width: 40px !important;
  min-width: 40px !important;
}
.explore-sidebar.collapsed .thumbnail-strip,
.explore-sidebar.collapsed .caption-content {
  display: none !important;
}

/* v13: 桌面端固定宽度 + 完整布局 */
.explore-sidebar {
  width: 280px;
  flex-shrink: 0;
  min-width: 280px;
  max-width: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-header-flex {
  display: flex;
  align-items: center;
  height: 32px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  background: var(--surface);
  overflow: auto;
}
.side-fold-btn {
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  gap: 4px;
  transition: background 0.15s;
}
.side-fold-btn:hover {
  background: var(--border);
}

.sidebar-status {
  margin: 10px 10px 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 12, 18, 0.86);
  color: #fff;
  flex-shrink: 0;
}
.sidebar-status.pending {
  background: rgba(8, 12, 18, 0.86);
}
.sidebar-status.error {
  background: rgba(133, 24, 36, 0.92);
}
.sidebar-status-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
.sidebar-status-sub {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.76);
}
.sidebar-status.error .sidebar-status-sub {
  color: rgba(255, 255, 255, 0.88);
}

.thumbnail-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  max-height: 180px;
  overflow-y: auto;
}
.thumbnail-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-size: 10px;
  color: var(--text2);
  max-width: 100%;
  transition: all 0.15s;
}
.thumbnail-item.active {
  border-color: var(--accent);
  background: var(--bg);
}
.thumbnail-item:hover {
  background: var(--bg);
}
.thumbnail-item img {
  width: 32px;
  height: 24px;
  border-radius: 4px;
  object-fit: fill;
  flex-shrink: 0;
}
.thumb-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.caption-content {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
}
.caption-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.caption-topic-type {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 179, 71, 0.16);
  color: #9a5a00;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.knowledge-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.knowledge-fact {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--border);
}
body.dark .knowledge-fact {
  background: rgba(255, 255, 255, 0.04);
}
.knowledge-fact-label {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 4px;
}
.knowledge-fact-value {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  font-weight: 600;
}
.caption-zh {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 8px;
  word-break: break-word;
}
.caption-en {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text2);
  font-style: italic;
  margin-bottom: 6px;
}
.caption-source {
  font-size: 9px;
  color: var(--text2);
  opacity: 0.6;
  font-style: normal;
}
.caption-footer {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.caption-footer a {
  font-size: 9px;
  color: var(--text2);
  text-decoration: none;
}
.knowledge-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.knowledge-block-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.knowledge-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.knowledge-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
  line-height: 1.2;
}
.knowledge-chip.muted {
  opacity: 0.82;
}
.knowledge-chip.action {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.knowledge-chip.action:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(255, 179, 71, 0.12);
}

/* ===== Footer ===== */
.footer {
  padding: 14px 30px;
  text-align: center;
  background: transparent;
  border-top: none;
  margin-top: auto;
}
.footer-brand {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 2px;
}
.footer-copy {
  font-size: 10px;
  color: var(--text2);
  opacity: 0.7;
}
.footer-version {
  margin-top: 3px;
  font-size: 8px;
  color: var(--text2);
  opacity: 0.5;
}
.footer-version a {
  color: var(--text2);
  text-decoration: none;
}

/* History entry button (homepage) */
.history-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.history-entry:hover {
  opacity: 0.9;
  transform: scale(1.02);
}
.history-entry:active {
  transform: scale(0.98);
}
.history-entry-icon {
  font-size: 18px;
}
.history-entry-text {
  white-space: nowrap;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .header {
    padding: 0 20px;
    gap: 12px;
  }
  .header-tag {
    font-size: 10px;
    padding: 2px 8px;
  }
  .home-title {
    font-size: 18px;
  }
  .home-desc {
    font-size: 12px;
    max-width: 240px;
  }
  .home-input {
    height: 40px;
    font-size: 13px;
  }
  .home-btn {
    height: 38px;
    font-size: 13px;
  }
  .chip {
    font-size: 11px;
    padding: 5px 12px;
  }
  .explore-sidebar {
    min-height: 0;
    width: 220px;
  }
  /* v7: 移动端历史记录也保持flex横排 */
  .history-grid {
    /* v9: 缩略图历史卡片 */
    gap: 6px;
  }
  .hint-desktop {
    display: none;
  }
  .hint-mobile {
    display: inline;
  }
  .explore-header {
    padding: 0 20px;
  }
  .header-left {
    gap: 8px;
  }
  .explore-query {
    font-size: 14px;
  }
  .click-hint-inline {
    max-width: 56px;
    font-size: 10px;
  }
  .infograph-overlay {
    padding: 12px;
  }
  .infograph-title-card {
    max-width: 68%;
    padding: 12px 14px;
  }
  .infograph-title-zh {
    font-size: 18px;
  }
  .infograph-title-en {
    font-size: 11px;
  }
  .infograph-meta {
    max-width: 44%;
  }
  .infograph-labels {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .infograph-label-group,
  .infograph-overlay.scene-taxonomy .infograph-label-group.primary,
  .infograph-overlay.scene-context .infograph-label-group.primary,
  .infograph-overlay.scene-comparison .infograph-labels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .explore-sidebar {
    min-height: 0;
    position: fixed;
    top: 56px;
    bottom: 0;
    right: 0;
    width: 260px;
    max-width: 80vw;
    z-index: 100;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }
  .explore-sidebar.show {
    transform: translateX(0);
  }
  .thumbnail-strip {
    display: none;
  }
  .click-hint-inline {
    display: none;
  }
  .explore-query {
    font-size: 13px;
  }
}
