/* ===== 译界 · 玻璃拟态深色主题 ===== */
:root {
  --bg: #0b1020;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --accent: #6c8cff;
  --accent-2: #a06cff;
  --success: #3ddc97;
  --warn: #ffb454;
  --danger: #ff6b7a;
  --radius: 20px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景光斑 */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; animation: drift 18s ease-in-out infinite alternate; }
.blob-1 { width: 480px; height: 480px; background: #2b4bcc; top: -120px; left: -100px; }
.blob-2 { width: 420px; height: 420px; background: #6a2fb8; bottom: -140px; right: -80px; animation-delay: -6s; }
.blob-3 { width: 300px; height: 300px; background: #0e7a6f; top: 40%; left: 55%; opacity: 0.28; animation-delay: -12s; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.12); } }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  padding: 22px clamp(16px, 5vw, 56px) 0;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon {
  font-size: 34px; width: 58px; height: 58px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(108,140,255,.25), rgba(160,108,255,.25));
  border: 1px solid var(--card-border); border-radius: 16px;
}
.brand h1 {
  font-size: 26px; letter-spacing: 2px;
  background: linear-gradient(90deg, #cdd9ff, #e6ccff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand p { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

.tabs { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--card-border); padding: 6px; border-radius: 999px; backdrop-filter: blur(14px); }
.tab {
  border: none; background: transparent; color: var(--text-dim); font-size: 14.5px;
  padding: 9px 22px; border-radius: 999px; cursor: pointer; transition: all .25s; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 18px rgba(108,140,255,.4); }

/* 主容器 */
.container { max-width: 1080px; margin: 26px auto 0; padding: 0 clamp(14px, 4vw, 32px) 40px; }
.panel { display: none; animation: fadeUp .35s ease; }
.panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 语言选择条 */
.lang-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.lang-select { flex: 1; position: relative; }
.lang-select select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 14px;
  color: var(--text); font-size: 15px; padding: 13px 16px; cursor: pointer; backdrop-filter: blur(14px);
  font-family: inherit; transition: border-color .2s;
}
.lang-select select:hover, .lang-select select:focus { border-color: var(--accent); outline: none; }
.lang-select::after { content: "▾"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.swap-btn {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--card-border); background: var(--card); color: var(--text);
  font-size: 20px; cursor: pointer; backdrop-filter: blur(14px); transition: all .25s;
}
.swap-btn:hover { transform: rotate(180deg); border-color: var(--accent); }

/* 翻译双栏 */
.translate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pane {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 300px;
}
.input-pane textarea {
  flex: 1; resize: none; border: none; background: transparent; color: var(--text);
  font-size: 16.5px; line-height: 1.75; padding: 20px; font-family: inherit; outline: none;
}
.input-pane textarea::placeholder { color: var(--text-dim); }
.output-text { flex: 1; padding: 20px; font-size: 16.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; overflow-y: auto; }
.output-text:empty::before { content: attr(data-placeholder); color: var(--text-dim); }

.pane-footer { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--card-border); min-height: 52px; }
.pane-footer .char-count { margin-left: auto; font-size: 12.5px; color: var(--text-dim); }

.ghost-btn {
  border: 1px solid var(--card-border); background: transparent; color: var(--text-dim);
  padding: 7px 16px; border-radius: 10px; font-size: 13px; cursor: pointer; transition: all .2s; font-family: inherit;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }
.ghost-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.engine-badge, .term-badge {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: rgba(108,140,255,.16); color: #b9c8ff; border: 1px solid rgba(108,140,255,.3);
}
.term-badge { background: rgba(61,220,151,.12); color: #8ff0c6; border-color: rgba(61,220,151,.3); }

.offline-tip { padding: 20px; color: var(--warn); font-size: 14px; }

/* 加载动画 */
.loader { display: flex; gap: 7px; padding: 22px; }
.loader span { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; }
.loader span:nth-child(2) { animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-8px); opacity: 1; } }
.hidden { display: none !important; }

