html,body,button,a,input,textarea,select,label,[role="button"],[contenteditable="true"]{touch-action:manipulation}

:root {
  color-scheme: dark;
  --bg: #05070a;
  --bg-raised: #0a0d12;
  --panel: rgba(16, 20, 27, 0.82);
  --panel-2: #11151c;
  --panel-3: #171c24;
  --text: #eef1f3;
  --muted: #919aa7;
  --faint: #68717d;
  --line: rgba(224, 231, 238, 0.12);
  --line-strong: rgba(224, 231, 238, 0.22);
  --accent: #8db6d7;
  --accent-strong: #b7d0e4;
  --accent-soft: rgba(141, 182, 215, 0.14);
  --warm: #d9a35f;
  --warm-soft: rgba(217, 163, 95, 0.14);
  --moss: #b4c990;
  --moss-soft: rgba(180, 201, 144, 0.13);
  --danger: #e07d78;
  --paper: transparent;
  --paper-text: #eef1f3;
  --paper-muted: #68717d;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  --serif: "Newsreader", Georgia, serif;
  --sans: "Avenir Next", Avenir, Inter, "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: "Avenir Next", Avenir, Inter, "Libre Franklin", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sidebar-width: 286px;
  --topbar-height: 68px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 22px;
  --max-width: 1180px;
}


body[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f6;
  --bg-raised: #e9edf0;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-2: #ffffff;
  --panel-3: #e1e6ea;
  --text: #15191e;
  --muted: #66707b;
  --faint: #89929c;
  --line: rgba(21, 25, 30, 0.11);
  --line-strong: rgba(21, 25, 30, 0.20);
  --accent: #527da0;
  --accent-strong: #315f82;
  --accent-soft: rgba(82, 125, 160, 0.11);
  --warm: #a56e2f;
  --warm-soft: rgba(165, 110, 47, 0.11);
  --moss: #6e8651;
  --moss-soft: rgba(110, 134, 81, 0.11);
  --danger: #b95450;
  --paper: transparent;
  --paper-text: #1a1f25;
  --paper-muted: #8a929a;
  --shadow: 0 24px 80px rgba(36, 45, 54, 0.14);
}


* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
textarea, input, select { color: var(--text); }
::selection { background: rgba(196, 119, 58, .32); }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.app-noise {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.screen { min-height: 100vh; }
.eyebrow {
  margin: 0 0 .45rem;
  color: var(--accent);
  font: 700 .68rem/1 var(--sans);
  letter-spacing: .15em;
  text-transform: uppercase;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  color: inherit;
  text-decoration: none;
}
.brand img { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 9px 26px rgba(196, 119, 58, .2); }
.brand span { display: flex; flex-direction: column; }
.brand strong { font: 600 1.35rem/1 var(--serif); letter-spacing: .01em; }
.brand small { margin-top: .27rem; color: var(--muted); font: 600 .58rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.compact-brand img { width: 36px; height: 36px; }
.compact-brand strong { font-size: 1.12rem; }

.library-header,
.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem clamp(1rem, 3vw, 2.4rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--line);
}
.library-header { position: relative; max-width: 1500px; margin: 0 auto; }
.header-actions, .topbar-left, .topbar-right { display: flex; align-items: center; gap: .55rem; }
.topbar-left { min-width: 0; }
.topbar-center { position: absolute; left: 50%; transform: translateX(-50%); }

.button, .icon-button, .text-button, .mini-button, .tool-button, .sync-chip {
  border: 0;
  cursor: pointer;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .7rem 1rem;
  border-radius: 999px;
  font: 700 .74rem/1 var(--sans);
  letter-spacing: .045em;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--text); color: var(--bg); }
.button.subtle { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.button.draft-button { background: var(--accent); color: #17110c; }
.button.danger { background: rgba(202, 107, 97, .13); color: var(--danger); border: 1px solid rgba(202, 107, 97, .25); }
.button.full-width { width: 100%; }
.compact-button { min-height: 36px; padding: .58rem .82rem; }
.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  font-size: 1.15rem;
}
.icon-button:hover { background: var(--panel-2); }
.text-button { padding: .5rem; background: transparent; color: var(--muted); font: 700 .72rem var(--sans); }
.text-button:hover { color: var(--text); }
.mini-button {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.mini-button:hover { color: var(--text); border-color: var(--line-strong); }

.library-main { max-width: 1370px; margin: 0 auto; padding: clamp(2.5rem, 6vw, 6rem) clamp(1rem, 4vw, 3rem) 6rem; }
.library-hero { max-width: 850px; padding: clamp(2rem, 4vw, 4rem) 0 clamp(3rem, 7vw, 6rem); }
.library-hero h1 {
  margin: 0;
  font: 500 clamp(4rem, 10vw, 8.6rem)/.85 var(--serif);
  letter-spacing: -.055em;
}
.library-hero h1 em { color: var(--accent); font-weight: 400; }
.hero-copy { max-width: 620px; margin: 1.75rem 0 0; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.15rem); line-height: 1.7; }
.sync-summary { margin-top: 1.4rem; display: flex; gap: .65rem; flex-wrap: wrap; }
.summary-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .72rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font: 700 .66rem var(--sans); }
.summary-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--moss); }

.section-heading, .view-header, .panel-card-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
}
.section-heading h2, .view-header h2, .panel-card h3 {
  margin: 0;
  font: 500 clamp(2.3rem, 5vw, 4rem)/.95 var(--serif);
  letter-spacing: -.035em;
}
.view-header > div > p:last-child { max-width: 620px; color: var(--muted); line-height: 1.55; }
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: .6rem .9rem; border-radius: 999px; cursor: pointer; font: 700 .68rem var(--sans); }
.segmented button.active { background: var(--text); color: var(--bg); }
.segmented.compact button { padding: .5rem .72rem; }

.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.project-card {
  min-height: 305px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.35rem;
  background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel-2) 74%, var(--bg)));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  overflow: hidden;
  position: relative;
}
.project-card::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; right: -95px; bottom: -110px; background: radial-gradient(circle, var(--accent-soft), transparent 68%); }
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.project-card-top, .project-card-bottom { position: relative; z-index: 2; }
.project-card-type { display: flex; justify-content: space-between; gap: .75rem; color: var(--accent); font: 700 .65rem var(--sans); letter-spacing: .13em; text-transform: uppercase; }
.project-card h3 { margin: 1.5rem 0 .65rem; font: 500 2.25rem/.95 var(--serif); letter-spacing: -.035em; }
.project-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.project-card-metrics { display: flex; gap: 1rem; color: var(--muted); font: 700 .65rem var(--sans); }
.project-card-metrics strong { display: block; margin-bottom: .2rem; color: var(--text); font-size: 1rem; }
.empty-project-card { min-height: 260px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--muted); text-align: center; cursor: pointer; }
.empty-project-card:hover { color: var(--text); background: var(--panel); }

.workspace-screen { height: 100vh; overflow: hidden; }
.workspace-topbar { position: relative; z-index: 80; height: var(--topbar-height); }
.project-identity { min-width: 0; display: flex; flex-direction: column; }
.project-type-label { color: var(--accent); font: 700 .58rem var(--sans); letter-spacing: .14em; }
.project-title-button { max-width: min(34vw, 430px); padding: .15rem 0 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 0; background: transparent; color: var(--text); text-align: left; font: 600 1.1rem var(--serif); cursor: pointer; }
.save-status { display: inline-flex; align-items: center; gap: .42rem; color: var(--faint); font: 700 .62rem var(--sans); }
.save-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--moss); }
.save-status.syncing i { background: var(--accent); animation: pulse 1s infinite; }
.save-status.error i { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

.workspace-layout { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: calc(100vh - var(--topbar-height)); }
.workspace-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border-right: 1px solid var(--line);
}
.workspace-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: .75rem; border-bottom: 1px solid var(--line); }
.workspace-nav button { min-width: 0; padding: .55rem .3rem; border: 0; border-radius: 9px; background: transparent; color: var(--faint); cursor: pointer; font: 700 .58rem var(--sans); text-transform: uppercase; letter-spacing: .06em; }
.workspace-nav button span { display: block; margin-bottom: .25rem; font-size: 1rem; }
.workspace-nav button:hover, .workspace-nav button.active { background: var(--panel-2); color: var(--text); }
.workspace-nav button.active { box-shadow: inset 0 -2px 0 var(--accent); }
.binder-panel { min-height: 0; flex: 1; overflow-y: auto; padding: .95rem .85rem 1.4rem; }
.binder-heading { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; padding: .35rem .25rem .85rem; background: var(--bg-raised); }
.binder-actions { display: flex; gap: .35rem; }
.draft-status-card { margin: 0 0 .7rem; padding: .75rem; border-radius: 12px; background: var(--accent-soft); border: 1px solid rgba(196, 119, 58, .21); }
.draft-status-card strong { display: block; font: 600 1rem var(--serif); }
.draft-status-card span { color: var(--muted); font: 600 .62rem var(--sans); }
.document-list { display: flex; flex-direction: column; gap: 3px; }
.document-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 26px; align-items: center; gap: .25rem; min-height: 46px; padding: .35rem .3rem; border-radius: 10px; color: var(--muted); cursor: pointer; }
.document-row:hover, .document-row.active { background: var(--panel-2); color: var(--text); }
.document-row.active { box-shadow: inset 3px 0 0 var(--accent); }
.document-row .drag-handle { color: var(--faint); font-size: .8rem; cursor: grab; }
.document-row-title { min-width: 0; }
.document-row-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 .78rem var(--sans); }
.document-row-title small { display: block; margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font: 600 .58rem var(--sans); }
.document-row .row-menu { opacity: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.document-row:hover .row-menu { opacity: 1; }
.document-row.dragging { opacity: .45; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: .75rem; border-top: 1px solid var(--line); }
.sync-chip { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .55rem .7rem; border-radius: 999px; background: var(--panel-2); color: var(--muted); font: 700 .59rem var(--sans); }

.workspace-main { min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.workspace-view { display: none; height: 100%; overflow-y: auto; }
.workspace-view.active { display: block; }
.write-view { position: relative; padding-bottom: 42px; }
.writing-toolbar { min-height: 92px; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3.2rem) .9rem; background: var(--bg); }
.document-heading-wrap { min-width: 0; }
.document-title-input { width: min(65vw, 650px); padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 clamp(1.8rem, 4vw, 3rem)/1 var(--serif); letter-spacing: -.035em; }
.writing-toolbar-actions { display: flex; align-items: center; gap: .35rem; }
.tool-button { min-width: 34px; min-height: 34px; padding: .4rem .58rem; border-radius: 9px; background: transparent; color: var(--muted); font: 700 .65rem var(--sans); }
.tool-button:hover { background: var(--panel-2); color: var(--text); }
.editor-shell { width: 100%; min-height: calc(100% - 140px); padding: 0 clamp(1rem, 6vw, 6rem) 6rem; }
.novel-editor {
  width: min(100%, 810px);
  min-height: calc(100vh - 220px);
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 5rem) clamp(1.25rem, 7vw, 5rem) 9rem;
  outline: none;
  background: var(--paper);
  color: var(--paper-text);
  box-shadow: 0 1px 0 var(--line), var(--shadow);
  border-radius: 3px;
  font: 400 clamp(1.03rem, 1.7vw, 1.18rem)/1.85 var(--serif);
}
.novel-editor p { margin: 0 0 1em; }
.novel-editor h1, .novel-editor h2 { font-family: var(--serif); line-height: 1.1; }
.novel-editor:empty::before { content: 'Begin here.'; color: var(--paper-muted); }
.full-manuscript-editor { width: min(100%, 860px); margin: 0 auto; }
.manuscript-section { margin-bottom: 2px; padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 7vw, 5rem); background: var(--paper); color: var(--paper-text); box-shadow: 0 1px 0 var(--line); }
.manuscript-section:first-child { border-radius: 4px 4px 0 0; }
.manuscript-section:last-child { border-radius: 0 0 4px 4px; padding-bottom: 8rem; }
.manuscript-section-title { margin: 0 0 2rem; color: var(--paper-text); font: 500 2.2rem/1 var(--serif); }
.manuscript-section-body { min-height: 8rem; outline: 0; font: 400 clamp(1.03rem, 1.7vw, 1.18rem)/1.85 var(--serif); }
.screenplay-editor-shell { padding-left: clamp(.8rem, 4vw, 3rem); padding-right: clamp(.8rem, 4vw, 3rem); }
.screenplay-editor { display: block; width: min(100%, 820px); min-height: calc(100vh - 250px); margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem); resize: none; outline: none; border: 0; background: var(--paper); color: var(--paper-text); box-shadow: var(--shadow); font: 400 1rem/1.45 "Courier New", Courier, monospace; tab-size: 5; }
.screenplay-keyboard { display: flex; gap: .3rem; width: min(100%, 820px); margin: 0 auto .6rem; overflow-x: auto; padding-bottom: .2rem; }
.screenplay-keyboard button { flex: 0 0 auto; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 8px; padding: .52rem .65rem; font: 700 .58rem var(--sans); }
.editor-footer { position: fixed; z-index: 22; bottom: 0; right: 0; left: var(--sidebar-width); min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .5rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); color: var(--faint); font: 700 .58rem var(--sans); }
.session-footer { color: var(--accent); }

.plan-view, .bible-view, .versions-view, .progress-view { padding: clamp(1.5rem, 5vw, 4rem); }
.view-toolbar { margin: 1.5rem 0; }
.outline-container { margin-top: 1.5rem; }
.outline-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.outline-card { min-height: 220px; display: flex; flex-direction: column; padding: 1rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); cursor: pointer; }
.outline-card:hover { border-color: var(--line-strong); }
.outline-card-top { display: flex; justify-content: space-between; gap: .5rem; color: var(--accent); font: 700 .59rem var(--sans); text-transform: uppercase; letter-spacing: .09em; }
.outline-card h3 { margin: 1rem 0 .55rem; font: 600 1.45rem/1 var(--serif); }
.outline-card p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.outline-card-footer { margin-top: auto; padding-top: 1rem; display: flex; justify-content: space-between; color: var(--faint); font: 700 .58rem var(--sans); }
.outline-table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.outline-table th, .outline-table td { padding: .85rem; text-align: left; border-bottom: 1px solid var(--line); }
.outline-table th { color: var(--faint); font: 700 .6rem var(--sans); text-transform: uppercase; letter-spacing: .08em; }
.outline-table td { color: var(--muted); font-size: .82rem; }
.outline-table td strong { color: var(--text); }
.beat-lanes { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: .8rem; overflow-x: auto; }
.beat-lane { min-height: 420px; padding: .9rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.beat-lane h3 { margin: 0 0 1rem; font: 600 1.2rem var(--serif); }

.bible-layout { margin-top: 2rem; }
.bible-tabs { display: flex; gap: .35rem; overflow-x: auto; margin-bottom: 1rem; }
.bible-tabs button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: .6rem .8rem; cursor: pointer; font: 700 .64rem var(--sans); }
.bible-tabs button.active { background: var(--text); color: var(--bg); }
.bible-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.bible-card { min-height: 210px; padding: 1.1rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); cursor: pointer; }
.bible-card:hover { border-color: var(--line-strong); }
.bible-card-type { color: var(--accent); font: 700 .58rem var(--sans); text-transform: uppercase; letter-spacing: .1em; }
.bible-card h3 { margin: .85rem 0 .5rem; font: 600 1.5rem/1 var(--serif); }
.bible-card p { color: var(--muted); font-size: .8rem; line-height: 1.55; }
.tag-list { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: 1rem; }
.tag { padding: .35rem .5rem; border-radius: 999px; background: var(--panel-2); color: var(--faint); font: 700 .55rem var(--sans); }


