/* ============================================================
   淞-translate  ——  鸿蒙6.0 光影质感 · 毛玻璃 · 动效
   主题变量由设置页 (#/settings) 实时驱动
   ============================================================ */
:root {
  --blue: #0a59f7;
  --blue-2: #4d9fff;
  --violet: #7c4dff;
  --cyan: #2dd4bf;
  --ink: #16213a;
  --ink-soft: #3a4664;
  --muted: #6b7690;
  --line: rgba(255, 255, 255, 0.55);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --glass-dark: rgba(18, 24, 42, 0.55);
  --shadow: 0 12px 40px rgba(20, 40, 80, 0.16);
  --shadow-hover: 0 20px 56px rgba(20, 40, 80, 0.26);
  --radius: 22px;
  --grad: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 50%, var(--violet) 100%);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;

  /* === 设置页可调主题变量 === */
  --glass-blur: 14px;          /* 玻璃模糊度（设置滑块） */
  --glass-sat: 1.5;            /* 玻璃饱和度 */
  --glass-opacity: 0.42;       /* 玻璃背景基色透明度 */
  --glass-edge: 0.5;           /* 玻璃边框透明度 */
  --frost: 0;                  /* 磨砂度（背景粒子化） */
  --bg-fluid-hue: 100deg;      /* 流体背景色相 */
  --bg-fluid-brightness: 1;    /* 流体背景亮度 */
  --bg-fluid-sat: 1;           /* 流体背景饱和 */
  --theme: dark;               /* 浅色 / 深色 */
  --bg-source: fluid;          /* fluid / wallpaper / custom */
  --custom-bg: none;           /* 用户上传背景图 */
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #0b1220;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}
body[data-theme="light"] {
  color: #16213a;
  background: #f0f4f8;
}
body[data-theme="light"] .bg-overlay { background: linear-gradient(160deg, rgba(255,255,255,0.2), rgba(255,255,255,0.35)); }
body[data-theme="light"] .glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0.45));
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 6px 24px rgba(20, 40, 80, 0.06), inset 0 1px 0 rgba(255,255,255,.7);
}
body[data-theme="light"] .card {
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,255,255,0.78));
  box-shadow: 0 8px 28px rgba(20, 40, 80, 0.08), inset 0 1px 0 rgba(255,255,255,.8);
}
body[data-theme="light"] .topbar { background: rgba(255,255,255,0.7) !important; }
body[data-theme="light"] .nav a { color: #3a4664; }
body[data-theme="light"] .nav a:hover { background: rgba(0,0,0,.05); }
body[data-theme="light"] .nav a.active { color: #fff; }
body[data-theme="light"] .nat-status { color: #3a4664; background: rgba(255,255,255,.7); }
body[data-theme="light"] .example-item { background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.7)); border: 1px solid rgba(0,0,0,.06); }
body[data-theme="light"] .engine-item, body[data-theme="light"] .sug-item, body[data-theme="light"] .correction-item, body[data-theme="light"] .form-item, body[data-theme="light"] .tab, body[data-theme="light"] .settings-group button, body[data-theme="light"] .settings-select, body[data-theme="light"] .analysis-block, body[data-theme="light"] .suggest-list { background: rgba(255,255,255,.85); color: var(--ink); }
body[data-theme="light"] .engine-item:hover, body[data-theme="light"] .form-item:hover, body[data-theme="light"] .suggest-list { background: rgba(255,255,255,.95); }
body[data-theme="light"] .hero h1 { color: var(--ink); }
body[data-theme="light"] .hero p { color: var(--ink-soft); }
body[data-theme="light"] .settings-section-title { color: var(--ink-soft); }
body[data-theme="light"] .settings-row .label { color: var(--ink); }
body[data-theme="light"] textarea, body[data-theme="light"] input[type=text], body[data-theme="light"] input[type=password], body[data-theme="light"] input[type=email], body[data-theme="light"] select {
  background: rgba(255,255,255,.92);
  color: var(--ink);
  border: 1px solid rgba(0,0,0,.12);
}

/* ---------------- 背景层（流体 / 壁纸 / 自定义） ---------------- */
.bg-wallpaper {
  position: fixed; inset: 0; z-index: -3;
  background-size: cover; background-position: center;
  transition: background-image 1.2s ease;
  background-image: var(--custom-bg);
  opacity: 0;
}
body[data-bg="wallpaper"] .bg-wallpaper,
body[data-bg="custom"] .bg-wallpaper { opacity: 1; }
body[data-bg="fluid"] .bg-wallpaper { opacity: 0; }

/* 流体背景层（默认）：色相 + 亮度可调，绿黄渐变质感 */
.bg-fluid {
  position: fixed; inset: -10%; z-index: -3; pointer-events: none;
  background:
    radial-gradient(45% 38% at 18% 22%, hsla(calc(var(--bg-fluid-hue) + 30), 80%, calc(65% * var(--bg-fluid-brightness)), .9), transparent 60%),
    radial-gradient(38% 32% at 82% 28%, hsla(calc(var(--bg-fluid-hue) - 20), 75%, calc(70% * var(--bg-fluid-brightness)), .85), transparent 65%),
    radial-gradient(50% 42% at 55% 78%, hsla(calc(var(--bg-fluid-hue) + 60), 70%, calc(60% * var(--bg-fluid-brightness)), .8), transparent 70%),
    radial-gradient(35% 30% at 30% 85%, hsla(calc(var(--bg-fluid-hue) + 90), 65%, calc(55% * var(--bg-fluid-brightness)), .7), transparent 65%),
    linear-gradient(140deg,
      hsl(var(--bg-fluid-hue), calc(60% * var(--bg-fluid-sat)), calc(22% * var(--bg-fluid-brightness)))),
    hsl(calc(var(--bg-fluid-hue) + 40), calc(70% * var(--bg-fluid-sat)), calc(38% * var(--bg-fluid-brightness))));
  filter: saturate(var(--bg-fluid-sat));
  display: none;
}
body[data-bg="fluid"] .bg-fluid { display: block; }

