:root {
  --primary: #292524;
  --primary-active: #0c0a09;
  --on-primary: #ffffff;
  --canvas: #f5f5f5;
  --canvas-soft: #fafafa;
  --surface-card: #ffffff;
  --surface-strong: #f0efed;
  --hairline: #e7e5e4;
  --hairline-soft: #f0efed;
  --hairline-strong: #d6d3d1;
  --ink: #0c0a09;
  --body: #4e4e4e;
  --body-strong: #292524;
  --muted: #777169;
  --muted-soft: #a8a29e;
  --mint: #a7e5d3;
  --peach: #f4c5a8;
  --lavender: #c8b8e0;
  --sky: #a8c8e8;
  --rose: #e8b8c4;
  --success: #16a34a;
  --error: #dc2626;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-base: 16px;
  --space-md: 20px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --rounded-md: 8px;
  --rounded-lg: 12px;
  --rounded-xl: 16px;
  --rounded-pill: 9999px;
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.04);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: 0.16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

button {
  font-family: inherit;
  cursor: pointer;
}

.display-lg {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 36px;
  line-height: 1.17;
  letter-spacing: -0.36px;
}

.display-sm {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 24px;
  line-height: 1.2;
}

.caption {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.chrome {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.orb {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
}

.orb--mint {
  top: -140px;
  left: -100px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, var(--mint) 0%, transparent 70%);
}

.orb--peach {
  right: -160px;
  bottom: -180px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, var(--peach) 0%, transparent 70%);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-lg);
  min-height: 64px;
  padding: 18px var(--space-xl);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--canvas) 82%, #fff);
  backdrop-filter: blur(8px);
}

.wordmark {
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
}

.status-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xxs) var(--space-sm);
  color: var(--muted);
}

.status-cluster > span::after {
  margin-left: var(--space-sm);
  color: var(--muted-soft);
  content: "·";
}

.status-cluster > span:last-child::after {
  content: "";
}

.nav-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
}

.check-compact[hidden] {
  display: none !important;
}

.check-compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-pill);
  background: var(--surface-card);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.check-compact input {
  margin: 0;
  accent-color: var(--ink);
}

.select-compact {
  min-width: 132px;
  height: 32px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-pill);
  background-color: var(--surface-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 8l3-3.5' stroke='%230c0a09' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 10px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
}

.format-strip {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 1680px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl) 0;
}

.format-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-base);
}

.format-row__main--paper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.format-row .filter-label {
  margin: 0;
  line-height: 32px;
  white-space: nowrap;
}

.format-row .mode-grid {
  min-width: 0;
}

.format-row__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.format-row__main--split {
  gap: 8px 10px;
}

.format-row__segment--video,
.format-row__segment--audio,
.format-row__segment--practice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.format-row__actions--inline {
  flex-shrink: 0;
}

.format-row__divider {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 32px;
  user-select: none;
  opacity: 0.55;
}

.vocab-practice-toolbar {
  display: flex;
  gap: 12px;
  margin: 0 0 8px;
}

.vocab-practice-types {
  display: grid;
  gap: 8px;
}

.vocab-practice-part {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 0;
}

.vocab-practice-part:first-child {
  margin-top: 0;
}

.vocab-practice-part h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.vocab-practice-type {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface-card);
}

.vocab-practice-type.is-running {
  border-color: color-mix(in srgb, var(--ink) 28%, var(--hairline));
}

.vocab-practice-type.is-done {
  border-color: color-mix(in srgb, #15803d 35%, var(--hairline));
}

.vocab-practice-type.is-error {
  border-color: color-mix(in srgb, #c2410c 40%, var(--hairline));
}

.vocab-practice-type__pick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.vocab-practice-type input {
  margin: 4px 0 0;
  accent-color: var(--ink);
  flex-shrink: 0;
}

.vocab-practice-type span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.vocab-practice-type strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.vocab-practice-type small {
  color: var(--muted);
  font-size: 12px;
}

.vocab-practice-type__status {
  color: var(--muted);
}

.vocab-practice-type.is-running .vocab-practice-type__status {
  color: var(--ink);
}

.vocab-practice-type.is-done .vocab-practice-type__status {
  color: #15803d;
}

.vocab-practice-type.is-error .vocab-practice-type__status {
  color: #c2410c;
}

.vocab-practice-type__actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

#vocab-practice-view-modal {
  z-index: 230;
}

#vocab-practice-view-modal .modal__body {
  min-height: 0;
}

