/* Shadowing APP — 手機優先，乾淨不花俏 */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #767676;
  --line: #e3e3e3;
  --card: #f7f7f8;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --star: #d97706;
  --danger: #dc2626;
  --ok: #16a34a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --fg: #ececec;
    --muted: #9a9a9a;
    --line: #333333;
    --card: #1f1f1f;
    --accent: #5b8def;
    --accent-fg: #101010;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Noto Sans TC", -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 90px;
}

/* ---------- 通用 ---------- */
header.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
header.topbar h1 { font-size: 1.05rem; font-weight: 700; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.back { text-decoration: none; color: var(--accent); font-size: 1.3rem; padding: 4px 8px; }
.muted { color: var(--muted); font-size: .85rem; }
.hidden { display: none !important; }

nav.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom)); z-index: 20;
}
nav.tabbar a {
  text-decoration: none; color: var(--muted); font-size: .78rem;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px;
}
nav.tabbar a .ico { font-size: 1.25rem; }
nav.tabbar a.active { color: var(--accent); font-weight: 600; }

button {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--fg);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; min-height: 44px;
}
button:active { transform: scale(.97); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.small { min-height: 36px; padding: 6px 10px; font-size: .85rem; }
button.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 20px;
  font-size: .85rem; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 50;
  max-width: 90%; text-align: center;
}
.toast.show { opacity: .92; }

/* ---------- 首頁片單 ---------- */
.langfilter { display: flex; gap: 8px; padding: 12px 0; }
.clip {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  background: var(--card);
}
.clip .t { font-weight: 600; }
.clip .m { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.emptymsg { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- 練習頁 ---------- */
.progress { display: flex; align-items: center; gap: 8px; padding: 10px 0 4px; }
.progress .bar { flex: 1; height: 6px; background: var(--card); border-radius: 3px; overflow: hidden; }
.progress .bar > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.progress .num { font-size: .8rem; color: var(--muted); white-space: nowrap; }

.sentcard {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 20px 16px; margin: 8px 0; min-height: 170px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px; text-align: center;
}
.sentcard .text { font-size: 1.45rem; font-weight: 600; line-height: 1.5; }
.sentcard .text .w { border-radius: 6px; padding: 0 2px; cursor: pointer; }
.sentcard .text .w.saved { color: var(--accent); text-decoration: underline dotted; }
.sentcard .notes { color: var(--star); font-size: .95rem; }
.sentcard .trans { color: var(--muted); font-size: 1rem; }
.sentcard .trans.masked { filter: blur(6px); cursor: pointer; }

.wordpop {
  position: fixed; left: 16px; right: 16px; bottom: 90px; z-index: 40;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.wordpop .w { font-size: 1.2rem; font-weight: 700; }
.wordpop .g { color: var(--muted); margin: 4px 0 10px; }
.wordpop .row { display: flex; gap: 8px; }
.wordpop .row button { flex: 1; }

.ctrl { display: flex; gap: 8px; margin: 10px 0; align-items: center; }
.ctrl.wrap { flex-wrap: wrap; }
.ctrl .grow { flex: 1; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: 1; }
.seg button { flex: 1; border: 0; border-radius: 0; background: var(--bg); min-height: 40px; font-size: .85rem; }
.seg button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.seg .label { display: flex; align-items: center; padding: 0 10px; font-size: .78rem; color: var(--muted); background: var(--card); }

.navrow { display: flex; gap: 10px; margin-top: 6px; }
.navrow button { flex: 1; }
.navrow button.play { flex: 2; font-size: 1.05rem; }

/* ---------- 生詞本／紀錄 ---------- */
.vocab-item, .hist-item {
  border-bottom: 1px solid var(--line); padding: 12px 2px;
}
.vocab-item .w { font-weight: 700; font-size: 1.1rem; }
.vocab-item .g { color: var(--fg); font-size: .9rem; }
.vocab-item .src { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.vocab-item .rowend { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.linklike { background: none; border: none; color: var(--danger); min-height: 32px; font-size: .8rem; }
.toolbar { display: flex; gap: 8px; padding: 12px 0; flex-wrap: wrap; }