.bg-overlay {
  position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(160deg, rgba(10, 20, 40, 0.32) 0%, rgba(10, 15, 30, 0.45) 100%);
  backdrop-filter: blur(2px);
}
body[data-theme="light"] .bg-overlay { background: linear-gradient(160deg, rgba(255,255,255,0.18), rgba(255,255,255,0.3)); }

.bg-aurora {
  position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 32% at 22% 18%, hsla(calc(var(--bg-fluid-hue) + 180), 70%, 60%, .25), transparent 70%),
    radial-gradient(30% 26% at 78% 30%, hsla(calc(var(--bg-fluid-hue) + 220), 65%, 55%, .20), transparent 70%),
    radial-gradient(34% 30% at 55% 82%, hsla(calc(var(--bg-fluid-hue) + 280), 60%, 50%, .18), transparent 70%);
  filter: blur(30px);
  transform: translateZ(0);
  animation: none;
}

/* ---------------- 毛玻璃基元（参数由 --glass-* 变量驱动）
   默认深色：半透明深色玻璃，跟背景融合；浅色主题切到白色 --------------- */
.glass {
  background: linear-gradient(135deg, rgba(20,28,48,calc(var(--glass-opacity) + 0.18)), rgba(20,28,48,calc(var(--glass-opacity) * 0.7)));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid rgba(255, 255, 255, var(--glass-edge));
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255,255,255,.08);
  transform: translateZ(0);
  color: rgba(255,255,255,.92);
}
.glass-strong {
  background: linear-gradient(135deg, rgba(20,28,48,calc(var(--glass-opacity) + 0.32)), rgba(20,28,48,calc(var(--glass-opacity) + 0.12)));
  backdrop-filter: blur(calc(var(--glass-blur) + 2px)) saturate(calc(var(--glass-sat) + 0.1));
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) + 2px)) saturate(calc(var(--glass-sat) + 0.1));
  border: 1px solid rgba(255, 255, 255, calc(var(--glass-edge) + 0.15));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,.1);
  transform: translateZ(0);
  color: rgba(255,255,255,.95);
}
.glass-dark {
  background: var(--glass-dark);
  backdrop-filter: blur(calc(var(--glass-blur) * 0.7)) saturate(calc(var(--glass-sat) * 0.8));
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.7)) saturate(calc(var(--glass-sat) * 0.8));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* 浅色主题：恢复白底玻璃 */
body[data-theme="light"] .glass {
  background: linear-gradient(135deg, rgba(255,255,255,var(--glass-opacity)), rgba(255,255,255,calc(var(--glass-opacity) * 0.55)));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 24px rgba(20, 40, 80, 0.08), inset 0 1px 0 rgba(255,255,255,.6);
  color: var(--ink);
}
body[data-theme="light"] .glass-strong {
  background: linear-gradient(135deg, rgba(255,255,255,calc(var(--glass-opacity) + 0.2)), rgba(255,255,255,calc(var(--glass-opacity) * 0.85)));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 40px rgba(20, 40, 80, 0.16), inset 0 1px 0 rgba(255,255,255,.7);
  color: var(--ink);
}