.vocab-practice-view__text {
  margin: 0;
  padding: 12px 14px;
  min-height: 240px;
  max-height: min(58vh, 520px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.audio-setup-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, auto);
  gap: 14px 16px;
}

.audio-setup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
}

.audio-setup-field .select-compact {
  width: 100%;
  min-width: 0;
}

.audio-setup-field__note {
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

.audio-setup-field__note.is-muted-strong {
  color: var(--muted);
  opacity: 0.85;
}

.paper-setup-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.paper-setup-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paper-setup-group__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.paper-setup-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.paper-setup-field__label {
  font-size: 12px;
  color: var(--muted);
}

.paper-setup-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

#copybook-font-intros {
  margin-top: 12px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

#paper-result-modal .modal__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.paper-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.paper-result-thumb {
  appearance: none;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface-card);
  overflow: hidden;
  cursor: zoom-in;
  text-align: left;
}

.paper-result-thumb:hover {
  border-color: var(--hairline-strong);
}

.paper-result-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  background: #f6f4f1;
}

.paper-result-thumb__name {
  padding: 6px 8px 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-row__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.format-row__actions[hidden] {
  display: none !important;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  height: 40px;
  padding: 10px var(--space-md);
  border-radius: var(--rounded-pill);
}

.btn-compact {
  height: 32px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--rounded-pill);
  background: var(--surface-card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.btn:disabled,
.btn-compact:disabled {
  border-color: var(--hairline);
  background: var(--surface-strong);
  color: var(--muted-soft);
  cursor: not-allowed;
}

.btn-primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover:not(:disabled),
.btn-compact.btn-primary:hover:not(:disabled) {
  background: var(--primary-active);
}

.btn-success {
  border: 1px solid var(--success);
  background: var(--success);
  color: var(--on-primary);
}

.btn-success:hover:not(:disabled),
.btn-compact.btn-success:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
}

.btn-outline:hover:not(:disabled),
.btn-compact:hover:not(:disabled):not(.btn-primary):not(.btn-success) {
  background: var(--canvas-soft);
}

.btn-compact.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

.btn-compact.btn-success {
  border-color: var(--success);
  background: var(--success);
  color: var(--on-primary);
}

#wordbook-sync {
  min-width: 8.5em;
  font-variant-numeric: tabular-nums;
}

.btn-text {
  padding: var(--space-xxs) 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.btn-text:hover {
  color: var(--ink);
  text-decoration: underline;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  gap: var(--space-lg) var(--space-xl);
  max-width: 1680px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl) var(--space-xxl);
}

.filter-bar {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  align-self: start;
  min-width: 0;
  max-height: calc(100vh - 160px);
  padding: var(--space-lg);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-xl);
  background: var(--surface-card);
  overflow: auto;
}

.filter-group { min-width: 0; }

