:root {
  --bg: #f5f5f7; --surface: #fff; --card-a: #4a5ee0; --card-b: #6c5ce7;
  --card-back-a: #2d8a6e; --card-back-b: #27ae60;
  --text: #1a1a2e; --text-dim: #888; --accent: #4a5ee0;
  --nav-bg: #fff; --nav-border: #e0e0e0;
  --chip-bg: #eee; --item-bg: #fff;
  --search-bg: #fff; --search-border: #ddd;
  --arrow-bg: rgba(0,0,0,0.06); --arrow-color: #333;
  --surface-rgb: 255,255,255; --surface-alpha: 1;
  --item-rgb: 255,255,255; --nav-rgb: 255,255,255;
  --panel-shadow: 0 1px 3px rgba(0,0,0,.05);
  --card-shadow: 0 4px 20px rgba(0,0,0,.12);
  --glass-blur: 0px; --body-overlay: none;
}
[data-theme="dark"] {
  --bg: #1a1a2e; --surface: #16213e; --card-a: #0f3460; --card-b: #533483;
  --card-back-a: #1b4332; --card-back-b: #2d6a4f;
  --text: #eee; --text-dim: #999; --accent: #e94560;
  --nav-bg: #16213e; --nav-border: #333;
  --chip-bg: #16213e; --item-bg: #16213e;
  --search-bg: #16213e; --search-border: #333;
  --arrow-bg: rgba(255,255,255,0.1); --arrow-color: #eee;
  --surface-rgb: 22,33,62; --surface-alpha: 1;
  --item-rgb: 22,33,62; --nav-rgb: 22,33,62;
  --panel-shadow: 0 1px 3px rgba(0,0,0,.28);
  --card-shadow: 0 4px 20px rgba(0,0,0,.24);
}
[data-theme="glass"] {
  --bg: #dfe9f3; --surface: rgba(255,255,255,.48);
  --card-a: #5a7cff; --card-b: #9b6df5;
  --card-back-a: #1d9a8a; --card-back-b: #4fac73;
  --text: #182033; --text-dim: #667085; --accent: #5268f2;
  --nav-bg: rgba(255,255,255,.54); --nav-border: rgba(255,255,255,.42);
  --chip-bg: rgba(255,255,255,.42); --item-bg: rgba(255,255,255,.48);
  --search-bg: rgba(255,255,255,.46); --search-border: rgba(255,255,255,.5);
  --arrow-bg: rgba(255,255,255,.48); --arrow-color: #263044;
  --surface-rgb: 255,255,255; --surface-alpha: .48;
  --item-rgb: 255,255,255; --nav-rgb: 255,255,255;
  --panel-shadow: 0 18px 50px rgba(75,94,135,.2);
  --card-shadow: 0 18px 45px rgba(43,58,101,.22);
  --glass-blur: 18px;
  --body-overlay:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.9), transparent 28%),
    radial-gradient(circle at 84% 4%, rgba(130,180,255,.5), transparent 26%),
    linear-gradient(135deg, rgba(255,255,255,.72), rgba(182,213,255,.36) 48%, rgba(246,226,255,.42));
}
[data-theme="pop"] {
  --bg: #fff7d7; --surface: #fffef6;
  --card-a: #ff4f9a; --card-b: #6c63ff;
  --card-back-a: #00b894; --card-back-b: #00c2ff;
  --text: #221833; --text-dim: #6d5f7a; --accent: #ff3d8d;
  --nav-bg: rgba(255,254,246,.92); --nav-border: rgba(255,61,141,.22);
  --chip-bg: #ffe66d; --item-bg: #fffef6;
  --search-bg: #fffef6; --search-border: rgba(255,61,141,.24);
  --arrow-bg: rgba(255,61,141,.14); --arrow-color: #ff3d8d;
  --surface-rgb: 255,254,246; --surface-alpha: 1;
  --item-rgb: 255,254,246; --nav-rgb: 255,254,246;
  --panel-shadow: 0 12px 26px rgba(255,61,141,.12), 0 4px 12px rgba(0,194,255,.08);
  --card-shadow: 0 18px 44px rgba(255,61,141,.28);
  --glass-blur: 10px;
  --body-overlay:
    radial-gradient(circle at 12% 10%, rgba(255,230,109,.9), transparent 24%),
    radial-gradient(circle at 88% 12%, rgba(0,194,255,.42), transparent 24%),
    radial-gradient(circle at 80% 78%, rgba(255,79,154,.28), transparent 26%),
    linear-gradient(135deg, rgba(255,247,215,.95), rgba(231,255,248,.82) 48%, rgba(255,234,248,.9));
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--body-overlay), var(--bg); color: var(--text);
  background-attachment: fixed;
  min-height: 100vh; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent; transition: background .3s, color .3s;
}
.nav {
  display:flex; justify-content:space-around;
  position:fixed; bottom:0; left:0; right:0;
  background:var(--nav-bg); padding:8px 0;
  padding-bottom:max(8px,env(safe-area-inset-bottom));
  border-top:1px solid var(--nav-border); z-index:100;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.nav-btn {
  background:none; border:none; color:var(--text-dim);
  font-size:11px; display:flex; flex-direction:column;
  align-items:center; gap:2px; cursor:pointer; padding:4px 12px;
}
.nav-btn.active { color:var(--accent); }
.nav-btn svg { width:22px; height:22px; }
.screen { display:none; padding:20px; padding-bottom:80px; }
.screen.active { display:block; }
.home-header { text-align:center; padding:30px 0 16px; }
.home-header h1 { font-size:28px; font-weight:300; }
.home-header .sub { color:var(--text-dim); margin-top:4px; font-size:14px; }
.dictionary-header h1 { font-size:32px; font-weight:700; }
.landing-shell,
.words-shell { max-width:420px; margin:0 auto; }
.landing-shell { max-width:620px; padding-top:34px; }
.global-view { display:none; }
.global-view.active { display:block; }
.deck-picker { margin:16px 0; }
.deck-picker-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:12px;
}
.source-control-grid {
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  margin-top:12px;
}
.source-control-grid.is-hidden {
  display:none;
}
.source-summary-row {
  width:100%;
  border:1px solid var(--search-border);
  border-radius:14px;
  background:rgba(var(--surface-rgb),var(--surface-alpha));
  color:var(--text);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:10px 0 0;
  padding:12px 14px;
  text-align:left;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.source-summary-label,
.source-summary-meta {
  color:var(--text-dim);
  display:block;
  font-size:12px;
  line-height:1.45;
}
.source-summary-label {
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:700;
}
.source-summary-title {
  display:block;
  font-size:16px;
  font-weight:800;
  line-height:1.4;
  margin-top:2px;
}
.source-open-btn {
  align-items:center;
  background:var(--accent);
  border:none;
  border-radius:999px;
  color:white;
  cursor:pointer;
  display:flex;
  flex:0 0 auto;
  font-size:16px;
  font-weight:800;
  height:38px;
  justify-content:center;
  min-width:46px;
  padding:0 14px;
  transition:transform .1s;
}
.source-open-btn:active {
  transform:scale(.97);
}
.source-control-block {
  display:flex;
  flex-direction:column;
  gap:8px;
}
.source-book-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(132px,1fr));
  gap:8px;
}
.source-book-chip {
  border:none;
  border-radius:999px;
  background:var(--chip-bg);
  color:var(--text-dim);
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  min-height:38px;
  padding:8px 12px;
  text-align:center;
  transition:background .2s,color .2s,border-color .2s,transform .1s;
}
.source-book-chip.active {
  background:var(--accent);
  color:white;
}
.source-book-chip:active {
  transform:scale(.98);
}
.picker-field {
  background:var(--surface);
  border:1px solid var(--search-border);
  border-radius:12px;
  padding:10px 12px;
  box-shadow:var(--panel-shadow);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.picker-label {
  font-size:11px;
  color:var(--text-dim);
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-bottom:6px;
}
.deck-picker select {
  width:100%; padding:6px 0; border-radius:10px;
  background:transparent; color:var(--text);
  border:none; font-size:15px;
}
.mode-toggle { display:flex; justify-content:center; gap:8px; margin:16px 0; }
.quick-start-panel {
  margin:24px 0 34px;
}
.quick-start-toggle {
  margin:0 0 16px;
}
.quick-start-btn {
  margin-top:0;
}
.quick-view-btn {
  margin-top:16px;
}
.quick-start-panel + .study-mode-card {
  margin-top:4px;
}
.mode-chip {
  padding:8px 18px; border-radius:20px; border:none;
  font-size:14px; cursor:pointer;
  background:var(--chip-bg); color:var(--text-dim); transition:all .2s;
}
.mode-chip.active { background:var(--accent); color:white; }
.start-btn {
  display:block; width:100%; max-width:300px; margin:16px auto;
  padding:16px; background:var(--accent); color:white;
  border:none; border-radius:12px; font-size:18px; font-weight:600; cursor:pointer;
}
.secondary-btn {
  display:block; margin:10px auto 0;
  padding:11px 16px; background:var(--surface); color:var(--accent);
  border:1px solid var(--search-border); border-radius:999px;
  font-size:14px; font-weight:600; cursor:pointer;
}
.inline-secondary {
  display:inline-flex;
  width:auto;
  margin:0;
  align-items:center;
  justify-content:center;
}
.home-dictionary-panel {
  display:flex;
  flex-direction:column;
  gap:12px;
}
.search-suggest-wrap {
  position:relative;
}
.home-search {
  margin-bottom:0;
  padding:14px 16px;
  border-radius:14px;
  font-size:16px;
  transition:border-radius .16s,border-color .16s,box-shadow .16s;
}
.search-suggest-wrap.has-suggestions .home-search {
  border-color:var(--accent);
  border-bottom-left-radius:0;
  border-bottom-right-radius:0;
  box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 12%, transparent);
}
.suggestion-list {
  display:none;
  margin-top:-1px;
  background:var(--surface);
  border:1px solid var(--accent);
  border-top:none;
  border-radius:0 0 14px 14px;
  box-shadow:var(--card-shadow);
  overflow:hidden;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.suggestion-list.show {
  display:block;
}
.suggestion-item {
  width:100%;
  border:none;
  border-bottom:1px solid var(--nav-border);
  background:transparent;
  color:var(--text);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  text-align:left;
}
.suggestion-item:last-child { border-bottom:none; }
.suggestion-item:hover,
.suggestion-item:active { background:var(--chip-bg); }
.suggestion-fr {
  font-size:16px;
  font-weight:700;
  line-height:1.3;
}
.suggestion-meta {
  color:var(--text-dim);
  flex:0 0 auto;
  font-size:12px;
}
.home-action-row,
.type-chip-row,
.study-mode-row {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.home-action-row {
  justify-content:center;
}
.list-type-chip-row {
  margin:0 0 12px;
}
.type-chip,
.study-mode-chip,
.study-scope-chip,
.unit-chip {
  border:none;
  border-radius:999px;
  background:var(--chip-bg);
  color:var(--text-dim);
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  padding:8px 12px;
  transition:background .2s,color .2s,transform .1s;
}
.type-chip:active,
.study-mode-chip:active,
.study-scope-chip:active,
.unit-chip:active {
  transform:scale(.97);
}
.type-chip.active,
.study-mode-chip.active,
.study-scope-chip.active,
.unit-chip.active {
  background:var(--accent);
  color:white;
}
.study-mode-chip.compact {
  font-size:12px;
  padding:7px 10px;
}
.study-mode-card,
.study-source-card {
  margin-bottom:12px;
}
.study-mode-card,
.study-source-card,
.source-summary-row {
  box-shadow:none;
}
.study-mode-card h3,
.study-source-card h3 {
  margin-bottom:10px;
}
.source-scope-row .study-scope-chip {
  flex:1 1 82px;
  text-align:center;
}
.tense-row {
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--search-border);
}
.tense-row.is-disabled {
  display:none;
}
.unit-chip-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(92px,1fr));
  gap:8px;
  margin-top:10px;
}
.unit-chip {
  border-radius:10px;
  text-align:center;
  min-height:38px;
}
.scope-summary {
  margin-top:10px;
  border-radius:12px;
  background:var(--bg);
  color:var(--text-dim);
  font-size:13px;
  line-height:1.5;
  padding:10px 12px;
}
.compact-dictionary-list {
  max-height:52vh;
  overflow:auto;
  padding-right:2px;
}
.global-detail-shell {
  margin-top:2px;
}
.detail-origin-row {
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:8px 0;
  border-bottom:1px solid var(--nav-border);
  font-size:13px;
}
.detail-origin-row:last-child {
  border-bottom:none;
}
.detail-origin-row .book {
  color:var(--text);
  font-weight:700;
}
.detail-origin-row .unit {
  color:var(--text-dim);
  text-align:right;
}
.resume-btn {
  background:transparent; color:var(--accent);
  border:1px solid var(--accent); font-size:15px; font-weight:600;
  padding:12px 16px; margin-top:8px;
}
.study-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.study-header .back { background:none; border:none; color:var(--text-dim); font-size:16px; cursor:pointer; padding:8px; }
.study-progress { font-size:14px; color:var(--text-dim); }
.card-container { perspective:1000px; margin:10px auto; max-width:420px; }
.card {
  position:relative; min-height:320px; height:320px; cursor:pointer;
  transform-style:preserve-3d; transition:transform .5s,height .24s ease;
}
.card.no-flip-transition { transition:height .24s ease; }
.card.flipped { transform:rotateY(180deg); }
.card-face {
  position:absolute; top:0; left:0; right:0; min-height:320px;
  backface-visibility:hidden; border-radius:16px; padding:30px 24px;
  display:flex; flex-direction:column; justify-content:center;
  align-items:center; text-align:center; box-shadow:var(--card-shadow);
}
.card-front { background:linear-gradient(135deg,var(--card-a),var(--card-b)); color:white; }
.card-back { background:linear-gradient(135deg,var(--card-back-a),var(--card-back-b)); color:white; transform:rotateY(180deg); }
.card-word { font-size:30px; font-weight:700; margin-bottom:8px; line-height:1.3; }
.card-example { font-size:15px; color:rgba(255,255,255,.8); font-style:italic; line-height:1.5; margin-top:12px; max-width:300px; }
.card-translation { font-size:26px; font-weight:600; margin-bottom:10px; }
.card-english { font-size:18px; color:rgba(255,255,255,.75); margin-bottom:12px; }
.card-tags { display:flex; gap:6px; flex-wrap:wrap; justify-content:center; margin-top:12px; }
.card-tag { font-size:11px; background:rgba(255,255,255,0.18); padding:3px 10px; border-radius:20px; }
.card-note {
  margin-top:12px; width:100%; max-width:320px;
  background:rgba(255,255,255,0.1); border-radius:10px; padding:10px 12px;
  font-size:13px; line-height:1.5; color:rgba(255,255,255,.86); display:none;
}
.card-actions {
  display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:12px;
}
.card-action-btn {
  background:rgba(255,255,255,.14); border:1px solid rgba(255,255,255,.18); color:white;
  padding:9px 12px; border-radius:20px; font-size:12px; cursor:pointer;
}
.card-action-btn:active { transform:scale(.96); }
.card-word[data-card-type="phrase"] { font-size:26px; }
.card-word[data-card-type="modifier"] { letter-spacing:.02em; }
.card-word[data-card-type="noun"] { font-size:28px; }
.conj-container {
  margin-top: 12px;
  width: 100%;
  max-width: 320px;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px;
  display: none;
}
.study-table-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.82);
  margin: 2px 0 6px;
}
.conj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: white;
}
.conj-table td {
  padding: 4px 6px;
  text-align: left;
}
.conj-table .pronoun {
  opacity: 0.7;
  font-size: 11px;
  width: 35px;
}
.conj-table .val {
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.challenge-table .is-target,
.forms-table tr.is-target td {
  color: #fff;
  background: rgba(255,255,255,.16);
}
.challenge-table .val.is-target {
  border-bottom-color: rgba(255,255,255,.45);
}
.forms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: white;
  margin-top: 5px;
}
.forms-table td {
  padding: 6px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
}
.forms-table .label {
  font-size: 10px;
  opacity: 0.6;
  display: block;
}
.gender-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  font-weight: bold;
  text-transform: uppercase;
}
.gender-m { background: rgba(52, 152, 219, 0.4); color: white; }
.gender-f { background: rgba(231, 76, 60, 0.4); color: white; }
.speak-btn {

  background:rgba(255,255,255,.18); border:none; color:white;
  width:44px; height:44px; border-radius:50%; cursor:pointer;
  margin-bottom:12px; display:flex; align-items:center; justify-content:center;
}
.speak-btn:active { background:rgba(255,255,255,.35); }
.tap-hint { color:rgba(255,255,255,.45); font-size:12px; margin-top:16px; }
.arrow-row {
  display:flex; justify-content:center; align-items:center;
  gap:40px; margin-top:24px; max-width:420px; margin-left:auto; margin-right:auto;
}
.arrow-btn {
  width:64px; height:64px; border-radius:50%;
  background:var(--arrow-bg); border:none; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .2s, transform .1s;
}
.arrow-btn:active { transform:scale(.92); }
.arrow-btn svg { width:28px; height:28px; stroke:var(--arrow-color); fill:none; stroke-width:2.5; }
.arrow-btn:disabled { opacity:.3; cursor:default; }
.arrow-counter { font-size:16px; color:var(--text-dim); min-width:70px; text-align:center; }
.study-session-meta {
  color:var(--text-dim);
  font-size:12px;
  line-height:1.45;
  margin:8px auto 0;
  max-width:360px;
  min-height:18px;
  overflow:hidden;
  text-align:center;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.done-screen { text-align:center; padding:60px 20px; }
.done-screen h2 { font-size:24px; margin-bottom:12px; }
.done-screen p { color:var(--text-dim); margin-bottom:30px; }
.search-bar {
  width:100%; padding:10px 14px; background:var(--search-bg);
  border:1px solid var(--search-border); border-radius:10px;
  color:var(--text); font-size:15px; margin-bottom:12px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.search-bar::placeholder { color:#aaa; }
.browse-header { margin-bottom:10px; }
.browse-header h2 { margin-bottom:4px; }
.browse-sub { color:var(--text-dim); font-size:14px; }
.browse-view { display:none; }
.browse-view.active { display:block; }
.browse-page-header {
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:5;
  background:rgba(var(--nav-rgb),.9);
  border-bottom:1px solid var(--nav-border);
  box-shadow:0 6px 18px rgba(0,0,0,.04);
  margin:0;
  padding:8px 16px;
  padding-top:max(8px,env(safe-area-inset-top));
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.browse-page-header ~ .browse-header,
.browse-page-header ~ .detail-shell {
  margin-top:58px;
}
.browse-page-header .back {
  color:var(--text);
  font-weight:600;
  padding:8px 10px;
  border-radius:999px;
}
.browse-page-header .back:active {
  background:var(--chip-bg);
}
.browse-page-header .study-progress {
  color:var(--text-dim);
  font-weight:600;
}
.words-count {
  margin-top:12px;
  text-align:center;
  color:var(--text-dim);
  font-size:13px;
}
.dictionary-list { display:flex; flex-direction:column; gap:10px; }
.dictionary-item {
  width:100%;
  text-align:left;
  border:none;
  background:var(--item-bg);
  border-radius:14px;
  padding:16px;
  box-shadow:var(--panel-shadow);
  cursor:pointer;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.dictionary-item:active { transform:scale(.99); }
.dictionary-item.active {
  outline:2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border:1px solid color-mix(in srgb, var(--accent) 45%, var(--search-border));
}
.dictionary-fr {
  font-size:18px;
  font-weight:700;
  color:var(--text);
  line-height:1.35;
}
.dictionary-meta {
  margin-top:6px;
  color:var(--text-dim);
  font-size:12px;
  line-height:1.6;
}
.dictionary-zh {
  margin-top:10px;
  color:var(--text);
  font-size:15px;
  line-height:1.5;
}
.dictionary-empty {
  margin-top:20px;
  color:var(--text-dim);
  text-align:center;
  font-size:14px;
}
.detail-shell { display:flex; flex-direction:column; gap:14px; }
.detail-hero,
.detail-card {
  background:var(--surface);
  border-radius:16px;
  padding:18px;
  box-shadow:var(--panel-shadow);
  border:1px solid var(--search-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.detail-overline {
  color:var(--accent);
  font-size:12px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.detail-title {
  margin-top:8px;
  font-size:28px;
  line-height:1.2;
}
.detail-meaning {
  margin-top:10px;
  font-size:18px;
  font-weight:600;
  color:var(--text);
}
.detail-english {
  margin-top:4px;
  color:var(--text-dim);
  font-size:14px;
}
.detail-chip-row {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
}
.detail-chip {
  border-radius:999px;
  background:var(--chip-bg);
  color:var(--text);
  font-size:12px;
  padding:6px 10px;
}
.detail-card h3 {
  font-size:15px;
  margin-bottom:12px;
}
.detail-info-row {
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-bottom:1px solid var(--nav-border);
  font-size:14px;
}
.detail-info-row:last-child { border-bottom:none; padding-bottom:0; }
.detail-info-row .label {
  color:var(--text-dim);
  flex:0 0 110px;
}
.detail-info-row .value {
  color:var(--text);
  text-align:right;
  flex:1;
}
.detail-note {
  margin-top:12px;
  padding:12px 14px;
  border-radius:12px;
  background:var(--bg);
  color:var(--text-dim);
  font-size:13px;
  line-height:1.6;
}
.detail-example {
  font-size:15px;
  line-height:1.7;
  color:var(--text);
  font-style:italic;
}
.detail-tense-block + .detail-tense-block {
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--nav-border);
}
.detail-tense-title,
.conj-section-title {
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:rgba(255,255,255,.72);
  margin-bottom:8px;
}
.detail-tense-title {
  color:var(--accent);
}
.detail-table {
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}
.detail-table td {
  padding:8px 6px;
  border-bottom:1px solid var(--nav-border);
  vertical-align:top;
}
.detail-table tr:last-child td { border-bottom:none; }
.detail-table .pronoun,
.detail-table .label {
  color:var(--text-dim);
  font-size:12px;
  width:82px;
}
.detail-table .val {
  color:var(--text);
  font-weight:600;
}
.conj-section + .conj-section {
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,0.12);
}
.setting-group {
  background:var(--surface); border-radius:12px; padding:16px;
  margin-bottom:16px; box-shadow:var(--panel-shadow);
  border:1px solid var(--search-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.setting-group h3 { font-size:13px; color:var(--text-dim); margin-bottom:12px; text-transform:uppercase; }
.setting-row { display:flex; justify-content:space-between; align-items:center; padding:8px 0; }
.setting-row label { font-size:15px; }
.setting-row.sub-setting-row {
  margin-left:18px;
  padding:6px 0 6px 14px;
  border-left:2px solid var(--search-border);
}
.setting-row.sub-setting-row label { font-size:13px; }
.setting-row.sub-setting-row.is-disabled { opacity:.58; }
.theme-options {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(96px,1fr));
  gap:10px;
}
.theme-choice {
  appearance:none;
  border:1px solid var(--search-border);
  border-radius:12px;
  background:rgba(var(--surface-rgb),var(--surface-alpha));
  color:var(--text);
  cursor:pointer;
  min-height:78px;
  padding:10px;
  text-align:left;
  transition:border-color .2s, box-shadow .2s, transform .1s;
}
.theme-choice:active { transform:scale(.98); }
.theme-choice.active {
  border-color:var(--accent);
  box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}
.theme-swatch {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:4px;
  margin-bottom:8px;
}
.theme-swatch span {
  display:block;
  height:20px;
  border-radius:7px;
  border:1px solid rgba(0,0,0,.06);
}
.theme-label {
  display:block;
  font-size:13px;
  font-weight:600;
}
.theme-note {
  display:block;
  color:var(--text-dim);
  font-size:11px;
  margin-top:2px;
}
.theme-choice[data-theme-option="light"] .theme-swatch span:nth-child(1) { background:#f5f5f7; }
.theme-choice[data-theme-option="light"] .theme-swatch span:nth-child(2) { background:#4a5ee0; }
.theme-choice[data-theme-option="light"] .theme-swatch span:nth-child(3) { background:#27ae60; }
.theme-choice[data-theme-option="dark"] .theme-swatch span:nth-child(1) { background:#1a1a2e; }
.theme-choice[data-theme-option="dark"] .theme-swatch span:nth-child(2) { background:#e94560; }
.theme-choice[data-theme-option="dark"] .theme-swatch span:nth-child(3) { background:#533483; }
.theme-choice[data-theme-option="glass"] .theme-swatch span:nth-child(1) { background:rgba(255,255,255,.65); }
.theme-choice[data-theme-option="glass"] .theme-swatch span:nth-child(2) { background:#8fb8ff; }
.theme-choice[data-theme-option="glass"] .theme-swatch span:nth-child(3) { background:#9b6df5; }
.theme-choice[data-theme-option="pop"] .theme-swatch span:nth-child(1) { background:#ffe66d; }
.theme-choice[data-theme-option="pop"] .theme-swatch span:nth-child(2) { background:#ff4f9a; }
.theme-choice[data-theme-option="pop"] .theme-swatch span:nth-child(3) { background:#00c2ff; }
.toggle { position:relative; width:50px; height:28px; cursor:pointer; }
.toggle input { opacity:0; width:0; height:0; }
.toggle .slider {
  position:absolute; top:0; left:0; right:0; bottom:0;
  background:#ccc; border-radius:28px; transition:.3s;
}
.toggle .slider:before {
  content:''; position:absolute; height:22px; width:22px;
  left:3px; bottom:3px; background:white; border-radius:50%; transition:.3s;
}
.toggle input:checked+.slider { background:var(--accent); }
.toggle input:checked+.slider:before { transform:translateX(22px); }
.toggle.compact { width:42px; height:24px; flex:0 0 42px; }
.toggle.compact .slider { border-radius:24px; }
.toggle.compact .slider:before { height:18px; width:18px; left:3px; bottom:3px; }
.toggle.compact input:checked+.slider:before { transform:translateX(18px); }
.toggle input:disabled+.slider { cursor:not-allowed; background:var(--chip-bg); }
.toast {
  position:fixed; bottom:80px; left:50%; transform:translateX(-50%);
  background:#333; color:white; padding:10px 20px; border-radius:8px;
  font-size:14px; z-index:200; opacity:0; transition:opacity .3s;
}
.toast.show { opacity:1; }

/* Reading screen */
.reading-list { list-style:none; }
.reading-item {
  background:var(--item-bg); border-radius:12px; padding:16px;
  margin-bottom:10px; cursor:pointer; box-shadow:var(--panel-shadow);
  transition:transform .1s;
  border:1px solid var(--search-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.reading-item:active { transform:scale(.98); }
.reading-item .title { font-size:16px; font-weight:600; margin-bottom:4px; }
.reading-item .meta { font-size:13px; color:var(--text-dim); }

.reader { max-width:600px; margin:0 auto; }
.reader-header {
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:20px;
}
.reader-header .back { background:none; border:none; color:var(--text-dim); font-size:16px; cursor:pointer; padding:8px; }
.reader-title { font-size:24px; font-weight:300; margin-bottom:4px; }
.reader-subtitle { font-size:14px; color:var(--text-dim); margin-bottom:20px; }
.reader-body {
  background:var(--surface); border-radius:16px; padding:24px;
  box-shadow:var(--panel-shadow);
  border:1px solid var(--search-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  line-height:1.9; font-size:16px;
}
.reader-fr { margin-bottom:20px; white-space: pre-wrap; }
.reader-fr span.word {
  cursor:pointer; border-bottom:1.5px solid var(--accent);
  transition:all .2s; padding: 0 1px;
}
.reader-fr span.phrase {
  cursor:pointer; border-bottom:1.5px dashed var(--card-back-b);
  transition:all .2s; padding: 0 1px;
}
.reader-fr span:hover { background: rgba(0,0,0,0.05); }
.reader-divider {
  border:none; border-top:1px solid var(--nav-border);
  margin:16px 0;
}
.reader-zh {
  color:var(--text-dim); font-size:14px; line-height:1.8; white-space: pre-wrap;
}
.reader-audio {
  position:sticky; bottom:70px;
  background:var(--surface); border-radius:12px;
  padding:12px 16px; margin-top:20px;
  box-shadow:var(--panel-shadow);
  border:1px solid var(--search-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display:grid;
  grid-template-columns:52px 1fr 52px;
  align-items:center;
  gap:8px 12px;
}
.reader-audio.no-audio {
  display:none;
}
.reader-audio-controls {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.reader-option-btn,
.reader-speed-trigger,
.reader-rate-btn {
  height:34px;
  border-radius:999px;
  border:1px solid var(--search-border);
  background:var(--bg);
  color:var(--text);
  cursor:pointer;
  font-size:12px;
  font-weight:700;
  padding:0 12px;
  transition:transform .1s, background .2s, color .2s;
}
.reader-loop-btn {
  width:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
}
.reader-loop-btn svg {
  width:18px;
  height:18px;
}
.reader-speed-menu-wrap {
  position:relative;
  justify-self:end;
}
.reader-speed-trigger {
  width:48px;
  padding:0 12px;
  font-variant-numeric:tabular-nums;
}
.reader-rate-menu {
  display:none;
  position:absolute;
  right:0;
  bottom:calc(100% + 8px);
  z-index:250;
  min-width:128px;
  padding:6px;
  border:1px solid var(--search-border);
  border-radius:14px;
  background:var(--surface);
  box-shadow:var(--card-shadow);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.reader-rate-menu.show {
  display:grid;
  gap:4px;
}
.reader-option-btn.active,
.reader-speed-trigger.active,
.reader-rate-btn.active {
  background:var(--accent);
  border-color:var(--accent);
  color:white;
}
.reader-option-btn:active,
.reader-speed-trigger:active,
.reader-rate-btn:active {
  transform:scale(.96);
}
.reader-rate-btn {
  width:100%;
  min-width:0;
  justify-content:space-between;
  padding:0 12px;
  text-align:left;
}
.reader-play-btn {
  width:44px; height:44px; border-radius:50%;
  background:var(--accent); border:none; color:white;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:transform .1s;
}
.reader-play-btn:active { transform:scale(.9); }
.reader-play-btn svg { width:20px; height:20px; }
.reader-skip-btn {
  min-width:52px;
  height:40px;
  border-radius:20px;
  border:1px solid var(--search-border);
  background:var(--bg);
  color:var(--text);
  cursor:pointer;
  font-size:13px;
  font-weight:600;
  padding:0 12px;
  transition:transform .1s, background .2s;
}
.reader-skip-btn:active { transform:scale(.96); }
.reader-skip-btn:hover { background:var(--chip-bg); }
.reader-progress {
  grid-column:1 / -1;
  display:flex; flex-direction:column; gap:4px;
  min-width:180px;
}
.reader-progress-bar {
  width:100%; height:4px; border-radius:2px;
  background:var(--chip-bg); appearance:none; cursor:pointer;
}
.reader-progress-bar::-webkit-slider-thumb {
  appearance:none; width:12px; height:12px; border-radius:50%;
  background:var(--accent); cursor:pointer;
}
.reader-time { font-size:11px; color:var(--text-dim); display:flex; justify-content:space-between; }
.word-tooltip {
  position:fixed; background:#333; color:white;
  padding:8px 14px; border-radius:8px; font-size:13px;
  z-index:300; pointer-events:none; opacity:0; transition:opacity .2s;
  max-width:240px; text-align:center;
}
.word-tooltip.show { opacity:1; }
.reader-glossary {
  list-style:none; padding:0; margin:0;
  font-size:14px; color:var(--text-dim); line-height:1.8;
}
.reader-glossary li::before { content:'· '; color:var(--accent); font-weight:700; }
.reader-glossary .gl-fr { font-weight:600; color:var(--text); }
.reader-glossary .gl-zh { margin-left:4px; }
