@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap');
* { box-sizing: border-box; }

/* When server renders with notes stripped, collapse any residual gaps */
.screenplay.strip-notes aside.note { display: none !important; margin: 0 !important; padding: 0 !important; }
.screenplay.strip-notes .note-inline { display: none !important; }
.screenplay.strip-notes p:empty { margin: 0; padding: 0; display: none; }
.screenplay.strip-notes .transition:empty,
.screenplay.strip-notes .centered:empty { margin: 0; padding: 0; display: none; }
.screenplay.strip-notes .empty { height: 0; }
:root { color-scheme: light dark; 
  /* UI and editor font variables */
  --ui-font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --editor-font-typewriter: 'Courier Prime', Courier, 'Courier New', monospace;
  --editor-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  --editor-font-serif: 'Times New Roman', Times, serif;
  --editor-font-sans: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --editor-font: var(--editor-font-sans);
  --editor-font-size: 16px;
  --editor-line-height: 1.6;
  /* Link color (light mode default) */
  --link-color: #006600;
}
html, body { margin: 0; padding: 0; font-family: var(--ui-font); }
html { background: #e5e5e5; }
body { background: #e5e5e5; color: CanvasText; }
@media (prefers-color-scheme: dark) {
  html { background: #030203; }
  body { background: #030203; }
  /* Dark mode link color */
  :root { --link-color: #00a900; }
}

.container { max-width: 960px; margin: 0 auto; padding: 16px; }

/* Screenplay preview/export styles (matches server/tap-editor/renderer.go classes) */
.screenplay {
  /* Print-friendly page layout */
  box-sizing: border-box;
  background: #fff;
  color: #111;
  /* Always use a Courier-style font for screenplay preview/export */
  font-family: 'Courier Prime', Courier, 'Courier New', monospace;
  font-size: 12pt;
  line-height: 1.5;
  /* US Letter page width; with 1in padding, inner content becomes 6.5in */
  width: 8.5in;
  max-width: 100%;
  margin: 0 auto;
  padding: 1in;
}

.screenplay h3.scene {
  margin: 18pt 0 6pt;
  padding: 0;
  font-size: 12pt;
  font-weight: 400;
  text-transform: uppercase;
}
.screenplay h3.scene .scene-number { float: right; font-weight: 400; }

.screenplay p.meta { margin: 0 0 12pt; font-style: normal; }

.screenplay p.action { margin: 0 0 12pt; }
.screenplay p.synopsis { margin: 0 0 12pt; font-style: normal; }
.screenplay p.lyric { margin: 0 0 6pt; font-style: normal; }

/* Dialogue blocks (approximate industry-standard indents) */
.screenplay .character {
  margin: 12pt auto 0;
  text-transform: uppercase;
  /* Centered name block within 6.5in content */
  width: 2in;
  margin-left: 2.25in; /* (6.5 - 2.0) / 2 */
  text-align: center;
}
.screenplay .character .ext { text-transform: none; font-weight: 400; }

.screenplay .parenthetical {
  margin: 0 0 6pt;
  /* Centered under character */
  margin-left: 2.25in;
  width: 2in;
  font-style: normal;
  text-align: center;
}

.screenplay .dialogue { margin: 0 0 12pt; }
.screenplay .dialogue p {
  margin: 0;
  /* Center a 3.5in dialogue block within 6.5in content: (6.5 - 3.5)/2 = 1.5in */
  margin-left: 1.5in;
  width: 3.5in;
}

.screenplay .transition { text-align: right; margin: 12pt 0; text-transform: uppercase; }
.screenplay .centered { text-align: center; margin: 12pt 0; }
.screenplay .empty { height: 12pt; }

/* When notes are stripped, some inline-only lines can become empty.
   Remove spacing for empty elements to avoid extra vertical gaps. */
.screenplay p:empty { margin: 0; padding: 0; display: none; }
.screenplay .transition:empty,
.screenplay .centered:empty { margin: 0; padding: 0; display: none; }

/* Sections and headings from outline levels */
.screenplay .section { margin: 12pt 0; font-weight: 700; }
.screenplay .section.section-l1 { font-size: 14pt; }
.screenplay .section.section-l2 { font-size: 13pt; }
.screenplay .section.section-l3 { font-size: 12pt; }

/* Inline notes and block notes */
.screenplay .note-inline { color: #999; font-style: italic; }
.screenplay .inline-strike { text-decoration: line-through; }
.screenplay aside.note { margin: 6pt 0; color: #666; font-style: italic; }

/* Dual dialogue: two columns side-by-side */
.screenplay .dual {
  display: grid;
  grid-template-columns: 3.0in 3.0in; /* two columns within 6.5in content with gap */
  gap: 0.5in; /* 3.0 + 0.5 + 3.0 = 6.5 */
  margin: 12pt 0;
}
.screenplay .dual .dual-col .character { margin-left: 0; }
.screenplay .dual .dual-col .parenthetical { margin-left: 0; width: auto; }
.screenplay .dual .dual-col .dialogue p { margin-left: 0; width: auto; }

@media (prefers-color-scheme: dark) {
  .screenplay { background: #0b0b0b; color: #e5e7eb; }
  .screenplay .note-inline { color: #9ca3af; }
}

/* Fountain emphasis should not alter weight/style in formatted screenplay */
.screenplay strong, .screenplay em { font-weight: 400; font-style: normal; }

@media print {
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #000 !important; }
  .screenplay { box-shadow: none; color: #000; background: #fff; width: 8.5in; padding: 1in; }
}
.header, .footer { background: transparent; }
main.container { background: #fafafa; border: 1px solid #e5e7eb; border-radius: 10px; }
@media (prefers-color-scheme: dark) {
  main.container { background: #151515; border-color: #1f2937; }
}
.header, .footer { display: flex; align-items: center; justify-content: space-between; }
a { color: var(--link-color); text-decoration: none;}
a:hover { text-decoration: underline; }

/* Footer layout: left links and right copyright */
.footer { justify-content: space-between; }
.footer p { display: flex; align-items: center; justify-content: space-between; margin: 0; width: 100%; }

/* Brand (logo + text) */
.brand { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 22px; }
.brand a { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand a:hover { text-decoration: none; }
.brand-logo { height: 60px; width: 60px; display: block; object-fit: contain; }
.brand-text { font-weight: 700; letter-spacing: 0.2px; }

.toolbar { display: flex; gap: 8px; margin: 12px 0; }
button { padding: 8px 12px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; color: #111; cursor: pointer; }
@media (prefers-color-scheme: dark) {
  button { background: #111; color: #eee; border-color: #333; }
}

.preview { margin-top: 16px; padding: 16px; border: 1px solid #e5e7eb; border-radius: 8px; background: rgba(0,0,0,0.02); }
@media (prefers-color-scheme: dark) {
  .preview { border-color: #222; background: rgba(255,255,255,0.02); }
}

p { line-height: 1.4; } 

/* Web component shell */
tap-editor { display: block; border: 1px solid #e5e7eb; border-radius: 8px; padding: 0; background: #f3f4f6; }
@media (prefers-color-scheme: dark) {
  tap-editor { border-color: #222; background: #0a0a0a; }
}
tap-editor textarea { width: 100%; min-height: 50vh; padding: 12px; border: 0; background: transparent; color: inherit; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; resize: vertical; }
tap-editor textarea:focus { outline: none; box-shadow: none; }