.filter-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.filter-label {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.filter-group > .filter-label,
.filter-group > .filter-label-row {
  margin: 0 0 var(--space-sm);
}

#btn-series-multi.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.filter-label-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.section-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.chip-row,
.mode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip,
.mode-chip {
  appearance: none;
  border: 1px solid var(--hairline-strong);
  background: var(--canvas-soft);
  color: var(--body-strong);
  height: 36px;
  padding: 0 16px;
  border-radius: var(--rounded-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover,
.mode-chip:hover {
  background: var(--surface-card);
}

.chip.is-active {
  border-color: transparent;
  background: color-mix(in srgb, var(--peach) 46%, #fff);
  color: var(--ink);
}

.chip.sub.is-active {
  background: color-mix(in srgb, var(--sky) 46%, #fff);
}

.chip.unit.is-active {
  background: color-mix(in srgb, var(--lavender) 46%, #fff);
}

.mode-chip.is-active {
  border-color: transparent;
  background: color-mix(in srgb, var(--mint) 46%, #fff);
  color: var(--ink);
}

.book-list {
  display: flex;
  flex-direction: column;
}

.unit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.unit-toolbar .section-label,
.unit-toolbar .filter-label {
  margin: 0;
}

.unit-toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.unit-label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}

.unit-count {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.unit-chip-row {
  position: relative;
  user-select: none;
  align-content: flex-start;
  width: 100%;
  overflow: visible;
}

.chip.unit {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.chip.unit.unit-more {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chip.unit.unit-more:hover {
  background: transparent;
  color: var(--ink);
}

.unit-band {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-base);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.list-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--hairline-soft);
  background: transparent;
  border-radius: 0;
  padding: var(--space-sm) 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row:hover {
  background: transparent;
}

.list-row:hover .list-row__title {
  color: var(--primary-active);
}

.list-row.is-selected {
  background: var(--surface-strong);
  margin: 0 calc(-1 * var(--space-xs));
  padding-left: var(--space-xs);
  padding-right: var(--space-xs);
  border-radius: var(--rounded-md);
  border-bottom-color: transparent;
}

.list-row__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.list-row__meta {
  margin-top: 0;
  font-size: 13px;
  color: var(--muted);
}

.stream {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

.stream__tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.ai-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 4px;
}

.ai-controls[hidden] {
  display: none;
}

.ai-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.tab {
  appearance: none;
  border: 1px solid var(--hairline-strong);
  background: var(--surface-card);
  color: var(--muted);
  height: 32px;
  padding: 0 14px;
  border-radius: var(--rounded-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tab:hover {
  background: var(--canvas-soft);
}

.tab[hidden] {
  display: none !important;
}

.tab.is-active {
  border-color: transparent;
  background: color-mix(in srgb, var(--rose) 46%, #fff);
  color: var(--ink);
}

.panel {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-xl);
  padding: var(--space-xl);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: var(--space-lg);
}

.panel__cover {
  width: 72px;
  height: auto;
  aspect-ratio: 1000 / 1400;
  object-fit: contain;
  object-position: top center;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  flex-shrink: 0;
  display: block;
}

.panel__cover[hidden] {
  display: none;
}

.panel__head-copy {
  min-width: 0;
  flex: 1;
}

.panel__title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}

.panel__title-row .panel__title {
  min-width: 0;
}

.panel__title-actions {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  flex-shrink: 0;
}

#book-edition-btn,
#book-textbook-btn {
  flex-shrink: 0;
}

.textbook-modal__panel {
  width: min(960px, 100%);
}

.textbook-modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.textbook-modal__text {
  margin: 0;
  flex: 1;
  min-height: 280px;
  max-height: min(58vh, 640px);
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.panel__title {
  margin: 0;
  color: var(--ink);
}

.panel__meta {
  margin: var(--space-xs) 0 0;
  color: var(--muted);
}

.panel__meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel__meta-row #preview-meta {
  min-width: 0;
  flex: 1;
}

.panel__meta-row #copybook-font-select {
  margin-left: auto;
  flex-shrink: 0;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
  max-height: min(78vh, 960px);
  overflow: auto;
  padding: 4px 4px 0 0;
}

.word-list > .empty {
  grid-column: 1 / -1;
}

.word-list .word-item.is-filtered-out,
.word-list .word-unit-head.is-filtered-out,
.word-list > .empty.is-filter.is-filtered-out {
  display: none;
}

.word-unit-head {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 2px;
  padding: 7px 4px 6px;
  background: color-mix(in srgb, var(--canvas-soft) 82%, #fff);
  border-bottom: 1px solid var(--hairline);
}

.word-unit-head__book {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.word-unit-head__name {
  font-size: 13px;
  font-weight: 650;
  color: var(--body-strong);
}

.word-unit-head__count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.word-item {
  display: grid;
  grid-template-columns: 32px 80px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 8px 11px;
  border-bottom: 1px solid var(--hairline);
  border-radius: 10px;
}

.word-item.is-preview {
  cursor: default;
}

.word-item.is-preview .word-item__cover {
  cursor: pointer;
}

.word-item.is-preview .word-item__cover:not(.is-empty) {
  cursor: zoom-in;
}

.word-item:hover {
  background: color-mix(in srgb, var(--canvas-soft) 70%, #fff);
}

.word-item__cover {
  position: relative;
  width: 80px;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  background: var(--canvas-soft);
  border: 1px solid var(--hairline);
}

.word-item__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.word-item__cover.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-soft);
  font-size: 13px;
  font-weight: 600;
}

.word-item__cover.is-empty::before {
  content: attr(data-letter);
}

.word-item__cover.is-empty img {
  display: none;
}

.word-item__index {
  padding-top: 2px;
  color: var(--muted-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: right;
}

.word-item__en {
  font-size: 15px;
  font-weight: 500;
  color: var(--body-strong);
  line-height: 1.35;
}

.word-item__ipa {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.word-item__zh {
  margin-top: 2px;
  color: var(--body);
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.word-item__gen {
  appearance: none;
  opacity: 0;
  pointer-events: none;
  height: 28px;
  min-width: 64px;
  padding: 0 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--rounded-pill);
  background: var(--surface-card);
  color: var(--body-strong);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.word-item:hover .word-item__gen,
.word-item__gen.is-busy,
.word-item__gen.is-ready,
.word-item__gen.is-error {
  opacity: 1;
  pointer-events: auto;
}

.word-item__gen:hover:not(:disabled) {
  background: var(--canvas-soft);
}

.word-item__gen.is-busy,
.word-item__gen.is-busy:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.word-item__gen.is-ready,
.word-item__gen.is-ready:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--mint) 38%, #fff);
  color: #2a5c4f;
}

.word-item__gen.is-error,
.word-item__gen.is-error:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--rose) 38%, #fff);
  color: #9f1239;
}

.field-label {
  display: block;
  margin: 12px 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.text-input,
.text-area {
  width: 100%;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--rounded-md);
  background: var(--surface-card);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: 0.16px;
  padding: 12px 16px;
}

.text-input {
  height: 44px;
}

.text-area {
  resize: vertical;
  min-height: 220px;
  line-height: 1.5;
}

.text-area--sm {
  min-height: 88px;
}

.article-wrap {
  position: relative;
}

.char-count {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.custom-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
  flex-wrap: wrap;
}

.custom-hint {
  font-size: 12px;
  color: var(--muted);
}

.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.export-brand-custom {
  width: 160px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-pill);
  background: var(--surface-card);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
}

.export-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
}

.mode-chip[data-video-format].is-active {
  background: color-mix(in srgb, var(--sky) 46%, #fff);
  color: var(--ink);
}

.word-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.word-toolbar .section-label,
.word-toolbar .filter-label {
  margin: 0;
}

.word-toolbar__filters {
  flex-wrap: nowrap;
  gap: 8px;
}

.word-toolbar__end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.word-toolbar__filters .chip {
  height: 28px;
  padding: 0 12px;
  font-size: 13px;
}

.word-toolbar__term-select {
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 13px;
}

#video-batch-list {
  grid-template-columns: 1fr;
}

.video-batch-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 118px 56px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 8px 11px;
  border-bottom: 1px solid var(--hairline);
  border-radius: 10px;
}

.video-batch-item:hover {
  background: color-mix(in srgb, var(--canvas-soft) 70%, #fff);
}

.video-batch-item.is-checked {
  background: color-mix(in srgb, var(--ink) 6%, #fff);
}

.video-batch-item__check {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
}

#video-batch-select.is-active,
#video-batch-select-all.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.video-batch-book-head .word-unit-head__book {
  font-size: 14px;
}

.video-batch-item__unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--body-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-batch-item__cache {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-batch-item__cache.is-cached {
  color: var(--body-strong);
  font-weight: 600;
}

.video-batch-item__count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.video-batch-item__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.video-batch-item__play,
.video-batch-item__download,
.video-batch-item__preview,
.video-batch-item__publish,
.video-batch-item__gen {
  height: 28px;
  min-width: 56px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.word-toolbar__progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--rounded-pill);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.word-toolbar__progress[hidden] {
  display: none !important;
}

.word-toolbar__progress::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: vocab-image-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.word-toolbar__batch {
  height: 28px;
  min-height: 28px;
  padding: 0 12px;
  font-size: 13px;
}

#batch-upload-modal .modal__panel {
  width: min(920px, 100%);
}

.batch-upload__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

.batch-upload__item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface-card);
  cursor: pointer;
}

.batch-upload__item.is-busy {
  opacity: 0.72;
  pointer-events: none;
}

.batch-upload__item.is-ok {
  border-color: transparent;
  background: color-mix(in srgb, var(--mint) 28%, #fff);
}

.batch-upload__item.is-error {
  border-color: transparent;
  background: color-mix(in srgb, var(--rose) 32%, #fff);
}

.batch-upload__check {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
}

.batch-upload__thumb {
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: var(--canvas-soft);
  border: 1px solid var(--hairline);
}

.batch-upload__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.batch-upload__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--body-strong);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-band {
  flex: 1 1 100%;
  margin-top: var(--space-xs);
  border-radius: var(--rounded-lg);
  border: 1px solid var(--hairline);
  overflow: hidden;
  background: var(--surface-card);
}

.progress-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--sky) 46%, #fff);
}

.progress-row.is-done {
  background: color-mix(in srgb, var(--mint) 46%, #fff);
}

.progress-row.is-error {
  background: color-mix(in srgb, var(--rose) 46%, #fff);
}

.progress-index { color: var(--muted); font-size: 13px; }
.progress-text { font-size: 14px; color: var(--body-strong); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--rounded-pill);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.96px;
  text-transform: uppercase;
  color: var(--muted);
}

.empty {
  padding: 24px 8px;
  color: var(--muted);
  font-size: 14px;
}

.word-list .empty {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding: var(--space-base);
  }
  .filter-bar {
    position: static;
    max-height: none;
  }
  .top-nav { padding: 16px; }
  .format-strip {
    padding: var(--space-base) var(--space-base) 0;
  }
  .format-row {
    grid-template-columns: auto 1fr;
    row-gap: var(--space-xs);
  }
  .format-row .filter-label {
    grid-column: 1;
  }
  .format-row__main {
    grid-column: 1 / -1;
  }
  .format-row__segment--video {
    width: 100%;
  }
  .nav-controls { margin-left: 0; }
  .panel__title { font-size: 28px; }
  .word-list { grid-template-columns: 1fr; }
}

body.modal-open {
  overflow: hidden;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#image-preview {
  z-index: 220;
}

#video-job-modal .modal__panel {
  width: min(864px, calc(100vw - 48px));
}

#audio-publish-modal {
  z-index: 215;
}