.empty-state { max-width: 620px; margin: 7vh auto 0; text-align: center; }
.empty-state h3 { margin: 0; font: 500 2.1rem var(--serif); }
.empty-state p { color: var(--muted); line-height: 1.6; }

.version-timeline { max-width: 900px; margin: 2rem auto 0; }
.version-card { display: grid; grid-template-columns: 95px minmax(0, 1fr) auto; gap: 1rem; align-items: start; padding: 1.2rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.version-card:hover .version-card-main h3 { color: var(--accent); }
.version-badge { display: grid; place-items: center; min-height: 72px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font: 700 .68rem var(--sans); text-transform: uppercase; letter-spacing: .08em; }
.version-card-main h3 { margin: 0; font: 600 1.55rem var(--serif); transition: color .15s ease; }
.version-card-main p { margin: .45rem 0; color: var(--muted); line-height: 1.5; }
.version-meta { display: flex; gap: .7rem; flex-wrap: wrap; color: var(--faint); font: 700 .58rem var(--sans); }
.working-version { background: var(--panel); margin-bottom: 1rem; padding: 1rem; border-radius: var(--radius); border: 1px solid var(--line); }

.progress-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-top: 2rem; }
.stat-card { padding: 1.1rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.stat-card strong { display: block; font: 500 2rem/1 var(--serif); }
.stat-card span { display: block; margin-top: .45rem; color: var(--muted); font: 700 .59rem var(--sans); text-transform: uppercase; letter-spacing: .07em; }
.progress-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; margin-top: 1rem; }
.panel-card { padding: 1.2rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.panel-card h3 { font-size: 1.75rem; }
.session-list, .section-progress { margin-top: 1rem; }
.session-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: .8rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.session-row:last-child { border: 0; }
.session-date { color: var(--faint); font: 700 .59rem var(--sans); }
.session-row strong { display: block; font: 600 .82rem var(--sans); }
.session-row p { margin: .3rem 0 0; color: var(--muted); font-size: .72rem; }
.session-net { color: var(--moss); font: 700 .72rem var(--sans); }
.section-progress-row { margin-bottom: .9rem; }
.section-progress-label { display: flex; justify-content: space-between; gap: .7rem; margin-bottom: .35rem; font: 700 .64rem var(--sans); }
.progress-bar { height: 6px; overflow: hidden; border-radius: 999px; background: var(--panel-3); }
.progress-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.app-dialog {
  width: min(92vw, 620px);
  max-height: min(88vh, 840px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0,0,0,.45);
}
.app-dialog::backdrop { background: rgba(0,0,0,.64); backdrop-filter: blur(8px); }
.app-dialog form { padding: 1.3rem; overflow-y: auto; max-height: 88vh; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.dialog-heading h2 { margin: 0; font: 500 2rem/1 var(--serif); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: 1.3rem; }
.split-actions { display: grid; grid-template-columns: auto 1fr auto auto; }
.field-label { display: block; margin: .9rem 0 .4rem; color: var(--muted); font: 700 .61rem var(--sans); text-transform: uppercase; letter-spacing: .08em; }
.text-input, .app-dialog textarea, .app-dialog select { width: 100%; padding: .8rem .85rem; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--panel); color: var(--text); }
.text-input:focus, .app-dialog textarea:focus, .app-dialog select:focus { border-color: var(--accent); }
.two-column-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.project-type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.project-type-picker label { cursor: pointer; }
.project-type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.project-type-picker span { min-height: 130px; display: flex; flex-direction: column; padding: .85rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.project-type-picker strong { font: 600 1.2rem var(--serif); }
.project-type-picker small { margin-top: .55rem; color: var(--muted); line-height: 1.4; }
.project-type-picker input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.lock-explainer { padding: 1rem; border-radius: 15px; background: var(--accent-soft); border: 1px solid rgba(196,119,58,.2); }
.lock-explainer strong { font: 600 1.4rem var(--serif); }
.lock-explainer p { margin: .5rem 0 0; color: var(--muted); line-height: 1.55; }
.checkbox-row { display: flex; align-items: center; gap: .55rem; margin-top: .9rem; color: var(--muted); font-size: .78rem; }
.backup-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-top: 1rem; }
.auth-status-panel { padding: .9rem; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); line-height: 1.5; }
.settings-list { display: flex; flex-direction: column; }
.settings-list button { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem .2rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.settings-list button span { color: var(--faint); }
.settings-list button:hover { color: var(--accent); }
.settings-list .danger-row { color: var(--danger); }
.settings-note { color: var(--faint); font-size: .7rem; line-height: 1.5; }
.session-end-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.session-end-summary div { padding: .8rem; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.session-end-summary strong { display: block; font: 600 1.4rem var(--serif); }
.session-end-summary span { color: var(--faint); font: 700 .55rem var(--sans); text-transform: uppercase; }
.version-dialog { width: min(94vw, 880px); }
.version-dialog-meta { color: var(--muted); font-size: .75rem; }
.version-read-only { max-height: 55vh; overflow-y: auto; margin-top: 1rem; padding: 1.2rem; background: var(--paper); color: var(--paper-text); border-radius: 12px; }
.version-read-only h3 { font: 600 1.7rem var(--serif); }
.version-read-only .version-section { padding-bottom: 2rem; border-bottom: 1px solid rgba(0,0,0,.08); }
.version-read-only pre { white-space: pre-wrap; font: 400 .86rem/1.5 "Courier New", monospace; }

.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast { max-width: 360px; padding: .8rem 1rem; border-radius: 13px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font: 700 .7rem var(--sans); animation: toast-in .22s ease; }
.toast.error { background: var(--danger); color: white; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

body.focus-mode .workspace-sidebar,
body.focus-mode .workspace-topbar,
body.focus-mode .editor-footer,
body.focus-mode .writing-toolbar-actions,
body.focus-mode .mobile-bottom-nav { display: none !important; }
body.focus-mode .workspace-layout { display: block; height: 100vh; }
body.focus-mode .workspace-main, body.focus-mode .write-view { height: 100vh; }
body.focus-mode .writing-toolbar { min-height: 64px; padding-top: .7rem; }
body.focus-mode .editor-shell { padding-top: 0; }
body.focus-mode .novel-editor, body.focus-mode .screenplay-editor { min-height: calc(100vh - 90px); box-shadow: none; }
body.focus-mode .editor-footer { left: 0; }

body.project-type-novel .script-only { display: none !important; }
body.project-type-feature .novel-only,
body.project-type-tv .novel-only { display: none !important; }

@media (max-width: 1050px) {
  .project-grid, .outline-grid, .bible-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  :root { --topbar-height: 60px; }
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }
  .library-header { padding: .65rem .85rem; }
  .library-header .brand small { display: none; }
  .library-main { padding-top: 2rem; }
  .library-hero { padding-top: 1rem; }
  .library-hero h1 { font-size: clamp(3.7rem, 20vw, 5.4rem); }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .segmented.compact { max-width: 100%; overflow-x: auto; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 245px; }

  .workspace-topbar { position: relative; padding: .55rem .65rem; }
  .topbar-center { display: none; }
  .topbar-right { gap: .2rem; }
  .topbar-right .button { font-size: .6rem; padding: .5rem .6rem; }
  .project-title-button { max-width: 36vw; font-size: .94rem; }
  .workspace-layout { display: block; height: calc(100vh - var(--topbar-height)); }
  .workspace-sidebar {
    position: fixed;
    inset: 0 12% 0 0;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 25px 0 70px rgba(0,0,0,.45);
  }
  .workspace-sidebar.open { transform: translateX(0); }
  .sidebar-brand { align-items: center; justify-content: space-between; padding: .8rem; border-bottom: 1px solid var(--line); }
  .workspace-nav { grid-template-columns: repeat(5, 1fr); overflow-x: auto; }
  .workspace-nav button { min-width: 58px; }
  .sidebar-footer { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
  .workspace-main { height: 100%; padding-bottom: 63px; }
  .writing-toolbar { min-height: 74px; align-items: center; padding: .7rem .85rem; }
  .document-title-input { width: 56vw; font-size: 1.6rem; }
  .writing-toolbar-actions .tool-button:not([data-action="focus-mode"]):not([data-action="open-document-inspector"]) { display: none; }
  .editor-shell { padding: 0 .55rem 5rem; }
  .novel-editor { min-height: calc(100vh - 210px); padding: 2rem 1.25rem 7rem; box-shadow: none; font-size: 1.05rem; line-height: 1.78; }
  .manuscript-section { padding: 2rem 1.2rem; }
  .screenplay-editor-shell { padding-left: .45rem; padding-right: .45rem; }
  .screenplay-editor { min-height: calc(100vh - 260px); padding: 1.5rem .8rem 7rem; font-size: .89rem; box-shadow: none; }
  .screenplay-keyboard { position: sticky; top: 0; z-index: 6; background: var(--bg); padding: .4rem 0; }
  .editor-footer { left: 0; bottom: 61px; }
  .mobile-bottom-nav { position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; display: grid !important; grid-template-columns: repeat(5, 1fr); min-height: calc(61px + env(safe-area-inset-bottom)); padding: .35rem .25rem env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg-raised) 94%, transparent); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
  .mobile-bottom-nav button { border: 0; background: transparent; color: var(--faint); font: 700 .54rem var(--sans); }
  .mobile-bottom-nav button span { display: block; margin-bottom: .18rem; font-size: 1.05rem; }
  .mobile-bottom-nav button.active { color: var(--accent); }

  .plan-view, .bible-view, .versions-view, .progress-view { padding: 1.2rem .85rem 5.5rem; }
  .view-header { align-items: flex-start; flex-direction: column; }
  .view-header h2 { font-size: 2.5rem; }
  .outline-grid, .bible-grid { grid-template-columns: 1fr; }
  .beat-lanes { grid-template-columns: repeat(3, 260px); }
  .version-card { grid-template-columns: 72px minmax(0,1fr); }
  .version-card > .button { display: none; }
  .progress-stats { grid-template-columns: repeat(2, 1fr); }
  .progress-grid { grid-template-columns: 1fr; }
  .session-row { grid-template-columns: 80px minmax(0, 1fr); }
  .session-net { grid-column: 2; }
  .project-type-picker { grid-template-columns: 1fr; }
  .project-type-picker span { min-height: 90px; }
  .two-column-fields { grid-template-columns: 1fr; }
  .app-dialog { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); border-radius: 20px; }
  .app-dialog form { max-height: calc(100vh - 1rem); }
  .backup-actions { grid-template-columns: 1fr; }
  .toast-region { left: .7rem; right: .7rem; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}

@media print {
  body { background: white !important; color: black !important; }
  .workspace-topbar, .workspace-sidebar, .writing-toolbar, .editor-footer, .mobile-bottom-nav, .app-noise { display: none !important; }
  .workspace-screen, .workspace-layout, .workspace-main, .workspace-view, .write-view { display: block !important; height: auto !important; overflow: visible !important; }
  .editor-shell { padding: 0 !important; }
  .novel-editor, .manuscript-section, .screenplay-editor { width: 100% !important; min-height: 0 !important; margin: 0 !important; padding: .75in !important; box-shadow: none !important; background: white !important; color: black !important; }
  .screenplay-editor { white-space: pre-wrap; border: 0; }
}

/* Scribe 0.2 — Continuity visual system
   The interface recedes; the draft gets the room. */

html { background: var(--bg); }
body {
  background:
    radial-gradient(circle at 50% -10%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 34rem),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, #0a1017) 0%, var(--bg) 48%, color-mix(in srgb, var(--bg) 94%, #111820) 100%);
  font-family: var(--body);
}
body[data-theme="light"] {
  background:
    radial-gradient(circle at 50% -10%, rgba(82,125,160,.12), transparent 34rem),
    linear-gradient(180deg, #f7f9fa 0%, #f3f5f6 52%, #edf1f3 100%);
}
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.ambient-space {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.ambient-space::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 74px, rgba(255,255,255,.012) 75px 76px),
    linear-gradient(90deg, rgba(0,0,0,.65), transparent 26%, transparent 72%, rgba(0,0,0,.68));
  opacity: .72;
}
body[data-theme="light"] .ambient-space::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 74px, rgba(14,21,29,.018) 75px 76px),
    linear-gradient(90deg, rgba(255,255,255,.48), transparent 25%, transparent 74%, rgba(255,255,255,.55));
}
.ambient-space::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.32) .4px, transparent .4px);
  background-size: 4px 4px;
  opacity: .035;
  mix-blend-mode: screen;
}
body[data-theme="light"] .ambient-space::after {
  background-image: radial-gradient(rgba(20,28,36,.30) .4px, transparent .4px);
  mix-blend-mode: multiply;
  opacity: .022;
}
.light-shelf {
  position: absolute;
  top: 7vh;
  width: 1px;
  height: 85vh;
  background: linear-gradient(180deg, transparent, rgba(238,241,243,.42) 22%, rgba(141,182,215,.18) 70%, transparent);
  box-shadow: 0 0 24px rgba(194,213,229,.20), 18px 0 72px rgba(141,182,215,.04);
  opacity: .19;
}
body[data-theme="light"] .light-shelf { opacity: .10; filter: invert(1); }
.shelf-a { left: 15%; transform: rotate(1deg); }
.shelf-b { left: 72%; transform: rotate(-1deg); opacity: .14; }
.shelf-c { left: 87%; transform: rotate(.5deg); opacity: .10; }
.app-noise { display: none; }