/* ---------------- 顶部导航 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  border-radius: 0 0 20px 20px;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(10, 89, 247, 0.4);
}
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: .5px; color: #fff; }
.brand-sub { font-weight: 500; color: var(--blue-2); }

.nav { display: flex; gap: 6px; flex: 1; }
.nav a {
  text-decoration: none; color: rgba(255,255,255,.78);
  padding: 8px 16px; border-radius: 12px; font-size: 15px; font-weight: 500;
  transition: all .25s ease; position: relative;
}
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; transform: translateY(-1px); }
.nav a.active {
  background: var(--grad); color: #fff;
  box-shadow: 0 6px 16px rgba(10,89,247,.35);
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.nat-status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: rgba(255,255,255,.78); font-style: normal;
  padding: 6px 10px; border-radius: 20px; background: rgba(255,255,255,.12);
}
.nat-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; animation: pulse 1.6s infinite; }
.nat-status.ok .dot { background: #10b981; animation: none; }
.nat-status.bad .dot { background: #ef4444; animation: none; }
.nat-status em { font-style: normal; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: none; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 13px; transition: all .25s ease; position: relative; overflow: hidden;
  white-space: nowrap;
}
.btn::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .6s ease;
}
.btn:hover::after { transform: translateX(120%); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(10,89,247,.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(10,89,247,.5); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: rgba(255,255,255,.14); color: rgba(255,255,255,.92); }
.btn-ghost:hover { background: rgba(255,255,255,.22); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------------- 布局 ---------------- */
.app-main { max-width: 1200px; margin: 0 auto; padding: 26px 20px 80px; }

.view { animation: viewIn .5s cubic-bezier(.22,.8,.32,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; margin: 22px 0 26px; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 700; letter-spacing: 1px; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.35); }
.hero p { color: rgba(255,255,255,.85); margin-top: 8px; font-size: 15px; }

.card {
  background: linear-gradient(135deg, rgba(20,28,48,calc(var(--glass-opacity) + 0.5)), rgba(20,28,48,calc(var(--glass-opacity) + 0.32)));
  backdrop-filter: blur(calc(var(--glass-blur) - 2px)) saturate(calc(var(--glass-sat) - 0.2));
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) - 2px)) saturate(calc(var(--glass-sat) - 0.2));
  border: 1px solid rgba(255, 255, 255, calc(var(--glass-edge) + 0.12)); border-radius: 22px;
  padding: 24px; box-shadow: 0 10px 36px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.1);
  transition: transform .3s ease, box-shadow .3s ease;
  animation: none;
  transform: translateZ(0);
  color: rgba(255,255,255,.92);
}
body[data-theme="light"] .card {
  background: linear-gradient(135deg, rgba(255,255,255,calc(var(--glass-opacity) + 0.44)), rgba(255,255,255,calc(var(--glass-opacity) + 0.3)));
  border: 1px solid rgba(255, 255, 255, calc(var(--glass-edge) + 0.25));
  box-shadow: 0 10px 36px rgba(20,40,80,.12), inset 0 1px 0 rgba(255,255,255,.8);
  color: var(--ink);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 20px 56px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.12); }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin-bottom: 16px; color: #fff; }
.card-title .badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }

/* 快捷示例行 */
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.quick-label { font-size: 13px; color: rgba(255,255,255,.7); }
.quick {
  border: 1px solid rgba(10,89,247,.4); background: rgba(10,89,247,.12);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: #93c5fd; font-size: 13px; padding: 5px 13px; border-radius: 20px;
  cursor: pointer; transition: all .2s; font-family: inherit; font-weight: 500;
}
.quick:hover { background: rgba(10,89,247,.28); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(10,89,247,.4); color: #fff; }

textarea, input[type=text], input[type=email], input[type=password], select {
  width: 100%; border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  padding: 14px 16px; font-family: inherit; font-size: 15px; color: #fff;
  background: rgba(20,28,48,.45); transition: all .25s; resize: vertical; outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.15);
}
textarea::placeholder, input::placeholder { color: rgba(255,255,255,.4); }
textarea:focus, input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, select:focus {
  border-color: var(--blue); background: rgba(20,28,48,.6);
  box-shadow: 0 0 0 4px rgba(10,89,247,.25);
  transform: translateY(-1px);
}
textarea:focus, input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(10,89,247,.25); }
textarea { min-height: 120px; }