#audio-publish-modal .modal__panel {
  width: min(1100px, calc(100vw - 32px));
  height: min(920px, calc(100vh - 16px));
  max-height: calc(100vh - 16px);
}

#audio-publish-modal .modal__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#audio-publish-modal .text-area {
  flex: 1;
  min-height: 520px;
}

#audio-publish-modal .field-label:first-child {
  margin-top: 0;
}

#video-play-modal {
  z-index: 212;
}

#video-play-modal .modal__panel--video-play {
  width: min(960px, calc(100vw - 48px));
}

#video-play-modal .modal__body--video-play {
  padding: 0;
  background: #111;
}

#video-play-player {
  display: block;
  width: 100%;
  max-height: min(72vh, 720px);
  background: #000;
}

#video-publish-modal {
  z-index: 210;
}

#video-publish-modal .modal__panel {
  width: min(1000px, calc(100vw - 48px));
}

#video-publish-modal .field-label:first-child {
  margin-top: 0;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 9, 0.42);
}

.modal__panel {
  position: relative;
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--surface-card);
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal__panel--compact {
  width: min(640px, 100%);
}

.image-preview {
  position: relative;
  width: max-content;
  max-width: min(880px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 20px 20px 16px;
  background: var(--surface-card);
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.image-preview__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
}

.image-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(840px, calc(100vw - 88px));
  max-height: min(78vh, 820px);
  object-fit: contain;
  background: transparent;
  border-radius: 10px;
}