.archive-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(118deg, rgba(255,255,255,.055), rgba(255,255,255,.015) 46%, color-mix(in srgb, var(--accent) 2%, transparent)),
    var(--panel);
  box-shadow: var(--shadow);
}
.archive-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(238,241,243,.62), color-mix(in srgb, var(--accent) 45%, transparent), transparent);
  box-shadow: 0 0 18px rgba(238,241,243,.20);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--muted);
  font: 700 .68rem/1 var(--sans);
  letter-spacing: .19em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-right: 9px;
  vertical-align: middle;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
  opacity: .75;
}
.eyebrow.cool { color: var(--accent); }
.eyebrow.warm { color: var(--warm); }

.brand { gap: 12px; text-align: left; }
.brand-mark {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  box-shadow: inset 0 0 26px color-mix(in srgb, var(--accent) 5%, transparent), 0 0 28px color-mix(in srgb, var(--accent) 7%, transparent);
}
.brand-mark::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid color-mix(in srgb, var(--warm) 28%, transparent);
  border-radius: 8px;
  transform: rotate(-4deg);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 8px;
  transform: rotate(4deg);
}
.brand-mark i {
  position: relative;
  z-index: 2;
  display: block;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(238,241,243,.92), rgba(141,182,215,.46), transparent);
  box-shadow: 0 0 8px rgba(238,241,243,.40);
}
.brand-mark i:nth-child(1) { height: 15px; opacity: .42; }
.brand-mark i:nth-child(2) { height: 27px; width: 2px; }
.brand-mark i:nth-child(3) { height: 19px; opacity: .56; }
.brand strong {
  font: 650 1.05rem/1.05 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.brand small {
  margin-top: 5px;
  color: var(--muted);
  font: 500 .72rem/1 var(--sans);
  letter-spacing: .05em;
  text-transform: none;
}
.compact-brand .brand-mark { width: 35px; height: 35px; }
.compact-brand strong { font-size: .92rem; }

.library-header,
.workspace-topbar {
  min-height: var(--topbar-height);
  padding: 10px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}
body[data-theme="light"] .library-header,
body[data-theme="light"] .workspace-topbar { border-bottom-color: rgba(16,24,32,.08); }
.library-header { max-width: none; }
.header-actions, .topbar-left, .topbar-right { gap: 8px; }

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  font-size: 1rem;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.icon-button:hover,
.icon-button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 14px;
  font: 700 .76rem/1 var(--sans);
  letter-spacing: .065em;
  text-transform: uppercase;
}
.button.primary {
  background: var(--text);
  color: color-mix(in srgb, var(--bg) 96%, black);
  box-shadow: 0 8px 28px rgba(238,241,243,.10);
}
.button.primary:hover { background: #fff; }
body[data-theme="light"] .button.primary:hover { background: #0d1116; color: #fff; }
.button.subtle {
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.04);
}
.button.subtle:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.button.draft-button {
  border: 1px solid color-mix(in srgb, var(--warm) 35%, transparent);
  background: var(--warm-soft);
  color: var(--warm);
}
.button.draft-button:hover { background: color-mix(in srgb, var(--warm) 22%, transparent); }
.text-button { color: var(--accent); letter-spacing: .05em; }
.mini-button,
.tool-button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}
.mini-button:hover,
.tool-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.055); }

.library-main {
  width: min(100%, var(--max-width));
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px) clamp(14px, 3.5vw, 34px) 70px;
}
.library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 24px;
  max-width: none;
  min-height: 255px;
  align-items: center;
  padding: clamp(26px, 5vw, 58px);
}
.library-hero::after {
  content: "";
  position: absolute;
  inset: -30% -5% auto auto;
  width: 420px;
  height: 420px;
  border: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 110px color-mix(in srgb, var(--accent) 5%, transparent), 0 0 90px rgba(0,0,0,.5);
}
.library-hero-copy { position: relative; z-index: 2; }
.library-hero h1 {
  margin: 0 0 12px;
  font: 560 clamp(2.35rem, 7vw, 4.7rem)/.97 var(--sans);
  letter-spacing: -.045em;
}
.library-hero h1 em { color: inherit; font-style: normal; }
.hero-copy {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.96rem, 2vw, 1.08rem);
  line-height: 1.65;
}
.sync-summary { margin-top: 20px; }
.summary-pill {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(8,11,17,.34);
  color: var(--muted);
  font-size: .68rem;
}
body[data-theme="light"] .summary-pill { background: rgba(255,255,255,.52); }
.scribe-rings { position: relative; z-index: 2; display: grid; min-height: 170px; place-items: center; }
.scribe-rings span {
  position: absolute;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(238,241,243,.15);
  border-radius: 50%;
  box-shadow: inset 0 0 36px rgba(0,0,0,.72), 0 0 34px color-mix(in srgb, var(--accent) 4%, transparent);
}
.scribe-rings span:nth-child(2) { width: 105px; height: 105px; border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.scribe-rings span:nth-child(3) {
  width: 50px;
  height: 50px;
  border-color: color-mix(in srgb, var(--warm) 50%, transparent);
  background: radial-gradient(circle, var(--warm-soft), transparent 72%);
  box-shadow: 0 0 34px color-mix(in srgb, var(--warm) 14%, transparent);
}
.project-section { margin-top: 46px; }
.section-heading h2,
.view-header h2,
.panel-card h3 {
  font-family: var(--sans);
  font-weight: 560;
  letter-spacing: -.025em;
}
.section-heading h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); }
.segmented {
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.segmented button { border-radius: 10px; text-transform: uppercase; letter-spacing: .055em; }
.segmented button.active { background: rgba(255,255,255,.09); color: var(--text); }
body[data-theme="light"] .segmented button.active { background: rgba(20,28,36,.08); }
.project-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.project-card {
  min-height: 235px;
  padding: 20px;
  border-radius: 18px;
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 52%),
    rgba(255,255,255,.018);
  box-shadow: none;
}
.project-card::after {
  width: 190px;
  height: 190px;
  right: -100px;
  bottom: -115px;
  background: radial-gradient(circle, color-mix(in srgb, var(--warm) 10%, transparent), transparent 68%);
}
.project-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 38%, transparent); box-shadow: 0 20px 50px rgba(0,0,0,.34); }
.project-card-type { color: var(--accent); font-size: .63rem; }
.project-card h3 { margin: 20px 0 8px; font: 610 1.45rem/1.04 var(--sans); letter-spacing: -.025em; }
.project-card p { font-size: .78rem; line-height: 1.55; }
.project-card-metrics { font-size: .62rem; }
.project-card-metrics strong { font-weight: 540; }
.empty-project-card { min-height: 235px; border-radius: 18px; background: rgba(255,255,255,.012); }

.workspace-screen { background: var(--bg); }
.workspace-topbar { position: relative; z-index: 80; }
.project-type-label { color: var(--accent); letter-spacing: .13em; }
.project-title-button { font: 610 1rem/1.05 var(--sans); letter-spacing: -.01em; }
.save-status { color: var(--muted); font-weight: 650; }
.save-status i { background: var(--moss); box-shadow: 0 0 14px color-mix(in srgb, var(--moss) 45%, transparent); }
.workspace-layout { grid-template-columns: var(--sidebar-width) minmax(0,1fr); }
.workspace-sidebar {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-raised) 88%, transparent);
  backdrop-filter: blur(18px);
}
.workspace-nav {
  grid-template-columns: repeat(3,1fr);
  gap: 5px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
}
.workspace-nav button {
  min-height: 49px;
  padding: 7px 4px;
  border-radius: 11px;
  color: var(--faint);
  letter-spacing: .045em;
}
.workspace-nav button span { margin-bottom: 3px; font-size: .95rem; }
.workspace-nav button:hover,
.workspace-nav button.active { background: rgba(255,255,255,.055); color: var(--text); }
.workspace-nav button.active { box-shadow: none; }
.workspace-nav button.active span { color: var(--accent); filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent) 28%, transparent)); }
.binder-panel { padding: 15px 12px 24px; }
.binder-heading { padding: 5px 4px 13px; background: color-mix(in srgb, var(--bg-raised) 94%, transparent); }
.draft-status-card {
  margin-bottom: 10px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--warm) 25%, transparent);
  border-radius: 14px;
  background: linear-gradient(90deg, var(--warm-soft), transparent);
}
.draft-status-card strong { font: 610 .9rem var(--sans); }
.draft-status-card span { color: var(--muted); }
.document-list { gap: 4px; }
.document-row {
  min-height: 50px;
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
}
.document-row:hover,
.document-row.active { border-color: var(--line); background: rgba(255,255,255,.038); }
.document-row.active { box-shadow: inset 2px 0 0 var(--accent); }
.document-row-title strong { font-size: .77rem; }
.document-row-title small { color: var(--faint); }
.sidebar-footer { border-top-color: var(--line); }
.sync-chip {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: rgba(8,11,17,.46);
  color: var(--muted);
}
body[data-theme="light"] .sync-chip { background: rgba(255,255,255,.60); }

.workspace-main {
  position: relative;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 31rem),
    var(--bg);
}
.workspace-main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.14), transparent 19%, transparent 81%, rgba(0,0,0,.14));
  opacity: .48;
}
body[data-theme="light"] .workspace-main::before { opacity: .08; }
.workspace-view { position: relative; z-index: 1; }
.write-view { padding-bottom: 42px; }
.writing-toolbar {
  min-height: 88px;
  align-items: flex-end;
  padding: 18px clamp(18px, 4vw, 48px) 14px;
  border-bottom: 1px solid transparent;
  background: transparent;
}
.document-title-input {
  width: min(65vw, 650px);
  font: 560 clamp(1.65rem, 3.5vw, 2.55rem)/1 var(--sans);
  letter-spacing: -.035em;
}
.writing-toolbar-actions { gap: 6px; }
.tool-button { min-width: 36px; min-height: 36px; color: var(--muted); }
.editor-shell {
  min-height: calc(100% - 135px);
  padding: 0 clamp(18px, 6vw, 84px) 7rem;
}
.novel-editor,
.screenplay-editor {
  width: min(100%, 790px);
  min-height: calc(100vh - 225px);
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--paper-text);
  box-shadow: none;
}
.novel-editor {
  padding: clamp(38px, 8vh, 78px) clamp(8px, 4vw, 36px) 10rem;
  font: 400 clamp(1.06rem, 1.65vw, 1.18rem)/1.9 var(--serif);
  caret-color: var(--accent-strong);
}
.novel-editor p { margin: 0 0 1.05em; }
.novel-editor:empty::before { color: var(--paper-muted); font-style: italic; }
.novel-editor:focus { outline: none; }
.full-manuscript-editor { width: min(100%, 790px); }
.manuscript-section {
  margin: 0;
  padding: clamp(48px, 8vh, 80px) clamp(8px, 4vw, 36px);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--paper-text);
  box-shadow: none;
}
.manuscript-section:first-child,
.manuscript-section:last-child { border-radius: 0; }
.manuscript-section:last-child { padding-bottom: 10rem; border-bottom: 0; }
.manuscript-section-title { margin-bottom: 2.5rem; color: var(--muted); font: 560 1.55rem/1 var(--sans); letter-spacing: -.025em; }
.manuscript-section-body { font: 400 clamp(1.06rem,1.65vw,1.18rem)/1.9 var(--serif); }
.screenplay-editor-shell { padding-right: clamp(14px,5vw,72px); padding-left: clamp(14px,5vw,72px); }
.screenplay-editor {
  min-height: calc(100vh - 250px);
  padding: clamp(40px, 7vh, 72px) clamp(8px, 4vw, 32px) 10rem;
  resize: none;
  font: 400 1rem/1.52 "Courier Prime", "Courier New", Courier, monospace;
  caret-color: var(--accent-strong);
}
.screenplay-keyboard {
  width: min(100%, 790px);
  margin-bottom: 0;
  padding: 7px 0;
}
.screenplay-keyboard button {
  min-height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
}
.editor-footer {
  left: var(--sidebar-width);
  min-height: 38px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
}
.session-footer { color: var(--warm); }

.plan-view,
.bible-view,
.versions-view,
.progress-view { padding: clamp(26px, 5vw, 56px); }
.view-header { align-items: flex-end; }
.view-header h2 { font-size: clamp(1.75rem, 4vw, 2.65rem); }
.view-header > div > p:last-child { margin-top: 8px; color: var(--muted); line-height: 1.65; }
.outline-grid,
.bible-grid { gap: 12px; }
.outline-card,
.bible-card,
.beat-lane,
.panel-card {
  border-radius: 16px;
  background: rgba(255,255,255,.022);
  box-shadow: none;
}
.outline-card,
.bible-card { min-height: 190px; }
.outline-card:hover,
.bible-card:hover { border-color: color-mix(in srgb, var(--accent) 38%, transparent); background: rgba(255,255,255,.038); }
.outline-card-top,
.bible-card-type { color: var(--accent); }
.outline-card h3,
.bible-card h3,
.beat-lane h3 { font-family: var(--sans); font-weight: 610; letter-spacing: -.02em; }
.outline-table { border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.outline-table th,
.outline-table td { border-bottom-color: var(--line); }
.bible-tabs button { min-height: 38px; border-radius: 999px; background: rgba(255,255,255,.018); }
.bible-tabs button.active { background: rgba(255,255,255,.09); color: var(--text); }
.tag { border: 1px solid var(--line); background: rgba(255,255,255,.025); }


.version-card,
.session-row,
.section-progress-row,
.stat-card {
  border-radius: 15px;
  background: rgba(255,255,255,.022);
}
.version-card:hover { border-color: color-mix(in srgb, var(--accent) 38%, transparent); }
.version-badge { color: var(--warm); border-color: color-mix(in srgb, var(--warm) 30%, transparent); background: var(--warm-soft); }
.working-version { border-color: color-mix(in srgb, var(--accent) 28%, transparent); background: linear-gradient(90deg, var(--accent-soft), transparent 68%); }
.stat-card strong { font-weight: 520; color: var(--text); }
.progress-bar span { background: linear-gradient(90deg, var(--accent), var(--warm)); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 22%, transparent); }

