/* punchup BUILD 2026-09-01d. Light theme on warm paper white, 17px base,
   15px floors on secondary text. Tuned for 35-55 year old eyes. */
:root {
  --bg: #faf7f0;
  --panel: #ffffff;
  --panel2: #f3eee1;
  --ink: #26221a;
  --dim: #6d6455;
  --gold: #8a6600;       /* text accents: readable on white */
  --accent: #e8b944;     /* button fill: dark text on top */
  --red: #b23a24;
  --green: #3f7a28;
  --line: #ddd4c0;
  --mono: "Courier New", Courier, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.6 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 18px; border-bottom: 3px solid var(--accent); background: var(--panel);
  flex-wrap: wrap;
}
.brand { color: var(--ink); text-decoration: none; font-weight: 800; font-size: 26px; letter-spacing: 0.5px; }
.brand2 { color: var(--gold); }
.brand-sub { display: block; font-size: 13px; font-weight: 400; color: var(--dim); letter-spacing: 0; }
#nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
#nav a { color: var(--ink); text-decoration: none; font-size: 16px; }
#nav a:hover { color: var(--gold); }
#nav .who { color: var(--dim); font-size: 15px; }
#app { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 10px 18px 24px; }
#foot { padding: 16px 24px; color: var(--dim); font-size: 14px; border-top: 1px solid var(--line); text-align: center; }
#foot a { color: var(--dim); }
h1 { font-size: 26px; margin: 4px 0 8px; }
h2 { font-size: 20px; margin: 14px 0 8px; }
a { color: var(--gold); }
.empty { color: var(--dim); padding: 40px 0; text-align: center; font-size: 17px; }
.loading {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 56px 0; text-align: center; color: var(--gold); font-size: 16px;
  letter-spacing: 2px; text-transform: uppercase; font-weight: 700;
  animation: puFade 1.6s ease-in-out infinite;
}
.loading::before {
  content: '🎬'; font-size: 52px; letter-spacing: 0;
  animation: puClap 1s ease-in-out infinite; filter: drop-shadow(0 4px 10px rgba(60,50,20,.25));
}
.loading::after {
  content: ''; width: 200px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--line) 0%, var(--accent) 50%, var(--line) 100%);
  background-size: 200% 100%; animation: puSweep 1.2s linear infinite;
}
@keyframes puClap { 0%, 100% { transform: rotate(-10deg) scale(1); } 50% { transform: rotate(10deg) scale(1.18); } }
@keyframes puSweep { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes puFade { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }

/* Reading typography per readability research: 50-75ch measure, roman not
   italic for passages, 1.6+ leading. Georgia for the editorial voice. */
.teaser {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px; line-height: 1.65; color: var(--ink);
  max-width: 66ch; padding: 6px 4px;
}
.teaser::first-letter { font-size: 40px; color: var(--gold); font-weight: 700; line-height: 1; }
.ovtext { max-width: 70ch; line-height: 1.6; }
li { max-width: 76ch; }
div.dim { max-width: 82ch; }
.dim { color: var(--dim); font-size: 15px; }
.pill { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line); color: var(--dim); background: var(--panel); }
.pill.status-active { color: var(--green); border-color: var(--green); }
.pill.status-pitch { color: var(--gold); border-color: var(--gold); }
.pill.status-filled { color: var(--green); border-color: var(--green); }
.pill.type { color: var(--ink); background: var(--panel2); }

button, .btn {
  background: var(--accent); color: #241d0d; border: 0; border-radius: 6px;
  padding: 9px 16px; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.05); }
button.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); font-weight: 400; }
button.ghost:hover { border-color: var(--gold); color: var(--gold); filter: none; }
button.tiny { padding: 4px 11px; font-size: 14px; }
button.danger { background: var(--red); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select {
  width: 100%; background: var(--panel); color: var(--ink); border: 1px solid #c5bba4;
  border-radius: 6px; padding: 10px 12px; font-size: 16px; font-family: inherit;
}
textarea.script { font-family: var(--mono); min-height: 220px; white-space: pre; font-size: 15px; }
label { display: block; margin: 12px 0 4px; font-size: 15px; color: var(--dim); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(60, 50, 20, .06);
}
.card h3 { margin: 0 0 4px; font-size: 19px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 10px 0; flex-wrap: wrap;
  position: sticky; top: 0; background: var(--bg); z-index: 50; padding-top: 4px; }
.tabs a {
  padding: 7px 14px; color: var(--dim); text-decoration: none; border-radius: 8px 8px 0 0;
  border: 1px solid transparent; border-bottom: 0; font-size: 15px;
}
.tabs a.on { color: var(--gold); background: var(--panel); border-color: var(--line); font-weight: 700; }

.actlane { margin-bottom: 24px; }
.actlane h2 { color: var(--gold); border-bottom: 2px solid var(--line); padding-bottom: 5px; }
.beatgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.beat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; cursor: pointer; box-shadow: 0 1px 3px rgba(60, 50, 20, .06); }
.beat:hover { border-color: var(--gold); }
.beat .slug { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--ink); }
.beat .sum { font-size: 15px; color: var(--ink); opacity: .85; margin-top: 6px; min-height: 22px; }
.beat .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 14px; color: var(--dim); }
.beat.filled { border-left: 4px solid var(--green); }
.beat.open { border-left: 4px solid var(--red); }

