.theme-toggle-btn {
  all: unset;
  position: fixed;
  top: 16px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
  z-index: 2000;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.theme-toggle-btn:focus, .theme-toggle-btn:hover {
  background: rgba(0,0,0,0.07);
}
:root {
  /* 基础灰白 */
  --bg:            #f7f9fc;
  --fg:            #1a1a1a;
  --border:        #dcdfe4;
  --card-bg:       rgba(255,255,255,0.72);
  --input-bg:      rgba(255,255,255,0.9);

  /* 品牌主色 */
  --primary:       #4a6cff;
  --primary-hover: #3858e1;
  --on-primary:    #ffffff;

  /* 新增交互变量 */
  --hover:         rgba(74,108,255,0.1); /* 统一hover背景 */
  --accent:        var(--primary);         /* 强调色复用主色 */
}

[data-theme='dark'] {
  --bg: #181a1b;
  --fg: #f6f6f6;
  --primary: #4a6cff;
  --primary-hover: #3858e1;
  --border: #333;
  --card-bg: #232526;
  --input-bg: #232526;
  --hover: rgba(74,108,255,0.2); /* 深色模式增强hover效果 */
}
/* 已移除机甲风格相关样式，恢复原有主题和全局样式 */

/* 外部链接样式 */
.external-link {
  color: #1E88E5;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease-in-out;
}

.external-link:hover {
  color: #1565C0;
  text-decoration: underline;
}
/* body {
  background: var(--bg);
  color: var(--fg);
  transition: background 0.2s, color 0.2s;
} */
html, body {
  transition: background-color .56s ease, color .56s ease,
              border-color .56s ease, box-shadow .56s ease;
}
.card-glass,
.main-action-btn,
.centered-control {
  transition: background-color .56s ease, color .56s ease,
              border-color .56s ease, box-shadow .56s ease;
}
.card-glass {
  min-width: 340px;
  max-width: 420px;
  min-height: 340px;
  padding: 48px 40px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: box-shadow 0.3s, transform 0.3s;
  box-sizing: border-box;
}
[data-theme='dark'] .card-glass {
  background: rgba(40,40,40,0.6);
  border: 1.5px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.card-glass select,
.card-glass button {
  width: 100%;
  box-sizing: border-box;
  font-size: 18px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.card-glass select {
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
}
.card-glass button {
  padding: 12px 0;
  background: var(--primary);
  color: var(--bg);
  border: none;
  font-weight: 600;
  margin-bottom: 0;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.card-glass button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.card-glass * {
  color: var(--fg);
}
.card-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255,255,255,0.13) 0%, rgba(0,0,0,0) 70%);
  z-index: 1;
}
.card-glass:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 16px 48px 0 rgba(0,0,0,0.32), 0 2.5px 1px 0 rgba(255,255,255,0.13) inset;
}
.card-glass:hover::before {
  background: linear-gradient(120deg, rgba(255,255,255,0.18) 10%, rgba(0,0,0,0) 80%);
}
.upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.upload-icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}
.upload-main-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  text-align: center;
}
.card-glass .centered-control {
  width: 220px;
  margin: 0 auto 18px auto;
  display: flex; /* 将block改为flex */
  align-items: center;
  justify-content: center;
}
.main-action-btn {
  width: 100%;
  height: 44px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  margin: 0 auto;
  box-sizing: border-box;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  /* 修改为 Flex 布局实现垂直居中 */
  display: flex;
  align-items: center;
  justify-content: center;
}
.main-action-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(74,108,255,0.25);
}
.main-action-btn:disabled {
  opacity: .5;
}
.upload-card > div {
  border-color: var(--border);
}
.toolbar {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 12px;
  z-index: 10;
}
.lang-btn,
.theme-toggle {
  height: 40px;
  min-width: 110px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center; /* 添加水平居中 */
  gap: 6px;
  transition: box-shadow .15s, background .15s;
}
.lang-btn:hover,
.theme-toggle:hover {
  box-shadow: 0 0 0 3px rgba(74,108,255,.15);
}
.theme-toggle {
  width: 40px;
  justify-content: center;
  font-size: 18px;
  padding: 0;
}
[data-theme='dark'] .lang-btn,
[data-theme='dark'] .theme-toggle {
  background: rgba(40,40,40,0.72);
  border: 1px solid rgba(255,255,255,.14);
  color: #f6f6f6;
}
/* 全局按钮基础样式 */
.text-container {
  display: flex;
  align-items: center; /* 垂直居中 */
  justify-content: center; /* 水平居中 */
  min-height: 44px; /* 确保足够高度容纳复杂字符 */
  padding: 0 16px; /* 预留文本膨胀空间 */
  box-sizing: border-box;
}
.main-action-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(74,108,255,0.25);
}
.main-action-btn:disabled {
  opacity: .5;
}
.upload-card > div {
  border-color: var(--border);
}
.toolbar {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 12px;
  z-index: 10;
}
.lang-btn,
.theme-toggle {
  height: 40px;
  min-width: 110px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: box-shadow .15s, background .15s;
}
.lang-btn:hover,
.theme-toggle:hover {
  box-shadow: 0 0 0 3px rgba(74,108,255,.15);
}
.theme-toggle {
  width: 40px;
  justify-content: center;
  font-size: 18px;
  padding: 0;
}
[data-theme='dark'] .lang-btn,
[data-theme='dark'] .theme-toggle {
  background: rgba(40,40,40,0.72);
  border: 1px solid rgba(255,255,255,.14);
  color: #f6f6f6;
}
body {
  font-family:
    /* 西文字体 */
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    /* 中日韩字体 */
    'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR',
    /* 复杂文字字体 */
    'Noto Sans Devanagari', 'Noto Sans Thai',
    /* 通用回退 */
    sans-serif;
}
html, body {
  min-height: 100vh;
  height: 100%;
}
html, body {
  --main-bg: var(--bg, #f7f9fb);
  background:
    linear-gradient(0deg, rgba(180,190,210,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180,190,210,0.12) 1px, transparent 1px),
    var(--main-bg);
  background-size: 32px 32px, 32px 32px, auto;
}
[data-theme="dark"] html, [data-theme="dark"] body {
  --main-bg: var(--bg, #181f2a);
  background:
    linear-gradient(0deg, rgba(60,80,120,0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60,80,120,0.18) 1px, transparent 1px),
    var(--main-bg);
  background-size: 32px 32px, 32px 32px, auto;
}
.theme-toggle{
  all: unset;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.25s ease, transform 0.25s ease;
  color: var(--fg);
  background: none;
}
.theme-toggle:hover{
  background: var(--hover-bg, rgba(0,0,0,.06));
}
.theme-toggle:active{
  transform: scale(.9);
} .pdf-lang-wrap {
  position: relative;
  display: inline-block;
}

/* 胶囊按钮 */
.pdf-lang-btn {
  padding: 8px 36px 8px 16px;
  border-radius: 9999px;
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  font-size: 16px;
  font-weight: 600;
}
.pdf-lang-btn:hover { transform: scale(1.04); }
.pdf-lang-btn:active { transform: scale(.97); }

/* 箭头 */
.pdf-lang-arrow {
  width: 0; height: 0;
  border: 5px solid transparent;
  border-top-color: var(--fg);
  transition: transform .25s;
  position: absolute;
  right: 16px;
}
.pdf-lang-arrow.up { transform: rotate(180deg); }

/* 下拉菜单 */
.pdf-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 140px;
  padding: 6px;
  margin: 0;
  list-style: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  animation: pdf-lang-pop .28s cubic-bezier(.34,1.56,.64,1);
  z-index: 20;
}
@keyframes pdf-lang-pop {
  0%   { opacity: 0; transform: translateY(-10px) scale(.95); }
  80%  { opacity: 1; transform: translateY(2px)  scale(1.03); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}

.pdf-lang-menu li {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  text-align: center;
  color: var(--fg); /* 添加此行以应用主题前景色 */
}
.pdf-lang-menu li:hover       { background: var(--hover); }
.pdf-lang-menu li.active      { background: var(--accent); color: var(--on-primary); }.topbar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 3000;
  height: 44px;
}

/* 仅保留主题切换按钮样式 */
.topbar .theme-toggle {
  border-radius: 50%;
  width: 44px;
  height: 44px;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar .theme-toggle:hover {
  background: var(--hover);
}

/* 新增语言选择器布局控制 */
.topbar .pdf-lang-select {
  min-width: 110px;
}
.topbar select,
.topbar .theme-toggle {
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-sizing: border-box;
}
.topbar select {
  padding: 0 12px; /* 减少水平内边距 */
  border-radius: 22px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  appearance: none;
  outline: none;
  cursor: pointer;
  text-align: center; /* 添加文本居中 */
}