/* Feedback & Useful Voting Widget Styles */

.feedback-trigger-btn {
  position: fixed;
  top: 50%;
  right: max(16px, env(safe-area-inset-right));
  bottom: auto;
  transform: translateY(-50%);
  z-index: 10000050;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 44px;
  justify-content: center;
  padding: 0;
  background: transparent;
  color: var(--text-main, #1e293b);
  border: none;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 0.7;
  cursor: move;
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

body.flashcard-page.flashcard-immersive .feedback-trigger-btn,
body.flashcard-page.flashcard-immersive .ai-qa-launcher {
  display: none !important;
}

.feedback-trigger-btn svg {
  width: 23px;
  height: 23px;
  stroke-width: 2.1;
  opacity: 0.9;
}

.feedback-trigger-btn::before {
  content: "AI";
  position: absolute;
  left: -2px;
  top: -4px;
  min-width: 18px;
  height: 15px;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #2d8a63;
  box-shadow: none;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: -0.2px;
  line-height: 1;
  opacity: 0.92;
  transition: opacity 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

@media (min-width: 769px) and (max-width: 1180px) {
  .feedback-trigger-btn {
    top: 52%;
    right: max(16px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    opacity: 0.7;
  }
}

@media (max-width: 768px) {
  .feedback-trigger-btn {
    top: 55%;
    right: max(12px, env(safe-area-inset-right));
    width: 40px;
    height: 40px;
    padding: 0;
    opacity: 0.7;
  }

  .feedback-trigger-btn svg {
    width: 21px;
    height: 21px;
  }
}

.feedback-trigger-btn.is-dragged {
  transform: none !important;
}

.feedback-trigger-btn:hover {
  transform: translateY(-50%) scale(1.08);
  box-shadow: none;
  background: rgba(0, 0, 0, 0.06);
  opacity: 1;
}

.feedback-trigger-btn:hover svg {
  opacity: 1;
}

.feedback-trigger-btn:hover::before {
  opacity: 1;
  background: transparent;
  color: #226b4d;
}

.feedback-trigger-btn.is-dragged:hover {
  transform: scale(1.08) !important;
}

.announcement-unread-dot {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--panel-bg, #ffffff);
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .16);
}

.feedback-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000090;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(7px) saturate(1.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  touch-action: pan-y;
}

.feedback-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.feedback-modal-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  background: rgba(250, 252, 250, 0.9);
  color: var(--text-main, #1e293b);
  border-radius: 18px;
  border: 1px solid rgba(218, 230, 222, 0.8);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.25s ease;
  touch-action: pan-y;
}

.feedback-modal-overlay.is-open .feedback-modal-card {
  transform: scale(1);
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(218, 230, 222, 0.82);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(1.14);
  -webkit-backdrop-filter: blur(16px) saturate(1.14);
}

.feedback-modal-tabs {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.feedback-modal-tabs::-webkit-scrollbar { display: none; }

.feedback-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text-muted, #64748b);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.feedback-tab-btn svg { width: 15px; height: 15px; }

.feedback-tab-btn.active {
  background: #e1ece2;
  color: #2d5a27;
  border-color: rgba(45, 90, 39, 0.35);
  box-shadow: 0 2px 6px rgba(45, 90, 39, 0.08);
}

.feedback-ai-body {
  gap: 14px;
  background: transparent;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-bottom: max(110px, calc(env(safe-area-inset-bottom, 24px) + 84px)) !important;
}

#feedback-ai-ask-panel,
#feedback-ai-quiz-panel,
#feedback-ai-history-panel {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  padding-bottom: 28px;
  touch-action: pan-y;
}

.feedback-ai-result,
.feedback-ai-sources {
  display: grid;
  gap: 10px;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feedback-ai-intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(205, 236, 215, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-main, #1e293b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.feedback-ai-intro strong {
  font-size: 1rem;
  font-weight: 800;
}

.feedback-ai-intro span {
  color: var(--text-muted, #64748b);
  font-size: 0.85rem;
  line-height: 1.55;
}

.feedback-ai-form {
  display: grid;
  gap: 12px;
}

.feedback-ai-form label {
  display: grid;
  gap: 6px;
  color: var(--text-main, #334155);
  font-size: 0.84rem;
  font-weight: 700;
}

.feedback-ai-form select,
.feedback-ai-form input,
.feedback-ai-form textarea {
  width: 100%;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-main, #0f172a);
  font: inherit;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.feedback-ai-form select {
  min-height: 42px;
  padding: 0 12px;
}

.feedback-ai-form input {
  min-height: 42px;
  padding: 0 12px;
}

.feedback-ai-form textarea {
  min-height: 118px;
  padding: 12px 14px;
  resize: vertical;
}

.feedback-ai-topbar {
  display: block;
  margin-bottom: 8px;
  width: 100%;
}

.feedback-ai-quota-bar {
  display: none !important;
}

.feedback-ai-quota-pill {
  display: none !important;
}

.feedback-ai-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #edf5ee;
  border: 1px solid #dce8dd;
  width: 100%;
  box-sizing: border-box;
}

.feedback-ai-mode-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #5f745e;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.feedback-ai-mode-switch button svg {
  width: 14px;
  height: 14px;
}

.feedback-ai-mode-switch button.active {
  background: #ffffff;
  color: #2d5a27;
  border: 1px solid rgba(45, 90, 39, 0.16);
  box-shadow: 0 1px 4px rgba(45, 90, 39, 0.08);
}

#feedback-ai-history-panel {
  display: grid;
  gap: 12px;
  min-height: 200px;
  width: 100%;
  box-sizing: border-box;
}

#feedback-ai-history-panel[hidden] {
  display: none !important;
}

.feedback-ai-history-detail {
  display: grid;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

#fb-hist-detail-result,
#fb-hist-detail-sources {
  width: 100%;
  box-sizing: border-box;
}

.feedback-ai-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  width: 100%;
  box-sizing: border-box;
}

.feedback-ai-history-count {
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--text-muted, #64748b);
}

.feedback-ai-clear-btn {
  border: 0;
  background: transparent;
  color: #ef4444;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.feedback-ai-clear-btn:hover {
  background: rgba(239, 68, 68, 0.08);
}

.feedback-ai-history-empty {
  padding: 48px 12px;
  color: var(--text-muted, #64748b);
  text-align: center;
  border: 1px dashed rgba(218, 230, 222, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.feedback-ai-history-empty p {
  margin: 0 0 4px;
  font-weight: 750;
  font-size: 0.92rem;
  color: var(--text-main, #1e293b);
}

.feedback-ai-history-empty small {
  font-size: 0.8rem;
}

.feedback-ai-history-list {
  display: grid;
  gap: 8px;
}

.feedback-ai-history-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(218, 230, 222, 0.9);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text-main, #1e293b);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.feedback-ai-history-item:hover {
  border-color: #2d8a63;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 138, 99, 0.12);
}

.feedback-ai-hist-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.feedback-ai-mode-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.feedback-ai-mode-tag.ask-badge {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.feedback-ai-mode-tag.quiz-badge {
  background: rgba(45, 138, 99, 0.12);
  color: #2d8a63;
}

.feedback-ai-hist-time {
  font-size: 0.76rem;
  color: var(--text-muted, #94a3b8);
}

.feedback-ai-hist-title {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-main, #1e293b);
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feedback-ai-hist-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: #2d8a63;
  color: #ffffff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 750;
  cursor: pointer;
  margin-bottom: 12px;
}

.feedback-ai-hist-meta-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(205, 236, 215, 0.8);
  margin-bottom: 14px;
}

.feedback-ai-hist-meta-card strong {
  display: block;
  font-size: 0.94rem;
  color: var(--text-main, #1e293b);
  margin-bottom: 4px;
}

.feedback-ai-hist-meta-card small {
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
}

.feedback-ai-grid {
  display: grid;
  gap: 10px;
}

.feedback-ai-grid.two {
  grid-template-columns: 1.3fr 0.7fr;
}

.feedback-ai-grid.three {
  grid-template-columns: 1fr 1fr 0.72fr;
}

.feedback-ai-form select:focus,
.feedback-ai-form input:focus,
.feedback-ai-form textarea:focus {
  border-color: #4f8549;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 133, 73, 0.15);
}

.feedback-ai-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid rgba(45, 90, 39, 0.25);
  border-radius: 12px;
  background: #e1ece2;
  color: #245220;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(45, 90, 39, 0.06);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.feedback-ai-submit:hover {
  background: #d4e8d6;
  border-color: rgba(45, 90, 39, 0.4);
  color: #173b14;
  box-shadow: 0 4px 14px rgba(45, 90, 39, 0.12);
  transform: translateY(-1px);
}

.feedback-ai-submit:active {
  background: #c6e0c9;
  transform: translateY(0) scale(0.99);
}

.feedback-ai-submit:disabled {
  opacity: 0.6;
  background: #edf3ee;
  color: #7b947a;
  border-color: #d8e2d9;
  cursor: wait;
  transform: none;
}

.feedback-ai-submit svg {
  width: 17px;
  height: 17px;
}

.feedback-ai-result,
.feedback-ai-sources {
  display: grid;
  gap: 10px;
}

.feedback-ai-text,
.feedback-ai-loading {
  line-height: 1.72;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(45, 138, 99, 0.18);
  background:
    linear-gradient(90deg, rgba(45, 138, 99, 0.08), transparent 34px),
    linear-gradient(135deg, rgba(243, 249, 245, 0.98), rgba(255, 255, 255, 0.95));
  color: var(--text-main, #1e293b);
  font-size: 0.94rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 8px 22px rgba(15, 23, 42, 0.05);
}

.feedback-ai-markdown {
  display: grid;
  gap: 7px;
  white-space: normal;
}

.feedback-ai-markdown h4 {
  margin: 8px 0 2px;
  color: #2d8a63;
  font-size: 0.98rem;
  line-height: 1.45;
}

.feedback-ai-markdown h4:first-child {
  margin-top: 0;
}

.feedback-ai-markdown p {
  margin: 0;
  color: var(--text-main, #1e293b);
  line-height: 1.68;
}

.feedback-ai-markdown strong {
  font-weight: 850;
  color: #173f2a;
}

.feedback-ai-answer-callout {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 111, 67, 0.18);
  border-radius: 13px;
  box-shadow: 0 8px 18px rgba(31, 111, 67, 0.06);
}

.feedback-ai-answer-callout.is-summary {
  background: linear-gradient(135deg, rgba(224, 244, 234, 0.98), rgba(250, 255, 252, 0.95));
}

.feedback-ai-answer-callout.is-mnemonic {
  background: linear-gradient(135deg, rgba(255, 247, 219, 0.98), rgba(245, 251, 242, 0.94));
  border-color: rgba(184, 134, 11, 0.24);
}

.feedback-ai-answer-label {
  color: #1f6f43;
  font-size: 0.82rem;
  font-weight: 900;
}

.feedback-ai-answer-callout.is-mnemonic .feedback-ai-answer-label {
  color: #8a5a00;
}

.feedback-ai-answer-callout-body {
  color: var(--text-main, #1e293b);
  line-height: 1.72;
}

.feedback-ai-answer-points {
  margin: 5px 0 8px;
  padding: 0;
  display: grid;
  gap: 6px;
  list-style: none;
  white-space: normal;
  border: 0;
  background: transparent;
}

.feedback-ai-answer-points li {
  padding: 2px 0;
  border-bottom: 0;
  line-height: 1.65;
  list-style: none;
}

.feedback-ai-point-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 5px;
  margin-right: 6px;
  background: #e0f2fe;
  color: #0284c7;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 800;
  vertical-align: middle;
}

.feedback-ai-point-title {
  color: var(--text-main, #1e293b);
  font-weight: 800;
}

.feedback-ai-sub-points {
  margin: 3px 0 4px 1rem;
  padding: 0;
  list-style-type: disc;
  display: grid;
  gap: 3px;
  color: var(--text-main, #1e293b);
  font-size: 0.88rem;
}

.feedback-ai-sub-points li {
  padding: 1px 0 !important;
  line-height: 1.55 !important;
  border-bottom: 0 !important;
  list-style: disc !important;
}

.feedback-ai-sub-points li::marker {
  color: #2d8a63;
  font-size: 0.8em;
}

.feedback-ai-live-card {
  border-style: dashed !important;
  border-color: rgba(45, 138, 99, 0.25) !important;
  background: rgba(255, 255, 255, 0.95) !important;
}

.feedback-ai-stream-hint {
  font-size: 0.86rem;
  color: #2d8a63;
  font-weight: 750;
  padding: 6px 0;
}

.feedback-ai-point-title {
  color: #173f2a;
  font-weight: 900;
}

.feedback-ai-cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.22em;
  height: 1.22em;
  margin-left: 3px;
  border-radius: 999px;
  background: rgba(45, 138, 99, 0.16);
  color: #226b4d;
  font-size: 0.68em;
  font-weight: 900;
  line-height: 1;
  vertical-align: super;
}

.feedback-ai-markdown hr {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(205, 236, 215, 0.9);
  margin: 4px 0;
}

.feedback-ai-bullet,
.feedback-ai-numbered {
  position: relative;
  padding-left: 18px;
}

.feedback-ai-bullet::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, #2d8a63 78%, #ffffff 22%);
}

.feedback-ai-loading-card {
  border: 1px solid rgba(45, 138, 99, 0.2);
  border-radius: 14px;
  padding: 11px 12px;
  background: linear-gradient(135deg, rgba(237, 247, 241, 0.7) 0%, rgba(255, 255, 255, 0.98) 100%);
  display: grid;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.feedback-ai-loading-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.feedback-ai-loading-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0%;
  min-width: 0 !important;
  max-width: calc(100% - 85px) !important;
  overflow: hidden !important;
}

.feedback-ai-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(45, 138, 99, 0.2);
  border-top-color: #2d8a63;
  border-radius: 50%;
  animation: feedback-spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.feedback-ai-loading-title {
  font-size: 0.82rem;
  font-weight: 750;
  color: #2d8a63;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.feedback-ai-elapsed-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #ffffff;
  border: 1px solid rgba(45, 138, 99, 0.24);
  border-radius: 999px;
  color: #2d8a63;
  font-family: var(--font-mono, monospace);
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.feedback-ai-meta-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  width: 100%;
}

.feedback-ai-meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feedback-ai-elapsed-meta {
  border: 1px solid rgba(45, 138, 99, 0.2);
  background: rgba(237, 247, 241, 0.85);
  color: #2d8a63;
}

.feedback-ai-usage-meta {
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: rgba(239, 246, 255, 0.85);
  color: #2563eb;
}

.feedback-ai-usage-meta.is-vip {
  border: 1px solid rgba(217, 119, 6, 0.28);
  background: rgba(254, 243, 199, 0.85);
  color: #b45309;
}

.feedback-ai-loading-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.feedback-ai-step-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(45, 138, 99, 0.16);
  font-size: 0.68rem;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.2s ease;
  user-select: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feedback-ai-step-chip.active {
  background: #2d8a63;
  border-color: #2d8a63;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(45, 138, 99, 0.2);
}

.feedback-ai-step-chip.done {
  background: rgba(45, 138, 99, 0.12);
  border-color: rgba(45, 138, 99, 0.28);
  color: #2d8a63;
  font-weight: 750;
}

.feedback-ai-notice {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 119, 6, 0.24);
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.96);
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.55;
}

.feedback-ai-answer-body {
  margin-top: 8px;
}

.feedback-ai-source-heading {
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  font-weight: 800;
}

.feedback-ai-source-details {
  display: grid;
  gap: 10px;
}

.feedback-ai-source-details summary {
  width: fit-content;
  cursor: pointer;
  user-select: none;
  list-style: none;
  color: #2d8a63;
  font-size: 0.84rem;
  font-weight: 850;
  padding: 5px 0;
}

.feedback-ai-source-details summary::-webkit-details-marker {
  display: none;
}

.feedback-ai-source-details summary::after {
  content: "⌄";
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.16s ease;
}

.feedback-ai-source-details[open] summary::after {
  transform: rotate(180deg);
}

.feedback-ai-source-list {
  display: grid;
  gap: 10px;
}

.feedback-ai-source-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(205, 236, 215, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.feedback-ai-source-card strong {
  color: var(--text-main, #1e293b);
  font-size: 0.84rem;
}

.feedback-ai-source-card span {
  color: var(--text-muted, #64748b);
  font-size: 0.75rem;
}

.feedback-ai-source-card p {
  margin: 0;
  color: var(--text-main, #334155);
  font-size: 0.82rem;
  line-height: 1.55;
}

.feedback-ai-question-card {
  padding: 13px;
  border: 1px solid rgba(205, 236, 215, 0.9);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.84);
  margin-top: 10px;
}

.feedback-ai-question-meta {
  color: var(--text-muted, #64748b);
  font-size: 0.76rem;
  font-weight: 800;
}

.feedback-ai-question-card h4 {
  margin: 8px 0 12px;
  color: var(--text-main, #1e293b);
  font-size: 0.96rem;
  line-height: 1.55;
}

.feedback-ai-options {
  display: grid;
  gap: 8px;
}

.feedback-ai-option {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-main, #1e293b);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}

.feedback-ai-option.is-selected { border-color: #2d8a63; }
.feedback-ai-option.is-correct { background: #e8f7ec; border-color: #38a169; }
.feedback-ai-option.is-wrong { background: #fff1f2; border-color: #ff3b30; }

.feedback-ai-answer {
  margin-top: 10px;
}

.feedback-ai-answer summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #2d8a63;
  font-size: 0.82rem;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(45, 138, 99, 0.08);
  border: 1px solid rgba(45, 138, 99, 0.18);
  user-select: none;
  transition: background 0.15s ease;
}

.feedback-ai-answer summary:hover {
  background: rgba(45, 138, 99, 0.14);
}

.feedback-ai-quiz-section {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(218, 230, 222, 0.8);
}

.feedback-ai-ans-sec {
  border-left: 3px solid #16a34a;
  background: #f0fdf4;
}

.feedback-ai-exp-sec {
  border-left: 3px solid #2563eb;
  background: #f8fafc;
}

.feedback-ai-quiz-sec-title {
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.feedback-ai-ans-sec .feedback-ai-quiz-sec-title {
  color: #15803d;
}

.feedback-ai-exp-sec .feedback-ai-quiz-sec-title {
  color: #1d4ed8;
}

.feedback-ai-quiz-sec-body {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-main, #1e293b);
}

.feedback-ai-choice-ans {
  font-size: 0.9rem;
  font-weight: 700;
  color: #15803d;
  padding: 2px 0;
}

.feedback-ai-sec-header {
  font-size: 0.9rem;
  font-weight: 850;
  color: #1e3a8a;
  margin: 8px 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px dashed rgba(59, 130, 246, 0.2);
}

.feedback-ai-quiz-sources-bar {
  margin-top: 8px;
  padding: 5px 8px;
  background: rgba(241, 245, 249, 0.85);
  border-radius: 6px;
  font-size: 0.78rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.feedback-ai-source-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.74rem;
}

@media (max-width: 520px) {
  .feedback-ai-dialog {
    width: 96vw !important;
    max-width: 96vw !important;
    padding: 14px 10px !important;
  }
  .feedback-ai-question-card {
    padding: 10px 9px !important;
    margin-bottom: 8px !important;
  }
  .feedback-ai-quiz-section {
    padding: 8px 9px !important;
  }
  .feedback-ai-grid.two,
  .feedback-ai-grid.three {
    grid-template-columns: 1fr;
  }
}

.feedback-context-badge {
  padding: 8px 12px;
  background: rgba(224, 246, 232, 0.72);
  color: #23643b;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  flex-shrink: 0;
}

#tab-discuss-body,
#tab-announcement-body {
  overflow-y: hidden;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  gap: 12px;
}

#tab-discuss-body .feedback-form-group {
  margin-top: auto;
  margin-bottom: 0;
  flex-shrink: 0;
}

.feedback-comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

.feedback-announcements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-right: 4px;
}

.feedback-announcement-item {
  flex: 0 0 auto;
  padding: 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  background: var(--bg-color, #f8fafc);
}

.feedback-announcements-list::-webkit-scrollbar { width: 6px; }
.feedback-announcements-list::-webkit-scrollbar-thumb { background: var(--border-color, #cbd5e1); border-radius: 999px; }

.feedback-announcement-item strong { color: var(--text-main); display: block; }
.feedback-announcement-item p { margin: 7px 0; line-height: 1.6; white-space: pre-wrap; }
.feedback-announcement-item time { color: var(--text-muted); font-size: 0.76rem; }
.feedback-announcement-image { display: block; width: 100%; max-height: 320px; margin: 10px 0; object-fit: contain; border: 1px solid var(--border-color, #e2e8f0); border-radius: 7px; background: #fff; }
.feedback-discussion-link { display: inline-flex; margin-top: 12px; color: var(--primary-color); font-size: 0.84rem; font-weight: 700; text-decoration: none; }

@media (min-width: 700px) {
  .feedback-modal-overlay {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
  }
  .feedback-modal-card {
    width: clamp(500px, 60vw, 920px);
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;
    max-height: 100%;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
    border-radius: 0;
    transform: translateX(100%);
    box-sizing: border-box;
  }
  .feedback-modal-overlay.is-open .feedback-modal-card { transform: translateX(0); }
  .feedback-modal-body {
    max-height: none;
    padding: 20px 24px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    box-sizing: border-box;
  }
  .feedback-ai-body {
    padding-bottom: max(110px, calc(env(safe-area-inset-bottom, 24px) + 84px)) !important;
  }
}

@media (max-width: 699px) {
  .feedback-modal-overlay {
    align-items: flex-end;
    padding: 0;
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
  }
  .feedback-modal-card {
    width: 100% !important;
    max-width: 100vw !important;
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;
    max-height: 100%;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
    border-radius: 0 !important;
    transform: translateY(100%);
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  .feedback-modal-overlay.is-open .feedback-modal-card { transform: translateY(0); }
  .feedback-modal-header {
    padding: 10px 12px !important;
  }
  .feedback-modal-body {
    padding: 10px 8px !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }
  .feedback-ai-body {
    padding: 10px 8px !important;
    padding-bottom: max(100px, calc(env(safe-area-inset-bottom, 20px) + 75px)) !important;
  }
  #tab-discuss-body,
  #tab-announcement-body {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
  }
  .feedback-ai-text,
  .feedback-ai-loading,
  .feedback-ai-question-card {
    padding: 11px 9px !important;
    border-radius: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .feedback-ai-markdown {
    gap: 6px !important;
  }
  .feedback-ai-markdown h4.feedback-ai-sec-header {
    margin: 5px 0 2px !important;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
  }
  .feedback-ai-markdown p {
    line-height: 1.62 !important;
  }
  .feedback-ai-answer-points {
    padding: 2px 0 4px 0 !important;
    margin: 3px 0 5px 0 !important;
    gap: 5px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .feedback-ai-answer-points li {
    padding: 1px 0 !important;
    line-height: 1.6 !important;
    word-break: break-word !important;
  }
  .feedback-ai-point-num {
    min-width: 1.25rem !important;
    height: 1.25rem !important;
    margin-right: 5px !important;
    font-size: 0.74rem !important;
  }
  .feedback-ai-sub-points {
    margin: 3px 0 3px 0.65rem !important;
    padding-left: 0.5rem !important;
    gap: 2px !important;
  }
  .feedback-ai-sub-points li {
    padding: 1px 0 !important;
    line-height: 1.52 !important;
  }
  .feedback-ai-options {
    gap: 6px !important;
  }
  .feedback-ai-option {
    padding: 8px 10px !important;
    min-height: 36px !important;
    font-size: 0.86rem !important;
  }
  .feedback-ai-quiz-section {
    padding: 8px 9px !important;
  }
  .feedback-ai-question-card h4 {
    margin: 6px 0 10px !important;
    line-height: 1.5 !important;
  }
}

.comment-item {
  padding: 10px 14px;
  background: var(--bg-color, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
}

.comment-title-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 700;
  color: var(--text-main, #1e293b);
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.comment-topic {
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-light, #e8f5e9) 72%, transparent);
  color: var(--text-muted, #64748b);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-time-line {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
  font-size: 0.76rem;
}

.comment-content-text {
  font-size: 0.88rem;
  color: var(--text-main, #1e293b);
  line-height: 1.5;
  word-break: break-word;
}

.comment-replies {
  display: grid;
  gap: 7px;
  margin-top: 4px;
  padding-left: 12px;
  border-left: 2px solid color-mix(in srgb, #2d8d4f 22%, transparent);
}

.comment-reply-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-bg, #ffffff) 74%, var(--primary-light, #e8f5e9) 26%);
}

.comment-reply-btn,
.comment-delete-own-btn {
  margin-left: 6px;
  padding: 1px 5px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  font-size: .76rem;
  cursor: pointer;
}

.comment-reply-btn {
  color: #23643b;
  font-weight: 700;
}

.comment-delete-own-btn {
  color: #b45309;
}

.discuss-reply-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary-light, #e8f5e9) 82%, #ffffff 18%);
  color: #23643b;
  font-size: 0.82rem;
  font-weight: 700;
}

.discuss-reply-target[hidden] {
  display: none !important;
}

.discuss-reply-target button {
  border: 0;
  background: transparent;
  color: #b45309;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

@media (max-width: 640px) {
  .comment-item {
    padding: 10px 12px;
    gap: 7px;
  }

  .comment-meta {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .comment-time-line {
    justify-content: flex-start;
    white-space: normal;
  }

  .comment-topic {
    max-width: 100%;
  }
}

.comment-delete-own-btn:hover,
.comment-delete-own-btn:focus-visible {
  background: #fff7ed;
  color: #9a3412;
}

.feedback-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted, #64748b);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
}

.feedback-modal-close:hover {
  color: var(--text-main, #1e293b);
  background: var(--border-color, #e2e8f0);
}

.feedback-modal-body {
  padding: 24px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  box-sizing: border-box;
}

html.feedback-modal-open,
body.feedback-modal-open {
  overflow: hidden;
}

.vote-section {
  background: var(--bg-color, #f8fafc);
  padding: 16px 20px;
  border-radius: var(--radius-sm, 10px);
  border: 1px solid var(--border-color, #e2e8f0);
  text-align: center;
}

.vote-section p {
  margin: 0 0 12px;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
}

.vote-buttons-row {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--panel-bg, #ffffff);
  color: var(--text-main, #334155);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.vote-btn:hover {
  border-color: #2d8d4f;
  color: #23643b;
  background: rgba(224, 246, 232, 0.72);
}

.vote-btn.is-selected-useful {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
}

.vote-btn.is-selected-not-useful {
  background: #f43f5e;
  color: #ffffff;
  border-color: #e11d48;
}

.feedback-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-form-group label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
}

.feedback-textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--panel-bg, #ffffff);
  color: var(--text-main, #0f172a);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  -webkit-appearance: none;
}

.feedback-textarea:focus,
.feedback-input:focus {
  outline: none;
  border-color: #2d8d4f;
  box-shadow: 0 0 0 3px rgba(45, 141, 79, 0.14);
}

.feedback-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--panel-bg, #ffffff);
  color: var(--text-main, #0f172a);
  font-size: 1rem;
  -webkit-appearance: none;
}

.feedback-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-color, #f8fafc);
}

.feedback-modal-footer .tip-text {
  font-size: 0.76rem;
  color: var(--text-muted, #64748b);
}

.submit-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: #2d8d4f;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.submit-feedback-btn:hover {
  background: #236f3e;
}

.submit-feedback-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.feedback-toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 1001;
  padding: 12px 20px;
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
}

.feedback-toast.is-show {
  opacity: 1;
  transform: translateY(0);
}

.feedback-ai-stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  vertical-align: text-bottom;
  background-color: #2563eb;
  margin-left: 4px;
  border-radius: 1px;
  animation: feedback-cursor-blink 0.8s infinite;
}

@keyframes feedback-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Custom Chapter Select Button */
.feedback-ai-custom-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--line-color, #cbd5e1);
  background: var(--surface-color, #ffffff);
  color: var(--text-main, #1e293b);
  font-size: 0.88rem;
  font-weight: 550;
  cursor: pointer;
  text-align: left;
  user-select: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.feedback-ai-custom-select:hover {
  border-color: #2d8a63;
  background: rgba(45, 138, 99, 0.05);
}

.feedback-ai-custom-select svg {
  color: #64748b;
  flex-shrink: 0;
}

.feedback-ai-select-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Custom Chapter Picker Overlay & Bottom Sheet Modal */
.ai-chapter-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000200;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.ai-chapter-picker-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.ai-chapter-picker-modal {
  width: 100%;
  max-width: 440px;
  max-height: 52vh;
  background: var(--surface-color, #ffffff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-sizing: border-box;
}

.ai-chapter-picker-modal.is-compact {
  max-height: 40vh;
}

.ai-chapter-picker-overlay.is-open .ai-chapter-picker-modal {
  transform: translateY(0);
}

@media (min-width: 641px) {
  .ai-chapter-picker-overlay {
    align-items: center;
  }
  .ai-chapter-picker-modal {
    border-radius: 14px;
    max-height: 48vh;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  }
  .ai-chapter-picker-modal.is-compact {
    max-height: 36vh;
  }
  .ai-chapter-picker-overlay.is-open .ai-chapter-picker-modal {
    transform: translateY(0) scale(1);
  }
}

.ai-chapter-picker-handle {
  width: 32px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 99px;
  margin: 6px auto 0;
}

@media (min-width: 641px) {
  .ai-chapter-picker-handle {
    display: none;
  }
}

.ai-chapter-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 4px;
}

.ai-chapter-picker-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main, #0f172a);
}

.ai-chapter-picker-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted, #64748b);
  margin-top: 1px;
}

.ai-chapter-picker-close-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-chapter-picker-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ai-chapter-picker-search-wrap {
  position: relative;
  margin: 2px 14px 8px;
  display: flex;
  align-items: center;
}

.ai-chapter-picker-search-wrap svg {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  pointer-events: none;
}

.ai-chapter-picker-search-input {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 30px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.84rem;
  color: var(--text-main, #0f172a);
  box-sizing: border-box;
  outline: none;
  transition: all 0.15s ease;
}

.ai-chapter-picker-search-input:focus {
  border-color: #2d8a63;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(45, 138, 99, 0.14);
}

.ai-chapter-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  display: grid;
  gap: 5px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.ai-chapter-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  user-select: none;
}

.ai-chapter-picker-item:hover {
  border-color: rgba(45, 138, 99, 0.3);
  background: #f6faf7;
}

.ai-chapter-picker-item.is-selected {
  border-color: #2d8a63;
  background: rgba(45, 138, 99, 0.08);
}

.ai-chapter-picker-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ai-chapter-picker-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}

.ai-chapter-picker-item.is-selected .ai-chapter-picker-badge {
  background: #2d8a63;
  color: #ffffff;
}

.ai-chapter-picker-badge.is-all {
  background: #e8f7ec;
  color: #2e7d5b;
  font-weight: 900;
}

.ai-chapter-picker-item-info {
  flex: 1;
  min-width: 0;
}

.ai-chapter-picker-item-title {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text-main, #0f172a);
  line-height: 1.4;
  word-break: break-word;
}

.ai-chapter-picker-item.is-selected .ai-chapter-picker-item-title {
  color: #2d8a63;
  font-weight: 800;
}

.ai-chapter-picker-item-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

.ai-chapter-picker-item-check {
  font-size: 0.95rem;
  font-weight: 900;
  color: #2d8a63;
  margin-left: 8px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

body.dark-theme .ai-chapter-picker-modal,
body[data-theme="dark"] .ai-chapter-picker-modal {
  background: #1e293b;
  color: #f1f5f9;
}
body.dark-theme .ai-chapter-picker-title,
body[data-theme="dark"] .ai-chapter-picker-title {
  color: #f1f5f9;
}
body.dark-theme .ai-chapter-picker-close-btn,
body[data-theme="dark"] .ai-chapter-picker-close-btn {
  background: #334155;
  color: #cbd5e1;
}
body.dark-theme .ai-chapter-picker-search-input,
body[data-theme="dark"] .ai-chapter-picker-search-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}
body.dark-theme .ai-chapter-picker-item,
body[data-theme="dark"] .ai-chapter-picker-item {
  background: #1e293b;
  border-color: #334155;
}
body.dark-theme .ai-chapter-picker-item-title,
body[data-theme="dark"] .ai-chapter-picker-item-title {
  color: #f1f5f9;
}
body.dark-theme .ai-chapter-picker-badge,
body[data-theme="dark"] .ai-chapter-picker-badge {
  background: #334155;
  color: #cbd5e1;
}

body.dark-theme .feedback-trigger-btn::before,
body[data-theme="dark"] .feedback-trigger-btn::before {
  color: #c4b5fd;
}

/* ==========================================================================
   Feedback Modal - Official Tab (药大官方黑白极简风格)
   ========================================================================== */
.feedback-official-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color, #e5e5e5);
  margin-bottom: 8px;
}

.feedback-bw-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main, #111);
}

.feedback-bw-fullscreen-link {
  font-size: 0.78rem;
  color: var(--text-muted, #666);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e5e5e5);
  background: var(--card-bg, #fafafa);
  transition: all 0.2s ease;
}

.feedback-bw-fullscreen-link:hover {
  color: var(--text-main, #111);
  border-color: var(--text-main, #111);
}

.feedback-official-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.feedback-official-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 右上角药丸按钮（轻量高级线框，绝无笨重感） */
.feedback-bw-books-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-color, #e5e5e5);
  color: var(--text-main, #111);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.feedback-bw-books-pill-btn:hover {
  border-color: var(--text-main, #111);
  background: rgba(0, 0, 0, 0.02);
}

body.dark-theme .feedback-bw-books-pill-btn:hover,
body[data-theme="dark"] .feedback-bw-books-pill-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.feedback-bw-books-pill-btn.is-active {
  border-color: #2563eb;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
}

/* 初试书抽屉式下拉面板 */
.feedback-bw-books-drawer {
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--bg-sub, #f9fafb);
  border: 1px solid var(--border-color, #e5e5e5);
  padding: 12px;
  animation: fadeIn 0.15s ease;
}

body.dark-theme .feedback-bw-books-drawer,
body[data-theme="dark"] .feedback-bw-books-drawer {
  background: #161616;
}

.feedback-bw-drawer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-color, #ebebeb);
}

.feedback-bw-drawer-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #111);
}

.feedback-bw-drawer-close {
  background: none;
  border: none;
  font-size: 0.74rem;
  color: var(--text-muted, #888);
  cursor: pointer;
}

.feedback-bw-drawer-close:hover {
  color: var(--text-main, #111);
}

.feedback-bw-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 下方超链接列表：彻底无背景！没有卡片框！纯粹简约文字流！ */
.feedback-bw-clean-links {
  display: flex;
  flex-direction: column;
}

.feedback-bw-clean-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--border-color, #f1f5f9) !important;
  box-shadow: none !important;
  text-decoration: none;
  color: var(--text-main, #111);
  transition: color 0.15s ease;
}

.feedback-bw-clean-link:last-child {
  border-bottom: none !important;
}

.feedback-bw-clean-link:hover {
  background: transparent !important;
}

.feedback-bw-link-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.feedback-bw-link-tag {
  font-size: 0.68rem;
  color: var(--text-muted, #777);
  background: transparent;
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.feedback-bw-link-title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-main, #111);
  line-height: 1.45;
  transition: color 0.15s ease;
}

.feedback-bw-clean-link:hover .feedback-bw-link-title {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.feedback-bw-link-arrow {
  font-size: 0.82rem;
  color: var(--text-muted, #888);
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.feedback-bw-clean-link:hover .feedback-bw-link-arrow {
  color: #2563eb;
  transform: translate(2px, -2px);
}

.feedback-bw-subject-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-color, #e5e5e5);
}

.feedback-bw-subject-block:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.feedback-bw-subject-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.feedback-bw-subject-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--text-main, #222);
  color: #fff;
}

body.dark-theme .feedback-bw-subject-tag,
body[data-theme="dark"] .feedback-bw-subject-tag {
  background: #3b82f6;
  color: #fff;
}

.feedback-bw-subject-subtag {
  font-size: 0.68rem;
  color: var(--text-muted, #777);
}

.feedback-bw-subject-books {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feedback-bw-book-card {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #ebebeb);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feedback-bw-book-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.feedback-bw-book-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #111);
}

.feedback-bw-book-edition {
  font-size: 0.72rem;
  font-weight: 600;
  color: #2563eb;
}

.feedback-bw-book-meta {
  font-size: 0.74rem;
  color: var(--text-muted, #666);
  line-height: 1.4;
}

.feedback-bw-book-fallback {
  font-size: 0.78rem;
  color: var(--text-muted, #555);
  line-height: 1.45;
}

.feedback-bw-color-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 2px;
}

.feedback-bw-color-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 6px;
  text-decoration: none;
  background: #f8f9fa;
  border: 1px solid #dde2e8;
  border-left: 4px solid #1e293b;
  color: #111827;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.feedback-bw-color-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -6px rgba(15, 23, 42, 0.14);
}

.feedback-bw-color-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.feedback-bw-color-arrow {
  font-size: 0.92rem;
  font-weight: 500;
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.feedback-bw-color-card:hover .feedback-bw-color-arrow {
  transform: translate(2px, -2px);
}

.feedback-bw-color-card.tone-rose {
  background: #f9f6f6;
  border-color: #e4dada;
  border-left: 4px solid #7f1d1d;
  color: #1c1917;
}
.feedback-bw-color-card.tone-rose:hover {
  background: #f4efef;
}
.feedback-bw-color-card.tone-rose .feedback-bw-color-arrow {
  color: #7f1d1d;
}

.feedback-bw-color-card.tone-blue {
  background: #f6f8fa;
  border-color: #d8e0e8;
  border-left: 4px solid #1e3a5f;
  color: #0f172a;
}
.feedback-bw-color-card.tone-blue:hover {
  background: #eef2f6;
}
.feedback-bw-color-card.tone-blue .feedback-bw-color-arrow {
  color: #1e3a5f;
}

.feedback-bw-color-card.tone-emerald {
  background: #f5f8f6;
  border-color: #d6e2da;
  border-left: 4px solid #1b4332;
  color: #0f1f17;
}
.feedback-bw-color-card.tone-emerald:hover {
  background: #edf3ef;
}
.feedback-bw-color-card.tone-emerald .feedback-bw-color-arrow {
  color: #1b4332;
}

.feedback-bw-color-card.tone-amber {
  background: #f9f8f5;
  border-color: #e4dfd5;
  border-left: 4px solid #5c4018;
  color: #1c1917;
}
.feedback-bw-color-card.tone-amber:hover {
  background: #f3f0ea;
}
.feedback-bw-color-card.tone-amber .feedback-bw-color-arrow {
  color: #5c4018;
}

body.dark-theme .feedback-bw-color-card.tone-rose,
body[data-theme="dark"] .feedback-bw-color-card.tone-rose {
  background: #191517;
  border-color: #2f2326;
  border-left: 4px solid #991b1b;
  color: #f3f4f6;
}
body.dark-theme .feedback-bw-color-card.tone-rose .feedback-bw-color-arrow,
body[data-theme="dark"] .feedback-bw-color-card.tone-rose .feedback-bw-color-arrow {
  color: #cbd5e1;
}

body.dark-theme .feedback-bw-color-card.tone-blue,
body[data-theme="dark"] .feedback-bw-color-card.tone-blue {
  background: #141921;
  border-color: #232d3b;
  border-left: 4px solid #2563eb;
  color: #f3f4f6;
}
body.dark-theme .feedback-bw-color-card.tone-blue .feedback-bw-color-arrow,
body[data-theme="dark"] .feedback-bw-color-card.tone-blue .feedback-bw-color-arrow {
  color: #cbd5e1;
}

body.dark-theme .feedback-bw-color-card.tone-emerald,
body[data-theme="dark"] .feedback-bw-color-card.tone-emerald {
  background: #131a17;
  border-color: #213029;
  border-left: 4px solid #2d6a4f;
  color: #f3f4f6;
}
body.dark-theme .feedback-bw-color-card.tone-emerald .feedback-bw-color-arrow,
body[data-theme="dark"] .feedback-bw-color-card.tone-emerald .feedback-bw-color-arrow {
  color: #cbd5e1;
}

