/* Screenplay Formatter — tool styles (base copied from script-timer) */

.tool-shell {
  background: #05070a;
  background-image: none;
  min-height: calc(100vh - var(--header-h, 72px));
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(2rem, 5vw, 3.5rem) var(--page-pad-inline, 1.25rem);
}

.tool-card {
  width: 100%;
  max-width: 680px;
  background: #111a2e;
  border: 1px solid rgba(96, 165, 250, 0.14);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(96, 165, 250, 0.06);
  overflow: hidden;
}

.tool-card__header {
  padding: 1.75rem 2rem 0;
}

.tool-card__eyebrow {
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #60a5fa;
  margin: 0 0 0.5rem;
}

.tool-card__title {
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
  color: #f1f5f9;
}

/* Mode tabs */
.mode-tabs {
  display: flex;
  gap: 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 0;
}

.mode-tab {
  flex: 1;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}

.mode-tab.is-active {
  background: #1d4ed8;
  color: #f1f5f9;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.4);
}

.mode-tab:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
}

/* Tool panels */
.tool-panel {
  padding: 1.5rem 2rem 2rem;
  display: none;
}

.tool-panel.is-active {
  display: block;
}

/* Textarea / input */
.calc-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.calc-textarea {
  width: 100%;
  min-height: 130px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(96, 165, 250, 0.14);
  border-radius: 10px;
  color: #f1f5f9;
  font-family: var(--font-body, "DM Sans", sans-serif);
  font-size: 0.9375rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.calc-textarea:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.45);
}

.calc-textarea::placeholder {
  color: #475569;
}

.word-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: #60a5fa;
  font-weight: 600;
  margin-top: 0.5rem;
}

.calc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.calc-number-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(96, 165, 250, 0.14);
  border-radius: 10px;
  color: #f1f5f9;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
  box-sizing: border-box;
}

.calc-number-input::-webkit-inner-spin-button,
.calc-number-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.calc-number-input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.45);
}

/* Speed selector */
.speed-group {
  margin-top: 1.25rem;
}

.speed-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.speed-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.speed-btn .speed-wpm {
  display: block;
  font-size: 1rem;
  color: #cbd5e1;
}

.speed-btn .speed-label {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.1rem;
}

.speed-btn.is-active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

.speed-btn.is-active .speed-wpm {
  color: #93c5fd;
}

.speed-btn:not(.is-active):hover {
  border-color: rgba(96, 165, 250, 0.35);
  color: #cbd5e1;
}

.speed-custom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

.speed-custom__label {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
}

.speed-custom__input {
  width: 5.5rem;
  padding: 0.45rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(96, 165, 250, 0.14);
  border-radius: 8px;
  color: #f1f5f9;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
  box-sizing: border-box;
}

.speed-custom__input::-webkit-inner-spin-button,
.speed-custom__input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.speed-custom__input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.45);
}

.speed-custom__unit {
  font-size: 0.8rem;
  color: #64748b;
}

/* Result */
.calc-result {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 12px;
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.calc-result__value {
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #93c5fd;
  line-height: 1;
}

.calc-result__label {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.calc-result__words {
  font-size: 0.875rem;
  color: #60a5fa;
  font-weight: 600;
}

.calc-result--empty .calc-result__value {
  font-size: 1.1rem;
  color: #475569;
  font-weight: 500;
}

/* Reference table */
.ref-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.12);
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ref-table th {
  padding: 0.75rem 1rem;
  text-align: start;
  background: rgba(29, 78, 216, 0.15);
  color: #93c5fd;
  font-family: var(--font-display, "Sora", sans-serif);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid rgba(96, 165, 250, 0.12);
}

.ref-table td {
  padding: 0.65rem 1rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(96, 165, 250, 0.07);
  white-space: nowrap;
}

.ref-table tr:last-child td {
  border-bottom: none;
}

.ref-table td:first-child {
  color: #f1f5f9;
  font-weight: 600;
  font-family: var(--font-display, "Sora", sans-serif);
}

.ref-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

@media (max-width: 560px) {
  .tool-card__header {
    padding: 1.25rem 1.25rem 0;
  }
  .tool-panel {
    padding: 1.25rem 1.25rem 1.5rem;
  }
  .calc-row {
    grid-template-columns: 1fr;
  }
  .speed-buttons {
    flex-wrap: wrap;
  }
  .speed-btn {
    flex: 1 1 calc(33% - 0.5rem);
  }
}

/* ── Script Timer additions ── */
.tool-card { max-width: 760px; }

.tool-description {
  margin: -0.75rem 0 1.25rem;
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1.6;
}

.tool-section { padding: 1.25rem 2rem 0; }
.tool-section:last-of-type { padding-bottom: 1.75rem; }

.script-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}