.image-preview__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
}

.image-preview__caption {
  margin: 0;
  min-width: 0;
  flex: 1;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#image-preview.is-editor .image-preview {
  width: min(1480px, calc(100vw - 24px));
  max-width: min(1480px, calc(100vw - 24px));
  max-height: calc(100vh - 16px);
  padding: 28px 28px 20px;
  align-items: stretch;
}

#image-preview-editor {
  width: 100%;
}

.vocab-image-editor {
  padding: 4px 8px 0;
}

.vocab-image-editor__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.vocab-image-editor__word {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.vocab-image-editor__hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.vocab-image-editor [hidden] {
  display: none !important;
}

.vocab-image-editor__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--canvas-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.vocab-image-editor__status--busy {
  background: var(--surface-strong);
  color: var(--ink);
}

.vocab-image-editor__status--busy::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: vocab-image-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.vocab-image-editor__status--ok {
  background: color-mix(in srgb, var(--mint) 38%, #fff);
  color: #2a5c4f;
}

.vocab-image-editor__status--error {
  background: color-mix(in srgb, var(--rose) 38%, #fff);
  color: #9f1239;
}

.vocab-image-editor__progress {
  margin: -2px 0 12px;
}

.vocab-image-editor__progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--hairline);
}

.vocab-image-editor__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width 0.25s ease;
}