pre.script {
  font-family: var(--mono); font-size: 15px; line-height: 1.55; white-space: pre-wrap;
  background: #fffdf7; border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px;
  overflow-x: auto; color: #1d1a13;
}
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 800px) { .diff { grid-template-columns: 1fr; } }
.diff pre { margin: 0; }
.diff .lbl { font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }

.vote { min-width: 56px; text-align: center; }
.vote button { background: var(--panel); border: 1px solid #c5bba4; color: var(--dim); border-radius: 6px; padding: 5px 12px; font-size: 15px; }
.vote button.my { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.alt { border: 1px dashed var(--gold); border-radius: 8px; padding: 12px; margin: 10px 0; cursor: pointer; font-family: var(--mono); font-size: 15px; white-space: pre-wrap; background: #fffdf7; }
.alt:hover { background: var(--panel2); }
.msg { padding: 12px 16px; border-radius: 8px; margin: 12px 0; background: var(--panel2); border: 1px solid var(--gold); font-size: 16px; }
.msg.err { border-color: var(--red); color: var(--red); }
.comments { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.comment { font-size: 15px; margin: 8px 0; }
.comment .who { color: var(--gold); font-weight: 700; }
table.plain { border-collapse: collapse; width: 100%; }
table.plain td, table.plain th { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; font-size: 15px; }
table.plain th { color: var(--dim); font-weight: 600; }
.copybox { font-family: var(--mono); font-size: 14px; word-break: break-all; background: var(--panel2); padding: 10px; border-radius: 6px; }

@media print {
  body { background: #fff; color: #000; }
  #topbar, #foot, .tabs, button { display: none !important; }
  pre.script { border: 0; background: #fff; color: #000; max-width: 100%; }
}

/* v1.4: scene workshop layout */
.scenewrap { display: flex; gap: 18px; align-items: flex-start; }
.scenenav {
  width: 250px; flex: none; position: sticky; top: 46px;
  max-height: calc(100vh - 70px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px;
}
.scenenav .acthead { font-size: 12px; color: var(--gold); font-weight: 700; padding: 6px 8px 2px; text-transform: uppercase; letter-spacing: 1px; }
.scenenav a { display: block; padding: 3px 8px; font-size: 13px; color: var(--ink); text-decoration: none; border-radius: 5px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scenenav a:hover { background: var(--panel2); }
.scenenav a.on { background: var(--accent); color: #241d0d; font-weight: 700; }
.scenenav a.empty { color: var(--red); }
.scenemain { flex: 1; min-width: 0; }
#mobileSlotSel { display: none; }
@media (max-width: 900px) {
  .scenenav { display: none; }
  #mobileSlotSel { display: block; margin-bottom: 8px; }
}

/* line-item blocks inside the canonical scene */
.blocks { background: #fffdf7; border: 1px solid var(--line); border-radius: 8px; padding: 12px 20px; }
.blk { position: relative; font-family: var(--mono); font-size: 15px; line-height: 1.5; white-space: pre-wrap; padding: 2px 90px 2px 4px; border-radius: 4px; color: #1d1a13; }
.blk.t-scene_heading { font-weight: 700; margin-top: 10px; }
.blk.t-character { padding-left: 160px; margin-top: 8px; }
.blk.t-parenthetical { padding-left: 120px; max-width: 620px; }
.blk.t-dialogue { padding-left: 80px; max-width: 820px; }
.blk.t-transition { text-align: right; }
.blk.t-action { margin-top: 6px; }
.blk:hover { background: var(--panel2); }
.blkbar { display: none; position: absolute; right: 2px; top: 1px; gap: 2px; }
.blk:hover .blkbar { display: flex; }
.blkbar button { padding: 0 6px; font-size: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); border-radius: 4px; font-weight: 400; }
.blkbar button:hover { color: var(--gold); border-color: var(--gold); }
.blkzone { font-family: -apple-system, "Segoe UI", Helvetica, sans-serif; background: var(--panel); border: 1px solid var(--gold); border-radius: 6px; padding: 8px 10px; margin: 4px 0; white-space: normal; }

/* single-column expandable outline rows */
.orow { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; background: var(--panel); margin-bottom: 6px; }
.orow.filled { border-left-color: var(--green); }
.orow.open { border-left-color: var(--red); }
.orow > .ohead { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; cursor: pointer; flex-wrap: wrap; }
.orow > .ohead:hover { background: var(--panel2); }
.orow .slug { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.orow .obody { padding: 0 12px 10px; }

/* v1.6: taste verdict buttons on AI suggestions */
.ajwrap { white-space: nowrap; }
/* thumbs stay invisible until the line is hovered; line tints subtly */
.ajudge { background: transparent; border: 1px solid transparent; padding: 0 3px; font-size: 14px; border-radius: 4px; opacity: .6; visibility: hidden; }
.ajudge:hover { opacity: 1; border-color: var(--gold); filter: none; }
.card li { border-radius: 4px; padding: 1px 4px; margin-left: -4px; }
.card li:hover { background: var(--panel2); }
.card li:hover .ajudge, .ajwrap:hover .ajudge { visibility: visible; }

/* breathing room between a card's header row and its content */
.card > .row.spread { margin-bottom: 8px; }
.blocks { margin-top: 6px; }
.ajform { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; margin-left: 4px; }
.ajform .ajnote { width: 260px; padding: 3px 8px; font-size: 13px; display: inline-block; }

/* inline doctor notes anchored under the script lines they reference */
.docnote {
  font-family: -apple-system, "Segoe UI", Helvetica, sans-serif; white-space: normal;
  background: #fdf6e0; border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  padding: 6px 10px; margin: 2px 0 6px 4px; font-size: 14px; color: var(--ink); max-width: 82ch;
}
.docnote .dnrow { margin: 2px 0; }
.docnote .dnlens {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--gold); margin-right: 6px;
}
.docnote .ajudge { visibility: visible; opacity: .5; }
.docnote .ajudge:hover { opacity: 1; }

/* pitch-page upload target, sits right of the type selector */
.upzone {
  margin-left: auto; display: flex; flex-direction: column; gap: 1px;
  border: 1.5px dashed var(--gold); border-radius: 10px; padding: 10px 16px;
  cursor: pointer; background: var(--panel); max-width: 300px;
}
.upzone:hover { background: #fdf6e0; border-style: solid; }
.upzone strong { font-size: 15px; color: var(--gold); }
.upzone .dim { font-size: 13px; }
.seqhead {
  font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--gold); margin: 14px 0 4px;
}

/* collaborator chips with live provisional equity */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  padding: 4px 12px 4px 5px; font-size: 14px; color: var(--ink);
}
.chip strong { color: var(--gold); }
.chipav {
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.chippend {
  background: var(--panel2); border-radius: 999px; padding: 0 7px; font-size: 12px;
  color: var(--dim); border: 1px solid var(--line);
}
.chipadd { cursor: pointer; border-style: dashed; border-color: var(--gold); color: var(--gold); font-weight: 700; padding: 4px 14px; }
.chipadd:hover { background: #fdf6e0; }

/* background doctor-pass progress toast */
#doctorToast {
  position: fixed; right: 16px; bottom: 16px; z-index: 200;
  background: var(--ink); color: #f5efe2; border-radius: 10px;
  padding: 10px 16px; font-size: 14px; max-width: 340px;
  box-shadow: 0 4px 16px rgba(30, 25, 10, .35);
}
.loading.doc::before { content: '🩺'; }

/* aligned character roster grid, tighter rows */
.orow > .ohead { padding: 6px 12px; }
.ohead.charhead {
  display: grid; grid-template-columns: 170px 90px 90px 1fr 16px;
  gap: 12px; align-items: center;
}
@media (max-width: 760px) { .ohead.charhead { grid-template-columns: 130px 80px 80px 1fr 16px; gap: 8px; } }

/* ===== Set Builder ===== */
.sbbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: sticky; top: 44px; z-index: 40;
  background: var(--bg); padding: 6px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.sbseg { margin: 10px 0 18px; }
.sbseghead { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line); }
.sbseghead h2 { margin: 0; font-size: 17px; color: var(--gold); }
.sbseghead.dropinto { outline: 2px dashed var(--gold); }
.sbseghead .sbws { margin-left: auto; padding: 3px 10px; font-size: 13px; }
.sbtree { list-style: none; margin: 4px 0 0 0; padding-left: 0; }
.sbnode > .sbtree { padding-left: 26px; border-left: 2px solid var(--line); margin-left: 12px; }
.sbnode { margin: 2px 0; }
.sbnode.dragging { opacity: .4; }
.sbnode.sbhidden > .sbrow, .sbnode.sbhidden > .sbtree { display: none; }
.sbrow { display: flex; align-items: flex-start; gap: 8px; padding: 5px 8px; border-radius: 6px; position: relative; background: var(--panel); border: 1px solid transparent; }
.sbrow:hover { border-color: var(--line); }
.sbrow.dropbefore { box-shadow: 0 -3px 0 var(--gold); }
.sbrow.dropafter { box-shadow: 0 3px 0 var(--gold); }
.sbrow.dropinto { background: #fdf6e0; border-color: var(--gold); }
.sbgrip { color: var(--dim); cursor: grab; user-select: none; font-size: 14px; padding-top: 2px; }
.sbtype { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 2px 6px; border-radius: 4px; margin-top: 3px; flex: none; }
.sbtype.t0 { background: #e8e1cf; color: #4a4030; }
.sbtype.t1 { background: var(--accent); color: #241d0d; }
.sbtype.t2 { background: #cfe3c6; color: #2b5220; }
.sbtype.t3 { background: #d9d2ea; color: #40306b; }
.sbtext { flex: 1; font-size: 16px; line-height: 1.45; min-height: 22px; cursor: text; border-radius: 4px; padding: 0 4px; }
.sbtext.editing { outline: 2px solid var(--gold); background: #fffdf7; }
.sbnode.d0 > .sbrow > .sbtext { font-weight: 700; }
.sblaugh { flex: none; font-size: 14px; letter-spacing: -2px; }
.sbact { display: none; gap: 2px; flex: none; }
.sbrow:hover .sbact { display: flex; }
.sbact button { padding: 0 6px; font-size: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); border-radius: 4px; font-weight: 400; }
.sbact button:hover { color: var(--gold); border-color: var(--gold); }
.sbzone { margin: 4px 0 4px 34px; }
.sbquiz { max-width: 760px; margin: 20px auto; text-align: left; }
.sbq-trigger { font-size: 34px; font-weight: 800; color: var(--gold); margin: 8px 0 14px; }
.sbq-line { font-size: 19px; margin: 8px 0; padding-left: 0; }
.sbq-line.d1 { padding-left: 24px; } .sbq-line.d2 { padding-left: 48px; } .sbq-line.d3 { padding-left: 72px; }
.loading.mic::before { content: '🎤'; }

/* joke outlines in the bins */
.jokeoutline { background: #fffdf7; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.jokeol { list-style: none; margin: 0; padding-left: 0; }
.jokeol li { margin: 4px 0; font-size: 15px; }
.jokeol.d1, .jokeol.d2, .jokeol.d3 { padding-left: 22px; border-left: 2px solid var(--line); margin-left: 8px; }
.jokeol.d0 > li { font-weight: 600; }
textarea.outline { font-family: inherit; white-space: pre; }

/* CTAs sit bottom-right */
.ctarow { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* notification bell */
.belln { position: absolute; top: -8px; right: -12px; background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; font-weight: 700; }
#bellPanel { position: fixed; top: 58px; right: 16px; z-index: 300; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(30, 25, 10, .18); padding: 12px 14px; width: 380px; max-height: 70vh; overflow: auto; font-size: 14px; }
.belli { display: block; padding: 6px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.belli:hover { background: var(--panel2); }

/* avatars */
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; border: 1px solid var(--line); }
.avatarbig { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); cursor: pointer; }
.avatarph { width: 96px; height: 96px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel2); color: var(--dim); font-size: 12px; text-align: center; cursor: pointer; border: 2px dashed var(--line); }
#foot .signout { float: left; color: var(--dim); font-size: 13px; text-decoration: underline dotted; cursor: pointer; background: none; border: 0; padding: 0; font-weight: 400; }
