/* ============================================================
 * v0.9.1 小说改编工作台
 * 仅负责小说任务的桌面/移动布局与状态呈现。
 * ============================================================ */

.novel-title-mobile,
.novel-source-toggle {
  display: none;
}

.novel-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.novel-target-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 10px;
}

.novel-target-route {
  min-width: 0;
  margin: 4px 0 14px;
  padding: 0;
  border: 0;
}

.novel-target-route legend {
  margin-bottom: 9px;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 700;
}

.novel-target-route-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.novel-target-route-option {
  display: grid;
  min-width: 0;
  min-height: 86px;
  padding: 12px;
  align-content: start;
  gap: 6px;
  color: var(--text-1);
  text-align: left;
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.novel-target-route-option:hover,
.novel-target-route-option.active {
  border-color: var(--primary);
  background: var(--bg-3);
}

.novel-target-route-option.active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.novel-target-route-option strong {
  color: var(--text-0);
  font-size: 14px;
}

.novel-target-route-option span {
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.5;
}

.novel-target-fields {
  margin-bottom: 10px;
}

.novel-medium-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 9px;
}

.novel-medium-heading strong {
  color: var(--text-1);
  font-size: 13px;
}

.novel-medium-heading > span {
  color: var(--text-3);
  font-size: 11px;
}

.novel-medium-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 11px;
}

.novel-medium-card {
  display: grid;
  min-width: 0;
  min-height: 92px;
  padding: 10px;
  align-content: start;
  gap: 5px;
  color: var(--text-1);
  text-align: left;
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-top: 2px solid var(--novel-reading-gold);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.novel-medium-card:hover,
.novel-medium-card.active {
  border-color: var(--novel-reading-gold);
  background: rgba(229, 183, 109, 0.08);
}

.novel-medium-card strong {
  color: var(--text-0);
  font-size: 12px;
}

.novel-medium-card span {
  color: var(--text-2);
  font-size: 10px;
  line-height: 1.45;
}

.novel-target-handoff {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  padding: 12px 13px;
  color: var(--text-1);
  background: var(--success-dim);
  border: 1px solid rgba(61, 220, 151, 0.28);
  border-radius: var(--radius-sm);
}

.novel-target-handoff[data-project-domain="non_short"] {
  background: var(--warning-dim);
  border-color: rgba(255, 200, 87, 0.32);
}

.novel-target-handoff strong {
  color: var(--text-0);
  font-size: 12px;
}

.novel-target-handoff span {
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.5;
}

.novel-retarget-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 840px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.novel-retarget-modal .modal-header,
.novel-retarget-modal .modal-footer {
  flex: 0 0 auto;
}

.novel-retarget-modal .modal-header p {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.55;
}

.novel-retarget-body {
  display: grid;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.novel-retarget-impact {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  color: var(--text-1);
  background: var(--warning-dim);
  border: 1px solid rgba(255, 200, 87, 0.3);
  border-radius: var(--radius-sm);
}

.novel-retarget-impact strong {
  color: var(--text-0);
  font-size: 12px;
}

.novel-retarget-impact span {
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.55;
}

html[data-theme="light"] .novel-retarget-impact {
  background: rgba(166, 112, 28, 0.08);
  border-color: rgba(142, 92, 18, 0.22);
}

.novel-project-item {
  position: relative;
  padding: 0;
  flex-direction: row;
  align-items: stretch;
}

.novel-project-select {
  display: flex;
  min-width: 0;
  padding: 12px;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.novel-project-select small {
  color: var(--text-3);
  font-size: 11px;
}

.novel-project-delete {
  align-self: center;
  margin-right: 8px;
  color: var(--danger);
}

#view-novel-adaptation {
  --novel-reading-gold: #e5b76d;
}

#view-novel-adaptation .novel-adaptation-header {
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(229, 183, 109, 0.16);
}

#view-novel-adaptation .novel-progress-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background-color: #111a2b;
  border-color: rgba(229, 183, 109, 0.2);
}

#view-novel-adaptation .novel-progress-card > :not(.novel-task-actions) {
  position: relative;
  z-index: 1;
}

#view-novel-adaptation .novel-progress-card::before {
  display: none;
}

.novel-progress-status-group {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.novel-progress-percent {
  color: var(--novel-reading-gold);
  font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.novel-progress-live {
  max-width: 72%;
  min-height: 26px;
  color: #d5dbea;
  font-size: 15px;
}

.novel-source-evidence {
  display: inline-flex;
  min-height: 32px;
  margin-top: 6px;
  padding: 6px 10px;
  align-items: center;
  color: var(--novel-reading-gold);
  background: rgba(10, 17, 29, 0.76);
  border: 1px solid rgba(229, 183, 109, 0.24);
  border-radius: 999px;
  font-size: 12px;
}

#view-novel-adaptation .novel-progress-track {
  max-width: 72%;
  height: 10px;
  margin-top: 18px;
  background: rgba(232, 237, 247, 0.12);
  border-color: rgba(232, 237, 247, 0.12);
}

#view-novel-adaptation .novel-progress-track span {
  background: var(--novel-reading-gold);
}