.app-dialog {
  width: min(94vw, 720px);
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: #0b0e13;
  color: var(--text);
  box-shadow: 0 32px 120px rgba(0,0,0,.72);
}
body[data-theme="light"] .app-dialog { background: #f8fafb; }
.app-dialog::backdrop {
  background: rgba(0,0,0,.76);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}
.app-dialog form { padding: clamp(20px,4vw,28px); }
.dialog-heading { margin-bottom: 20px; }
.dialog-heading h2 { font: 560 1.8rem/1.05 var(--sans); letter-spacing: -.025em; }
.field-label { color: var(--muted); font-size: .7rem; letter-spacing: .05em; }
.text-input,
.app-dialog textarea,
.app-dialog select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
}
.text-input:focus,
.app-dialog textarea:focus,
.app-dialog select:focus {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}
.project-type-picker span,
.auth-status-panel,
.lock-explainer,
.session-end-summary div {
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.project-type-picker strong,
.lock-explainer strong,
.session-end-summary strong { font-family: var(--sans); font-weight: 610; }
.project-type-picker input:checked + span { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); box-shadow: none; }
.lock-explainer { border-color: color-mix(in srgb, var(--warm) 24%, transparent); background: var(--warm-soft); }
.settings-list button:hover { color: var(--accent); }
.version-read-only { background: color-mix(in srgb, var(--panel-2) 88%, var(--bg)); color: var(--text); }
.version-read-only h3 { font-family: var(--sans); }
.toast { border: 1px solid var(--line-strong); background: rgba(17,21,28,.96); color: var(--text); }

body.focus-mode .workspace-main { background: var(--bg); }
body.focus-mode .novel-editor,
body.focus-mode .screenplay-editor { width: min(100%, 820px); }

@media (max-width: 1050px) {
  .project-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .library-header { min-height: calc(62px + env(safe-area-inset-top)); padding: calc(9px + env(safe-area-inset-top)) 12px 9px; }
  .library-header .brand small { display: block; }
  .header-actions .button.subtle { display: none; }
  .library-main { padding: 14px 12px 86px; }
  .library-hero {
    grid-template-columns: 1fr;
    min-height: 235px;
    padding: 28px 22px;
  }
  .library-hero h1 { font-size: clamp(2.5rem, 13vw, 3.65rem); }
  .scribe-rings { position: absolute; right: -25px; bottom: -48px; width: 180px; opacity: .55; }
  .project-section { margin-top: 34px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 205px; }

  .workspace-topbar { min-height: var(--topbar-height); padding: .55rem .65rem; }
  .topbar-right .button { min-height: 36px; border-radius: 11px; }
  .workspace-sidebar { background: rgba(7,9,13,.97); }
  body[data-theme="light"] .workspace-sidebar { background: rgba(244,247,249,.98); }
  .workspace-nav { grid-template-columns: repeat(5,1fr); }
  .workspace-main { padding-bottom: 63px; }
  .writing-toolbar { min-height: 72px; padding: 12px 14px 10px; }
  .document-title-input { width: 55vw; font-size: 1.45rem; }
  .editor-shell { padding: 0 16px 6rem; }
  .novel-editor {
    min-height: calc(100vh - 205px);
    padding: 32px 2px 8rem;
    font-size: 1.06rem;
    line-height: 1.82;
  }
  .full-manuscript-editor { width: 100%; }
  .manuscript-section { padding: 38px 2px; }
  .screenplay-editor { min-height: calc(100vh - 255px); padding: 30px 2px 8rem; font-size: .9rem; }
  .screenplay-keyboard { position: sticky; top: 0; z-index: 6; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); }
  .editor-footer { bottom: 61px; left: 0; }
  .mobile-bottom-nav {
    min-height: calc(61px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.08);
    background: rgba(7,9,13,.91);
    backdrop-filter: blur(22px) saturate(1.2);
  }
  body[data-theme="light"] .mobile-bottom-nav { background: rgba(244,247,249,.93); border-top-color: rgba(15,23,31,.08); }
  .mobile-bottom-nav button.active { color: var(--text); }
  .mobile-bottom-nav button.active span { color: var(--accent); filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent) 28%, transparent)); }

  .plan-view,
  .bible-view,
  .versions-view,
  .progress-view { padding: 20px 14px 5.5rem; }
  .view-header h2 { font-size: 2.05rem; }
  .app-dialog { width: 100vw; max-width: none; max-height: 93vh; margin: auto 0 0; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 24px 24px 0 0; }
  .app-dialog form { max-height: 93vh; }
}

@media print {
  .ambient-space { display: none !important; }
  .novel-editor,
  .manuscript-section,
  .screenplay-editor {
    padding: .75in !important;
    background: white !important;
    color: black !important;
  }
}

/* Scribe 0.2.1 — mobile navigation and visible cloud access */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --workspace-header-height: calc(var(--topbar-height) + var(--safe-top));
  --mobile-project-strip-height: 0px;
}

body.workspace-open {
  overflow: hidden;
}

.workspace-screen:not(.hidden) {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.workspace-topbar {
  height: var(--workspace-header-height);
  min-height: var(--workspace-header-height);
  padding-top: calc(10px + var(--safe-top));
}

.workspace-layout {
  height: calc(100dvh - var(--workspace-header-height) - var(--mobile-project-strip-height));
}

.mobile-label,
.mobile-project-strip,
.binder-scrim {
  display: none;
}

.library-sync-button {
  position: relative;
  gap: 8px;
}

.sync-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 4px rgba(255,255,255,.035);
}

.library-sync-button[data-mode="available"] .sync-dot,
.workspace-sync-button[data-mode="available"]::after {
  background: var(--warm);
  box-shadow: 0 0 12px color-mix(in srgb, var(--warm) 45%, transparent);
}

.library-sync-button[data-mode="synced"] .sync-dot,
.workspace-sync-button[data-mode="synced"]::after {
  background: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 55%, transparent);
}

.workspace-sync-button {
  position: relative;
}

.workspace-sync-button::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--faint);
}

@media (max-width: 760px) {
  :root {
    --topbar-height: 60px;
    --workspace-header-height: calc(var(--topbar-height) + var(--safe-top));
    --mobile-project-strip-height: 46px;
  }

  .desktop-label { display: none !important; }
  .mobile-label { display: inline !important; }

  .library-header {
    min-height: calc(62px + var(--safe-top));
    padding: calc(9px + var(--safe-top)) 10px 9px;
    gap: 8px;
  }

  .library-header .brand {
    min-width: 0;
    gap: 9px;
  }

  .library-header .brand-mark {
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
  }

  .library-header .brand strong {
    font-size: .88rem;
  }

  .library-header .brand small,
  .library-header [data-action="toggle-theme"] {
    display: none !important;
  }

  .header-actions {
    flex: 0 0 auto;
    gap: 6px;
  }

  .header-actions .button.subtle.library-sync-button {
    display: inline-flex !important;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 12px;
    font-size: .64rem;
  }

  .library-sync-button::before {
    content: "☁";
    font-size: .9rem;
  }

  .new-project-button {
    width: 40px;
    min-width: 40px;
    min-height: 38px;
    padding: 0;
    border-radius: 12px;
    font-size: 1.05rem;
  }

  .workspace-topbar {
    position: relative;
    z-index: 90;
    height: var(--workspace-header-height);
    min-height: var(--workspace-header-height);
    padding: calc(.5rem + var(--safe-top)) .6rem .5rem;
    gap: 7px;
  }

  .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .topbar-right {
    flex: 0 0 auto;
    gap: 4px;
  }

  .desktop-project-action {
    display: none !important;
  }

  .mobile-back-button {
    display: inline-grid !important;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    font-size: 1.25rem;
  }

  .workspace-sync-button,
  .topbar-right [data-action="open-settings"] {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .project-identity {
    flex: 1 1 auto;
    min-width: 0;
  }

  .project-title-button {
    width: 100%;
    max-width: none;
    font-size: .9rem;
  }

  .mobile-project-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    height: var(--mobile-project-strip-height);
    min-height: var(--mobile-project-strip-height);
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-draft-status {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font: 700 .61rem/1 var(--sans);
    letter-spacing: .06em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mobile-project-strip button {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.035);
    color: var(--text);
    font: 700 .59rem/1 var(--sans);
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .mobile-project-strip button:last-child {
    border-color: color-mix(in srgb, var(--warm) 34%, transparent);
    background: var(--warm-soft);
    color: var(--warm);
  }

  .workspace-layout {
    height: calc(100dvh - var(--workspace-header-height) - var(--mobile-project-strip-height));
  }

  .workspace-main {
    height: 100%;
  }

  .workspace-sidebar {
    top: 0;
    bottom: 0;
    height: 100dvh;
  }

  .sidebar-brand {
    min-height: calc(64px + var(--safe-top));
    padding: calc(.8rem + var(--safe-top)) .8rem .8rem;
  }

  .binder-scrim {
    position: fixed;
    inset: 0;
    z-index: 99;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(0,0,0,.58);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  .workspace-sidebar.open + .binder-scrim {
    display: block !important;
  }

  .mobile-bottom-nav {
    padding-bottom: calc(.35rem + var(--safe-bottom));
  }

  .app-dialog {
    padding-bottom: var(--safe-bottom);
  }
}

@media (max-width: 370px) {
  .library-sync-button .mobile-label { display: none !important; }
  .library-sync-button { width: 40px; min-width: 40px; padding: 0 !important; justify-content: center; }
  .library-sync-button .sync-dot { position: absolute; right: 6px; bottom: 6px; }
  .mobile-project-strip { grid-template-columns: minmax(0, 1fr) auto auto; }
  .mobile-project-strip button { padding: 0 8px; font-size: .54rem; }
}


/* Scribe 0.2.3 — compact mobile outline table and clearer project navigation */
.outline-table-mobile {
  display: none;
}

.mobile-menu-dialog {
  width: min(94vw, 560px);
}

.mobile-menu-dialog .dialog-heading p:last-child {
  max-width: 44ch;
  margin: .55rem 0 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.55;
}

.mobile-menu-group + .mobile-menu-group {
  margin-top: 1.2rem;
}

.mobile-menu-label {
  margin: 0 0 .3rem;
  color: var(--faint);
  font: 700 .58rem var(--sans);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.mobile-menu-list button {
  min-height: 52px;
  padding: .85rem .25rem;
}

@media (max-width: 760px) {
  .outline-table-desktop {
    display: none;
  }

  .outline-table-mobile {
    display: grid;
    gap: 8px;
  }

  .outline-mobile-hint {
    margin: 0 2px 3px;
    color: var(--faint);
    font-size: .68rem;
    line-height: 1.45;
  }

  .outline-mobile-row {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.022);
  }

  .outline-mobile-row[open] {
    border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
    background: color-mix(in srgb, var(--accent-soft) 32%, rgba(255,255,255,.022));
  }

  .outline-mobile-row summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 62px;
    padding: 12px 13px;
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
  }

  .outline-mobile-row summary::-webkit-details-marker {
    display: none;
  }

  .outline-mobile-summary-copy {
    min-width: 0;
  }

  .outline-mobile-summary-copy strong,
  .outline-mobile-summary-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .outline-mobile-summary-copy strong {
    color: var(--text);
    font-size: .9rem;
    font-weight: 650;
  }

  .outline-mobile-summary-copy small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .66rem;
  }

  .outline-mobile-chevron {
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--cool);
    border-bottom: 1.5px solid var(--cool);
    transform: rotate(45deg);
    transition: transform .18s ease;
  }

  .outline-mobile-row[open] .outline-mobile-chevron {
    transform: rotate(225deg);
  }

  .outline-mobile-details {
    padding: 0 13px 13px;
    border-top: 1px solid var(--line);
  }

  .outline-mobile-details > p {
    margin: 12px 0;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.55;
  }

  .outline-mobile-details dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 12px;
  }

  .outline-mobile-details dl > div {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.018);
  }

  .outline-mobile-details dt,
  .outline-mobile-details dd {
    margin: 0;
  }

  .outline-mobile-details dt {
    color: var(--faint);
    font: 700 .55rem var(--sans);
    letter-spacing: .07em;
    text-transform: uppercase;
  }

  .outline-mobile-details dd {
    overflow: hidden;
    margin-top: 4px;
    color: var(--text);
    font-size: .72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-sidebar .workspace-nav {
    display: none;
  }

  .binder-panel {
    padding-top: .65rem;
  }

  .mobile-project-strip {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .mobile-project-strip .mobile-draft-status {
    text-align: center;
  }

  .mobile-project-strip .mobile-sections-button,
  .mobile-project-strip .mobile-session-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
  }

  .mobile-project-strip .mobile-sections-button {
    border-color: color-mix(in srgb, var(--cool) 30%, var(--line));
    color: var(--cool);
  }

  .mobile-project-strip .mobile-session-button {
    border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  }

  .mobile-bottom-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding-right: 3px;
    padding-left: 3px;
  }

  .mobile-bottom-nav button {
    min-width: 0;
    padding-right: 1px;
    padding-left: 1px;
    font-size: .5rem;
  }

  .mobile-bottom-nav button span {
    font-size: .98rem;
  }

  .mobile-menu-dialog form {
    padding-bottom: calc(1.25rem + var(--safe-bottom));
  }
}

@media (max-width: 390px) {
  .mobile-project-strip .mobile-sections-button,
  .mobile-project-strip .mobile-session-button {
    padding-right: 8px;
    padding-left: 8px;
    font-size: .53rem;
  }

  .mobile-bottom-nav button {
    font-size: .46rem;
  }

  .outline-mobile-details dl {
    grid-template-columns: 1fr;
  }
}


/* Scribe 0.2.4 — true mobile accordion table, five-tab navigation, and compact plan header */
.outline-table-mobile {
  display: grid;
  gap: 8px;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .outline-table-desktop {
    display: none !important;
  }

  .outline-table-mobile {
    display: grid !important;
  }
}

@media (max-width: 760px) {
  .mobile-bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    flex-wrap: nowrap !important;
  }

  .mobile-bottom-nav button {
    min-width: 0;
  }

  .plan-view .view-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  .plan-view .view-header > div {
    min-width: 0;
  }

  .plan-view .view-header .eyebrow,
  .plan-view .view-header > div > p:last-child {
    display: none;
  }

  .plan-view .view-header h2 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1;
  }

  .plan-view .view-header > .button {
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 12px;
    font-size: .68rem;
    white-space: nowrap;
  }

  .plan-view .view-toolbar {
    margin-bottom: 16px;
  }

  .outline-mobile-row {
    border-radius: 15px;
  }

  .outline-mobile-row summary {
    min-height: 60px;
    padding: 12px 14px;
  }

  .outline-mobile-summary-copy strong {
    font-size: .92rem;
  }

  .outline-mobile-summary-copy small {
    max-width: 100%;
    font-size: .64rem;
  }

  .outline-mobile-details {
    padding: 0 14px 14px;
  }

  .outline-mobile-details > p {
    margin: 13px 0;
    font-size: .82rem;
    line-height: 1.6;
  }
}

