#editor-preview-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding-inline: 12px; white-space: nowrap; color: #193c5a;
}
#editor-preview-toggle[aria-expanded="true"] { color: #fff; background: #173950; border-color: #173950; }
.editor-draft-views { display: grid; min-width: 0; gap: 12px; align-items: start; }
.editor-draft-views > * { min-width: 0; }
.editor-prompt-preview[hidden] { display: none; }
.editor-prompt-preview {
  --preview-height: clamp(290px, 48vh, 490px);
  --preview-rim: clamp(6px, .75vw, 10px);
  padding: 0 var(--preview-rim) var(--preview-rim); color: #edf7ff;
  border: 1px solid #263c4f; border-radius: 15px; overflow: hidden;
  background: linear-gradient(135deg, #344c61 0%, #1d3245 27%, #142637 70%, #233b4f 100%);
  box-shadow: inset 0 1px #b1c5d6a8, inset 1px 0 #849aae55, inset 0 -2px #0a1624,
    0 2px 0 #112334, 0 9px 19px -9px #0c294a66;
}
.editor-preview-header, .editor-preview-nav {
  display: flex; align-items: center; gap: 9px; justify-content: space-between;
}
.editor-preview-header {
  margin: 0 calc(-1 * var(--preview-rim)) 6px; padding: 10px calc(var(--preview-rim) + 5px);
  border-bottom: 1px solid #0a2239;
  background: linear-gradient(110deg, #103c64, #225f93 57%, #1a456d);
  box-shadow: inset 0 1px #a0c9eb70, inset 0 -1px #6aa7d55c;
}
.editor-preview-header > div { min-width: 0; }
.editor-preview-header h3 {
  display: flex; align-items: center; gap: 8px; margin: 0;
  color: #f4f9ff; font: 700 16px/1.35 system-ui, sans-serif; letter-spacing: -.015em;
}
.editor-preview-header h3::before {
  content: ""; width: 8px; height: 4px; flex: none; border-radius: 1px;
  background: #b9e5ff; box-shadow: 0 0 0 2px #0c1c2b, 0 0 6px #8fd1ff75;
}
.editor-preview-header p { color: #bed3e3; font-size: 13px; overflow-wrap: anywhere; margin: 2px 0 0 16px; }
.editor-prompt-preview button {
  min-height: 44px; padding: 6px 12px; border-radius: 7px; border: 1px solid #59758a;
  color: #edf7ff; background: linear-gradient(#355269, #233e53);
  box-shadow: inset 0 1px #bad3e337, 0 2px #0b1b28;
  font: 650 13px/1.25 system-ui, sans-serif; white-space: nowrap; cursor: pointer;
}
.editor-prompt-preview button:hover:not(:disabled) { background: linear-gradient(#43657e, #2c4c65); border-color: #94b1c6; }
.editor-prompt-preview button:active:not(:disabled) { background: #1b3347; box-shadow: inset 0 2px 3px #0a1928; }
.editor-prompt-preview button:focus-visible { outline: 2px solid #c5eaff; outline-offset: 2px; }
.editor-preview-surface:focus-visible { outline: 2px solid #377cb2; outline-offset: -3px; }
.editor-prompt-preview button:disabled { color: #a6b9c7; background: #1b3041; border-color: #435968; box-shadow: inset 0 1px 2px #102332; cursor: default; }
.editor-preview-surface {
  position: relative; height: var(--preview-height); overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid #0b1b2a; border-radius: 6px;
  box-shadow: 0 0 0 2px #0b1b29, 0 2px 0 2px #617789, inset 0 1px 3px #27465e1c;
  scrollbar-color: #8ca9c1 #fff;
  background-color: #fff;
  background-image: radial-gradient(circle, #d8e9f8 .85px, transparent 1.35px);
  background-size: 16px 16px;
}
.editor-preview-text { min-width: 0; padding: 16px clamp(12px, 1.8vw, 22px); }
.editor-preview-text:has(> p:nth-child(2))::after { content: ''; display: block; height: calc(var(--preview-height) - 35px); }
.editor-preview-text p {
  max-inline-size: var(--pp-reading-measure, 24em); margin: 0 auto 18px;
  padding-inline-start: .39em; border-inline-start: 3px solid transparent; color: #37536c;
  font: normal 400 clamp(24px, 2.6vw, 36px)/var(--pp-reading-leading, 1.5) var(--pp-prompt-font, system-ui, sans-serif);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.editor-preview-text p[aria-current="true"] { border-inline-start-color: #3379b5; color: #162f46; }
.editor-preview-text .sp-stage__ink { color: var(--sp-editor-ink); }
.editor-preview-text .editor-preview-empty { color: #48637a; font: 400 16px/1.6 system-ui, sans-serif; padding: 8px; }
.editor-preview-nav { padding: 10px 3px 2px; }
.editor-preview-nav [data-preview-counter] {
  min-width: 4.4em; padding: 5px 9px; border: 1px solid #496172; border-radius: 4px;
  color: #ccdfed; background: #122638; box-shadow: inset 0 1px 3px #091b27;
  font: 650 13px/1.2 system-ui, sans-serif; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap;
}
.editor-preview-nav [data-preview-counter]:empty { visibility: hidden; }
.editor-preview-text .pp-speaker-label {
  --preview-speaker-color: #2056a2;
  color: var(--preview-speaker-color);
  border-color: color-mix(in srgb, var(--preview-speaker-color) 34%, white);
  border-inline-start-color: var(--preview-speaker-color);
  background: color-mix(in srgb, var(--preview-speaker-color) 6%, white);
  box-shadow: none;
}
.editor-preview-text .pp-speaker-label[data-color="teal"] { --preview-speaker-color: #00695e; }
.editor-preview-text .pp-speaker-label[data-color="plum"] { --preview-speaker-color: #753d83; }
.editor-preview-text .pp-speaker-label[data-color="red"] { --preview-speaker-color: #a23c37; }
.editor-preview-text .pp-speaker-label[data-color="ink"] { --preview-speaker-color: #243444; }
@media (forced-colors: active) {
  .editor-prompt-preview, .editor-preview-nav [data-preview-counter], .editor-prompt-preview button, .editor-preview-surface {
    background: Canvas; color: CanvasText; border-color: CanvasText; box-shadow: none;
  }
  .editor-preview-header h3::before { background: Highlight; box-shadow: none; }
  .editor-preview-text .pp-speaker-label { color: CanvasText; background: Canvas; border-color: CanvasText; }
}
@media (min-width: 900px) {
  .editor-writing[data-preview-open] .editor-draft-views { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .editor-writing[data-preview-open] .editor-paper { align-self: stretch; }
  .editor-writing[data-preview-open] #editor-text { min-height: 100%; padding: clamp(17px, 2vw, 29px); }
}
@media (max-width: 899px) {
  .editor-writing[data-preview-open] .editor-paper, .editor-writing[data-preview-open] .editor-settings-bank { display: none; }
  .editor-writing[data-preview-open] #editor-format-help { display: none; }
}
@media (max-width: 500px) {
  #editor-preview-toggle { margin-top: 1px; }
  .editor-preview-header { padding-inline: calc(var(--preview-rim) + 3px); }
  .editor-preview-header h3 { font-size: 15px; }
  .editor-prompt-preview button { padding-inline: 8px; }
}