#view-novel-adaptation .novel-progress-stats {
  max-width: 72%;
}

#view-novel-adaptation .novel-progress-stats span {
  color: #aeb7cb;
  background: rgba(10, 17, 29, 0.78);
  border: 1px solid rgba(232, 237, 247, 0.08);
}

#view-novel-adaptation .novel-progress-stats strong {
  color: #f2f4f8;
}

.novel-chunk-rail-wrap {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(232, 237, 247, 0.12);
}

.novel-chunk-rail-wrap .novel-section-head span {
  color: #aeb7cb;
  font-size: 12px;
}

.novel-chunk-rail {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 0 4px;
  overflow-x: auto;
  list-style: none;
}

.novel-chunk-rail li {
  min-height: 66px;
  padding: 10px;
  color: #8f99ae;
  background: rgba(10, 17, 29, 0.74);
  border: 1px solid rgba(232, 237, 247, 0.1);
  border-radius: 10px;
}

.novel-chunk-rail strong,
.novel-chunk-rail span {
  display: block;
}

.novel-chunk-rail strong {
  margin-bottom: 7px;
  color: #d5dbea;
  font-size: 13px;
}

.novel-chunk-rail span {
  font-size: 11px;
}

.novel-chunk-rail li.completed {
  color: #8ed9a9;
  border-color: rgba(61, 220, 151, 0.34);
  background: rgba(61, 220, 151, 0.08);
}

.novel-chunk-rail li.current {
  color: #c8c0ff;
  border-color: rgba(140, 125, 255, 0.62);
  background: rgba(140, 125, 255, 0.14);
  box-shadow: 0 0 0 2px rgba(140, 125, 255, 0.08);
}

.novel-chunk-rail li.failed {
  color: #ff9aae;
  border-color: rgba(255, 92, 124, 0.42);
  background: rgba(255, 92, 124, 0.1);
}