/* Scribe 0.2.5 — project stage controls and stage-based landing */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.project-identity-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.project-stage-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.project-stage-control::after {
  content: "⌄";
  position: absolute;
  right: 8px;
  color: var(--muted-2);
  font-size: .66rem;
  pointer-events: none;
}

.project-stage-select {
  min-height: 25px;
  max-width: 130px;
  padding: 3px 24px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  appearance: none;
  background: rgba(255,255,255,.028);
  color: var(--muted);
  font: 750 .58rem/1 var(--sans);
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
}

.project-stage-select:hover,
.project-stage-select:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: var(--cool-soft);
  color: var(--text);
}

.project-stage-select option {
  background: var(--panel-solid);
  color: var(--text);
  text-transform: none;
}

.field-help {
  margin: -4px 0 14px;
  color: var(--muted-2);
  font-size: .69rem;
  line-height: 1.5;
}

@media (max-width: 560px) {
  .project-identity-meta {
    gap: 7px;
  }

  .project-stage-select {
    max-width: 108px;
    min-height: 23px;
    padding-right: 21px;
    padding-left: 7px;
    font-size: .51rem;
  }

  .project-stage-control::after {
    right: 6px;
    font-size: .58rem;
  }
}


/* Scribe 0.2.6 — make the project-stage control unmistakable */
.project-stage-control {
  flex: 0 0 auto;
}

.project-stage-select {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 68%, rgba(255,255,255,.02));
  color: var(--text);
}

@media (max-width: 760px) {
  .project-identity-meta {
    overflow: visible;
  }

  .project-stage-select {
    width: auto;
    max-width: 112px;
    min-height: 25px;
    padding: 4px 23px 4px 9px;
    border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
    background: color-mix(in srgb, var(--accent-soft) 82%, rgba(255,255,255,.025));
    color: var(--text);
    font-size: .54rem;
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 8%, transparent);
  }

  .project-stage-control::after {
    color: var(--accent);
  }
}

/* Scribe 0.2.7 — unmistakable project stage and direct project editing */
.project-stage-button {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  gap: 7px;
  padding: 4px 9px 4px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 82%, rgba(255,255,255,.025));
  color: var(--text);
  font: 750 .58rem/1 var(--sans);
  letter-spacing: .075em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 8%, transparent);
}

.project-stage-button:hover,
.project-stage-button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 100%, rgba(255,255,255,.04));
  outline: none;
}

.stage-chevron {
  color: var(--accent);
  font-size: .68rem;
}

.project-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.project-title-row .project-title-button {
  flex: 0 1 auto;
  min-width: 0;
}

.project-edit-button {
  display: inline-grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: .78rem;
}

.project-edit-button:hover,
.project-edit-button:focus-visible {
  border-color: var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
}

.project-stage-dialog {
  width: min(94vw, 620px);
}

.stage-choice-list {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.stage-choice-list > button {
  display: grid;
  width: 100%;
  grid-template-columns: 40px minmax(0, 1fr) 26px;
  gap: 13px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.025);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.stage-choice-list > button:hover,
.stage-choice-list > button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: var(--cool-soft);
  outline: none;
}

.stage-choice-list > button.active {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 78%, rgba(255,255,255,.025));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
}

.stage-choice-list strong,
.stage-choice-list small {
  display: block;
}

.stage-choice-list strong {
  font-size: .91rem;
}

.stage-choice-list small {
  margin-top: 5px;
  color: var(--muted);
  font-size: .71rem;
  line-height: 1.5;
}

.stage-choice-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--cool);
  font-size: 1.05rem;
}

.stage-choice-list > button.active .stage-choice-mark {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  color: var(--accent);
}

.stage-choice-check {
  color: transparent;
  text-align: center;
}

.stage-choice-list > button.active .stage-choice-check {
  color: var(--accent);
}

.stage-dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.mobile-stage-button {
  display: none;
}

.mobile-draft-status {
  display: none !important;
}

@media (max-width: 760px) {
  .project-identity-meta {
    gap: 6px;
  }

  .project-stage-button {
    display: none;
  }

  .project-edit-button {
    width: 25px;
    height: 25px;
  }

  .mobile-project-strip {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr) auto;
    height: 58px;
    min-height: 58px;
    gap: 6px;
    padding: 6px 8px;
  }

  .mobile-stage-button,
  .mobile-sections-button,
  .mobile-session-button {
    min-width: 0;
    height: 44px;
    border-radius: 13px;
  }

  .mobile-stage-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 11px;
    border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
    background: color-mix(in srgb, var(--accent-soft) 74%, rgba(255,255,255,.02));
    color: var(--text);
    cursor: pointer;
    text-align: left;
  }

  .mobile-stage-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
  }

  .mobile-stage-copy small {
    color: var(--muted-2);
    font: 750 .5rem/1 var(--sans);
    letter-spacing: .11em;
    text-transform: uppercase;
  }

  .mobile-stage-copy strong {
    overflow: hidden;
    font: 750 .65rem/1 var(--sans);
    letter-spacing: .055em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mobile-stage-button > span:last-child {
    flex: 0 0 auto;
    color: var(--accent);
  }

  .mobile-sections-button {
    padding-right: 9px;
    padding-left: 9px;
    font-size: .63rem;
  }

  .mobile-session-button {
    padding-right: 11px;
    padding-left: 11px;
    white-space: nowrap;
  }

  .stage-choice-list > button {
    grid-template-columns: 36px minmax(0, 1fr) 22px;
    gap: 10px;
    padding: 13px;
  }

  .stage-choice-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .stage-dialog-footer {
    justify-content: stretch;
  }

  .stage-dialog-footer .text-button {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .mobile-project-strip {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .mobile-sections-button {
    font-size: 0;
  }

  .mobile-sections-button span {
    font-size: .85rem;
  }

  .mobile-session-button {
    max-width: 96px;
    font-size: .56rem;
  }
}

/* Scribe 0.2.8 — Continuity-style desktop workspace polish */
:root {
  --desktop-workspace-nav-height: 62px;
  --sidebar-width: 264px;
}

@media (min-width: 761px) {
  .workspace-topbar {
    position: relative;
    z-index: 85;
    gap: 16px;
    padding-right: clamp(18px, 2.6vw, 32px);
    padding-left: clamp(18px, 2.6vw, 32px);
  }

  .workspace-topbar .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 14px;
  }

  .workspace-topbar .topbar-left > .text-button {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255,255,255,.022);
    color: var(--muted);
    white-space: nowrap;
  }

  .workspace-topbar .topbar-left > .text-button:hover,
  .workspace-topbar .topbar-left > .text-button:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
    background: var(--accent-soft);
    color: var(--text);
    outline: none;
  }

  .project-identity {
    gap: 4px;
  }

  .project-identity-meta {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .project-title-row {
    gap: 7px;
  }

  .project-title-button {
    max-width: min(43vw, 620px);
    font-size: 1.02rem;
    line-height: 1.1;
  }

  .topbar-center {
    position: static;
    left: auto;
    flex: 0 0 auto;
    margin-left: auto;
    transform: none;
  }

  .topbar-right {
    flex: 0 0 auto;
  }

  .save-status {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(255,255,255,.018);
  }

  .desktop-workspace-nav {
    position: relative;
    z-index: 70;
    display: flex !important;
    height: var(--desktop-workspace-nav-height);
    align-items: center;
    padding: 7px clamp(18px, 2.6vw, 32px);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(20px) saturate(1.15);
    -webkit-backdrop-filter: blur(20px) saturate(1.15);
  }

  .desktop-workspace-nav .workspace-nav {
    display: grid;
    width: min(900px, 100%);
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    margin: 0 auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.022);
    box-shadow: 0 16px 44px rgba(0,0,0,.18);
  }

  .desktop-workspace-nav .workspace-nav button {
    display: inline-flex;
    min-width: 0;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    font: 700 .66rem/1 var(--sans);
    letter-spacing: .055em;
    text-transform: uppercase;
    transition: background .18s ease, color .18s ease, transform .18s ease;
  }

  .desktop-workspace-nav .workspace-nav button span {
    display: inline;
    margin: 0;
    color: inherit;
    font-size: .95rem;
  }

  .desktop-workspace-nav .workspace-nav button:hover,
  .desktop-workspace-nav .workspace-nav button:focus-visible {
    background: rgba(255,255,255,.045);
    color: var(--text);
    outline: none;
  }

  .desktop-workspace-nav .workspace-nav button.active {
    background: rgba(255,255,255,.075);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .desktop-workspace-nav .workspace-nav button.active span {
    color: var(--accent);
    filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent) 30%, transparent));
  }

  .workspace-layout {
    height: calc(100dvh - var(--workspace-header-height) - var(--desktop-workspace-nav-height));
  }

  .workspace-sidebar {
    background: color-mix(in srgb, var(--bg-raised) 90%, transparent);
  }

  .binder-panel {
    padding-top: 18px;
  }

  .binder-heading {
    padding-top: 0;
  }

  .plan-view,
  .bible-view,
  .versions-view,
  .progress-view {
    padding: clamp(30px, 4vw, 50px);
  }

  .view-header {
    max-width: 1120px;
    margin: 0 auto;
  }

  .view-toolbar,
  .outline-grid,
  .outline-table-wrap,
  .beat-board,
  .bible-grid,
  .versions-grid,
  .progress-layout,
  .progress-stats {
    max-width: 1120px;
    margin-right: auto;
    margin-left: auto;
  }

  .editor-footer {
    left: var(--sidebar-width);
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .desktop-project-action.button,
  .desktop-project-action[data-action="toggle-theme"] {
    display: none !important;
  }

  .project-title-button {
    max-width: 42vw;
  }

  .desktop-workspace-nav .workspace-nav {
    width: min(760px, 100%);
  }
}

@media (max-width: 760px) {
  :root {
    --desktop-workspace-nav-height: 0px;
    --sidebar-width: 286px;
  }

  .desktop-workspace-nav {
    display: none !important;
  }

  .workspace-layout {
    height: calc(100dvh - var(--workspace-header-height) - var(--mobile-project-strip-height));
  }
}

body.focus-mode .desktop-workspace-nav {
  display: none !important;
}

