/* =========================
   CHAPTER LIST + GROUP
========================= */

.chapter-list {
  display: block;
}

.chapter-group-card {
  width: 100%;
  margin-top: var(--space-7);
  margin-bottom: var(--space-7);
  border-radius: 26px;
  background: var(--bg-card);
  overflow: hidden;
}

.chapter-group-details {
  background: var(--bg-card);
}

.chapter-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-7) var(--space-8);
  padding: var(--space-7) var(--space-8);
  list-style: none;
  cursor: pointer;
}

.chapter-group-summary::-webkit-details-marker {
  display: none;
}

.chapter-group-summary-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chapter-group-title {
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.chapter-group-meta {
  color: var(--text-dark);
  font-size: 12px;
}

.chapter-group-body {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: var(--space-5);
  padding: 0 var(--space-6) var(--space-7);
}

/* =========================
   CHAPTER CARD
========================= */

.chapter-card {
  position: relative;
  z-index: 1;
  min-width: 0;
  border-radius: 22px;
  background: var(--bg-main);
  overflow: visible;
}

.chapter-details {
  height: 100%;
  background: transparent;
}

/* open chapter spans full width */
.chapter-card:has(.chapter-details[open]) {
  grid-column: 1 / -1;
}

/* =========================
   CHAPTER SUMMARY
========================= */

.chapter-summary {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 15px;
  padding: var(--space-7);
  list-style: none;
  cursor: pointer;
}

.chapter-summary::-webkit-details-marker {
  display: none;
}

.chapter-summary-main {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
  min-width: 0;
}

.chapter-title-text {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chapter-meta {
  flex-shrink: 0;
  transform: translateY(1px);
  color: var(--text-dark);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.chapter-summary-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
  flex-shrink: 0;
}

.chapter-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
}

.chapter-mini-btn:hover {
  color: var(--text-primary);
}

.chapter-style-btn {
  color: #d8ff00;
}

.chapter-style-btn:hover {
  color: #f4ff7a;
}

.chapter-details[open] .chapter-summary {
  padding-bottom: var(--space-5);
  min-height: unset;
}

/* =========================
   CHAPTER BODY
========================= */

.chapter-body {
  padding: 0 var(--space-7) var(--space-7);
}

.chapter-preview-box {
  margin-bottom: var(--space-1);
  padding: var(--space-1);
  border-radius: 16px;
  background: transparent;
  color: var(--text-secondary);
  line-height: var(--line-height-preview);
  white-space: pre-wrap;
  cursor: text;
}

.chapter-body-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.chapter-body-actions button {
  min-height: 36px;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-pill);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.chapter-body-actions button:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
}

/* =========================
   INLINE EDITOR
========================= */

.chapter-inline-editor {
  min-height: 200px;
  padding: var(--space-6);
  border: none;
  border-radius: 16px;
  background: transparent;
  outline: none;
  color: var(--text-secondary);
  line-height: var(--line-height-preview);
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
  caret-color: var(--text-primary);
}

.chapter-inline-editor::selection,
.chapter-inline-editor *::selection {
  background: rgba(255, 255, 255, 0.18);
}

.chapter-inline-editor.main-editor {
  width: 100%;
  min-height: 220px;
  box-sizing: border-box;
}

.chapter-body .chapter-inline-editor.main-editor {
  margin-top: 0.25rem;
}

/* =========================
   STYLE REVIEW HIGHLIGHTS
========================= */

.style-flag {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.style-flag-adverb {
  padding: 0 1px;
  border-radius: 2px;
  background: #d8ff00;
  color: #101014;
  box-shadow: 0 0 10px rgba(216, 255, 0, 0.55);
}

.style-sentence-span {
  border-radius: 4px;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.style-sentence-span.is-hard {
  background: rgba(255, 196, 0, 0.12);
}

.style-sentence-span.is-very-hard {
  background: rgba(255, 98, 0, 0.16);
}

.style-sentence-span.is-passive {
  box-shadow: inset 0 -2px 0 rgba(0, 255, 255, 0.7);
}

.style-sentence-span.is-targeted {
  background: rgba(255, 0, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 0, 255, 0.45);
}

/* =========================
   STYLE PANEL SENTENCE BLOCKS
========================= */

.style-sentence-row {
  width: 100%;
  padding: var(--space-6);
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-search-card);
  color: var(--text-secondary);
  text-align: left;
}

.style-sentence-row:hover {
  background: var(--bg-search-card-hover);
}

.style-sentence-row.is-hard {
  background: rgba(255, 196, 0, 0.08);
}

.style-sentence-row.is-very-hard {
  background: rgba(255, 98, 0, 0.10);
}

.style-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-glass-strong);
  color: var(--text-primary);
}

.style-feedback {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.style-feedback-line {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: 1.4;
}

.style-feedback-global {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
}