/* Private novel test. Deliberately scoped; never repositions #chatView. */
.novel-test-banner {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 5px 10px; background: #fff1c9; color: #553b09;
  border-bottom: 1px solid #d4ab52; font-size: 12px; line-height: 1.35;
}
.novel-test-banner span { min-width: 0; }
.novel-test-banner button {
  flex: 0 0 auto; min-height: 44px; padding: 7px 10px; border: 1px solid #a37a25;
  background: #fffbef; color: #553b09; border-radius: 10px; font: inherit; font-weight: 600;
}
.novel-test-menu { width: 100%; min-height: 44px; margin-top: 8px; }
.novel-test {
  --novel-bg: var(--bg, #fffaf3);
  --novel-fg: var(--fg, var(--text, #262321));
  --novel-muted: var(--muted, #6b625b);
  --novel-accent: var(--accent, #77532d);
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh;
  z-index: 60; overflow: hidden; overscroll-behavior: contain; scroll-padding-top: 112px;
  -webkit-overflow-scrolling: touch;
  background: var(--novel-bg); color: var(--novel-fg);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  isolation: isolate; touch-action: pan-y; overflow-wrap: anywhere;
}
.novel-test *, .novel-test *::before, .novel-test *::after { box-sizing: border-box; }
.novel-test[hidden], .novel-test [hidden] { display: none !important; }
.novel-test-wrap { max-width: 1050px; height: 100%; min-height: 0; margin: 0 auto; display: flex; flex-direction: column; }
.novel-test-header {
  flex: 0 0 auto; position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--novel-bg); border-bottom: 1px solid var(--line, #d9cfc3);
}
.novel-test-header > div { min-width: 0; }
.novel-test h1 { font-size: 18px; line-height: 1.3; margin: 0; font-weight: 650; }
.novel-test-header p { color: var(--novel-muted); font-size: 12px; margin: 4px 0 0; }
.novel-test-header > button { flex: 0 0 auto; }
.novel-test-content { flex: 1 1 0; min-height: 0; width: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; max-width: 820px; margin: 0 auto; padding: 12px 18px calc(32px + env(safe-area-inset-bottom, 0px)); }
.novel-test p { white-space: pre-wrap; }
.novel-test-notice { font-size: 12px; color: var(--novel-muted); margin: 0 0 8px; }
.novel-test-role { font-size: 13px; font-weight: 650; margin: 8px 0; }
.novel-test-status { margin: 8px 0 14px; border-inline-start: 3px solid var(--novel-accent); padding: 6px 10px; font-size: 14px; }
.novel-test-art {
  flex: 0 0 auto; height: 40%; max-height: 420px; min-height: 0;
  width: 100%; background: #181513; overflow: hidden;
}
.novel-test-image {
  display: block; width: 100%; height: 100%; max-height: 100%;
  object-fit: contain; object-position: center; margin: 0 auto; border-radius: 0;
}
.novel-test-text p, .novel-test-narration p { margin: 0 0 16px; }
.novel-test-dialogue { margin: 0 0 20px; }
.novel-test-dialogue p { margin: 0 0 10px; padding: 10px 12px; border-inline-start: 3px solid var(--novel-accent); border-radius: 0 10px 10px 0; background: var(--card, #fffdf9); }
.novel-test-dialogue strong { display: block; margin-bottom: 3px; font-size: 12px; color: var(--novel-muted); }
.novel-test-status:empty { display: none; }
.novel-test-choices { display: grid; gap: 9px; border: 0; margin: 18px 0; padding: 0; min-width: 0; }
.novel-test button, .novel-test summary, .novel-test-menu, .novel-test-banner button { cursor: pointer; }
.novel-test button {
  display: block; min-height: 44px; border: 1px solid var(--line, #bdb0a0); border-radius: 12px;
  padding: 11px 14px; color: var(--novel-fg); background: var(--card, #fffdf9);
  font: inherit; line-height: 1.4; white-space: normal; overflow-wrap: anywhere;
}
.novel-test-choices button { text-align: left; width: 100%; }
.novel-test button:disabled { opacity: .55; cursor: default; }
.novel-test :focus-visible, .novel-test-menu:focus-visible, .novel-test-banner button:focus-visible {
  outline: 3px solid var(--novel-accent, #77532d); outline-offset: 3px;
}
.novel-test label { display: block; font-size: 13px; margin: 14px 0 6px; color: var(--novel-muted); }
.novel-test textarea {
  width: 100%; min-height: 88px; max-height: 220px; resize: vertical; padding: 12px;
  font: inherit; font-size: 16px; border: 1px solid var(--line, #bdb0a0); border-radius: 12px;
  background: var(--card, #fffdf9); color: var(--novel-fg); scroll-margin-block: 100px;
}
.novel-test-tools { display: flex; flex-wrap: wrap; gap: 9px; margin: 16px 0; }
.novel-test-tools > button { flex: 0 1 auto; font-size: 13px; padding: 8px 12px; color: var(--novel-muted); }
.novel-test button.novel-test-primary { border-width: 2px; border-color: var(--novel-accent); font-weight: 700; }
.novel-test-hint { flex-basis: 100%; font-size: 13px; color: var(--novel-muted); }
.novel-test-error { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 1px solid #b86c3c; border-radius: 12px; padding: 12px; margin: 12px 0; }
.novel-test-error span { flex: 1 1 180px; }
.novel-test-history { border-top: 1px solid var(--line, #d9cfc3); margin-top: 24px; padding-top: 8px; }
.novel-test-history summary { min-height: 44px; padding: 10px 0; font-weight: 650; }
.novel-test-history p { font-size: 14px; margin: 12px 0; }
@media (max-height: 550px) {
  .novel-test-art { height: 28%; max-height: 140px; }
  .novel-test-header { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
  .novel-test h1 { font-size: 16px; }
  .novel-test-content { padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { .novel-test { scroll-behavior: auto; } }