/* The Study / Typewriter theme ------------------------------------------ */
:root {
  --bg: #12110f;
  --bg-raised: #181613;
  --panel: rgba(31, 28, 24, .88);
  --panel-2: #1e1b17;
  --panel-3: #29251f;
  --text: #f3ecdd;
  --muted: #9d9587;
  --faint: #6f695f;
  --line: rgba(244, 237, 220, .13);
  --line-strong: rgba(244, 237, 220, .23);
  --accent: #c8a469;
  --accent-strong: #e1c58f;
  --accent-soft: rgba(181, 139, 84, .14);
  --warm: #b96f5f;
  --warm-soft: rgba(116, 53, 47, .16);
  --moss: #9dad7f;
  --moss-soft: rgba(157,173,127,.13);
  --danger: #d37b70;
  --paper: #f7f1df;
  --paper-text: #1b1915;
  --paper-muted: #777064;
  --serif: "Special Elite", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body[data-theme="light"] {
  --bg: #e8deca;
  --bg-raised: #f2eadb;
  --panel: rgba(255, 251, 241, .86);
  --panel-2: #f7f1e4;
  --panel-3: #ddd1bb;
  --text: #191713;
  --muted: #70695d;
  --faint: #918779;
  --line: rgba(31, 25, 18, .14);
  --line-strong: rgba(31, 25, 18, .24);
  --accent: #8d6537;
  --accent-strong: #70491f;
  --accent-soft: rgba(141, 101, 55, .11);
  --warm: #87483f;
  --warm-soft: rgba(135,72,63,.11);
  --paper: #fffdf6;
  --paper-text: #181612;
  --paper-muted: #81786a;
}
body {
  background:
    radial-gradient(circle at 55% -12%, rgba(255,255,255,.07), transparent 34rem),
    linear-gradient(180deg, var(--bg-raised), var(--bg));
}
.ambient-space { display: none; }
.app-noise { opacity: .028; }
.study-scribe-brand img { width: 43px; height: 43px; border-radius: 11px; box-shadow: 0 9px 26px rgba(0,0,0,.28); }
.study-scribe-brand span { flex-direction: column-reverse; }
.study-scribe-brand strong { margin-top: 4px; font: 400 1.1rem/1 var(--serif); letter-spacing: .04em; }
.study-scribe-brand small { margin: 0; color: var(--muted); font: 700 .54rem/1 var(--sans); letter-spacing: .13em; text-transform: uppercase; }
.library-header,
.workspace-topbar { background: color-mix(in srgb, var(--bg) 91%, transparent); }
.library-hero h1,
.section-heading h2,
.view-header h2,
.panel-card h3 { font-family: var(--serif); font-weight: 400; }
.library-hero h1 { font-size: clamp(3.8rem, 9vw, 7.6rem); line-height: .92; }
.archive-panel,
.project-card,
.panel-card,
.outline-card,
.entity-card,
.version-card,
.session-card { border-radius: 10px; }
.library-hero { position: relative; max-width: 960px; padding: clamp(2.4rem,5vw,5rem); border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(118deg, rgba(255,255,255,.045), rgba(255,255,255,.012) 55%, rgba(181,139,84,.05)), var(--panel); box-shadow: 0 25px 75px rgba(0,0,0,.26); }
.library-hero::before { content:""; position:absolute; inset:0 auto 0 0; width:2px; background:linear-gradient(transparent,var(--accent),transparent); opacity:.55; }
.scribe-rings { opacity: .18; }
.button { border-radius: 8px; }
.icon-button { border-radius: 9px; }
.segmented { border-radius: 9px; }
.segmented button { border-radius: 6px; }
.project-card { min-height: 290px; background: linear-gradient(145deg, rgba(255,255,255,.04), rgba(255,255,255,.012)), var(--panel); box-shadow: 0 15px 45px rgba(0,0,0,.17); }
.project-card::after { content:""; position:absolute; right:18px; bottom:18px; width:46px; height:34px; opacity:.11; background: repeating-linear-gradient(0deg, currentColor 0 1px, transparent 1px 7px); }
.project-card-title { font-family: var(--serif); font-weight: 400; }
.workspace-sidebar { background: linear-gradient(90deg, rgba(255,255,255,.018), transparent 25%), repeating-linear-gradient(0deg, transparent 0 7px, rgba(255,255,255,.012) 7px 8px), var(--bg-raised); }
.desktop-workspace-nav { background: color-mix(in srgb, var(--bg) 93%, transparent); }
.workspace-nav { border-radius: 9px; }
.workspace-nav button { border-radius: 6px; }
.workspace-main { background: radial-gradient(circle at 65% 0%, rgba(255,255,255,.035), transparent 26rem), #1a1815; }
body[data-theme="light"] .workspace-main { background: radial-gradient(circle at 65% 0%, rgba(255,255,255,.65), transparent 27rem), #dfd3bd; }
.document-title-input { font-family: var(--serif); font-weight: 400; }
.editor-shell { padding-top: 18px; }
.novel-editor,
.screenplay-editor,
.manuscript-section {
  background: var(--paper);
  color: var(--paper-text);
  border: 1px solid rgba(47,38,26,.16);
  box-shadow: 0 22px 62px rgba(0,0,0,.28);
}
.novel-editor {
  min-height: calc(100vh - 245px);
  padding: clamp(54px, 9vh, 88px) clamp(36px, 7vw, 84px) 10rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(.98rem,1.35vw,1.08rem);
  line-height: 1.78;
  caret-color: #7f4e29;
}
.full-manuscript-editor { width: min(100%, 860px); }
.manuscript-section { margin-bottom: 12px; padding: clamp(52px,8vh,82px) clamp(36px,7vw,84px); }
.manuscript-section-title { color: #746b5e; font-family: var(--serif); font-weight: 400; }
.manuscript-section-body { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 1rem; line-height: 1.78; }
.screenplay-editor { padding: clamp(56px,8vh,82px) clamp(38px,7vw,78px) 10rem; font-family: "IBM Plex Mono", "Courier New", monospace; }
.plan-view,
.bible-view,
.versions-view,
.progress-view { max-width: 1180px; margin: 0 auto; }
.app-dialog { border-radius: 14px; background: var(--bg-raised); }
@media (max-width: 720px) {
  .study-scribe-brand img { width: 37px; height: 37px; }
  .study-scribe-brand strong { font-size: .94rem; }
  .novel-editor,
  .screenplay-editor { width: 100%; border-right: 0; border-left: 0; box-shadow: none; }
  .novel-editor { padding: 38px 22px 8rem; font-size: 1rem; line-height: 1.75; }
  .manuscript-section { padding: 42px 22px; border-right: 0; border-left: 0; box-shadow: none; }
}
.settings-list .settings-link {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  text-decoration: none;
  font: 650 .78rem/1.35 var(--sans);
}
.settings-list .settings-link:hover { border-color: var(--line-strong); background: rgba(255,255,255,.045); }
.settings-list .settings-link > span { color: var(--accent); }


/* The Study v1.1.1 — compact Scribe landing */
.library-main { padding-top: clamp(14px, 2.5vw, 28px); }
.library-hero {
  min-height: 188px;
  grid-template-columns: minmax(0, 1fr) 145px;
  gap: 18px;
  padding: clamp(22px, 3.2vw, 34px);
}
.library-hero h1 {
  margin-bottom: 4px;
  font-size: clamp(2.85rem, 6.2vw, 5.2rem);
  line-height: .95;
}
.sync-summary { margin-top: 14px; }
.scribe-rings { min-height: 112px; }
.scribe-rings span { width: 104px; height: 104px; }
.scribe-rings span:nth-child(2) { width: 72px; height: 72px; }
.scribe-rings span:nth-child(3) { width: 36px; height: 36px; }
.project-section { margin-top: 30px; }

@media (max-width: 760px) {
  .library-main { padding-top: 10px; }
  .library-hero {
    min-height: 178px;
    padding: 21px 19px;
  }
  .library-hero h1 {
    max-width: 10ch;
    font-size: clamp(2.3rem, 10.5vw, 3.3rem);
  }
  .scribe-rings {
    right: -38px;
    bottom: -64px;
    width: 155px;
    opacity: .24;
  }
  .project-section { margin-top: 26px; }
}

/* Scribe 0.3.1 — honest cloud state */
.library-sync-button[data-mode="pending"] .sync-dot,
.workspace-sync-button[data-mode="pending"]::after {
  background: var(--warm);
  box-shadow: 0 0 14px color-mix(in srgb, var(--warm) 55%, transparent);
  animation: scribe-sync-pulse 1.05s ease-in-out infinite;
}
@keyframes scribe-sync-pulse {
  50% { opacity: .4; transform: scale(.72); }
}

/* The Study 1.2.2 — explicit manuscript sync state and mobile Table Read entry */
.document-sync-status {
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--cool-soft) 42%, transparent);
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.5;
}
.document-sync-status strong { color: var(--text); }
.document-sync-status[data-state="synced"] { border-color: color-mix(in srgb, var(--success) 38%, var(--line)); color: var(--success); }
.document-sync-status[data-state="pending"] { border-color: color-mix(in srgb, var(--warm) 38%, var(--line)); color: var(--warm); }
.document-sync-status[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); }

.mobile-table-read-button { display: none; }

@media (max-width: 760px) {
  body.project-type-feature,
  body.project-type-tv {
    --mobile-project-strip-height: 108px;
  }

  body.project-type-feature .mobile-project-strip,
  body.project-type-tv .mobile-project-strip {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr) auto;
    grid-template-rows: 44px 38px;
    height: var(--mobile-project-strip-height);
    min-height: var(--mobile-project-strip-height);
    align-content: center;
  }

  .mobile-table-read-button.script-only {
    display: inline-flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-height: 38px;
    border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
    background: color-mix(in srgb, var(--accent-soft) 82%, rgba(255,255,255,.02));
    color: var(--accent);
    font-size: .64rem;
    letter-spacing: .075em;
  }

  .mobile-table-read-button span { font-size: .9rem; }
}

/* The Study v1.2.5 — keep the active writing line visible */
.write-view {
  scroll-padding-top: 24px;
  scroll-padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
}
.screenplay-editor {
  height: auto;
  max-height: none;
  overflow-y: hidden;
  field-sizing: content;
}
.novel-editor,
.screenplay-editor,
.manuscript-section-body {
  scroll-margin-top: 24px;
  scroll-margin-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 760px) {
  .write-view {
    scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px));
  }
  .novel-editor,
  .screenplay-editor,
  .manuscript-section-body {
    scroll-margin-bottom: calc(10rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Scribe 0.3.4 — non-destructive manuscript sync inspector */
.sync-inspector-dialog { width: min(96vw, 920px); }
.sync-inspector-summary {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--muted);
  line-height: 1.55;
}
.sync-inspector-summary strong { color: var(--text); }
.sync-inspector-rows { display: grid; gap: 10px; max-height: min(56vh, 620px); overflow: auto; padding-right: 2px; }
.sync-inspector-row {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.022);
}
.sync-inspector-row[data-state="empty-cloud-risk"],
.sync-inspector-row[data-state="mismatch"] { border-color: color-mix(in srgb, var(--danger) 48%, var(--line)); }
.sync-inspector-row[data-state="local-only"],
.sync-inspector-row[data-state="mirror-missing"],
.sync-inspector-row[data-state="library-missing"] { border-color: color-mix(in srgb, var(--warm) 42%, var(--line)); }
.sync-inspector-row header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.sync-inspector-row header strong,
.sync-inspector-row header span { display: block; }
.sync-inspector-row header strong { font-size: .86rem; }
.sync-inspector-row header span { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.sync-inspector-row header em {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .61rem;
  font-style: normal;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.sync-copy-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.sync-copy-grid label {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted-2);
  font-size: .6rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sync-copy-grid label span { display: grid; gap: 3px; min-width: 0; }
.sync-copy-grid label strong { color: var(--text); font-size: .73rem; letter-spacing: 0; text-transform: none; }
.sync-copy-grid label small { overflow: hidden; color: var(--muted); font-size: .58rem; font-weight: 500; letter-spacing: 0; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.sync-copy-grid .is-missing strong { color: var(--danger); }
.sync-inspector-note { margin: 12px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
@media (max-width: 640px) {
  .sync-copy-grid { grid-template-columns: 1fr; }
  .sync-inspector-row header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .sync-inspector-row header em { align-self: flex-start; }
}

/* Scribe 0.3.6 — verified cloud handoff + safety history */
.library-sync-button[data-mode="verified"] .sync-dot,
.workspace-sync-button[data-mode="verified"]::after {
  background: var(--success);
  box-shadow: 0 0 16px color-mix(in srgb, var(--success) 60%, transparent);
}
.library-sync-button[data-mode="connected"] .sync-dot,
.workspace-sync-button[data-mode="connected"]::after {
  background: var(--cool);
  box-shadow: 0 0 12px color-mix(in srgb, var(--cool) 42%, transparent);
}
.document-sync-status[data-state="verified"] {
  border-color: color-mix(in srgb, var(--success) 42%, var(--line));
  background: color-mix(in srgb, var(--success) 8%, transparent);
  color: var(--success);
}
.safety-history-section {
  max-width: 900px;
  margin: 2.6rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.safety-history-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.safety-history-heading h3 {
  margin: 0;
  font: 600 1.55rem var(--serif);
}
.safety-history-heading p:not(.eyebrow) {
  max-width: 650px;
  margin: .45rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.recovery-timeline {
  display: grid;
  gap: .65rem;
}
.recovery-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: .9rem;
  align-items: center;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  cursor: pointer;
}
.recovery-card:hover { border-color: color-mix(in srgb, var(--cool) 40%, var(--line)); }
.recovery-mark {
  width: 7px;
  height: 38px;
  border-radius: 999px;
  background: var(--cool);
  opacity: .72;
}
.recovery-mark[data-kind="session"] { background: var(--warm); }
.recovery-mark[data-kind="milestone"] { background: var(--accent); }
.recovery-mark[data-kind="handoff"] { background: var(--success); }
.recovery-copy { min-width: 0; }
.recovery-copy strong,
.recovery-copy span { display: block; }
.recovery-copy strong { font-size: .9rem; }
.recovery-copy span { margin-top: .28rem; color: var(--muted); font-size: .72rem; }
.empty-state.compact { min-height: 120px; margin-top: 1rem; }
@media (max-width: 760px) {
  .safety-history-heading { align-items: stretch; flex-direction: column; }
  .safety-history-heading .button { width: 100%; }
  .recovery-card { grid-template-columns: 8px minmax(0, 1fr); padding: .8rem .85rem; }
  .recovery-card > .button { display: none; }
}

/* The Study v1.2.7 — Scribe visual cleanup + project writing text size */
.workspace-screen { --scribe-text-scale: 1; }

.novel-editor {
  font-size: calc(1.03rem * var(--scribe-text-scale));
}
.manuscript-section-body {
  font-size: calc(1rem * var(--scribe-text-scale));
}
.screenplay-editor {
  font-size: calc(1rem * var(--scribe-text-scale));
}

.text-size-tool {
  min-width: 70px;
  gap: 5px;
  white-space: nowrap;
}
.text-size-tool span {
  color: var(--accent);
  font-size: .62rem;
  font-weight: 700;
}

.text-size-dialog { width: min(94vw, 520px); }
.text-size-preview {
  margin: 8px 0 22px;
  padding: 22px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--paper-text);
}
.text-size-preview-label {
  display: block;
  margin-bottom: 15px;
  color: var(--paper-muted);
  font: 700 .58rem/1 var(--sans);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.text-size-preview p {
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  line-height: 1.75;
  transition: font-size .12s ease;
}
.text-size-range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font: 650 .72rem/1 var(--sans);
}
.text-size-range-label strong {
  color: var(--accent);
  font-size: .82rem;
}
.text-size-range {
  width: 100%;
  accent-color: var(--accent);
}
.text-size-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 7px;
  margin-top: 16px;
}
.text-size-presets button {
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  cursor: pointer;
  font: 700 .62rem/1 var(--sans);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.text-size-presets button:hover,
.text-size-presets button.active {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: var(--accent-soft);
  color: var(--text);
}

@media (min-width: 761px) {
  :root {
    --topbar-height: 62px;
    --workspace-header-height: 62px;
    --desktop-workspace-nav-height: 54px;
    --sidebar-width: 248px;
  }

  .workspace-topbar {
    padding: 7px clamp(16px, 2.2vw, 26px);
    gap: 10px;
  }

  .workspace-topbar .topbar-left { gap: 10px; }
  .workspace-topbar .topbar-left > .text-button {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: .68rem;
  }

  .project-identity { gap: 2px; }
  .project-identity-meta { gap: 6px; }
  .project-type-label { font-size: .54rem; }
  .project-stage-button {
    min-height: 23px;
    padding: 3px 8px;
    border-color: var(--line);
    background: rgba(255,255,255,.025);
    box-shadow: none;
    font-size: .52rem;
  }
  .project-stage-button:hover,
  .project-stage-button:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    background: var(--accent-soft);
  }
  .project-title-button {
    max-width: min(38vw, 540px);
    font-size: .94rem;
  }
  .project-edit-button {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: .7rem;
  }

  .topbar-center { margin-left: auto; }
  .save-status {
    min-height: 30px;
    max-width: 220px;
    padding: 0 9px;
    overflow: hidden;
    font-size: .64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-right { gap: 5px; }
  .topbar-right .button {
    min-height: 34px;
    padding: 8px 11px;
    border-radius: 8px;
    font-size: .62rem;
  }
  .topbar-right .icon-button,
  .workspace-sync-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .desktop-workspace-nav {
    height: var(--desktop-workspace-nav-height);
    padding: 6px clamp(16px, 2.2vw, 26px);
  }
  .desktop-workspace-nav .workspace-nav {
    width: min(780px, 100%);
    padding: 3px;
    border-radius: 10px;
    box-shadow: none;
  }
  .desktop-workspace-nav .workspace-nav button {
    min-height: 36px;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 7px;
    font-size: .61rem;
  }
  .desktop-workspace-nav .workspace-nav button span { font-size: .86rem; }
  body.project-type-feature .desktop-workspace-nav .workspace-nav,
  body.project-type-tv .desktop-workspace-nav .workspace-nav {
    width: min(920px, 100%);
    grid-template-columns: repeat(6, minmax(0,1fr));
  }

  .binder-panel { padding: 12px 10px 22px; }
  .draft-status-card { padding: 11px 12px; border-radius: 9px; }
  .document-row { min-height: 45px; border-radius: 8px; }

  .writing-toolbar {
    min-height: 72px;
    padding: 12px clamp(18px, 3vw, 38px) 10px;
  }
  .document-title-input {
    width: min(58vw, 620px);
    font-size: clamp(1.42rem, 2.6vw, 2rem);
  }
  .writing-toolbar-actions { gap: 4px; }
  .tool-button {
    min-width: 34px;
    min-height: 34px;
    border-radius: 7px;
    font-size: .68rem;
  }
  .writing-toolbar-actions .table-read-tool-button { display: none; }
  .editor-shell {
    padding-top: 7px;
    padding-right: clamp(18px, 4vw, 58px);
    padding-left: clamp(18px, 4vw, 58px);
  }
  .novel-editor,
  .screenplay-editor,
  .full-manuscript-editor { width: min(100%, 850px); }
}

@media (max-width: 760px) {
  .novel-editor { font-size: calc(1rem * var(--scribe-text-scale)); }
  .manuscript-section-body { font-size: calc(1rem * var(--scribe-text-scale)); }
  .screenplay-editor { font-size: calc(.9rem * var(--scribe-text-scale)); }

  .writing-toolbar-actions .text-size-tool {
    display: inline-flex !important;
    min-width: 52px;
    padding-right: 7px;
    padding-left: 7px;
  }
  .text-size-tool { font-size: .66rem; }
  .text-size-tool span { font-size: .55rem; }
  .text-size-presets { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* The Study v1.2.9 — screenplay smart autocomplete */
.screenplay-character-autocomplete {
  position: fixed;
  z-index: 120;
  width: min(310px, calc(100vw - 20px));
  max-height: min(300px, 46vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-raised) 96%, black);
  box-shadow: 0 16px 42px rgba(0,0,0,.34);
  backdrop-filter: blur(14px);
}
.screenplay-character-autocomplete.hidden { display: none; }
.screenplay-autocomplete-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 7px;
  color: var(--muted);
  font: 700 .55rem/1 var(--sans);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.screenplay-autocomplete-heading small {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  font-size: .51rem;
  letter-spacing: .035em;
  text-transform: none;
}
.screenplay-autocomplete-option {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: 650 .72rem/1.2 "IBM Plex Mono", ui-monospace, monospace;
}
.screenplay-autocomplete-option + .screenplay-autocomplete-option { margin-top: 2px; }
.screenplay-autocomplete-option small {
  flex: 0 0 auto;
  color: var(--muted);
  font: 650 .56rem/1 var(--sans);
  letter-spacing: .02em;
}
.screenplay-autocomplete-option:hover,
.screenplay-autocomplete-option.active,
.screenplay-autocomplete-option[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--accent-soft);
  color: var(--text);
}
.screenplay-autocomplete-option.active small,
.screenplay-autocomplete-option[aria-selected="true"] small { color: var(--accent); }

@media (max-width: 760px) {
  .screenplay-character-autocomplete {
    width: min(330px, calc(100vw - 16px));
    max-height: min(260px, 38vh);
    padding: 5px;
  }
  .screenplay-autocomplete-option { min-height: 46px; padding: 10px; font-size: .76rem; }
  .screenplay-autocomplete-heading { padding: 7px 9px; }
}

/* The Study v1.3.2 — Scribe project archive */
.project-section-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.archive-library-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  cursor: pointer;
  font: 700 .66rem/1 var(--sans);
  letter-spacing: .055em;
  text-transform: uppercase;
}
.archive-library-button:hover,
.archive-library-button.active {
  border-color: color-mix(in srgb, var(--warm) 38%, var(--line));
  background: var(--warm-soft);
  color: var(--warm);
}
.archive-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warm) 15%, transparent);
  color: var(--warm);
  font-size: .6rem;
}
.archived-project-card {
  cursor: default;
  border-style: dashed;
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--warm) 4%, transparent), transparent 52%),
    rgba(255,255,255,.012);
}
.archived-project-card:hover {
  transform: none;
  box-shadow: none;
  border-color: color-mix(in srgb, var(--warm) 28%, var(--line));
}
.archived-project-card::after { opacity: .52; }
.archived-project-card .project-card-type { color: var(--warm); }
.archived-project-bottom {
  display: grid;
  gap: 15px;
}
.archive-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.archive-card-actions .mini-button {
  min-height: 36px;
  padding: 0 11px;
  color: var(--text);
  cursor: pointer;
  font: 700 .62rem/1 var(--sans);
  letter-spacing: .035em;
}
.archive-card-actions .archive-delete-button:not(:disabled) {
  border-color: color-mix(in srgb, #c76969 44%, var(--line));
  color: #d99090;
}
.archive-card-actions .archive-delete-button:disabled {
  cursor: not-allowed;
  opacity: .48;
}
.archive-empty-state {
  grid-column: 1 / -1;
  min-height: 190px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}
.archive-empty-state strong { color: var(--text); font: 600 1rem/1.2 var(--sans); }
.archive-empty-state p { max-width: 430px; margin: 0; font-size: .78rem; line-height: 1.55; }
.archive-project-row { color: var(--warm) !important; }

@media (max-width: 760px) {
  .project-section-controls {
    width: 100%;
    justify-content: space-between;
  }
  .project-section-controls .segmented { max-width: 100%; overflow-x: auto; }
  .archive-library-button { min-height: 42px; }
  .archive-card-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .archive-card-actions .mini-button { min-height: 44px; }
  .archive-card-actions .archive-delete-button { grid-column: 1 / -1; }
}

/* v1.3.3 — draft import */
.project-import-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: .78rem;
}
.project-import-callout .text-button { color: var(--accent); }
.import-draft-dialog { width: min(94vw, 790px); }
.import-draft-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px dashed color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}
.import-draft-picker > div { display: grid; gap: 3px; min-width: 0; }
.import-draft-picker strong { font: 600 .82rem/1.25 var(--sans); color: var(--text); }
.import-draft-picker small { color: var(--muted); font-size: .7rem; }
.import-draft-status {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 0 18px;
  min-height: 20px;
  color: var(--muted);
  font-size: .74rem;
}
.import-draft-status strong { color: var(--text); font-weight: 600; }
.import-working-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  animation: importPulse 1s ease-in-out infinite alternate;
}
@keyframes importPulse { to { opacity: .28; transform: scale(.82); } }
.import-draft-options { display: grid; gap: 12px; }
.import-type-row { align-items: end; }
#importDraftFormatWrap { min-width: 0; }
.import-format-pill {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  font: 500 .76rem/1.25 var(--mono);
  overflow-wrap: anywhere;
}
.novel-import-controls {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
}
.novel-import-controls > .field-label { display: block; margin-bottom: 5px; }
.novel-import-controls .checkbox-row {
  align-items: flex-start;
  margin-top: 9px;
}
.novel-import-controls .checkbox-row input { margin-top: 3px; }
.novel-import-controls .checkbox-row span { display: grid; gap: 2px; }
.novel-import-controls .checkbox-row strong { color: var(--text); font: 560 .77rem/1.3 var(--sans); }
.novel-import-controls .checkbox-row small { color: var(--muted); font-size: .69rem; line-height: 1.4; }
.import-scene-break-note {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .71rem;
  line-height: 1.45;
}
.import-scene-break-note strong { color: var(--text); font-weight: 560; }
.import-scene-break-note code {
  padding: 1px 4px;
  border-radius: 5px;
  background: var(--panel);
  color: var(--warm);
}
.import-preview-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  color: var(--muted);
  font-size: .69rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.import-preview-heading small { color: var(--text); font-size: .67rem; letter-spacing: 0; text-transform: none; }
