/* v39 — Wordbook tidy-up (all seven wordbooks). Loaded after page CSS and dark-mode.css. */

/* ---------- Toolbar: one line ---------- */
body.wb-tidy .controls { display: block; }
.wb-bar { display: flex; align-items: center; gap: 8px; width: 100%; }
.wb-find { display: flex; align-items: center; gap: 6px; flex: 1 1 320px; min-width: 0; }
.wb-find input[type="search"] { flex: 1 1 auto !important; min-width: 0 !important; width: 100%; }
.wb-selects { display: flex; gap: 6px; flex: 0 0 auto; }
.wb-selects select { min-width: 112px; }
.wb-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; margin-left: auto; }
.wb-loop { display: inline-flex; }
.wb-loop .loop-btn { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.wb-loop .voca-loop-settings-btn { margin-left: -1px; border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; min-width: 36px; padding: 0 9px !important; }
body.wb-tidy .controls .check-filter-label { padding: 0 6px; }

/* Menus */
.wb-menu { position: relative; }
.wb-menu-btn .wb-ico { font-size: 11px; }
.wb-study .wb-menu-btn { background: #eef2ff !important; border-color: #c7d2fe !important; color: #3730a3 !important; }
.wb-study .wb-menu-btn:hover { background: #e0e7ff !important; }
.wb-caret { font-size: 10px; opacity: .7; }
.wb-due { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 900; line-height: 20px; text-align: center; }
.wb-due[hidden] { display: none; }
.wb-more .wb-menu-btn { min-width: 40px; height: 38px; min-height: 38px !important; padding-top: 0 !important; padding-bottom: 0 !important; font-size: 18px !important; letter-spacing: 1px; }
.wb-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 400;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 250px; padding: 6px;
  border: 1px solid #dbe3ee; border-radius: 12px; background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
}
.wb-menu-panel.align-left { right: auto; left: 0; }
.wb-menu-panel[hidden] { display: none !important; }
.controls .wb-menu-panel .wb-menu-item {
  display: grid !important; grid-template-columns: 26px 1fr; align-items: center; justify-items: start;
  column-gap: 8px; row-gap: 1px;
  width: 100%; min-height: 46px; height: auto; padding: 7px 10px !important;
  border: 0 !important; border-radius: 8px !important; background: transparent !important;
  color: #1e293b !important; font-size: 14px !important; font-weight: 750; text-align: left; box-shadow: none !important;
}
.controls .wb-menu-panel .wb-menu-item:hover { background: #f1f5f9 !important; }
.wb-menu-item > span[aria-hidden="true"]:first-child { grid-row: span 2; font-size: 18px; justify-self: center; }
.wb-menu-item .voca-btn-label { display: inline !important; }
.wb-menu-item .wb-item-desc { grid-column: 2; color: #64748b; font-size: 12px; font-weight: 550; }
#dueReviewBtn.wb-menu-item { grid-template-columns: 1fr; padding-left: 44px !important; position: relative; }
#dueReviewBtn.wb-menu-item::before { content: "🗓"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 17px; }
#dueReviewBtn.wb-menu-item .wb-item-desc { grid-column: 1; }
.controls .wb-menu-panel .wb-danger { color: #b91c1c !important; }
.controls .wb-menu-panel #checkVisibleBtn { grid-template-columns: 1fr; padding-left: 44px !important; position: relative; }
.controls .wb-menu-panel #checkVisibleBtn::before { content: "☑"; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 17px; }
.controls .wb-menu-panel #checkVisibleBtn .wb-item-desc { grid-column: 1; }
.wb-menu-sep { height: 1px; margin: 4px 6px; background: #e2e8f0; }
.wb-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; }
.wb-menu-row-label { color: #334155; font-size: 14px; font-weight: 750; }
.wb-menu-row .font-size-controls { margin: 0 !important; }

/* Header: lighter title row now that font buttons moved */
body.wb-tidy .top-inner { gap: 10px; }
body.wb-tidy details.help { margin-top: 0; }

/* ---------- Band bar: one scrolling row ---------- */
.wb-band-wrap { position: relative; display: flex; align-items: center; gap: 4px; width: min(1500px, calc(100% - 32px)); margin: 8px auto 0; }
.wb-band-wrap .freq-band-bar.wb-band-row {
  flex: 1 1 auto; width: auto; margin: 0; padding: 8px 4px;
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-height: none;
  scrollbar-width: none; scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}
.wb-band-row::-webkit-scrollbar { display: none; }
.wb-band-row .freq-band-box {
  flex: 0 0 auto; scroll-snap-align: center; height: 30px; min-width: 38px;
  background: color-mix(in srgb, var(--band-color, #64748b) 13%, #fff);
  border-color: color-mix(in srgb, var(--band-color, #64748b) 38%, transparent);
  color: color-mix(in srgb, var(--band-color, #64748b) 80%, #000);
  text-shadow: none; border-radius: 7px;
}
.wb-band-row .freq-band-box .freq-band-num { color: inherit; font-size: 12px; }
.wb-band-row .freq-band-box:hover { transform: none; background: color-mix(in srgb, var(--band-color, #64748b) 24%, #fff); }
.wb-band-row .freq-band-box.is-active {
  background: var(--band-color, #1d4ed8); color: #fff; border-color: var(--band-color);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--band-color, #1d4ed8); transform: none;
}
.wb-band-row .freq-band-box.is-active .freq-band-num { color: #fff; }
.wb-band-row .freq-band-box.is-active::after { display: none; }
.wb-band-row .freq-band-all { position: relative; left: auto; background: #fff; color: #475569; border-color: #cbd5e1; }
.wb-band-row .freq-band-all .freq-band-num, .wb-band-row .freq-band-all { font-size: 12px; }
.wb-band-row .freq-band-all.is-active { background: #334155; color: #fff; border-color: #334155; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #334155; }
.freq-band-level {
  flex: 0 0 auto; height: 30px; margin: 0 2px 0 10px; padding: 0 10px 0 8px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1.5px solid var(--band-color, #475569); border-radius: 999px;
  background: #fff; color: var(--band-color, #475569);
  font: inherit; font-size: 13px; font-weight: 900; white-space: nowrap; cursor: pointer;
}
.freq-band-level::before { content: "HSK"; font-size: 9px; font-weight: 900; letter-spacing: .02em; opacity: .75; }
.freq-band-level:hover { background: color-mix(in srgb, var(--band-color, #475569) 12%, #fff); }
.freq-band-level.is-active { background: var(--band-color, #475569); color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--band-color, #475569); }
html[data-theme="dark"] .freq-band-level { background: #0f172a; color: color-mix(in srgb, var(--band-color, #94a3b8) 55%, #fff); }
html[data-theme="dark"] .freq-band-level.is-active { background: var(--band-color); color: #fff; box-shadow: 0 0 0 2px #0f172a, 0 0 0 4px var(--band-color); }
.wb-band-nav { flex: 0 0 auto; width: 30px; height: 30px; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; color: #334155; font-size: 18px; font-weight: 800; line-height: 1; cursor: pointer; }
.wb-band-nav:disabled { opacity: .3; cursor: default; }

/* Row band badge: tinted, not solid */
.row-band-badge {
  min-width: 34px; height: 24px; border-radius: 999px; font-size: 11px;
  background: color-mix(in srgb, var(--band-color, #64748b) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--band-color, #64748b) 40%, transparent);
  color: color-mix(in srgb, var(--band-color, #64748b) 82%, #000);
  text-shadow: none;
}
.row-band-badge:hover { transform: none; background: color-mix(in srgb, var(--band-color, #64748b) 26%, transparent); }

/* ---------- Row tools: quiet icon buttons ---------- */
body.wb-tidy .action-group { gap: 4px; }
body.wb-tidy .action-button, body.wb-tidy .tools-cell .audio-btn, body.wb-tidy .tools-cell .dict-link, body.wb-tidy .tools-cell .voca-art-trigger {
  min-width: 0; min-height: 36px; padding: 6px 11px; gap: 5px;
  border: 1px solid #e2e8f0; border-radius: 9px; background: #fff; color: #475569;
  font-size: calc(12px * var(--voca-scale)); font-weight: 750; box-shadow: none;
}
body.wb-tidy .action-button .action-icon { display: none; }
body.wb-tidy .action-button::before {
  content: ""; width: 16px; height: 16px; flex: 0 0 16px; background: currentColor;
  -webkit-mask: var(--wb-icon) center / contain no-repeat; mask: var(--wb-icon) center / contain no-repeat;
}
body.wb-tidy .action-art { --wb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
body.wb-tidy .action-audio { --wb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E"); }
body.wb-tidy .action-dict { --wb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5A2.5 2.5 0 0 0 4 21.5 2.5 2.5 0 0 0 6.5 24'/%3E%3Cpath d='M8 7h8M8 11h6'/%3E%3C/svg%3E"); }
body.wb-tidy .action-art:hover { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
body.wb-tidy .action-audio:hover { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
body.wb-tidy .action-dict:hover { background: #f0f9ff; border-color: #bae6fd; color: #0369a1; }
body.wb-tidy .action-audio.playing, body.wb-tidy .audio-btn.playing { background: #fef3c7 !important; border-color: #f59e0b !important; color: #92400e !important; box-shadow: none !important; }

/* Tap the word to open 보기 */
body.wb-tidy .word-main, body.wb-tidy .word-info-cell > .hanzi { cursor: pointer; width: fit-content; }
body.wb-tidy .word-main:hover, body.wb-tidy .word-info-cell > .hanzi:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: rgba(37, 99, 235, .35); }

/* ---------- Row internals ---------- */
/* English inflections: one line, tap to expand */
body.wb-tidy .word-subline { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 6px; margin-top: 3px; max-width: 34ch; cursor: pointer; }
body.wb-tidy .word-subline .forms-cell { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748b; font-size: calc(13px * var(--voca-scale)); }
body.wb-tidy .word-subline.is-open { max-width: none; }
body.wb-tidy .word-subline.is-open .forms-cell { white-space: normal; }
body.wb-tidy .subline-label { flex: 0 0 auto; padding: 1px 6px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: calc(11px * var(--voca-scale)); font-weight: 750; }
body.wb-tidy .english-def, body.wb-tidy .meaning-en { color: #64748b; }

/* Chinese: character chips and radicals on one flowing line */
body.wb-tidy .word-char-parts, body.wb-tidy .word-explorer-mini { display: inline-flex; vertical-align: middle; margin-top: 6px; }
body.wb-tidy .word-char-parts { margin-right: 6px; }
body.wb-tidy .word-explorer-mini { gap: 2px 8px; font-size: 12px; }
body.wb-tidy .word-explorer-mini a { padding: 0; border: 0; background: none; color: #7c3aed; font-weight: 650; }
body.wb-tidy .word-explorer-mini a:hover { background: none; text-decoration: underline; }
body.wb-tidy .word-explorer-mini::before { content: "부수"; padding: 1px 6px; border-radius: 999px; background: #f5f3ff; color: #6d28d9; font-size: 11px; font-weight: 800; }

/* Even rhythm whether or not a row has a second meaning line */
@media (min-width: 651px) {
  body.wb-tidy .word-table tbody td { vertical-align: middle; }
  body.wb-tidy .word-table tbody tr td { padding-top: 12px; padding-bottom: 12px; }
}

/* ---------- Dark mode ---------- */
html[data-theme="dark"] .wb-study .wb-menu-btn { background: #1e1b4b !important; border-color: #3730a3 !important; color: #c7d2fe !important; }
html[data-theme="dark"] .wb-menu-panel { background: #0f172a; border-color: #1f2a3c; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
html[data-theme="dark"] .controls .wb-menu-panel .wb-menu-item { color: #e2e8f0 !important; }
html[data-theme="dark"] .controls .wb-menu-panel .wb-menu-item:hover { background: #1e293b !important; }
html[data-theme="dark"] .wb-menu-item .wb-item-desc { color: #94a3b8; }
html[data-theme="dark"] .controls .wb-menu-panel .wb-danger { color: #fca5a5 !important; }
html[data-theme="dark"] .wb-menu-sep { background: #1f2a3c; }
html[data-theme="dark"] .wb-menu-row-label { color: #cbd5e1; }
html[data-theme="dark"] .wb-band-row .freq-band-box { opacity: 1; background: color-mix(in srgb, var(--band-color, #64748b) 22%, #0f172a); border-color: color-mix(in srgb, var(--band-color, #64748b) 45%, transparent); color: color-mix(in srgb, var(--band-color, #64748b) 45%, #fff); }
html[data-theme="dark"] .wb-band-row .freq-band-box.is-active { background: var(--band-color); color: #fff; box-shadow: 0 0 0 2px #0f172a, 0 0 0 4px var(--band-color); }
html[data-theme="dark"] .wb-band-row .freq-band-all { background: #0f172a; color: #cbd5e1; border-color: #334155; }
html[data-theme="dark"] .wb-band-row .freq-band-all.is-active { background: #e2e8f0; color: #0f172a; box-shadow: 0 0 0 2px #0f172a, 0 0 0 4px #e2e8f0; }
html[data-theme="dark"] .wb-band-nav { background: #111a2b; border-color: #1f2a3c; color: #cbd5e1; }
html[data-theme="dark"] .row-band-badge { opacity: 1; background: color-mix(in srgb, var(--band-color, #64748b) 22%, transparent); color: color-mix(in srgb, var(--band-color, #64748b) 45%, #fff); }
html[data-theme="dark"] body.wb-tidy .action-button { background: transparent; border-color: #1f2a3c; color: #94a3b8; }
html[data-theme="dark"] body.wb-tidy .action-art:hover { background: #172554; border-color: #1e40af; color: #93c5fd; }
html[data-theme="dark"] body.wb-tidy .action-audio:hover { background: #052e16; border-color: #166534; color: #86efac; }
html[data-theme="dark"] body.wb-tidy .action-dict:hover { background: #082f49; border-color: #075985; color: #7dd3fc; }
html[data-theme="dark"] body.wb-tidy .subline-label { background: #1e293b; color: #94a3b8 !important; }
html[data-theme="dark"] body.wb-tidy .word-subline .forms-cell { color: #94a3b8 !important; }
html[data-theme="dark"] body.wb-tidy .word-explorer-mini a { color: #c4b5fd; }
html[data-theme="dark"] body.wb-tidy .word-explorer-mini::before { background: #2e1065; color: #c4b5fd; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .wb-bar { flex-wrap: wrap; }
  .wb-find { flex: 1 1 100%; }
  .wb-actions { margin-left: auto; }
}

/* ---------- Mobile ---------- */
@media (max-width: 650px) {
  .wb-bar { gap: 6px; }
  .wb-selects { flex: 1 1 100%; }
  .wb-selects select { flex: 1 1 0 !important; min-width: 0; height: 38px; }
  .wb-actions { flex: 1 1 100%; margin-left: 0; gap: 6px; }
  .wb-actions > * { flex: 0 0 auto; }
  body.wb-tidy .controls .wb-actions button { flex: 0 0 auto; min-height: 38px; }
  .wb-loop { flex: 1 1 auto !important; }
  .wb-loop .loop-btn { flex: 1 1 auto !important; }
  .wb-study { flex: 1 1 auto !important; }
  .wb-study .wb-menu-btn { width: 100%; }
  /* The header creates its own containing block, so drop the menu under the whole toolbar instead of using position: fixed. */
  .wb-bar { position: relative; }
  .wb-menu { position: static; }
  .wb-menu-panel { left: 0 !important; right: 0 !important; top: calc(100% + 6px); min-width: 0; padding: 8px; border-radius: 14px; }
  .controls .wb-menu-panel .wb-menu-item { min-height: 52px; }
  body.wb-tidy .title-group .page-title { font-size: calc(18px * var(--voca-scale)); }
  .wb-band-wrap { width: calc(100% - 16px); margin-top: 6px; }
  .wb-band-nav { display: none; }
  .wb-band-row .freq-band-box { height: 30px; min-width: 36px; }
  body.wb-tidy .action-group { gap: 6px; }
  body.wb-tidy .action-button, body.wb-tidy .tools-cell .audio-btn, body.wb-tidy .tools-cell .dict-link, body.wb-tidy .tools-cell .voca-art-trigger { min-height: 34px; min-width: 0 !important; padding: 5px 12px; }
  body.wb-tidy .word-subline { max-width: none; }
}

/* English books link roots/affixes here, not radicals. */
body.voca-page:not(.hsk-page):not(.hsk79-page).wb-tidy .word-explorer-mini::before { content: "어원"; }
.help-content kbd { display: inline-block; min-width: 20px; padding: 0 6px; border: 1px solid #cbd5e1; border-bottom-width: 2px; border-radius: 5px; background: #fff; font: 700 12px/1.6 ui-monospace, monospace; text-align: center; color: #1e293b; }
html[data-theme="dark"] .help-content kbd { background: #0f172a; border-color: #475569; color: #e2e8f0; }

/* ---------- v42: narrower, closer row layout (desktop) ---------- */
body.wb-tidy { --wb-max: 1140px; }
@media (min-width: 761px) {
  body.wb-tidy .top-inner { width: min(var(--wb-max), 100%); }
  body.wb-tidy .main-content,
  body.wb-tidy .checked-section { width: min(var(--wb-max), calc(100% - 32px)); }
  body.wb-tidy .wb-band-wrap { width: min(var(--wb-max), calc(100% - 32px)); }
  /* word · meaning side by side, tools + check grouped at the right */
  body.wb-tidy .word-table th:nth-child(2), body.wb-tidy .word-table td:nth-child(2) { width: 36%; }
  body.wb-tidy .word-table th:nth-child(3), body.wb-tidy .word-table td:nth-child(3) { width: auto; }
  body.wb-tidy .word-table th:nth-child(4), body.wb-tidy .word-table td:nth-child(4) { width: 132px; padding-left: 4px; padding-right: 0; text-align: right; }
  body.wb-tidy .word-table th:nth-child(5), body.wb-tidy .word-table td:nth-child(5) { width: 52px; }
  body.wb-tidy .tools-cell .action-group { justify-content: flex-end; gap: 2px; }
  /* icon-only buttons; the label stays for screen readers and as tooltip */
  body.wb-tidy .tools-cell .action-button { width: 38px; height: 38px; min-height: 38px; padding: 0; justify-content: center; border-color: transparent; background: transparent; font-size: 0; }
  body.wb-tidy .tools-cell .action-button > span:not(.action-icon) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.wb-tidy .tools-cell .action-button::before { width: 19px; height: 19px; flex-basis: 19px; }
  body.wb-tidy .word-table th:nth-child(4) { font-size: 0; }
}
/* Quiet tools until the row is hovered or focused (mouse users only; touch keeps them visible). */
@media (min-width: 761px) and (hover: hover) and (pointer: fine) {
  body.wb-tidy .tools-cell .action-button { color: #94a3b8; }
  body.wb-tidy .word-table tbody tr:hover .tools-cell .action-button,
  body.wb-tidy .word-table tbody tr:focus-within .tools-cell .action-button { color: #334155; }
  body.wb-tidy .word-table tbody tr:hover .tools-cell .action-art { color: #1d4ed8; }
  body.wb-tidy .word-table tbody tr:hover .tools-cell .action-audio { color: #15803d; }
  body.wb-tidy .word-table tbody tr:hover .tools-cell .action-dict { color: #0369a1; }
  html[data-theme="dark"] body.wb-tidy .tools-cell .action-button { color: #475569; }
  html[data-theme="dark"] body.wb-tidy .word-table tbody tr:hover .tools-cell .action-button { color: #cbd5e1; }
}

/* v42 — ❝ mark for words with a famous line */
.wb-quote-mark { display: inline-block; margin-left: 6px; vertical-align: super; font: 900 13px/1 Georgia, serif; color: #d97706; text-decoration: none !important; }
html[data-theme="dark"] .wb-quote-mark { color: #fbbf24; }
body.wb-tidy .word-main:has(+ .wb-quote-mark), body.wb-tidy .word-info-cell > .hanzi:has(+ .wb-quote-mark) { display: inline-block; }

/* ---------- v45: study cards (집중 · 복습 · 슬라이드) ---------- */
.voca-modal.voca-focus-card .voca-card-inner, .voca-modal.voca-slide-card .voca-card-inner {
  max-width: 640px; padding: 22px 24px 20px; border-radius: 22px; border: 1px solid #e2e8f0;
  background: #fff; box-shadow: 0 30px 80px rgba(15,23,42,.35);
}
.voca-focus-card .voca-card-top, .voca-slide-card .voca-card-top { display: flex; align-items: center; justify-content: space-between; }
.voca-focus-card .voca-card-tag, .voca-slide-card .voca-card-tag { padding: 5px 12px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 13px; font-weight: 850; }
.voca-slide-card .voca-card-tag { background: #ecfeff; color: #0e7490; }
.voca-focus-card .voca-card-close, .voca-slide-card .voca-card-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #e2e8f0; background: #f8fafc; color: #475569; font-size: 20px; }
.voca-focus-card .voca-card-progress, .voca-slide-card .voca-card-progress { display: flex; align-items: center; gap: 4px; margin: 14px 0 6px; color: #64748b; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.voca-card-bar { flex: 1 1 auto; height: 6px; margin-left: 10px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.voca-card-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #6366f1, #22c55e); transition: width .25s ease; }
.voca-card-stage, .voca-slide-card .voca-slide-content { min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px 10px; border-radius: 18px; background: linear-gradient(160deg, #f8fafc, #eef2ff); cursor: pointer; }
.voca-slide-card .voca-slide-content { background: linear-gradient(160deg, #f8fafc, #ecfeff); }
.voca-focus-card .voca-card-word, .voca-slide-card .voca-card-word { font-size: clamp(38px, 8vw, 68px); color: #0f172a; }
.voca-focus-card .voca-card-pron, .voca-slide-card .voca-card-pron { color: #4f46e5; font-weight: 700; }
.voca-focus-card .voca-card-meaning, .voca-slide-card .voca-card-meaning { color: #1e293b; font-size: 20px; font-weight: 800; text-align: center; }
.voca-focus-card .voca-card-def, .voca-slide-card .voca-card-def { color: #64748b; font-size: 14px; text-align: center; }
.voca-card-tap { margin-top: 6px; color: #94a3b8; font-size: 12.5px; font-weight: 700; }
.voca-modal[data-meaning-shown="true"] .voca-card-tap { display: none; }
.voca-slide-card .voca-slide-stage { gap: 10px; margin: 6px 0; }
.voca-slide-card .voca-slide-prev, .voca-slide-card .voca-slide-next { width: 44px; height: 44px; border-color: #e2e8f0; color: #0e7490; font-size: 24px; }

.voca-modal .voca-card-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.voca-card-tools { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.voca-modal .voca-card-tools button { height: 40px; padding: 0 14px; border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; color: #334155; font-size: 13.5px; font-weight: 800; }
.voca-modal .voca-card-tools button:hover { background: #f1f5f9; }
.voca-modal .voca-card-tools .tool-prev, .voca-modal .voca-card-tools .tool-next { width: 40px; padding: 0; font-size: 0; position: relative; }
.voca-modal .voca-card-tools .tool-prev::before, .voca-modal .voca-card-tools .tool-next::before { content: "‹"; font-size: 22px; line-height: 1; color: #475569; }
.voca-modal .voca-card-tools .tool-next::before { content: "›"; }
.voca-modal .voca-card-tools .tool-auto[aria-pressed="true"] { background: #dcfce7; border-color: #86efac; color: #166534; }
.voca-card-rate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.voca-modal .voca-card-rate button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 58px; padding: 0 6px; border: 0; border-radius: 14px; color: #fff; cursor: pointer; transition: transform .12s, filter .12s; }
.voca-modal .voca-card-rate button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.voca-card-rate b { font-size: 15px; font-weight: 900; }
.voca-card-rate small { font-size: 11px; font-weight: 700; opacity: .85; }
.voca-modal .voca-card-rate .rate-again { background: #ef4444; }
.voca-modal .voca-card-rate .rate-hard { background: #f59e0b; }
.voca-modal .voca-card-rate .rate-good { background: #22c55e; }
.voca-modal .voca-card-rate .rate-easy { background: #3b82f6; }
html[data-theme="dark"] .voca-modal.voca-focus-card .voca-card-inner, html[data-theme="dark"] .voca-modal.voca-slide-card .voca-card-inner { background: #0f172a; border-color: #1f2a3c; }
html[data-theme="dark"] .voca-card-stage, html[data-theme="dark"] .voca-slide-card .voca-slide-content { background: linear-gradient(160deg, #111a2b, #1e1b4b); }
html[data-theme="dark"] .voca-focus-card .voca-card-word, html[data-theme="dark"] .voca-slide-card .voca-card-word { color: #f8fafc; }
html[data-theme="dark"] .voca-focus-card .voca-card-meaning, html[data-theme="dark"] .voca-slide-card .voca-card-meaning { color: #e2e8f0; }
html[data-theme="dark"] .voca-modal .voca-card-tools button { background: #111a2b; border-color: #1f2a3c; color: #cbd5e1; }
html[data-theme="dark"] .voca-card-bar { background: #1f2a3c; }
@media (max-width: 560px) {
  .voca-modal.voca-focus-card .voca-card-inner, .voca-modal.voca-slide-card .voca-card-inner { padding: 16px 14px 14px; border-radius: 18px; }
  .voca-card-stage, .voca-slide-card .voca-slide-content { min-height: 190px; }
  .voca-modal .voca-card-rate button { height: 52px; }
  .voca-card-rate small { display: none; }
  .voca-slide-card .voca-slide-stage { grid-template-columns: 1fr; }
  .voca-slide-card .voca-slide-prev, .voca-slide-card .voca-slide-next { display: none; }
}
.voca-modal .voca-card-tools .tool-prev, .voca-modal .voca-card-tools .tool-next { display: inline-grid; place-items: center; }
.voca-modal .voca-card-tools .tool-prev::before, .voca-modal .voca-card-tools .tool-next::before { position: static; margin-top: -2px; }

/* v47 — no empty strip beside the table on mid-size screens: the list spans edge to edge */
@media (min-width: 761px) and (max-width: 1180px) {
  body.wb-tidy .main-content { width: 100%; margin-left: 0; margin-right: 0; }
  body.wb-tidy .table-wrap { border-left: 0; border-right: 0; border-radius: 0; }
  body.wb-tidy .wb-band-wrap { width: calc(100% - 20px); }
  body.wb-tidy .checked-section { width: calc(100% - 20px); }
}
/* the study menu now holds more items: let it scroll on short screens */
.wb-study .wb-menu-panel { max-height: min(78vh, 640px); overflow-y: auto; }

/* ---------- v50: band mastery (quiz) ---------- */
.wb-band-row .freq-band-box { background-image: linear-gradient(0deg, color-mix(in srgb, var(--band-color, #64748b) 30%, transparent) 0 3px, transparent 3px); background-size: var(--mastery, 0%) 100%; background-repeat: no-repeat; }
.wb-band-row .freq-band-box.is-mastered::before { content: "✓"; position: absolute; top: -6px; right: -5px; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 9px; font-weight: 900; box-shadow: 0 0 0 2px #fff; }
.wb-band-row { padding-top: 10px !important; }

/* ---------- v50: 간단 보기 (word + meaning, large) ---------- */
body.wb-simple .word-subline, body.wb-simple .english-def, body.wb-simple .meaning-en,
body.wb-simple .word-char-parts, body.wb-simple .word-explorer-mini, body.wb-simple .wb-quote-mark,
body.wb-simple .tools-cell, body.wb-simple .word-table th:nth-child(4) { display: none !important; }
body.wb-simple .word-main, body.wb-simple .word-info-cell > .hanzi { font-size: calc(28px * var(--voca-scale)) !important; }
body.wb-simple .word-info-cell > .pinyin { font-size: calc(17px * var(--voca-scale)); }
body.wb-simple .meaning-main { font-size: calc(19px * var(--voca-scale)) !important; }
body.wb-simple .word-table tbody td { padding-top: 16px; padding-bottom: 16px; }
@media (max-width: 760px) {
  body.wb-simple .word-main, body.wb-simple .word-info-cell > .hanzi { font-size: calc(26px * var(--voca-scale)) !important; }
  body.wb-simple .meaning-main { font-size: calc(18px * var(--voca-scale)) !important; }
}
.controls .wb-menu-panel .wb-simple-btn[aria-pressed="true"] { background: #eef2ff !important; color: #3730a3 !important; }

/* v52 */
.wb-size-row { padding: 8px 12px 4px; }
.wb-gear-btn { min-width: 40px; height: 38px; min-height: 38px !important; padding: 0 !important; font-size: 17px !important; }

/* v66 — 좁은 화면: 툴바가 넘치지 않게, ⚙는 맨 위 오른쪽으로 */
.wb-gear-top { display: none !important; }
body.wb-tidy { overflow-x: clip; }
@media (max-width: 560px) {
  body.wb-tidy .controls .wb-gear-btn { display: none !important; }
  body.wb-tidy .wb-gear-top { display: inline-flex !important; margin-left: auto; width: 36px; min-width: 36px !important; height: 34px; min-height: 34px !important; align-items: center; justify-content: center; }
  body.wb-tidy .controls .wb-actions { gap: 5px; flex-wrap: nowrap; min-width: 0; }
  body.wb-tidy .controls .wb-actions > * { min-width: 0; }
  body.wb-tidy .wb-study { flex: 1 1 auto; min-width: 0; }
  body.wb-tidy .wb-study .wb-menu-btn { width: 100%; min-width: 0; padding-left: 8px !important; padding-right: 8px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.wb-tidy .wb-more .wb-menu-btn { min-width: 36px; }
}
@media (max-width: 380px) {
  body.wb-tidy .controls .wb-actions button { padding-left: 7px !important; padding-right: 7px !important; font-size: 12.5px !important; }
}
@media (max-width: 560px) {
  body.wb-tidy .wb-gear-top { border: 1px solid #dbe3ee !important; border-radius: 10px !important; background: #fff !important; color: #334155 !important; font-size: 16px !important; padding: 0 !important; box-shadow: none !important; }
  html[data-theme="dark"] body.wb-tidy .wb-gear-top { background: #111a2b !important; border-color: #1f2a3c !important; color: #cbd5e1 !important; }
}

/* v112: align header and frequency bands to the actual list width. */
body.wb-tidy.voca-page .top-inner { width: min(var(--wb-max), calc(100% - 32px)); padding-inline: 0; }
body.wb-tidy.voca-page .wb-band-wrap { width: min(var(--wb-max), calc(100% - 32px)); }
@media (min-width: 761px) and (max-width: 1180px) {
  body.wb-tidy.voca-page .top-inner, body.wb-tidy.voca-page .wb-band-wrap { width: 100%; }
}
@media (max-width: 760px) {
  body.wb-tidy.voca-page .top-inner, body.wb-tidy.voca-page .wb-band-wrap { width: calc(100% - 20px); }
}

/* Shared HSK-style batch controls. */
.hsk-load-controls { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 16px; padding:14px 4px 20px; color:#64748b; font-size:13px; }
.hsk-load-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.hsk-load-actions label { font-weight:650; }
.hsk-load-actions select, .hsk-load-actions button { min-height:38px; border:1px solid #cbd5e1; border-radius:9px; padding:7px 12px; background:#fff; color:#1e293b; font:inherit; font-weight:700; }
.hsk-load-actions button { border-color:#2563eb; background:#2563eb; color:#fff; cursor:pointer; }
.hsk-load-actions button:disabled { opacity:.55; cursor:default; }
@media (max-width:600px) { .hsk-load-controls { align-items:flex-start; flex-direction:column; } .hsk-load-actions { width:100%; } }
.hsk-load-controls[hidden] { display:none !important; }
html[data-theme="dark"] .hsk-load-actions select { background:#1e293b; color:#e2e8f0; border-color:#475569; }

/* v115: retain mobile targets and per-book row spacing only. */
@media (max-width:760px), (pointer:coarse) {
 body.wb-tidy .controls select, body.wb-tidy .controls input[type=search],body.wb-tidy .controls button {min-height:44px!important;}
 body.wb-tidy .tools-cell .action-button {min-width:44px;min-height:44px;}
 body.wb-tidy .wb-band-row .freq-band-box {min-width:44px;min-height:44px;}
 body.wb-tidy .word-table input[type=checkbox] {min-width:24px;min-height:24px;}
}
body.wb-tidy[data-jv-spacing=tight] .word-table tbody td {padding-block:5px!important;}
body.wb-tidy[data-jv-spacing=wide] .word-table tbody td {padding-block:20px!important;}


/* v117 — restrained book palettes and compact responsive toolbar */
body.wb-tidy.voca-page { --head-a:#344354; --head-b:#46576a; --head-ink:#f5f7fa; }
body.wb-tidy.hsk-page { --head-a:#56363c; --head-b:#79534b; }
body.wb-tidy.hsk79-page { --head-a:#39364e; --head-b:#57506a; }
body.wb-tidy.ngsl-page { --head-a:#283c56; --head-b:#465c76; }
body.wb-tidy.ngsls-page { --head-a:#304c4c; --head-b:#4c6664; }
body.wb-tidy.tsl-page { --head-a:#44454f; --head-b:#636477; }
body.wb-tidy.bsl-page { --head-a:#263e47; --head-b:#435c69; }
body.wb-tidy.nawl-page { --head-a:#4c3a50; --head-b:#6b5368; }
body.wb-tidy.kcv-page { --head-a:#35483b; --head-b:#576953; }
body.wb-tidy.idiom-page { --head-a:#584438; --head-b:#79624f; }
body.wb-tidy.voca-page .top-panel { background:linear-gradient(120deg,var(--head-a),var(--head-b)); border-bottom:0; box-shadow:0 3px 12px #17203318; }
body.wb-tidy.voca-page .top-inner { padding:12px 0; gap:9px; min-width:0; }
body.wb-tidy.voca-page .title-group { gap:9px; }
body.wb-tidy.voca-page .brand-link,body.wb-tidy.voca-page .brand-link .brand-voca,body.wb-tidy.voca-page .page-title { color:var(--head-ink); font-size:clamp(15px,1.5vw,19px); line-height:1.3; }
body.wb-tidy.voca-page .brand-link { font-weight:850; }
body.wb-tidy.voca-page .page-title { font-weight:650; overflow-wrap:anywhere; }
body.wb-tidy.voca-page .header-meta,body.wb-tidy.voca-page .rank-status { color:#e2e8f0; }
body.wb-tidy.voca-page .wb-bar { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:7px; align-items:center; }
body.wb-tidy.voca-page .wb-find { display:grid; grid-template-columns:minmax(0,1fr) minmax(90px,130px); width:100%; min-width:0; }
body.wb-tidy.voca-page .wb-find #globalSearchInput { width:100%; min-width:0!important; }
body.wb-tidy.voca-page .wb-find #globalSearchScope { width:100%; min-width:0; max-width:none; }
body.wb-tidy.voca-page .wb-selects { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; min-width:0; }
body.wb-tidy.voca-page .wb-selects select { width:100%; min-width:0; max-width:100%; }
body.wb-tidy.voca-page .wb-actions { grid-column:1/-1; margin:0; flex-wrap:wrap; justify-content:flex-start; min-width:0; }
body.wb-tidy.voca-page .top-panel :is(.wb-find input,.wb-find select,.wb-selects select,.wb-actions > button,.wb-loop button,.wb-menu-btn,.wb-gear-top,.check-filter-label) { background:rgba(255,255,255,.09)!important; border:1px solid rgba(255,255,255,.23)!important; color:#f5f7fa!important; box-shadow:none!important; }
body.wb-tidy.voca-page .top-panel :is(.wb-find input,.wb-find select,.wb-selects select,.wb-actions > button,.wb-loop button,.wb-menu-btn,.wb-gear-top):hover { background:rgba(255,255,255,.16)!important; }
body.wb-tidy.voca-page .top-panel select option { background:#fff; color:#243142; }
body.wb-tidy.voca-page .top-panel input::placeholder { color:#e1e6eb; opacity:1; }
body.wb-tidy.voca-page .top-panel .loop-btn.active { background:#7e434a!important; }
body.wb-tidy.voca-page .check-filter-label input { accent-color:#c4d0dc; }
body.wb-tidy.voca-page .top-panel details.help { background:#ffffff0d; border-color:#ffffff25; color:#e2e8f0; }
body.wb-tidy.voca-page .top-panel details.help summary { color:#f5f7fa; }
body.wb-tidy.voca-page .main-content > .wb-band-wrap { width:100%; min-width:0; margin:8px 0; }
body.wb-tidy.voca-page .wb-band-row { min-width:0; }
@media(max-width:1100px) { body.wb-tidy.voca-page .wb-bar { grid-template-columns:minmax(0,1fr); } }
@media(max-width:760px) {
 body.wb-tidy.voca-page .top-inner { width:calc(100% - 20px); padding:10px 0; gap:7px; }
 body.wb-tidy.voca-page .title-group { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:6px; }
 body.wb-tidy.voca-page .brand-link,body.wb-tidy.voca-page .page-title { font-size:15px; }
 body.wb-tidy.voca-page .wb-find { grid-template-columns:minmax(0,1fr) minmax(82px,28%); }
 body.wb-tidy.voca-page .wb-selects select { padding-inline:5px 12px; font-size:11px; }
 body.wb-tidy.voca-page .wb-actions { display:grid; grid-template-columns:auto minmax(0,1fr) minmax(0,1fr) auto; gap:5px; width:100%; }
 body.wb-tidy.voca-page .wb-actions > * { min-width:0; margin:0; }
 body.wb-tidy.voca-page .wb-actions .check-filter-label { padding:3px 4px; gap:3px; font-size:11px; }
 body.wb-tidy.voca-page .wb-loop { min-width:0; display:flex; }
 body.wb-tidy.voca-page .wb-loop .loop-btn { flex:1 1 0!important; min-width:0; width:auto; padding:3px!important; font-size:11px!important; white-space:normal; }
 body.wb-tidy.voca-page .wb-loop .voca-loop-settings-btn { flex:0 0 28px!important; width:28px; min-width:28px; padding:0!important; }
 body.wb-tidy.voca-page .wb-study .wb-menu-btn { width:100%; min-width:0; padding:3px!important; font-size:11px!important; gap:3px; }
 body.wb-tidy.voca-page .wb-more .wb-menu-btn { min-width:30px; width:30px; padding:0!important; }
 body.wb-tidy.voca-page .wb-actions > .wb-gear-btn { display:none!important; }
 body.wb-tidy.voca-page .wb-gear-top { display:inline-flex!important; margin:0; width:32px; min-width:32px!important; height:34px; align-items:center; justify-content:center; }
 body.wb-tidy.voca-page .wb-bar { position:relative; }
 body.wb-tidy.voca-page .wb-menu { position:static; }
 body.wb-tidy.voca-page .wb-menu-panel { left:0!important; right:0!important; min-width:0; }
}
@media(max-width:340px) { body.wb-tidy.voca-page .wb-actions { grid-template-columns:repeat(2,minmax(0,1fr)); } }

body.wb-tidy.voca-page .wb-find input[hidden],body.wb-tidy.voca-page .wb-find input[type=hidden] {display:none!important;}
body.wb-tidy.voca-page .top-panel .wb-find #globalSearchInput {display:block; }

/* v118: compact desktop toolbar and subdued brand */
body.wb-tidy.voca-page .title-group { column-gap:14px; }
body.wb-tidy.voca-page .brand-link { opacity:.73; }
body.wb-tidy.voca-page .brand-link:hover,body.wb-tidy.voca-page .brand-link:focus-visible { opacity:1; }
@media(min-width:1050px) {
 body.wb-tidy.voca-page .top-inner { width:min(var(--wb-max),calc(100% - 32px)); }
 body.wb-tidy.voca-page .wb-bar { grid-template-columns:minmax(0, 1fr) minmax(0, 1.12fr) auto; gap:6px; }
 body.wb-tidy.voca-page .wb-find { grid-template-columns:minmax(0,1fr) 85px; max-width:345px; }
 body.wb-tidy.voca-page .wb-selects { grid-template-columns:repeat(3,minmax(0,1fr)); }
 body.wb-tidy.voca-page .wb-selects select,body.wb-tidy.voca-page .wb-find select { padding-inline:6px 14px; font-size:11px; text-overflow:ellipsis; }
 body.wb-tidy.voca-page .wb-actions { grid-column:auto; flex-wrap:nowrap; gap:4px; }
 body.wb-tidy.voca-page .wb-actions button { padding-inline:7px; gap:4px; }
 body.wb-tidy.voca-page .wb-actions .check-filter-label { padding-inline:4px; }
}
@media(min-width:761px) and (max-width:1049px) {
 body.wb-tidy.voca-page .wb-bar {grid-template-columns:minmax(0,1fr) minmax(0,1fr);}
 body.wb-tidy.voca-page .wb-find {max-width:350px;}
}
@media(max-width:760px) {body.wb-tidy.voca-page .title-group {column-gap:9px;}}

/* v119: five extra pixels beneath header controls. */
body.wb-tidy.voca-page .top-inner { padding-bottom:17px; }
@media(max-width:760px){body.wb-tidy.voca-page .top-inner {padding-bottom:15px;}}

body.wb-tidy.eev-page { --head-a:#344454; --head-b:#586f80; }
/* v269: three information densities, shared controls always visible */
.word-table .word-main,.word-table .word-info-cell>.hanzi{font-size:calc(28px * var(--voca-scale,1))!important;line-height:1.25}
.word-table .meaning-main{font-size:calc(19px * var(--voca-scale,1))!important;line-height:1.4}
html[data-jv-view=simple] .word-table :is(.english-def,.meaning-en,.word-char-parts,.word-explorer-mini,.wb-quote-mark,.jv-example-pinyin),html[data-jv-view=minimal] .word-table :is(.english-def,.meaning-en,.word-char-parts,.word-explorer-mini,.wb-quote-mark,.word-subline,.pinyin,.jv-ex,.jv-pron){display:none!important}
html[data-jv-view=minimal] .word-table tbody td{padding-block:6px!important}
.jv-view-bar{display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin:8px 0;color:inherit}.jv-view-bar button{font:inherit;font-size:13px;padding:6px 12px;border:1px solid #94a3b866;background:transparent;color:inherit;border-radius:7px;cursor:pointer}.jv-view-bar button[aria-pressed=true]{background:#64748b;color:#fff}.jv-view-bar label{margin-inline-start:auto;font-size:13px;display:flex;align-items:center;gap:5px}.jv-book-help{max-width:min(680px,90vw);max-height:85vh;overflow:auto;border:1px solid #94a3b8;border-radius:12px;padding:20px;background:Canvas;color:CanvasText}.jv-book-help::backdrop{background:#0007}.word-table .jv-ex{margin-top:6px;font-size:14px;line-height:1.5}.word-table .jv-ex span,.word-table .jv-ex small{display:block}.word-table .jv-ex small{opacity:.8}
@media(max-width:600px){.word-table .word-main,.word-table .word-info-cell>.hanzi{font-size:calc(26px * var(--voca-scale,1))!important}.word-table .meaning-main{font-size:calc(18px * var(--voca-scale,1))!important}}

html[data-jv-view=simple] .word-table :is(.idm-origin,.idm-rel,.idm-type),html[data-jv-view=minimal] .word-table :is(.idm-ex,.idm-origin,.idm-rel,.idm-type){display:none!important}

body.wb-tidy .top-header .font-size-controls{display:none!important}

body.edition-wordbook .jv-view-bar button[aria-pressed=true]{background:#64748b;color:#fff}
html[data-jv-view=simple] .word-table tbody td{padding-block:8px}

/* v271: list typography, same sizes across languages and view modes. */
.word-table :is(.word-info-cell > .pinyin,.word-subline .forms-cell,.jv-pron){font-size:calc(14px * var(--voca-scale,1))!important}
.word-table .jv-ex{font-size:calc(15px * var(--voca-scale,1))}.word-table .jv-ex small{font-size:calc(14px * var(--voca-scale,1))}
@media(max-width:600px){.word-table :is(.word-info-cell > .pinyin,.word-subline .forms-cell,.jv-pron){font-size:calc(13px * var(--voca-scale,1))!important}.word-table .jv-ex{font-size:calc(14px * var(--voca-scale,1))}.word-table .jv-ex small{font-size:calc(13px * var(--voca-scale,1))}}