/* 术语提示 */
.term-hints { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.term-hint {
  font-size: 12.5px; padding: 6px 12px; border-radius: 10px;
  background: rgba(61,220,151,.1); border: 1px solid rgba(61,220,151,.25); color: #a8ecd2;
}
.term-hint b { color: #d4ffe9; font-weight: 600; }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  backdrop-filter: blur(14px); box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px;
}
.card h2 { font-size: 17px; margin-bottom: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 0; }
.muted { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; }
.muted code { background: rgba(255,255,255,.08); padding: 2px 7px; border-radius: 6px; font-size: 12.5px; }

/* 表单 */
input, textarea, select {
  background: rgba(255,255,255,.05); border: 1px solid var(--card-border); border-radius: 12px;
  color: var(--text); font-size: 14px; padding: 12px 14px; font-family: inherit; outline: none; transition: border-color .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select option { background: #141a30; color: var(--text); }
textarea { width: 100%; min-height: 110px; resize: vertical; line-height: 1.6; margin: 10px 0; }

.term-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.term-form input, .term-form select { width: 100%; }
.term-form .primary-btn { grid-column: -1; }

.primary-btn {
  border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 14px; font-weight: 600; padding: 11px 24px; border-radius: 12px;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.primary-btn:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(108,140,255,.4); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.row-end { display: flex; justify-content: flex-end; }

/* 术语列表 */
.term-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.term-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: rgba(255,255,255,.04); border: 1px solid var(--card-border); border-radius: 12px; font-size: 14px;
}
.term-item .pair { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-item .pair .arrow { color: var(--accent); margin: 0 8px; }
.term-item .domain { font-size: 11.5px; color: var(--text-dim); background: rgba(255,255,255,.06); padding: 3px 9px; border-radius: 999px; flex-shrink: 0; }
.term-item .origin { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.term-item .del {
  border: none; background: transparent; color: var(--text-dim); font-size: 16px; cursor: pointer;
  padding: 4px 8px; border-radius: 8px; transition: all .2s; flex-shrink: 0;
}
.term-item .del:hover { color: var(--danger); background: rgba(255,107,122,.12); }
.empty { text-align: center; color: var(--text-dim); padding: 36px 0; font-size: 14px; }

/* 历史 */
.history-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; max-height: 560px; overflow-y: auto; }
.history-item { background: rgba(255,255,255,.04); border: 1px solid var(--card-border); border-radius: 12px; padding: 14px 18px; cursor: pointer; transition: border-color .2s; }
.history-item:hover { border-color: var(--accent); }
.history-item .meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; flex-wrap: wrap; }
.history-item .src { font-size: 13.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .dst { font-size: 15px; margin-top: 6px; }

/* 状态页 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  backdrop-filter: blur(14px); padding: 22px; text-align: center;
}
.stat-num { font-size: 30px; font-weight: 700; background: linear-gradient(90deg, #b9c8ff, #e0c8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }

.engine-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.engine-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; background: rgba(255,255,255,.04); border: 1px solid var(--card-border); border-radius: 12px; font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 9px; }
.dot.ok { background: var(--success); box-shadow: 0 0 10px rgba(61,220,151,.7); }
.dot.bad { background: var(--danger); box-shadow: 0 0 10px rgba(255,107,122,.7); }

.sync-result { margin-top: 14px; padding: 16px; background: rgba(61,220,151,.07); border: 1px solid rgba(61,220,151,.25); border-radius: 12px; font-size: 13.5px; line-height: 1.9; }

/* ===== 语音 ===== */
.mic-btn {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--card-border); background: linear-gradient(135deg, rgba(108,140,255,.25), rgba(160,108,255,.25));
  color: var(--text); font-size: 17px; cursor: pointer; transition: all .2s;
}
.mic-btn:hover { border-color: var(--accent); transform: scale(1.08); }
.mic-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.mic-btn.recording {
  background: linear-gradient(135deg, #ff6b7a, #ff9060);
  border-color: transparent; color: #fff;
  animation: micPulse 1.4s ease-out infinite;
}
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,107,122,.55); }
  70% { box-shadow: 0 0 0 14px rgba(255,107,122,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,107,122,0); }
}

.voice-bar {
  margin-top: 14px; display: flex; align-items: center; gap: 12px;
  background: rgba(255,107,122,.08); border: 1px solid rgba(255,107,122,.3);
  border-radius: 14px; padding: 12px 18px; font-size: 14px; color: #ffd9de;
}
.voice-bar .pulse-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #ff6b7a; flex-shrink: 0;
  animation: micPulse 1.4s ease-out infinite;
}
.voice-bar .interim { color: var(--text-dim); font-style: italic; }

.toggle-btn {
  border: 1px solid var(--card-border); background: transparent; color: var(--text-dim);
  padding: 7px 16px; border-radius: 10px; font-size: 13px; cursor: pointer; transition: all .2s; font-family: inherit;
  margin-left: auto;
}
.toggle-btn.on {
  background: rgba(61,220,151,.12); border-color: rgba(61,220,151,.4); color: #8ff0c6;
}
.pane-footer .term-badge, .pane-footer .engine-badge { margin-left: 0; }

/* 提示气泡 */
.toast {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 26, 48, .95); border: 1px solid var(--card-border); color: var(--text);
  padding: 12px 26px; border-radius: 999px; font-size: 14px; z-index: 99;
  box-shadow: var(--shadow); animation: fadeUp .3s ease;
}

.footer { text-align: center; color: var(--text-dim); font-size: 12px; padding: 8px 0 28px; }

/* 响应式 */
@media (max-width: 760px) {
  .translate-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .term-form { grid-template-columns: 1fr; }
  .topbar { justify-content: center; }
  .lang-bar { flex-wrap: wrap; }
  .swap-btn { order: 3; width: 100%; border-radius: 12px; }
}