.import-draft-preview {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}
.import-preview-row {
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  min-height: 50px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.import-preview-row:last-child { border-bottom: 0; }
.import-preview-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 .66rem/1 var(--mono);
}
.import-preview-row > span:last-child { min-width: 0; display: grid; gap: 2px; }
.import-preview-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font: 560 .78rem/1.25 var(--sans); }
.import-preview-row small { color: var(--muted); font-size: .68rem; }
.script-preview-row strong { font-family: var(--mono); font-size: .72rem; }
.import-preview-empty { padding: 16px; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.scribe-import-scene-break { text-align: center; letter-spacing: .12em; }

@media (max-width: 760px) {
  .header-actions .import-project-button {
    display: inline-flex !important;
    width: 40px;
    min-width: 40px;
    min-height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
    font-size: 1rem;
  }
  .project-import-callout { align-items: flex-start; flex-direction: column; }
  .import-draft-picker { align-items: flex-start; }
  .import-draft-picker .button { flex: 0 0 auto; }
  .import-draft-status { align-items: flex-start; flex-direction: column; gap: 4px; }
  .import-preview-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .import-draft-preview { max-height: 210px; }
}

/* v1.3.4 — formatted screenplay PDF preview */
body.screenplay-preview-open { overflow: hidden; }
.screenplay-preview-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr);
  background: var(--bg);
  color: var(--text);
}
.screenplay-preview-screen.hidden { display: none; }
.screenplay-preview-topbar {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(120px,1fr) auto minmax(240px,1fr);
  align-items: center;
  gap: 16px;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(18px);
}
.screenplay-preview-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 600 .72rem/1 var(--sans);
}
.screenplay-preview-back:hover { color: var(--text); }
.screenplay-preview-heading { min-width: 0; display: grid; gap: 2px; text-align: center; }
.screenplay-preview-heading small { color: var(--muted); font: 600 .55rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.screenplay-preview-heading strong { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 .82rem/1.2 var(--sans); }
.screenplay-preview-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.screenplay-preview-actions .button { min-height: 38px; padding: 0 12px; }
.screenplay-preview-actions .preview-refresh-needed {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--text);
}
.screenplay-preview-page-count { color: var(--muted); font: 600 .65rem/1 var(--mono); white-space: nowrap; }
.screenplay-preview-info {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.screenplay-preview-info > div:first-child { min-width: 0; display: grid; gap: 2px; }
.screenplay-preview-info strong { color: var(--text); font: 600 .67rem/1.25 var(--sans); }
.screenplay-preview-info span { color: var(--muted); font-size: .64rem; }
.screenplay-preview-zoom { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.screenplay-preview-zoom button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 600 .6rem/1 var(--sans);
}
.screenplay-preview-zoom button.active { background: var(--panel-2); color: var(--text); }
.screenplay-preview-viewport {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 28px max(14px, env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% -20%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 42%),
    #242526;
}
.screenplay-preview-pages {
  --screenplay-preview-scale: 1;
  width: max-content;
  max-width: 100%;
  display: grid;
  gap: 24px;
  margin: 0 auto;
}
.screenplay-preview-page-wrap { position: relative; flex: 0 0 auto; }
.screenplay-preview-page {
  position: relative;
  width: 816px;
  height: 1056px;
  box-sizing: border-box;
  padding: 96px 96px 96px 144px;
  overflow: hidden;
  transform: scale(var(--screenplay-preview-scale));
  transform-origin: top left;
  background: #fff;
  color: #000;
  box-shadow: 0 12px 34px rgba(0,0,0,.38), 0 0 0 1px rgba(0,0,0,.14);
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: 0;
}
.screenplay-preview-page-body {
  width: 576px;
  height: 864px;
  overflow: hidden;
}
.screenplay-preview-page-number {
  position: absolute;
  top: 48px;
  right: 72px;
  font: 400 16px/16px "Courier New", Courier, monospace;
}
.screenplay-output-block { box-sizing: border-box; width: 100%; white-space: normal; overflow-wrap: break-word; }
.screenplay-output-block + .screenplay-output-block { margin-top: 16px; }
.screenplay-output-scene_heading { font-weight: 400; text-transform: uppercase; }
.screenplay-output-section { text-align: center; font-weight: 700; text-transform: uppercase; }
.screenplay-output-transition { text-align: right; text-transform: uppercase; }
.screenplay-output-dialogue { margin-top: 16px; }
.screenplay-output-character {
  width: 365px;
  margin-left: 211px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: visible;
}
.screenplay-output-parenthetical {
  width: 240px;
  margin-left: 154px;
}
.screenplay-output-dialogue-text {
  width: 336px;
  margin-left: 96px;
}
.screenplay-output-more {
  width: 336px;
  margin-left: 96px;
  text-align: center;
}
.screenplay-output-dual-dialogue {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}
.screenplay-output-dual-column { min-width: 0; }
.screenplay-output-dual-character {
  width: 100%;
  padding-left: 54px;
  text-transform: uppercase;
  white-space: nowrap;
}
.screenplay-output-dual-parenthetical {
  width: 190px;
  margin-left: 22px;
}
.screenplay-output-dual-text {
  width: 244px;
  margin-left: 0;
}
.screenplay-output-continuation { margin-top: 0; }
.screenplay-preview-measure-host {
  position: fixed;
  left: -10000px;
  top: 0;
  z-index: -1;
  width: 816px;
  height: auto;
  visibility: hidden;
  pointer-events: none;
}
.screenplay-preview-measure-page { transform: none; box-shadow: none; }
.screenplay-preview-empty {
  width: min(560px, calc(100vw - 32px));
  display: grid;
  gap: 6px;
  margin: 80px auto;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}
.screenplay-preview-empty strong { color: var(--text); font: 600 .9rem/1.2 var(--sans); }
.screenplay-preview-empty span { font-size: .74rem; line-height: 1.5; }

@media (max-width: 760px) {
  .screenplay-preview-topbar {
    min-height: 58px;
    grid-template-columns: auto minmax(0,1fr) auto;
    gap: 8px;
    padding-right: 10px;
    padding-left: 8px;
  }
  .screenplay-preview-back { min-height: 44px; padding: 0 7px; }
  .screenplay-preview-back span { display: none; }
  .screenplay-preview-heading { text-align: left; }
  .screenplay-preview-heading small { display: none; }
  .screenplay-preview-heading strong { max-width: none; font-size: .72rem; }
  .screenplay-preview-actions .screenplay-preview-page-count,
  .screenplay-preview-actions .button.subtle { display: none; }
  .screenplay-preview-actions .button.primary { min-height: 42px; padding: 0 9px; font-size: .62rem; }
  .screenplay-preview-info { min-height: 48px; padding: 7px 10px; }
  .screenplay-preview-info strong { font-size: .61rem; }
  .screenplay-preview-info span { font-size: .58rem; }
  .screenplay-preview-zoom button { min-height: 34px; padding: 0 7px; }
  .screenplay-preview-zoom button[data-preview-zoom="75"] { display: none; }
  .screenplay-preview-viewport { padding-top: 16px; }
  .screenplay-preview-pages { gap: 14px; }
}

@media print {
  @page { size: Letter; margin: 0; }
  html, body { width: auto !important; height: auto !important; margin: 0 !important; padding: 0 !important; background: white !important; }
  body > *:not(.screenplay-preview-screen) { display: none !important; }
  body * { visibility: hidden !important; }
  .screenplay-preview-screen,
  .screenplay-preview-screen * { visibility: visible !important; }
  .screenplay-preview-screen {
    position: static !important;
    display: block !important;
    background: white !important;
  }
  .screenplay-preview-topbar,
  .screenplay-preview-info { display: none !important; }
  .screenplay-preview-viewport {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    background: white !important;
  }
  .screenplay-preview-pages { display: block !important; width: auto !important; max-width: none !important; margin: 0 !important; }
  .screenplay-preview-page-wrap {
    width: 8.5in !important;
    height: 11in !important;
    margin: 0 !important;
    break-after: page;
    page-break-after: always;
  }
  .screenplay-preview-page-wrap:last-child { break-after: auto; page-break-after: auto; }
  .screenplay-preview-page {
    width: 8.5in !important;
    height: 11in !important;
    transform: none !important;
    box-shadow: none !important;
  }
}

/* The Study v1.3.8 — cross-device writing bookmark */
.continue-point-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.continue-point-tool.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
}
.continue-point-footer {
  border: 0;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  max-width: min(42vw, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.continue-point-footer:hover { background: color-mix(in srgb, var(--accent-soft) 76%, var(--accent) 24%); }

@media (max-width: 760px) {
  .writing-toolbar-actions .continue-point-tool {
    display: inline-flex !important;
    min-width: 44px;
    padding-right: 7px;
    padding-left: 7px;
  }
  .continue-point-tool { font-size: .6rem; }
  .continue-point-tool span { font-size: .66rem; }
  .continue-point-footer {
    max-width: 44vw;
    padding: 3px 6px;
    font-size: .52rem;
  }
}

@media (max-width: 430px) {
  .continue-point-tool { gap: 3px; }
  .continue-point-tool { font-size: 0; }
  .continue-point-tool span { font-size: .72rem; }
  .continue-point-tool::after { content: 'Mark'; font-size: .56rem; }
  .continue-point-tool.active::after { content: 'Marked'; }
}


/* The Study v1.3.10 — cursor-aware screenplay preview (retained in v1.3.11) */
.editor-footer-preview {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 54%, transparent);
  color: var(--text);
  cursor: pointer;
  font: 700 .57rem/1 var(--sans);
  letter-spacing: .025em;
  white-space: nowrap;
}
.editor-footer-preview:hover,
.editor-footer-preview:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 82%, transparent);
  outline: none;
}
.screenplay-preview-current-block {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: 4px;
  background: color-mix(in srgb, var(--accent) 9%, white);
  animation: screenplay-preview-locate 1.8s ease-out both;
}
@keyframes screenplay-preview-locate {
  0% { outline-color: color-mix(in srgb, var(--accent) 76%, transparent); background: color-mix(in srgb, var(--accent) 16%, white); }
  68% { outline-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 6%, white); }
  100% { outline-color: transparent; background: transparent; }
}
@media (max-width: 760px) {
  .editor-footer { gap: .5rem; padding-right: .55rem; padding-left: .55rem; }
  .editor-footer-preview { width: 32px; min-height: 31px; justify-content: center; padding: 4px 6px; font-size: .65rem; }
  .editor-footer-preview span { display: none; }
}
@media print {
  .screenplay-preview-current-block { outline: none !important; background: transparent !important; animation: none !important; }
}