.vocab-image-editor__progress.is-indeterminate .vocab-image-editor__progress-fill {
  width: 36% !important;
  animation: vocab-image-indet 1.1s ease-in-out infinite;
}

.vocab-image-editor__shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.vocab-image-editor__shot {
  margin: 0;
}

.vocab-image-editor__frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: min(58vh, 680px);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: #111;
}

.vocab-image-editor__shot img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.vocab-image-editor__shot figcaption {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.vocab-image-editor__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.vocab-image-editor__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

.vocab-image-editor__btn {
  min-width: 112px;
}

.vocab-image-editor__kbd {
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  opacity: 0.78;
}

.vocab-image-editor__btn--ghost {
  background: transparent;
}

@keyframes vocab-image-spin {
  to { transform: rotate(360deg); }
}

@keyframes vocab-image-indet {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

@media (max-width: 720px) {
  .vocab-image-editor__shots {
    grid-template-columns: 1fr;
  }
  .vocab-image-editor__frame {
    height: min(36vh, 280px);
  }
}

.modal__panel--download {
  width: min(1080px, calc(100vw - 48px));
}

#recordVideoModal .modal__panel--download {
  width: min(1080px, calc(100vw - 32px));
  height: min(920px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
}

#recordVideoModal .modal__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#audio-modal .modal__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.audio-unit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(420px, calc(100vh - 280px));
  overflow-y: auto;
}

#audio-modal .audio-setup-form {
  margin-bottom: 16px;
}

.audio-unit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-card);
}

.audio-unit-row.is-running {
  border-color: color-mix(in srgb, var(--ink) 28%, var(--hairline));
}

