/* ===== 语文翻译器 · 古典中国风样式 ===== */
:root {
  --paper: #faf6ee;
  --card: #fffdf7;
  --ink: #2b2620;
  --ink-light: #6b5f4f;
  --seal-red: #b03a2e;
  --accent: #8c3b2e;
  --gold: #b98a2f;
  --border: #e5dcc8;
  --shadow: 0 4px 18px rgba(90, 70, 40, 0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(185, 138, 47, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(176, 58, 46, 0.05), transparent 50%);
  color: var(--ink);
  min-height: 100vh;
}

.bg-decor {
  position: fixed;
  right: -60px;
  bottom: -80px;
  font-size: 420px;
  color: rgba(140, 59, 46, 0.04);
  pointer-events: none;
  user-select: none;
  font-weight: bold;
  z-index: 0;
}

.hidden { display: none !important; }

/* ===== 头部 ===== */
.header {
  text-align: center;
  padding: 44px 20px 26px;
  position: relative;
  z-index: 1;
}
.header h1 {
  font-size: 40px;
  letter-spacing: 8px;
  color: var(--accent);
  font-weight: 700;
  text-shadow: 1px 2px 0 rgba(185, 138, 47, 0.15);
}
.subtitle {
  margin-top: 10px;
  color: var(--ink-light);
  font-size: 15px;
  letter-spacing: 2px;
}
.settings-btn {
  position: absolute;
  top: 24px;
  right: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-light);
  font-family: inherit;
  transition: all .2s;
  box-shadow: var(--shadow);
}
.settings-btn:hover { border-color: var(--gold); color: var(--accent); }

/* ===== 布局 ===== */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 60px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 12px 0 0 12px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
  opacity: .55;
}

.card-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 印章风格标题装饰 */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 17px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
  flex-shrink: 0;
}
.seal-green  { background: #4a7c59; }
.seal-blue   { background: #3a6b8c; }
.seal-orange { background: #c07a2e; }
.seal-purple { background: #6b4a8c; }
.seal-red    { background: var(--seal-red); }

/* ===== 输入区 ===== */
textarea {
  width: 100%;
  border: 1px dashed var(--gold);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 17px;
  font-family: inherit;
  line-height: 1.9;
  background: #fffef9;
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border .2s, box-shadow .2s;
}
textarea:focus {
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(185, 138, 47, 0.15);
}
textarea::placeholder { color: #b8ab93; }

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.examples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.examples-label { color: var(--ink-light); font-size: 13px; }
.example-chip {
  background: #f4ecdb;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-light);
  transition: all .2s;
}
.example-chip:hover { background: #ecdfc2; color: var(--accent); border-color: var(--gold); }

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #a04a38);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 11px 30px;
  font-size: 16px;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 12px rgba(140, 59, 46, 0.3);
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(140, 59, 46, 0.4); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ===== 加载动画（墨滴） ===== */
.loading { text-align: center; padding: 34px 0; color: var(--ink-light); }
.ink-loader {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  border-radius: 50% 50% 50% 8px;
  background: radial-gradient(circle at 35% 35%, #555, #1a1a1a);
  animation: drop 1.1s ease-in-out infinite;
}
@keyframes drop {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: .9; }
  50% { transform: translateY(-16px) rotate(20deg) scale(.85); opacity: .6; }
}

/* ===== 错误 ===== */
.error-card { border-color: #e0b4ae; }
.error-card p { color: var(--seal-red); line-height: 1.8; }

/* ===== 出处 ===== */
.source-info { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.source-tag {
  background: #f4ecdb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 15px;
}
.source-tag b { color: var(--accent); font-size: 17px; }
.full-text-wrap {
  margin-top: 18px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.full-text-label { font-size: 14px; color: var(--ink-light); margin-bottom: 8px; }
.full-text {
  line-height: 2.1;
  font-size: 16.5px;
  background: #fbf7ec;
  border-radius: 8px;
  padding: 14px 18px;
  white-space: pre-wrap;
}

/* ===== 拼音 ===== */
.pinyin-box {
  background: #fbf7ec;
  border-radius: 8px;
  padding: 16px 18px;
  line-height: 2.4;
  font-size: 16px;
  white-space: pre-wrap;
  color: #3a6b8c;
  font-family: "KaiTi", "STKaiti", "Noto Serif SC", serif;
  letter-spacing: 1px;
}

/* ===== 翻译 ===== */
.translation-box {
  line-height: 2.1;
  font-size: 16.5px;
  white-space: pre-wrap;
}

/* ===== 重点字词 ===== */
.keywords-box { display: flex; flex-direction: column; gap: 10px; }
.keyword-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: #fbf7ec;
  border-radius: 8px;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.keyword-word {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
}
.keyword-pinyin { color: #3a6b8c; font-size: 14px; }
.keyword-meaning { color: var(--ink); font-size: 15px; flex: 1; min-width: 200px; }

/* ===== 知识讲解 ===== */
.summary-box {
  background: linear-gradient(135deg, #f7efdd, #f4ecdb);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 15.5px;
  color: var(--ink-light);
  line-height: 1.8;
}
.knowledge-box { padding-left: 22px; }
.knowledge-box li {
  line-height: 2;
  font-size: 15.5px;
  margin-bottom: 10px;
  padding-left: 6px;
}
.knowledge-box li::marker { color: var(--gold); font-weight: bold; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--card);
  border-radius: 14px;
  width: 92%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; letter-spacing: 1px; }
.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--ink-light);
  line-height: 1;
}
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 22px; text-align: right; }

.form-item { margin-bottom: 18px; }
.form-item label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--ink-light); }
.form-item input, .form-item select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fffef9;
  outline: none;
  transition: border .2s;
}
.form-item input:focus, .form-item select:focus { border-color: var(--gold); }
.form-tip { font-size: 12px; color: #a89b82; margin-top: 6px; }
.form-tip a { color: var(--accent); }
.key-status { font-size: 12px; }
.key-status.ok { color: #4a7c59; }
.key-status.missing { color: var(--seal-red); }

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 26px;
  color: #a89b82;
  font-size: 13px;
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
}

/* ===== 移动端 ===== */
@media (max-width: 640px) {
  .header h1 { font-size: 30px; letter-spacing: 4px; }
  .settings-btn { top: 14px; right: 14px; padding: 5px 12px; font-size: 13px; }
  .card { padding: 18px; }
  .input-actions { flex-direction: column; align-items: stretch; }
  .primary-btn { width: 100%; }
}