/* The Study v1.3.14 — Scribe mobile workspace repair
   Keep the project controls to one compact row. Table Read remains immediately
   available, while writing-session controls live in the project menu / Progress. */
@media (max-width: 760px) {
  :root,
  body.project-type-feature,
  body.project-type-tv {
    --mobile-project-strip-height: 54px;
  }

  .mobile-project-strip,
  body.project-type-feature .mobile-project-strip,
  body.project-type-tv .mobile-project-strip {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: 44px;
    height: var(--mobile-project-strip-height);
    min-height: var(--mobile-project-strip-height);
    align-content: center;
    gap: 6px;
    padding: 5px 8px;
    overflow: hidden;
  }

  .mobile-stage-button,
  .mobile-sections-button,
  .mobile-table-read-button.script-only {
    height: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .mobile-stage-button {
    padding: 5px 10px;
  }

  .mobile-stage-copy { gap: 2px; }
  .mobile-stage-copy small { font-size: .46rem; }
  .mobile-stage-copy strong { font-size: .62rem; }

  .mobile-sections-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 88px;
    padding: 0 10px;
    border-color: color-mix(in srgb, var(--cool) 26%, var(--line));
    color: var(--text);
  }

  .mobile-table-read-button.script-only {
    display: inline-flex;
    grid-column: auto;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: auto;
    min-width: 64px;
    padding: 0 9px;
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
    background: color-mix(in srgb, var(--accent-soft) 58%, rgba(255,255,255,.018));
    color: var(--accent);
    font-size: .58rem;
    letter-spacing: .055em;
  }

  .mobile-table-read-button span:first-child { font-size: .78rem; }
  .mobile-table-read-label { font: 750 .56rem/1 var(--sans); letter-spacing: .05em; text-transform: uppercase; }

  /* The fourth control was creating an implicit third grid row and visibly
     overflowing into the writing surface. Session remains available from ⋯
     and Progress, which is a better home on a small screen. */
  .mobile-project-strip .mobile-session-button { display: none !important; }

  .workspace-layout {
    height: calc(100dvh - var(--workspace-header-height) - var(--mobile-project-strip-height));
  }

  /* Tighten the writing chrome so the draft owns more of the iPhone screen. */
  .writing-toolbar {
    min-height: 62px;
    padding: 8px 10px 7px;
    gap: 8px;
    border-bottom-color: color-mix(in srgb, var(--line) 78%, transparent);
  }

  .document-heading-wrap { min-width: 0; }
  .document-heading-wrap .eyebrow { margin-bottom: 2px; font-size: .5rem; }
  .document-title-input {
    width: min(42vw, 190px);
    font-size: 1.28rem;
    line-height: 1.05;
  }

  .writing-toolbar-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 3px;
    min-width: 0;
  }

  .writing-toolbar-actions .tool-button {
    min-width: 42px;
    min-height: 40px;
    padding: 0 7px;
    border-radius: 10px;
  }

  .writing-toolbar-actions .text-size-tool {
    min-width: 49px;
    padding-right: 6px;
    padding-left: 6px;
  }

  .writing-toolbar-actions [data-action="open-document-inspector"] {
    display: none !important;
  }

  .screenplay-keyboard {
    gap: 5px;
    margin-bottom: 5px;
    padding: 5px 0 4px;
    scrollbar-width: none;
  }
  .screenplay-keyboard::-webkit-scrollbar { display: none; }
  .screenplay-keyboard button {
    min-height: 38px;
    padding: 0 11px;
    border-radius: 10px;
    font-size: .55rem;
  }

  .screenplay-editor-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .screenplay-editor {
    min-height: calc(100dvh - var(--workspace-header-height) - var(--mobile-project-strip-height) - 125px);
    padding-top: 24px;
  }

  /* Footer remains useful for Preview Here / word count but should read as a
     quiet utility rail rather than another full navigation bar. */
  .editor-footer {
    min-height: 34px;
    gap: .42rem;
    padding: 4px 8px;
    background: color-mix(in srgb, var(--bg-raised) 96%, transparent);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .editor-footer > span { font-size: .5rem; }
}

@media (max-width: 390px) {
  .mobile-sections-button {
    min-width: 44px;
    width: 44px;
    padding: 0;
    font-size: 0;
  }
  .mobile-sections-button span { font-size: .8rem; }
  .mobile-table-read-button.script-only {
    min-width: 54px;
    padding: 0 7px;
  }
  .document-title-input { width: min(40vw, 155px); font-size: 1.18rem; }
  .writing-toolbar-actions .tool-button { min-width: 38px; padding-right: 5px; padding-left: 5px; }
}

/* The Study v1.3.15 — writing controls + stable long-draft scrolling */
.write-view,
.screenplay-editor-shell,
.screenplay-editor {
  overflow-anchor: none;
}
.write-view { scroll-behavior: auto; }

.editor-footer-mark {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--cool) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 74%, transparent);
  color: var(--text);
  cursor: pointer;
  font: 700 .57rem/1 var(--sans);
  letter-spacing: .025em;
  white-space: nowrap;
}
.editor-footer-mark:hover,
.editor-footer-mark:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 66%, transparent);
  outline: none;
}
.editor-footer-mark.active {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 78%, transparent);
  color: var(--accent);
}
.editor-footer-mark > span:first-child { font-size: .72rem; }

.screenplay-keyboard .screenplay-format-key {
  min-width: 38px;
  padding-right: 10px;
  padding-left: 10px;
}
.screenplay-keyboard .screenplay-format-key strong,
.screenplay-keyboard .screenplay-format-key em,
.screenplay-keyboard .screenplay-format-key u {
  color: inherit;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: .72rem;
}

.screenplay-inline-underline { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 1px; }
.screenplay-output-block strong { font-weight: 700; }
.screenplay-output-block em { font-style: italic; }

@media (max-width: 760px) {
  .editor-footer-mark,
  .editor-footer-preview {
    width: auto;
    min-width: 34px;
    min-height: 31px;
    justify-content: center;
    padding: 4px 7px;
  }
  .editor-footer-mark .editor-footer-action-label { display: none; }
  .screenplay-keyboard .screenplay-format-key { min-width: 36px; }
}

@media (max-width: 430px) {
  .continue-point-footer { max-width: 30vw; }
}

/* The Study v1.3.19 — Scribe title pages */
.title-page-dialog { width: min(760px, calc(100vw - 2rem)); }
.title-page-dialog form { display: grid; gap: .95rem; }
.title-page-enabled-row {
  margin: 0;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  align-items: flex-start;
}
.title-page-enabled-row input { margin-top: 3px; }
.title-page-enabled-row span { display: grid; gap: 3px; }
.title-page-enabled-row strong { color: var(--text); font: 600 .82rem/1.3 var(--sans); }
.title-page-enabled-row small { color: var(--muted); font-size: .7rem; line-height: 1.45; }
.title-page-fields label,
.title-page-script-fields > label,
.title-page-contact-field { display: grid; gap: .35rem; }
.title-page-script-fields { display: grid; gap: .8rem; }
.title-page-novel-fields { display: grid; gap: .65rem; }
.title-page-word-count {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem .85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: .72rem;
}
.title-page-word-count strong { color: var(--text); font-family: var(--mono); font-weight: 600; }
.title-page-preview {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 8.5 / 11;
  margin: .2rem auto .4rem;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.18);
  background: #fff;
  color: #111;
  box-shadow: 0 12px 28px rgba(0,0,0,.2);
  transition: opacity .18s ease, filter .18s ease;
}
.title-page-disabled-preview { opacity: .38; filter: grayscale(.65); }
.title-page-disabled-preview::after {
  content: 'NOT INCLUDED';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8b1e1e;
  font: 700 .76rem/1 var(--sans);
  letter-spacing: .16em;
  transform: rotate(-18deg);
}
.script-title-page-preview {
  font-family: "Courier New", Courier, monospace;
  font-size: 7px;
  line-height: 1.25;
}
.title-preview-center {
  position: absolute;
  top: 30%;
  left: 10%;
  right: 10%;
  display: grid;
  gap: 5px;
  text-align: center;
}
.title-preview-center strong { font: inherit; font-weight: 400; }
.title-preview-center small { margin-top: 5px; font: inherit; }
.title-preview-bottom {
  position: absolute;
  left: 11%;
  right: 11%;
  bottom: 9%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.title-preview-bottom > div:last-child { text-align: right; }
.novel-title-page-preview {
  font-family: "Times New Roman", Times, serif;
  font-size: 7px;
  line-height: 1.25;
}
.novel-title-page-preview .title-preview-top {
  position: absolute;
  top: 9%;
  left: 11%;
  right: 11%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.novel-title-page-preview .title-preview-top > div:last-child { text-align: right; }
.novel-title-page-preview .title-preview-center { top: 44%; }

.screenplay-title-page { padding: 0; }
.screenplay-title-page-center {
  position: absolute;
  top: 292px;
  left: 144px;
  right: 96px;
  display: grid;
  gap: 16px;
  text-align: center;
  font: 400 16px/16px "Courier New", Courier, monospace;
}
.screenplay-title-page-center strong { font: inherit; font-weight: 400; }
.screenplay-title-page-center small { margin-top: 16px; font: inherit; }
.screenplay-title-page-contact,
.screenplay-title-page-date {
  position: absolute;
  bottom: 96px;
  font: 400 16px/16px "Courier New", Courier, monospace;
}
.screenplay-title-page-contact { left: 144px; max-width: 340px; }
.screenplay-title-page-date { right: 96px; max-width: 220px; text-align: right; }

@media (max-width: 760px) {
  .title-page-dialog { width: 100vw; }
  .title-page-word-count { flex-direction: column; gap: .25rem; }
  .title-page-preview { width: min(82vw, 330px); }
}

@media print {
  .screenplay-title-page-wrap { break-after: page !important; page-break-after: always !important; }
}


/* The Study v1.3.19 — true PDF export + clearer project binder */
.binder-title-page-button { min-width: 48px; padding-inline: 8px; font-size: .62rem; letter-spacing: .04em; }
.pdf-export-dialog { width: min(620px, calc(100vw - 24px)); }
.pdf-title-page-options { display: grid; gap: 10px; margin: 18px 0 14px; padding: 0; border: 0; }
.pdf-title-page-options legend { margin-bottom: 8px; color: var(--muted); font: 700 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.pdf-export-choice { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--panel) 88%, transparent); cursor: pointer; }
.pdf-export-choice:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.pdf-export-choice input { margin-top: 3px; accent-color: var(--accent); }
.pdf-export-choice span { display: grid; gap: 4px; }
.pdf-export-choice strong { font-size: .88rem; color: var(--text); }
.pdf-export-choice small { color: var(--muted); line-height: 1.45; }
.pdf-metadata-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.pdf-metadata-preview span { min-width: 0; display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.pdf-metadata-preview small { color: var(--muted); font: 700 .58rem/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.pdf-metadata-preview strong { overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: .78rem; white-space: nowrap; }
@media (max-width: 560px) {
  .pdf-metadata-preview { grid-template-columns: 1fr; }
}


/* The Study v1.3.22 — inline screenplay parenthetical recovery */
.binder-title-page-row {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.binder-title-page-row:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}
.binder-title-page-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: .88rem;
}
.binder-title-page-copy { min-width: 0; display: grid; gap: 2px; }
.binder-title-page-copy strong { font: 650 .76rem/1.2 var(--sans); }
.binder-title-page-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 600 .56rem/1.25 var(--sans); }
.binder-title-page-chevron { color: var(--faint); font-size: 1rem; }