.audio-unit-row.is-done {
  border-color: color-mix(in srgb, #15803d 35%, var(--hairline));
}

.audio-unit-row.is-cache {
  border-color: color-mix(in srgb, var(--primary-active, #2563eb) 35%, var(--hairline));
}

.audio-unit-row.is-error {
  border-color: color-mix(in srgb, #c2410c 40%, var(--hairline));
}

.audio-unit-row__status {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.audio-unit-row__status.is-done {
  color: #15803d;
}

.audio-unit-row__status.is-cache {
  color: var(--primary-active, #2563eb);
}

.audio-unit-row__status.is-running {
  color: var(--ink);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-unit-row__status.is-error {
  color: #c2410c;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-unit-row__cover {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: #fff;
  object-fit: contain;
  flex-shrink: 0;
}

.audio-unit-row__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.audio-unit-row__meta {
  min-width: 0;
  flex: 1;
}

.audio-unit-row__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-unit-row__file {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-job-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(520px, calc(100vh - 280px));
  overflow-y: auto;
}

.video-job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-card);
}

.video-job-row__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.video-job-row__meta {
  min-width: 0;
}

.video-job-row__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-job-row__detail {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.video-job-row__track {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.video-job-row__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
}

.video-job-row__status {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
}

.video-job-row__status.is-running {
  color: var(--primary-active);
}

.video-job-row__status.is-done {
  color: var(--success);
}

.video-job-row__status.is-error {
  color: var(--error);
}

.video-job-row__status.is-cache {
  color: var(--primary-active);
}

.video-job-row.is-plan {
  grid-template-columns: minmax(0, 1fr) auto;
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--hairline);
}

.modal__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.article-theme-color {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.article-theme-color .select-compact {
  min-width: 108px;
}

.modal__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal__title-row .check-compact {
  height: 28px;
  font-size: 12px;
}

.modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal__subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-strong);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal__close:hover {
  background: var(--hairline);
  color: var(--ink);
}

.modal__body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-strong);
}

.modal__hint {
  font-size: 12px;
  color: var(--muted);
}

.modal__hint.is-error {
  color: #c2410c;
}

#ai-modal-input {
  min-height: 140px;
}

.article-body-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
}

.article-body-label .field-label {
  margin: 0;
}

.article-body-label-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.article-body-label .check-compact {
  height: 28px;
  flex-shrink: 0;
}

.article-modal-body {
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-modal-stream {
  margin: 10px 0 0;
  max-height: 160px;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--canvas-soft);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal__footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.download-brand-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.download-brand-select select {
  min-width: 180px;
  max-width: 280px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  background: var(--surface-card);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}

.download-brand-select select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.record-video-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.record-video-modal--custom .download-units {
  display: none;
}

.record-video-custom-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  margin: 0 0 12px;
}

.record-video-custom-meta[hidden] {
  display: none !important;
}

.record-video-custom-meta__field {
  flex: 1 1 220px;
  min-width: 180px;
}

.record-video-custom-meta__input {
  width: 100%;
  min-width: 160px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.record-video-cover-pick {
  margin-bottom: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.record-video-cover-pick[hidden] {
  display: none !important;
}

.record-video-cover-pick__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

.record-video-cover-pick__bar > span:first-child {
  font-weight: 600;
  color: var(--ink);
}

.record-video-cover-pick__hint {
  font-size: 11px;
  color: var(--muted);
}

.record-video-cover-pick__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: start;
  align-content: start;
  grid-auto-rows: min-content;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
}

.record-video-cover-pick__empty {
  grid-column: 1 / -1;
  padding: 8px 2px;
  font-size: 12px;
  color: var(--muted);
}

.record-video-cover-thumb {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: start;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-card);
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: var(--ink);
  line-height: 0;
}

.record-video-cover-thumb__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  background: var(--canvas-soft);
  overflow: hidden;
  flex: 0 0 auto;
}

.record-video-cover-thumb img,
.record-video-cover-thumb > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  object-position: center;
  background: var(--canvas-soft);
}

.record-video-cover-thumb__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.record-video-cover-thumb__word {
  display: block;
  padding: 5px 6px 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-video-cover-thumb:hover:not(:disabled) {
  border-color: var(--primary);
}

.record-video-cover-thumb.is-selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
}

