/* Screenplay page opts out of document-style layout */
main[data-section="screenplay"] .panel {
  width: 100%;
  max-width: clamp(900px, 85vw, 1200px);
  margin: 16px auto;
}


.screenplay-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.screenplay-header {
  height: 48px;
  flex-shrink: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 16px;

  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.screenplay-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.screenplay-header-right {
  font-size: 13px;
  color: var(--text-secondary);
}

.draft-label {
  white-space: nowrap;
}

.screenplay-canvas {
  flex: 1;
  min-height: 0;
  min-width: 0;          /* CRITICAL for flex scrolling */
  overflow-y: auto;

  background: #181818;

  padding: 32px 48px;
}

.screenplay-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.screenplay-paper {
  width: 8.5in;
  min-height: 11in;
  background: #fff;
  color: #000;
  position: relative;
  box-shadow:
    0 0 0 1px #333,
    0 10px 30px rgba(0,0,0,.4);
}


.screenplay-paper-content {
  position: absolute;

  top: 1in;
  bottom: 1in;
  left: 1.5in;
  right: 1in;

  height: calc(11in - 2in); /* 9in usable space */

  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 12pt;
  line-height: 12pt;

  overflow: hidden;
}


.sp-block {
  padding-bottom: 11.2pt;
}


.sp-scene {
  font-weight: 700;
  text-transform: uppercase;
  position: relative;
}

.sp-action {
  /* inherits block spacing */
}

.sp-character {
  margin-left: 2.2in;
  font-weight: 700;
  text-transform: uppercase;
}

.sp-dialogue {
  margin-left: 1in;
  width: 3.6in;
}

.sp-parenthetical {
  margin-left: .5in;
  width: 3in;
  text-align: left;
}

.sp-transition {
  margin-left: 4.5in;
  text-align: right;
  font-weight: 700;
  text-transform: uppercase;
}

.sp-scene-number {
  position: absolute;
  left: -1.25in;
  width: 1in;
  text-align: right;
  font-weight: 700;
}


.screenplay-page *,
.screenplay-page *::before,
.screenplay-page *::after {
  box-sizing: border-box;
}

@page {
  size: Letter;
  margin: 0;
}

@media print {

  /* Hide UI */
  nav,
  aside,
  .sidebar,
  .screenplay-header {
    display: none !important;
  }
  
  header,
  .top-bar,
  .app-header,
  .lina-header {
    display: none !important;
  }

  /* Leave layout ALONE */
  .screenplay-paper {
    width: 8.5in;
    height: 11in;
    margin: 0;
    box-shadow: none;
  }
  
  .screenplay-paper {
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
    border-radius: 0 !important;
    background: white !important;
  }

}
