/* SWZ EDUCATION 单词听写 — 浅色主题 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --cream: #faf8f3;
  --cream-200: #efe9dd;
  --navy-800: #1f2a44;
  --navy-900: #16203a;
  --navy-400: #7c8aa5;
  --gold-500: #c9a84c;
  --gold-600: #b8963a;
  --gold-50: #faf5e8;
  --green: #2e8b57;
  --red: #c0392b;
  --radius: 14px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--cream);
  color: var(--navy-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
.container { max-width: 720px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* Header */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--cream-200);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
.brand { display: flex; flex-direction: column; }
.brand-mark { font-size: 15px; font-weight: 800; letter-spacing: 0.08em; color: var(--navy-800); }
.brand-sub { font-size: 11px; color: var(--navy-400); letter-spacing: 0.05em; }

.tabs { display: flex; gap: 4px; background: var(--cream); padding: 4px; border-radius: 10px; }
.tab-btn {
  border: none; background: transparent; padding: 8px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--navy-400); cursor: pointer; transition: all .15s;
}
.tab-btn.active { background: #fff; color: var(--navy-900); box-shadow: 0 1px 4px rgba(22,32,58,.12); }

main { flex: 1; padding: 20px 0 40px; }

.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--cream-200); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(22,32,58,.04);
}
.card-title { font-size: 17px; font-weight: 700; color: var(--navy-800); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

/* Segmented control */
.seg { display: flex; background: var(--cream); border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 10px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--navy-400); cursor: pointer;
}
.seg-btn.active { background: #fff; color: var(--navy-900); box-shadow: 0 1px 4px rgba(22,32,58,.12); }
.src-pane { display: none; }
.src-pane.active { display: block; }

/* Inputs */
textarea, .text-input, .num-input, select, .answer-input {
  width: 100%; border: 1.5px solid var(--cream-200); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; color: var(--navy-900);
  background: #fff; outline: none; transition: border-color .15s;
}
textarea:focus, .text-input:focus, .num-input:focus, select:focus, .answer-input:focus { border-color: var(--gold-500); }
textarea { resize: vertical; }
select { width: auto; min-width: 120px; cursor: pointer; }
.num-input { width: 90px; }

.row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.row.center { justify-content: center; }
.lbl { font-size: 14px; font-weight: 600; color: var(--navy-800); }
.hint { font-size: 12.5px; color: var(--navy-400); }
.hint.warn { color: var(--red); }
.hint-list { font-size: 13px; color: var(--navy-400); margin: 6px 0 10px 18px; }
.hint-list li { margin-bottom: 3px; }
code { background: var(--cream); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* Buttons */
.btn {
  border: none; border-radius: 10px; padding: 10px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn.primary { background: var(--navy-800); color: #fff; }
.btn.primary:hover { background: var(--navy-900); }
.btn.ghost { background: var(--cream); color: var(--navy-800); border: 1px solid var(--cream-200); }
.btn.ghost:hover { border-color: var(--gold-500); color: var(--gold-600); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 16px; }
.file-btn { display: inline-block; }
.import-msg { margin-top: 10px; font-size: 13px; }
.import-msg.ok { color: var(--green); }
.import-msg.err { color: var(--red); }

/* Mode cards */
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.mode-card {
  border: 1.5px solid var(--cream-200); border-radius: 12px; padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  text-align: center; transition: all .15s; background: #fff;
}
.mode-card:hover { border-color: var(--gold-500); }
.mode-card input { display: none; }
.mode-card:has(input:checked) { border-color: var(--gold-500); background: var(--gold-50); box-shadow: 0 0 0 2px var(--gold-500); }
.mode-emoji { font-size: 24px; }
.mode-name { font-size: 14px; font-weight: 700; color: var(--navy-800); }
.mode-desc { font-size: 11.5px; color: var(--navy-400); }

/* Settings */
.settings { display: flex; flex-direction: column; gap: 4px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px dashed var(--cream-200);
  font-size: 14.5px; color: var(--navy-800); cursor: pointer;
}
.setting-row:last-child { border-bottom: none; }
.setting-row input[type="checkbox"] {
  width: 20px; height: 20px; accent-color: var(--gold-500); cursor: pointer;
}

/* Dictation */
.progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.progress-bar { flex: 1; height: 8px; background: var(--cream-200); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-600)); border-radius: 99px; transition: width .3s ease; width: 0; }
.progress-text { font-size: 13px; font-weight: 700; color: var(--navy-800); min-width: 60px; text-align: right; }

.dict-card { text-align: center; }
.dict-prompt { padding: 24px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 120px; }
.play-btn {
  width: 88px; height: 88px; border-radius: 50%; border: none; font-size: 38px;
  background: var(--navy-800); color: #fff; cursor: pointer; transition: all .15s;
  box-shadow: 0 4px 14px rgba(22,32,58,.25);
}
.play-btn:hover { transform: scale(1.06); background: var(--navy-900); }
.play-btn:active { transform: scale(.95); }
.play-btn.playing { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(201,168,76,.5); } 50% { box-shadow: 0 0 0 14px rgba(201,168,76,0); } }
.dict-prompt-text { font-size: 15px; color: var(--navy-800); font-weight: 600; }

.answer-input {
  font-size: 22px; text-align: center; padding: 14px; margin: 14px 0 6px; letter-spacing: .03em;
}
.hint-btn { font-size: 13px; padding: 6px 16px; }
.feedback { min-height: 40px; margin-top: 8px; font-size: 15px; }
.feedback.correct { color: var(--green); }
.feedback.wrong { color: var(--red); }
.feedback .fb-word { font-size: 22px; font-weight: 800; }
.feedback .fb-detail { font-size: 13px; color: var(--navy-400); margin-top: 2px; }

/* Result */
.result-card { text-align: center; }
.result-title { font-size: 22px; font-weight: 800; color: var(--navy-800); }
.result-score { font-size: 52px; font-weight: 900; color: var(--gold-600); margin: 8px 0 2px; }
.result-pct { font-size: 16px; color: var(--navy-400); margin-bottom: 18px; }
.result-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; margin-bottom: 8px; }
.result-col { background: var(--cream); border-radius: 12px; padding: 14px; max-height: 300px; overflow-y: auto; }
.result-col h3 { font-size: 14px; margin-bottom: 8px; color: var(--navy-800); }
.result-col ul { list-style: none; font-size: 13.5px; }
.result-col li { padding: 5px 0; border-bottom: 1px dashed var(--cream-200); display: flex; justify-content: space-between; gap: 8px; }
.result-col li:last-child { border-bottom: none; }
.result-col li .w { font-weight: 700; color: var(--navy-900); }
.result-col li .m { color: var(--navy-400); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

/* Dict list */
.dict-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--cream-200); border-radius: 12px; margin-bottom: 8px;
  background: var(--cream);
}
.dict-item .d-name { font-weight: 700; color: var(--navy-800); font-size: 14.5px; }
.dict-item .d-meta { font-size: 12px; color: var(--navy-400); margin-top: 2px; }
.dict-item .d-actions { display: flex; gap: 8px; }
.dict-item .btn { padding: 6px 14px; font-size: 13px; }
.empty-tip { color: var(--navy-400); font-size: 13.5px; padding: 10px 0; }