.record-video-cover-thumb:disabled {
  opacity: 0.65;
  cursor: wait;
}

.download-brand-custom {
  min-width: 160px;
  max-width: 240px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface-card);
  color: var(--ink);
  font-size: 12px;
}

.download-brand-custom:disabled {
  opacity: 0.6;
}

.download-brand-custom[hidden] {
  display: none;
}

.download-force-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.download-force-refresh[hidden] {
  display: none !important;
}

.download-force-refresh input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

.download-units {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.download-units__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.download-units__filter {
  flex: 1;
  min-width: 160px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-card);
}

.download-units__filter:focus {
  outline: none;
  border-color: var(--primary);
}

.download-units__all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.download-units__all input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

.download-units__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
  padding: 2px;
}

.download-units__empty {
  width: 100%;
  padding: 10px 4px;
  font-size: 12px;
  color: var(--muted);
}

.download-unit {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface-card);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink);
}

.download-unit:hover:not(:disabled) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--sky) 28%, #fff);
}

.download-unit.is-selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--sky) 28%, #fff);
}

.download-unit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.download-unit__check {
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.download-unit__name {
  font-weight: 600;
}

.download-unit__count {
  font-size: 11px;
  color: var(--muted);
}

.download-mode-status {
  font-size: 13px;
  color: var(--body);
}

.download-mode-status--error {
  color: var(--error);
}

.record-video-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.record-video-progress__track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.record-video-progress__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.2s ease;
}

.record-video-progress__pct {
  min-width: 3em;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

@media (max-width: 900px) {
  .record-video-cover-pick__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.modal__footer--redeem {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.modal__footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal__footer-row .modal__hint {
  flex: 1;
  min-width: 0;
}

.paper-redeem-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.paper-redeem-progress__track {
  flex: 1;
  height: 8px;
  border-radius: var(--rounded-pill);
  background: var(--hairline);
  overflow: hidden;
}

.paper-redeem-progress__fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--peach), #f59e0b);
  transition: width 0.2s ease;
}

.paper-redeem-progress__label {
  flex: 0 0 auto;
  min-width: 3.2em;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--body-strong);
  text-align: right;
}

.paper-redeem-input {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.paper-redeem-types {
  margin-top: 14px;
}

.paper-redeem-types__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.paper-redeem-types__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--body-strong);
}

.paper-redeem-types__tip {
  font-size: 12px;
  color: var(--muted);
}

#paper-redeem-type-grid .mode-chip {
  height: auto;
  min-height: 36px;
  padding: 8px 14px;
}

/* ---- dcxcs preview overrides ---- */
.preview-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin:0 0 12px;min-height:36px}
.preview-toolbar:has(#btn-download:not([hidden])){justify-content:space-between}
.preview-toolbar:not(:has(.preview-pager:not([hidden]))){justify-content:flex-end}
.preview-pager{display:flex;align-items:center;gap:8px}
.preview-stage{min-height:min(70vh,860px);display:flex;justify-content:center;align-items:flex-start;padding:8px 0 0;overflow:auto}
.preview-empty{margin:12vh auto 0;color:var(--muted);text-align:center;max-width:28em;line-height:1.6}
.preview-image{max-width:min(980px,100%);width:auto;height:auto;border-radius:4px;box-shadow:0 8px 32px rgba(0,0,0,.08);background:#fff}
.preview-pdf{width:min(980px,100%);height:calc(100vh - 280px);min-height:640px;border:0;border-radius:4px;background:#fff;box-shadow:0 8px 32px rgba(0,0,0,.08)}
.mode-chip.is-muted{opacity:.45}
.hidden{display:none!important}
a.btn-compact{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}

a.wordmark{text-decoration:none;color:inherit}

.preview-downloads{display:flex;align-items:center;gap:8px;margin-left:auto}
.unit-band .btn-text.is-active{color:var(--ink);font-weight:700;text-decoration:underline}

.chip.unit.is-preview{box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--lavender) 70