/* ---------------- 翻译页 ---------------- */
.translate-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.input-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.lang-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); background: rgba(255,255,255,.14); padding: 6px 12px; border-radius: 20px; }
.lang-pill .arrow { color: var(--blue-2); }

.result-zone { display: grid; gap: 20px; }
.zone-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 1px; }

/* 深度翻译（最上方，突出） */
.deep-zone { border: 1px solid rgba(10,89,247,.28); background: linear-gradient(160deg, rgba(255,255,255,.85), rgba(235,242,255,.75)); }
.deep-zone .zone-tag { background: var(--grad); color: #fff; }

/* 结果文本 */
.result-text { font-size: 16.5px; line-height: 1.9; color: var(--ink); white-space: pre-wrap; word-break: break-word; min-height: 24px; }
.result-text.typing::after { content: "▍"; color: var(--blue); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.time-badge { font-size: 12px; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* 进度条（渐变光影 + 百分比） */
.progress { height: 8px; border-radius: 8px; background: rgba(0,0,0,.07); overflow: hidden; position: relative; margin: 12px 0; }
.progress .bar {
  height: 100%; width: 0%; border-radius: 8px; background: var(--grad);
  background-size: 200% 100%; position: relative; transition: width .35s cubic-bezier(.4,0,.2,1);
  animation: none; /* 移除持续光影动画，降低重绘 */
}
.progress .pct {
  position: absolute; top: -2px; right: 0; transform: translateY(-100%);
  font-size: 11px; font-weight: 700; color: var(--blue); text-shadow: 0 1px 2px rgba(255,255,255,.8);
}
@keyframes shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* 可点击词链接（词形变化/例句单词/相关词） */
.word-link {
  display: inline-block; padding: 1px 5px; margin: 1px; border-radius: 6px;
  color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: none;
  background: rgba(10,89,247,.07); border: 1px solid rgba(10,89,247,.16);
  transition: all .18s ease;
}
.word-link:hover { background: var(--blue); color: #fff; transform: translateY(-1px); box-shadow: 0 3px 10px rgba(10,89,247,.35); }
.example-item { padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(20,28,48,.7), rgba(20,28,48,.5)); border: 1px solid rgba(255,255,255,.7); margin: 8px 0; transition: all .2s; box-shadow: 0 2px 8px rgba(20,40,80,.04); }
.example-item:hover { background: linear-gradient(135deg, rgba(10,89,247,.06), rgba(124,77,255,.06)); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(20,40,80,.1); }
.example-item .en { line-height: 1.9; font-size: 15px; }
.example-item .zh { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.related-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sources { font-size: 12px; margin-top: -4px; margin-bottom: 6px; opacity: 0.7; }
.compare-card .best-row { background: linear-gradient(135deg, rgba(16,185,129,.1), rgba(56,189,248,.06)); padding: 8px 10px; border-radius: 10px; margin: 6px 0; }
.compare-card .kv { margin: 4px 0; line-height: 1.7; }
.analysis-raw { font-size: 13px; color: var(--ink-soft); line-height: 1.7; font-family: monospace; white-space: pre-wrap; word-break: break-all; }
.audio-btn {
  background: rgba(10,89,247,.08); border: 1px solid rgba(10,89,247,.2);
  border-radius: 50%; width: 30px; height: 30px; padding: 0; font-size: 14px;
  cursor: pointer; transition: all .2s;
}
.audio-btn:hover { background: var(--blue); color: #fff; transform: scale(1.08); }


/* 骨架加载 */
.skeleton { border-radius: 8px; background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.12) 50%, rgba(0,0,0,.06) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; height: 16px; margin: 8px 0; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* 在线引擎结果列表 */
.engine-list { display: grid; gap: 12px; margin-top: 14px; }
.engine-item {
  padding: 14px 16px; border-radius: 16px; background: rgba(20,28,48,.55);
  border: 1px solid rgba(0,0,0,.06); cursor: pointer; transition: all .25s;
}
.engine-item:hover { background: rgba(20,28,48,.75); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20,40,80,.12); }
.engine-item.winner { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10,89,247,.12); }
.engine-item .engine-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.engine-item .score-dot { font-size: 12px; color: var(--blue); font-weight: 700; margin-left: auto; }

/* 反馈按钮 */
.feedback-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.fb-btn {
  border: 1px solid rgba(0,0,0,.1); background: rgba(20,28,48,.55); cursor: pointer;
  border-radius: 20px; padding: 6px 14px; font-size: 13px; color: var(--ink-soft); transition: all .2s;
}
.fb-btn:hover { background: #fff; transform: translateY(-1px); }
.fb-btn.liked { background: rgba(16,185,129,.15); color: #059669; border-color: #10b981; }
.fb-btn.disliked { background: rgba(239,68,68,.12); color: #dc2626; border-color: #ef4444; }

/* 语法评析 */
.analysis-block { margin-top: 14px; padding: 16px; border-radius: 16px; background: rgba(20,28,48,.55); border: 1px dashed rgba(10,89,247,.25); }
.analysis-block h4 { font-size: 14px; color: var(--blue); margin-bottom: 8px; }
.analysis-block .kv { font-size: 14px; margin: 6px 0; }
.analysis-block .kv b { color: var(--ink-soft); }

/* ---------------- 单词查询 ---------------- */
.word-hero { max-width: 720px; margin: 0 auto; }
.search-box { display: flex; gap: 10px; position: relative; }
.search-box input { flex: 1; font-size: 17px; padding: 16px 20px; border-radius: 16px; }
.suggest-list {
  position: absolute; top: 60px; left: 0; right: 0; z-index: 10;
  max-width: 460px; margin: 0 auto;
  background: rgba(20,28,48,.75);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(20,40,80,.18);
  overflow: hidden;
  animation: sugIn .25s ease;
}
@keyframes sugIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.suggest-list .sug-item {
  padding: 10px 18px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  border-bottom: 1px solid rgba(0,0,0,.04);
  transition: background .15s;
}
.suggest-list .sug-item:last-child { border-bottom: none; }
.suggest-list .sug-item:hover { background: rgba(10,89,247,.12); }
.suggest-list .sug-word {
  font-weight: 700; color: var(--ink); font-size: 15px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex-shrink: 0;
}
.suggest-list .sug-cn {
  color: var(--muted); font-size: 13px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right;
}
.suggest-list .sug-more {
  padding: 8px 18px; font-size: 12px; color: var(--muted); text-align: center;
  background: rgba(0,0,0,.03); font-weight: 500;
}
.sug-word-inline {
  font-weight: 700; color: var(--blue); font-size: 15px;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex-shrink: 0; flex-basis: 140px;
}
.sug-tags { display: flex; gap: 4px; flex-wrap: nowrap; flex-shrink: 0; }

/* 词形变化独立卡片网格 */
.forms-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin-top: 6px;
}
.trans-list { display: flex; flex-direction: column; gap: 8px; }
.trans-item {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(255,255,255,.7), rgba(255,255,255,.5));
  border: 1px solid rgba(255,255,255,.6); border-radius: 12px;
  font-size: 15px;
}
.trans-item .cn { color: var(--ink); font-weight: 500; flex: 1; min-width: 200px; }
.form-item {
  display: flex; flex-direction: column; padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.65));
  border: 1px solid rgba(10,89,247,.16); border-radius: 14px;
  transition: all .2s; min-height: 56px;
}
.form-item:hover {
  background: linear-gradient(135deg, rgba(10,89,247,.08), rgba(124,77,255,.08));
  transform: translateY(-2px); box-shadow: 0 6px 16px rgba(10,89,247,.18);
}
.form-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.form-value { font-size: 16px; color: var(--blue); font-weight: 700; }
.word-result { margin-top: 22px; }
.word-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px dashed rgba(0,0,0,.08); margin-bottom: 6px; }
.word-head .word {
  font-size: 40px; font-weight: 800; letter-spacing: .5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  text-shadow: none; filter: drop-shadow(0 2px 10px rgba(10,89,247,.25));
}
.word-head .phonetic { color: var(--muted); font-size: 16px; }
.pos-line { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.pos-chip { background: rgba(10,89,247,.1); color: var(--blue); padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.meaning-item { padding: 12px 0; border-bottom: 1px dashed rgba(0,0,0,.08); }
.meaning-item .pos { display: inline-block; font-weight: 700; color: var(--blue); margin-right: 8px; min-width: 40px; }
.meaning-item .cn { color: var(--ink); font-size: 15.5px; }
.tag-row { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 20px; background: rgba(0,0,0,.05); color: var(--muted); }

/* ---------------- 纠错 & 分析 ---------------- */
.correction-item { padding: 14px; border-radius: 14px; background: rgba(20,28,48,.55); margin-bottom: 10px; border-left: 4px solid #ef4444; }
.correction-item .err-type { font-size: 12px; font-weight: 700; color: #dc2626; }
.correction-item .orig { color: #dc2626; text-decoration: line-through; }
.correction-item .corr { color: #059669; font-weight: 600; }
.corrected-full { margin-top: 16px; padding: 16px; border-radius: 14px; background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); font-size: 15.5px; }

/* ---------------- 表格（后台） ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(0,0,0,.06); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:hover td { background: rgba(20,28,48,.4); }

/* ---------------- 统计卡片 ---------------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 18px; border-radius: 18px; text-align: center; }
.stat-card .num { font-size: 30px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-card .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------------- 选项卡 ---------------- */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 9px 18px; border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-soft); background: rgba(20,28,48,.45); border: none; transition: all .2s; }
.tab.active { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(10,89,247,.3); }

/* ---------------- 弹窗 ---------------- */
.modal-mask { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(8,12,24,.5); backdrop-filter: blur(6px); padding: 20px; animation: fadeIn .25s; }
/* 关键：确保 hidden 属性生效，登录弹窗默认隐藏（display:grid 会覆盖 UA 的 [hidden] 规则） */
.modal-mask[hidden], [hidden] { display: none !important; }
.modal { width: 100%; max-width: 420px; border-radius: 24px; padding: 28px; position: relative; }
.modal-close { position: absolute; top: 14px; right: 18px; font-size: 26px; border: none; background: none; cursor: pointer; color: var(--muted); }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 9px; border-radius: 12px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-soft); background: rgba(0,0,0,.05); transition: all .2s; }
.auth-tab.active { background: var(--grad); color: #fff; }
.auth-form .field { margin-bottom: 14px; }
.auth-form label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.auth-msg { font-size: 13px; color: #dc2626; margin-bottom: 10px; min-height: 18px; }

/* ---------------- Toast ---------------- */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 200; background: rgba(20,28,48,.92); color: #fff; padding: 12px 22px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .35s; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(220,38,38,.95); }

/* ---------------- 工具类 ---------------- */
.muted { color: var(--muted); }
body:not([data-theme="light"]) .muted { color: rgba(255,255,255,.6); }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.mt { margin-top: 14px; }
.input-row-right { justify-content: flex-end; }
.spacer { flex: 1; }
a.link { color: var(--blue); cursor: pointer; text-decoration: none; }

/* ---------------- 设置页 ---------------- */
.settings-hero { display: flex; align-items: center; gap: 14px; padding: 8px 4px 18px; }
.settings-hero h1 { font-size: 22px; font-weight: 700; color: var(--ink); }
.settings-hero p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.settings-section { margin-bottom: 22px; }
.settings-section-title { font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-bottom: 12px; letter-spacing: .5px; text-transform: uppercase; }
body:not([data-theme="light"]) .settings-section-title { color: rgba(255,255,255,.85); }
.settings-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; flex-wrap: wrap; }
.settings-row .label { flex: 0 0 110px; font-size: 14px; color: var(--ink); font-weight: 500; }
body:not([data-theme="light"]) .settings-row .label { color: #fff; }
.settings-row .value { font-size: 13px; color: var(--muted); min-width: 60px; text-align: right; }
body:not([data-theme="light"]) .settings-row .value { color: rgba(255,255,255,.65); }
.settings-desc { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
body:not([data-theme="light"]) .settings-desc { color: rgba(255,255,255,.55); }
.settings-slider { flex: 1; min-width: 160px; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; background: rgba(255,255,255,.18); outline: none; }
body[data-theme="light"] .settings-slider { background: rgba(0,0,0,.12); }
.settings-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--grad); cursor: pointer; box-shadow: 0 2px 8px rgba(10,89,247,.4); border: 2px solid #fff; }
.settings-slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--blue); cursor: pointer; border: 2px solid #fff; }
.settings-group { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-group button {
  flex: 1; min-width: 110px; padding: 14px 12px; border-radius: 14px; border: 1.5px solid transparent;
  background: rgba(20,28,48,.5); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .2s;
}
.settings-group button:hover { background: rgba(20,28,48,.5); }
.settings-group button.active {
  border-color: var(--blue); background: linear-gradient(135deg, rgba(10,89,247,.1), rgba(124,77,255,.08));
  color: var(--blue); box-shadow: 0 4px 16px rgba(10,89,247,.18);
}
body[data-theme="light"] .settings-group button { background: rgba(255,255,255,.6); }
body[data-theme="light"] .settings-slider { background: rgba(0,0,0,.18); }
.settings-select { padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(20,28,48,.55); color: #fff; font-size: 14px; font-family: inherit; min-width: 200px; }
body[data-theme="light"] .settings-select { background: rgba(255,255,255,.7); color: var(--ink); border: 1px solid rgba(0,0,0,.1); }
.settings-desc { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.settings-file { display: none; }
.settings-upload {
  padding: 18px; border: 2px dashed rgba(0,0,0,.15); border-radius: 14px; text-align: center; cursor: pointer; color: var(--muted); font-size: 13px; transition: all .2s;
}
.settings-upload:hover { border-color: var(--blue); color: var(--blue); background: rgba(10,89,247,.05); }
.settings-upload-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 10px; margin-top: 10px; }
body[data-theme="light"] body { color: #16213a; }
body[data-theme="light"] .ink-text { color: var(--ink); }

/* ---------------- 动画 ---------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .brand-name { font-size: 18px; }
  .app-main { padding: 16px 12px 70px; }
  .card { padding: 16px; }
  .word-head .word { font-size: 28px; }
  .nat-status em { display: none; }
}

/* ---------------- 词典页（完整字段） ---------------- */
.word-head .phonetic { color: var(--muted); font-size: 14px; margin-left: 6px; font-weight: 500; }
.word-head .phonetic + .phonetic { margin-left: 0; }
.meaning-list { margin: 10px 0; }
.meaning-block { padding: 12px 0; border-bottom: 1px dashed rgba(0,0,0,.06); transition: background .2s; }
.meaning-block:last-child { border-bottom: none; }
.meaning-block .pos-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.meaning-block .pos-chip { background: linear-gradient(135deg, rgba(10,89,247,.14), rgba(124,77,255,.14)); color: var(--blue); padding: 3px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; flex-shrink: 0; border: 1px solid rgba(10,89,247,.18); }
.meaning-block .cn { font-size: 16px; color: var(--ink); font-weight: 500; }
.def-en { color: var(--ink-soft); font-size: 14.5px; font-style: italic; margin: 4px 0 0 60px; line-height: 1.7; border-left: 2px solid rgba(10,89,247,.18); padding-left: 10px; }
.section-title { font-size: 14px; font-weight: 700; color: var(--ink-soft); margin: 18px 0 10px; display: flex; align-items: center; gap: 10px; letter-spacing: 0.3px; }
.section-title::before { content: ""; width: 5px; height: 16px; border-radius: 5px; background: var(--grad); }
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.form-item { display: flex; flex-direction: column; padding: 8px 12px; background: rgba(20,28,48,.5); border-radius: 10px; border: 1px solid rgba(0,0,0,.05); transition: all .2s; }
.form-item:hover { background: rgba(20,28,48,.75); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,40,80,.1); }
.form-label { font-size: 12px; color: var(--muted); }
.form-value { font-size: 14px; color: var(--ink); font-weight: 600; margin-top: 2px; }
.meaning-cn { font-size: 15px; color: var(--ink); line-height: 1.8; padding: 8px 0; }

/* ---------------- 语法错误智能提示 ---------------- */
.grammar-hint { margin-top: 14px; padding: 14px; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); border-radius: 14px; font-size: 14px; line-height: 1.7; color: var(--ink); }
.grammar-hint b { color: var(--ink); font-weight: 600; }
.countdown { font-size: 12px; color: var(--muted); margin-left: auto; font-weight: 500; }
.analysis-block { padding: 4px 0; }
.analysis-block h4 { font-size: 15px; font-weight: 700; color: var(--blue); margin-bottom: 10px; }
.analysis-block .kv { margin-bottom: 8px; line-height: 1.7; }
.analysis-block .kv b { color: var(--ink); font-weight: 600; margin-right: 6px; }