.script-meta .word-count-badge { margin-top: 0; }

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: #94a3b8;
  cursor: pointer;
}

.check-inline input { accent-color: #3b82f6; }

.speed-buttons--4 .speed-btn { min-width: 0; }

.wpm-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.wpm-slider-row input[type="range"] {
  flex: 1;
  accent-color: #3b82f6;
  min-width: 0;
}

.wpm-value {
  font-family: var(--font-display, "Sora", sans-serif);
  font-weight: 700;
  color: #93c5fd;
  min-width: 5.5rem;
  text-align: end;
  font-size: 0.95rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.chip {
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-body, "DM Sans", sans-serif);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover { border-color: rgba(96, 165, 250, 0.4); color: #cbd5e1; }

.chip.is-active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.14);
  color: #bfdbfe;
}

.chip-row--targets .chip { font-variant-numeric: tabular-nums; }

.target-note {
  margin: 0.6rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.5;
}

.target-note a { color: #60a5fa; }

.custom-target {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  font-size: 0.8125rem;
  color: #94a3b8;
}

.custom-target[hidden] { display: none; }

.custom-target input {
  width: 4rem;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(96, 165, 250, 0.14);
  border-radius: 8px;
  color: #f1f5f9;
  font-weight: 600;
  text-align: center;
  box-sizing: border-box;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.result-tile {
  padding: 1rem;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 12px;
  text-align: center;
}

.result-tile__value {
  margin: 0;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  font-weight: 700;
  color: #93c5fd;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.result-tile__label {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fit-status {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  background: rgba(255, 255, 255, 0.03);
}

.fit-status__text {
  margin: 0 0 0.6rem;
  font-weight: 600;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.fit-status.is-ok { border-color: rgba(52, 211, 153, 0.4); }
.fit-status.is-ok .fit-status__text { color: #6ee7b7; }
.fit-status.is-over { border-color: rgba(248, 113, 113, 0.45); }
.fit-status.is-over .fit-status__text { color: #fca5a5; }

.fit-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.fit-bar__fill {
  height: 100%;
  width: 0;
  background: #3b82f6;
  border-radius: 999px;
  transition: width 0.2s;
}

.fit-status.is-ok .fit-bar__fill { background: #34d399; }
.fit-status.is-over .fit-bar__fill { background: #f87171; }

.stopwatch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.stopwatch__time {
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
  min-width: 5.5rem;
}

.stopwatch__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn-ghost {
  padding: 0.55rem 1rem;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover { background: rgba(59, 130, 246, 0.12); }
.btn-ghost[disabled] { opacity: 0.45; cursor: default; }

.stopwatch__pace {
  flex: 1 1 100%;
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #94a3b8;
}

.stopwatch__pace strong { color: #93c5fd; }

.answer-block {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  border-inline-start: 3px solid #3b82f6;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 0 12px 12px 0;
  color: #cbd5e1;
  line-height: 1.65;
}

.prose-block {
  max-width: 760px;
  margin: 0 auto;
  color: #94a3b8;
  line-height: 1.7;
}

.prose-block p { margin: 0 0 1rem; }
.prose-block a, .source-note a, .ref-table a { color: #60a5fa; }

.source-note {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.5;
}

.ref-table td.wrap-cell { white-space: normal; min-width: 12rem; }

@media (max-width: 560px) {
  .tool-section { padding: 1.1rem 1.25rem 0; }
  .tool-section:last-of-type { padding-bottom: 1.5rem; }
  .speed-buttons--4 .speed-btn { flex: 1 1 calc(50% - 0.5rem); }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .result-tile--wide { grid-column: 1 / -1; }
}

/* ── Screenplay Formatter additions ── */
.tool-card.sf-card { max-width: 1180px; }

.sf-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.25rem;
  padding: 1.25rem 2rem 1.5rem;
  align-items: start;
}

.sf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.sf-editor {
  min-height: 480px;
  height: 62vh;
  max-height: 760px;
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.sf-editor-note {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.5;
}

.sf-status {
  min-height: 1.2em;
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  color: #6ee7b7;
}

.sf-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sf-stats .result-tile { padding: 0.6rem 0.4rem; }
.sf-stats .result-tile__value { font-size: clamp(1.15rem, 3vw, 1.5rem); }
.sf-stats .result-tile__label { font-size: 0.6875rem; }

.sf-preview {
  container-type: inline-size;
  max-height: calc(62vh + 3.5rem);
  min-height: 480px;
  overflow-y: auto;
  padding: 0.75rem;
  border-radius: 12px;
  background: #0b1222;
  border: 1px solid rgba(96, 165, 250, 0.14);
}

/* One screenplay page. Every size is in em so the page scales on screen
   and prints at exactly 12pt: 1em = 12pt = one Courier line (6 lines per inch),
   and Courier is 10 characters per inch (1in = 6em = 10ch). */
.sf-page {
  position: relative;
  box-sizing: border-box;
  width: 51em;          /* 8.5in */
  height: 66em;         /* 11in */
  margin: 0 auto 0.75rem;
  padding: 6em 6em 6em 9em; /* top 1in, right 1in, bottom 1in, left 1.5in */
  background: #fff;
  color: #111;
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 12pt;
  font-size: min(12pt, calc((100cqw - 2px) / 51));
  line-height: 1em;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.sf-page:last-child { margin-bottom: 0; }

.sf-pagenum {
  position: absolute;
  top: 3em;   /* 0.5in */
  right: 6em; /* flush with the 1in right margin */
}

.sf-row {
  height: 1em;
  line-height: 1em;
  white-space: pre;
}

.sf-heading,
.sf-action { margin-left: 0; }
.sf-character { margin-left: 13.2em; }  /* 3.7in from the page edge */
.sf-paren { margin-left: 9.6em; }       /* 3.1in */
.sf-dialogue { margin-left: 6em; }      /* 2.5in */
.sf-more { margin-left: 13.2em; }
.sf-transition { text-align: right; }
.sf-centered { text-align: center; }

.sf-row b { font-weight: 700; }
.sf-row i { font-style: italic; }
.sf-row u { text-decoration: underline; }

.sf-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-family: var(--font-body, "DM Sans", sans-serif);
  text-align: center;
}

.sf-bridge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.sf-select {
  padding: 0.55rem 0.75rem;
  background: #0b1222;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 8px;
  color: #f1f5f9;
  font-family: var(--font-body, "DM Sans", sans-serif);
  font-size: 0.875rem;
}

.sf-bridge label {
  font-size: 0.875rem;
  color: #94a3b8;
}

.ref-table td code,
.prose-block code {
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.prose-block ol { padding-inline-start: 1.25rem; margin: 0 0 1rem; }
.prose-block li { margin-bottom: 0.4rem; }

@media (max-width: 900px) {
  .sf-workspace { grid-template-columns: 1fr; }
  .sf-editor { height: 42vh; min-height: 300px; }
  .sf-preview { max-height: 80vh; min-height: 0; }
}

@media (max-width: 560px) {
  .sf-workspace { padding: 1rem 1.25rem 1.25rem; }
  .sf-stats { grid-template-columns: 1fr 1fr; }
}

/* ── Hero above the tool ── */
.tool-shell.sf-shell {
  flex-direction: column;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2rem);
  min-height: 0;
  padding-top: clamp(1.75rem, 4vw, 3rem);
  background: radial-gradient(ellipse 70% 50% at 15% 0%, rgba(59, 130, 246, 0.16), transparent 70%), #05070a;
}
.sf-hero {
  width: 100%;
  max-width: 1180px;
  display: grid;
  gap: 1rem;
  align-items: end;
}
@media (min-width: 1000px) {
  .sf-hero { grid-template-columns: minmax(0, 1fr); }
  .sf-hero__chips { justify-content: flex-end; }
}
.sf-hero__copy { display: grid; gap: 0.85rem; max-width: 72rem; }
.sf-hero__title {
  margin: 0;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #f8fafc;
}
.sf-hero__title span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.55em;
  letter-spacing: -0.01em;
  color: var(--accent-bright, #60a5fa);
}
.sf-hero__lead { margin: 0; font-size: 1.02rem; line-height: 1.6; color: #cbd5e1; }
.sf-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sf-hero__chips li {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(96, 165, 250, 0.22);
}
.sf-workspace { padding-top: 1.5rem; }

/* ── Rehearse bar under the tool ── */
.sf-rehearse {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 1.5rem 2rem;
  background: rgba(29, 78, 216, 0.08);
  border-top: 1px solid rgba(96, 165, 250, 0.1);
  text-align: center;
}
.sf-rehearse p { margin: 0; color: #94a3b8; font-size: 0.9375rem; }
.sf-rehearse .btn-download { border: none; cursor: pointer; font-family: inherit; font-size: 0.875rem; padding: 0.6rem 1.25rem; }
.sf-rehearse__hint { font-size: 0.8125rem !important; color: #64748b !important; }

/* ── Annotated page in "How to format a screenplay" ── */
.sf-annotated { container-type: inline-size; width: 100%; min-width: 0; }
.sf-annotated .sf-page--excerpt {
  height: auto;
  margin: 0;
  padding-bottom: 3em;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  -webkit-mask-image: linear-gradient(180deg, #000 93%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 93%, transparent 100%);
}
.sf-hl {
  background: rgba(59, 130, 246, 0.16);
  box-shadow: 0 0 0 0.15em rgba(59, 130, 246, 0.16);
  border-radius: 2px;
}
.sf-badge {
  position: absolute;
  top: calc((6.5 + var(--row)) * 1em);
  left: var(--x, 7.4em);
  width: 0;
  height: 0;
}
.sf-badge::before,
.sf-legend li::before {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-family: var(--font-display, "Sora", sans-serif);
  font-weight: 700;
  line-height: 1;
}
.sf-badge::before {
  content: attr(data-n);
  position: absolute;
  width: max(1.7em, 14px);
  height: max(1.7em, 14px);
  font-size: max(0.95em, 9px);
  transform: translate(-50%, -50%);
}
@media (min-width: 820px) {
  .tool-explain .sf-format-row { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
}
.sf-annotated figcaption { margin-top: 0.85rem; font-size: 0.85rem; color: #94a3b8; text-align: center; }
.sf-legend { list-style: none; counter-reset: sfl; margin: 1rem 0; padding: 0; display: grid; gap: 0.55rem; }
.sf-legend li { counter-increment: sfl; display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.6rem; align-items: start; color: #cbd5e1; line-height: 1.5; }
.sf-legend li::before { content: counter(sfl); width: 1.6rem; height: 1.6rem; font-size: 0.8rem; margin-top: 0.05rem; }
.sf-legend strong { color: #f1f5f9; }
.tool-row a, .sf-privacy a { color: #60a5fa; }

/* ── How to use: numbered step cards ── */
.sf-steps {
  list-style: none;
  counter-reset: sfs;
  margin: 0 auto;
  padding: 0;
  max-width: 1000px;
  display: grid;
  gap: 1rem;
}
@media (min-width: 760px) { .sf-steps { grid-template-columns: 1fr 1fr; } }
.sf-steps li {
  counter-increment: sfs;
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 3.75rem;
  border-radius: 16px;
  background: #0d1528;
  border: 1px solid rgba(96, 165, 250, 0.14);
  color: #94a3b8;
  line-height: 1.65;
}
.sf-steps li::before {
  content: counter(sfs);
  position: absolute;
  left: 1.1rem;
  top: 1.15rem;
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  font-family: var(--font-display, "Sora", sans-serif);
  font-weight: 700;
  font-size: 0.9rem;
}
.sf-steps strong { color: #f1f5f9; }
.sf-privacy { max-width: 760px; margin: 1.25rem auto 0; text-align: center; color: #64748b; font-size: 0.9rem; line-height: 1.6; }

/* ── Free screenplay template ── */
.sf-template {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-radius: 24px;
  background: #0d1528;
  border: 1px solid rgba(96, 165, 250, 0.16);
}
@media (min-width: 900px) { .sf-template { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } }
.sf-template h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  color: #f8fafc;
}
.sf-template h3 {
  margin: 1.75rem 0 0.5rem;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 1.15rem;
  color: #f1f5f9;
}
.sf-template p { margin: 0; color: #cbd5e1; line-height: 1.7; }
.sf-template__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.sf-template__actions .btn-secondary { cursor: pointer; font-family: inherit; }
.sf-template__file {
  margin: 0;
  padding: 1.5rem;
  border-radius: 12px;
  background: #fff;
  color: #111;
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.section__subtitle a { color: #60a5fa; }

@media print {
  .sf-hero { display: none !important; }
}

/* ── Print / Save as PDF: only the screenplay pages, US Letter ── */
@media print {
  @page { size: letter; margin: 0; }
  html, body { background: #fff !important; margin: 0; padding: 0; }
  body > *:not(main),
  main > *:not(.tool-shell),
  .tool-card > *:not(.sf-workspace),
  .sf-workspace > *:not(.sf-preview-col),
  .sf-preview-col > *:not(.sf-preview) { display: none !important; }
  .tool-shell, .tool-card, .sf-workspace, .sf-preview-col, .sf-preview {
    display: block !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    max-width: none !important;
    container-type: normal;
  }
  .sf-page {
    font-size: 12pt !important;
    width: 8.5in;
    height: calc(11in - 2px);
    margin: 0 !important;
    box-shadow: none !important;
    break-after: page;
    page-break-after: always;
  }
  .sf-page:last-child { break-after: auto; page-break-after: auto; }
  .sf-empty { display: none !important; }
}
