/* Script Editor visual refresh — calmer surfaces without changing editor behavior */
body.page-script-editor {
  --editor-bg: #E2E4E9;
  --editor-ink: #111317;
  --editor-yellow: #F8D000;
  --editor-paper: #F0F2F5;
  --editor-blue: #D6E4EE;
  background: var(--editor-bg) !important;
  color: var(--editor-ink);
}

/* Shared header/footer treatment */
body.page-script-editor > header {
  background: rgba(248, 208, 0, .96) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--editor-ink) !important;
  box-shadow: 0 4px 20px -4px rgba(17, 19, 23, .06) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
body.page-script-editor > header img[src*="drlogo"],
body.page-script-editor > footer img[src*="drlogo"] {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}
body.page-script-editor > header nav a,
body.page-script-editor > header > div a,
body.page-script-editor > header button:not(.theme-toggle) {
  border-radius: 10px !important;
  box-shadow: 0 2px 4px rgba(17, 19, 23, .06) !important;
  transition: background-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
body.page-script-editor > header nav a:hover,
body.page-script-editor > header > div a:hover,
body.page-script-editor > header button:not(.theme-toggle):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(17, 19, 23, .14) !important;
}
body.page-script-editor > footer {
  background: var(--editor-blue) !important;
  border: 0 !important;
  border-top: 1px solid var(--editor-ink) !important;
  box-shadow: none !important;
}
body.page-script-editor > footer .border-b-2 {
  border: 0 !important;
  border-bottom: 1px solid var(--editor-ink) !important;
}
body.page-script-editor > footer .border-t-2 {
  border: 0 !important;
  border-top: 1px solid var(--editor-ink) !important;
}
body.page-script-editor > footer > div > div:first-child > div:last-child > span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: .55rem 1rem;
  border: 1px solid var(--editor-ink);
  border-radius: 999px;
  font-size: .72rem;
  line-height: 1.2;
  letter-spacing: .035em;
  box-shadow: none;
}
body.page-script-editor > footer a:hover { color: var(--editor-ink); }

/* Back link */
body.page-script-editor main > div > div:first-child a {
  border-width: 1px !important;
  border-radius: 999px;
  box-shadow: none !important;
}
body.page-script-editor main > div > div:first-child a:hover {
  transform: translateY(-1px);
  box-shadow: none !important;
}

/* Hero: soften frame, preserve neutral studio surface */
body.page-script-editor main section:first-of-type {
  border-width: 1px !important;
  border-color: rgba(17, 19, 23, .65) !important;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(17, 19, 23, .04) !important;
  padding: clamp(1.5rem, 4vw, 2.75rem) !important;
}
body.page-script-editor main section:first-of-type > div:first-child {
  border-radius: 999px;
  letter-spacing: .045em;
}
body.page-script-editor main section:first-of-type h1 {
  line-height: 1.04;
  letter-spacing: -.04em;
}
body.page-script-editor main section:first-of-type p {
  line-height: 1.7;
}

/* Toolbar: reduce visual weight without changing controls */
body.page-script-editor #script-workspace {
  border-radius: 8px;
  box-shadow: none !important;
}
body.page-script-editor main .grid > div:first-child > div:first-child {
  border-width: 1px !important;
  border-color: rgba(17, 19, 23, .65) !important;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(17, 19, 23, .03) !important;
  padding: 1rem !important;
}
body.page-script-editor #element-select,
body.page-script-editor #story-input,
body.page-script-editor #export-menu {
  border-radius: 8px;
}
body.page-script-editor #element-select,
body.page-script-editor #story-input {
  border-width: 1px !important;
}

/* Editor shell: keep the screenplay canvas itself visually distinct and readable */
body.page-script-editor #script-workspace {
  background-color: #FAF9F5;
  color: #111317;
  border-width: 1px !important;
  border-style: dashed !important;
  border-color: #D1D5DB !important;
  box-shadow: none !important;
  border-radius: 6px;
  line-height: 1.35;
}
body.page-script-editor .screenplay-paper:focus {
  outline: 2px solid rgba(248, 208, 0, .55);
  outline-offset: 2px;
}
body.page-script-editor main .grid > div:first-child > div:nth-child(2) {
  border-width: 1px !important;
  border-color: rgba(17, 19, 23, .5) !important;
  border-radius: 16px;
  box-shadow: 0 5px 16px rgba(17, 19, 23, .035) !important;
}

/* Utility cards on the right */
body.page-script-editor main .grid > div:last-child > div {
  border-width: 1px !important;
  border-color: rgba(17, 19, 23, .6) !important;
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(17, 19, 23, .025) !important;
}
body.page-script-editor main .grid > div:last-child > div h2,
body.page-script-editor main .grid > div:last-child > div h3 {
  line-height: 1.15;
  letter-spacing: -.025em;
}
body.page-script-editor main .grid > div:last-child > div p {
  line-height: 1.65;
}
body.page-script-editor main .grid > div:last-child > div a,
body.page-script-editor main .grid > div:last-child > div button,
body.page-script-editor main button:not(.theme-toggle) {
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
body.page-script-editor main .grid > div:last-child > div a:hover,
body.page-script-editor main .grid > div:last-child > div button:hover {
  transform: translateY(-1px);
}

/* Bottom CTA */
body.page-script-editor main > div > div.mt-16 {
  border-width: 1px !important;
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(17, 19, 23, .04) !important;
}
body.page-script-editor main > div > div.mt-16 a {
  border-width: 1px !important;
  border-radius: 999px;
  box-shadow: none !important;
}
body.page-script-editor main > div > div.mt-16 a:hover {
  transform: translateY(-1px);
  box-shadow: none !important;
}

@media (max-width: 640px) {
  body.page-script-editor main > div { padding-top: 1.5rem !important; }
  body.page-script-editor main section:first-of-type { border-radius: 17px; }
  body.page-script-editor main .grid > div:first-child > div:first-child { border-radius: 12px; }
  body.page-script-editor main .grid > div:last-child > div { border-radius: 14px; }
  body.page-script-editor > footer { padding-top: 2.5rem; padding-bottom: 2.5rem; }
  body.page-script-editor > footer > div > div:first-child > div:last-child > span {
    min-height: 34px;
    padding: .45rem .8rem;
    font-size: .68rem;
  }
}

/* Dark-mode support: preserve the editor's existing palette and theme toggle */
body.page-script-editor.dark > header {
  background: #16181E !important;
  border-color: #2A2F3A !important;
}
body.page-script-editor.dark > footer {
  background: #111317 !important;
  border-color: #2A2F3A !important;
}
body.page-script-editor.dark main section:first-of-type,
body.page-script-editor.dark main .grid > div:first-child > div:first-child,
body.page-script-editor.dark main .grid > div:last-child > div {
  border-color: #2A2F3A !important;
}