.novel-result-availability {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.novel-result-card.is-locked .novel-result-summary,
.novel-result-card.is-locked .novel-result-tabs,
.novel-result-card.is-locked .novel-result-content {
  opacity: 0.62;
}

.novel-recommendation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.novel-recommendation-item,
.novel-diagnostic-item {
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.novel-recommendation-item.low-confidence {
  border-color: rgba(229, 183, 109, 0.52);
}

.novel-recommendation-title,
.novel-diagnostic-meta,
.novel-diagnostic-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.novel-recommendation-title span,
.novel-recommendation-title small,
.novel-recommendation-item small,
.novel-diagnostic-item small {
  color: var(--text-3);
}

.novel-recommendation-item > strong {
  display: block;
  margin: 9px 0 7px;
  color: var(--text-0);
  font-size: 17px;
}

.novel-recommendation-item > p,
.novel-diagnostic-item > p,
.novel-diagnostic-suggestion p {
  margin: 0 0 8px;
  color: var(--text-2);
  line-height: 1.65;
}

.novel-diagnostic-toolbar {
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.novel-diagnostic-toolbar > div:first-child span {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
}

.novel-diagnostic-item {
  margin-bottom: 12px;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.novel-diagnostic-item.selected {
  background: rgba(140, 125, 255, 0.08);
  border-color: rgba(140, 125, 255, 0.48);
}

.novel-diagnostic-choice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.novel-diagnostic-choice input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.novel-diagnostic-choice strong {
  display: block;
  margin-top: 6px;
  color: var(--text-0);
  font-size: 16px;
}

.novel-diagnostic-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.novel-diagnostic-meta b,
.novel-diagnostic-meta em,
.novel-diagnostic-meta i {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
}

.novel-diagnostic-meta b {
  color: #ffb4c2;
  background: rgba(255, 92, 124, 0.12);
}

.novel-diagnostic-meta em {
  color: var(--text-2);
  background: var(--bg-3);
}

.novel-diagnostic-meta i {
  color: #8ed9a9;
  background: rgba(61, 220, 151, 0.1);
}

.novel-diagnostic-impact {
  color: var(--text-1) !important;
}

.novel-diagnostic-suggestion {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--bg-1);
  border-left: 3px solid var(--novel-reading-gold);
  border-radius: 0 8px 8px 0;
}

.novel-diagnostic-suggestion > span {
  display: block;
  margin-bottom: 4px;
  color: var(--novel-reading-gold);
  font-size: 11px;
  font-weight: 700;
}

html[data-theme="light"] #view-novel-adaptation .novel-progress-card {
  background-color: #f8f5ee;
  border-color: rgba(153, 102, 31, 0.24);
}

html[data-theme="light"] .novel-progress-live,
html[data-theme="light"] .novel-chunk-rail strong {
  color: var(--text-1);
}

html[data-theme="light"] .novel-source-evidence {
  color: #8a5717;
  background: #fffaf0;
  border-color: rgba(153, 102, 31, 0.24);
}

html[data-theme="light"] #view-novel-adaptation .novel-progress-stats span,
html[data-theme="light"] .novel-chunk-rail li {
  color: var(--text-2);
  background: var(--bg-2);
  border-color: var(--border-soft);
}

html[data-theme="light"] #view-novel-adaptation .novel-progress-stats strong {
  color: var(--text-0);
}

@media (prefers-reduced-motion: reduce) {
  .novel-progress-track span {
    animation: none;
    transition: none;
  }
}

@media (max-width: 767px) {
  body.novel-workbench-active {
    padding-bottom: calc(84px + var(--safe-bottom));
  }

  body.novel-workbench-active .app-container {
    padding: 0 12px calc(100px + var(--safe-bottom));
  }

  .novel-target-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .novel-target-route-options,
  .novel-medium-cards {
    grid-template-columns: 1fr;
  }

  .novel-retarget-modal {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 24px);
  }

  .novel-target-route-option,
  .novel-medium-card {
    min-height: 0;
  }

  body.novel-workbench-active .mobile-bottom-nav,
  body.novel-workbench-active .mobile-action-dock {
    display: none;
  }

  #view-novel-adaptation .novel-analysis-main {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .novel-title-desktop {
    display: none;
  }

  .novel-title-mobile,
  .novel-source-toggle {
    display: inline;
  }

  #view-novel-adaptation .novel-adaptation-header {
    display: grid;
    grid-template-columns: minmax(76px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin: 0 -12px 14px;
    padding: 12px;
  }

  .novel-header-copy {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    text-align: center;
  }

  .novel-header-copy .novel-adaptation-eyebrow,
  .novel-header-copy .page-subtitle {
    display: none;
  }

  .novel-header-copy .page-title {
    overflow: hidden;
    font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", serif;
    font-size: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .novel-header-actions {
    display: contents;
  }

  #btnBackFromNovelAdaptation {
    grid-column: 1;
    grid-row: 1;
    min-height: 44px;
    padding: 8px;
  }

  .novel-source-toggle {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  #view-novel-adaptation.novel-has-project:not(.novel-source-expanded) .novel-import-card {
    display: none;
  }

  #view-novel-adaptation .novel-progress-card {
    margin: 0 -12px;
    padding: 22px 16px 18px;
    overflow: visible;
    isolation: auto;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  #view-novel-adaptation .novel-progress-card .novel-section-head {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
  }

  #view-novel-adaptation .novel-progress-card h2 {
    max-width: 210px;
    font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", serif;
    font-size: 30px;
    line-height: 1.18;
  }

  .novel-progress-status-group {
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
  }

  .novel-progress-percent {
    font-size: 44px;
  }

  .novel-progress-live,
  #view-novel-adaptation .novel-progress-track,
  #view-novel-adaptation .novel-progress-stats {
    max-width: 100%;
  }

  .novel-progress-live {
    padding-right: 88px;
    line-height: 1.65;
  }

  .novel-source-evidence {
    margin-top: 10px;
  }

  #view-novel-adaptation .novel-progress-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #view-novel-adaptation .novel-progress-stats span {
    padding: 9px 8px;
  }

  .novel-chunk-rail {
    grid-template-columns: repeat(7, 92px);
    scroll-snap-type: x proximity;
  }

  .novel-chunk-rail li {
    scroll-snap-align: start;
  }

  .novel-result-card {
    margin-top: 12px;
  }

  .novel-result-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .novel-result-actions .btn {
    width: 100%;
  }

  .novel-recommendation-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .novel-diagnostic-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .novel-diagnostic-toolbar .btn-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .novel-task-actions {
    position: fixed;
    z-index: 880;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 12px 14px calc(12px + var(--safe-bottom));
    background: rgba(8, 14, 26, 0.96);
    border-top: 1px solid rgba(229, 183, 109, 0.2);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(14px);
  }

  html[data-theme="light"] .novel-task-actions {
    background: rgba(248, 245, 238, 0.96);
    border-top-color: rgba(153, 102, 31, 0.2);
    box-shadow: 0 -10px 24px rgba(40, 48, 67, 0.1);
  }

  html[data-theme="light"] .novel-task-actions .btn-ghost:not(:disabled) {
    color: var(--text-1);
    background: rgba(255, 255, 255, 0.82);
    border-color: var(--border-soft);
  }

  .novel-task-actions .btn {
    min-height: 50px;
  }

  .novel-task-actions .btn:disabled {
    display: none;
  }

  .novel-task-actions .btn:not(:disabled):first-child,
  .novel-task-actions .btn-accent:not(:disabled) {
    color: #101725;
    background: var(--novel-reading-gold);
    border-color: var(--novel-reading-gold);
  }

}