/* Lookup */
.lookup-input { flex: 1; font-size: 17px; padding: 12px; }
.lookup-result { margin-top: 16px; }
.lookup-card {
  border: 1px solid var(--cream-200); border-radius: 12px; padding: 18px;
  background: var(--gold-50); border-color: var(--gold-500);
}
.lookup-card .lw { font-size: 30px; font-weight: 900; color: var(--navy-900); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lookup-card .lw .play-sm {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--navy-800);
  color: #fff; font-size: 15px; cursor: pointer; flex-shrink: 0;
}
.lookup-card .lp { font-size: 14px; color: var(--navy-400); margin: 4px 0 10px; }
.lookup-card .lm { font-size: 16px; color: var(--navy-800); line-height: 1.7; }
.lookup-card .ls { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--gold-500); font-size: 14.5px; color: var(--navy-800); font-style: italic; }
.lookup-empty { color: var(--navy-400); font-size: 14px; padding: 14px 0; text-align: center; }
.lookup-notfound { color: var(--red); font-size: 14px; padding: 14px 0; text-align: center; }
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-bottom: 1px dashed var(--cream-200); font-size: 14px; cursor: pointer;
}
.history-item:hover { background: var(--cream); }
.history-item .hw { font-weight: 700; color: var(--navy-900); }
.history-item .hm { color: var(--navy-400); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

.footer { padding: 18px 0; text-align: center; font-size: 12px; color: var(--navy-400); border-top: 1px solid var(--cream-200); background: #fff; }

@media (max-width: 560px) {
  .mode-grid { grid-template-columns: 1fr; }
  .result-detail { grid-template-columns: 1fr; }
  .topbar-inner { flex-direction: column; }
}
