/* AI help while reading (assist.js): chapter button, the panel that slides up from the bottom, quiz. */

.chapter-ai { max-width: 760px; margin: 14px auto 0; text-align: center; }

/* panel: over the reading area, beside the sidebar on wide screens, full width on phones */
.assist { position: fixed; left: 260px; right: 0; bottom: 0; z-index: 30; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; max-height: 62vh; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,.18); font-size: 14.5px; animation: assist-up .2s ease; }
@keyframes assist-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.assist-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.assist-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assist-body { overflow-y: auto; padding: 12px 16px; flex: 1; min-height: 0; }
.assist-body p { margin: 0 0 8px; line-height: 1.55; }
.assist-body h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.assist-body ul { margin: 0 0 8px; padding-left: 20px; }
.assist-body .meta { font-size: 12px; color: var(--muted); margin-top: 10px; }
.as-quote { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 0 0 6px; font-family: Georgia, "Iowan Old Style", serif; font-size: 16px; }
.as-quote mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.as-answer { margin-top: 10px; }
.as-answer .pt { margin: 0 0 10px; }
.as-answer .pt b { display: block; }
.as-head { font-size: 17px; }
.as-head .pos { font-size: 13px; color: var(--muted); font-style: italic; }

/* quiz */
.quiz-score { color: var(--accent); margin-left: 6px; }
.quiz-q { margin: 0 0 14px; }
.quiz-q p { margin: 0 0 6px; }
.quiz-choices { display: grid; gap: 6px; }
.quiz-choices .choice { text-align: left; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); cursor: pointer; white-space: normal; }
.quiz-choices .choice:disabled { opacity: 1; cursor: default; }
.quiz-choices .choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); font-weight: 600; }
.quiz-choices .choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.quiz-q .why { font-size: 13.5px; color: var(--muted); margin-top: 6px; }

/* follow-up questions */
.assist-thread .turn { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.assist-thread .q { font-weight: 600; }
.assist-thread .q::before { content: "You: "; color: var(--muted); font-weight: 400; }
.assist-ask { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.assist-ask input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; }

@media (max-width: 760px) {
  .assist { left: 0; max-height: 72vh; }
}

/* night reading */
body.reading.reader-night .assist, body.reading.reader-night .assist-ask input, body.reading.reader-night .quiz-choices .choice:not(.right):not(.wrong) {
  background: #221f1a; color: #d9cfbf; border-color: #3a352c; }
body.reading.reader-night .assist-head, body.reading.reader-night .assist-ask { border-color: #3a352c; }
body.reading.reader-night .assist button.small { background: #2b2721; color: #d9cfbf; border-color: #3a352c; }
body.reading.reader-night .as-quote mark { background: #3a3224; }
body.reading.reader-night .chapter-ai button { background: #221f1a; color: #d9cfbf; border-color: #3a352c; }
