/* Novel in November - a writer's desk at night: cream manuscript paper, midnight-ink type, and an ember heat scale
 * that fills the month as words are logged. Serif display type, a mono face for every number. */
:root {
  --bg: #efe6d6; --paper: #fbf6ec; --ink: #1d2340; --rule: #1d2340; --muted: #5b5f73; --soft: #e9dfcc; --line: #d6c9b1;
  --accent: #b8321a; --accent-ink: #ffffff; --accent-soft: #f6dccf; --grid: #d9ccb4;
  --h-plan: #f3eadb; --h0: #d9d4cc; --h1: #f3cfae; --h2: #e8a57a; --h3: #b04a24; --h4: #7f1f0d; --h-on3: #ffffff; --h-on4: #ffffff;
  --good: #2f6b45; --good-soft: #dcebdc; --meh: #8a5a00; --meh-soft: #f6e7c2; --bad: #a3271a; --bad-soft: #f6d8d2;
  --beat: #2d3a8c; --beat-soft: #dfe3f7;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121420; --paper: #1b1e2c; --ink: #ece4d3; --rule: #c9c0ae; --muted: #a8a596; --soft: #262a3b; --line: #34384c;
  --accent: #ff8a5c; --accent-ink: #1b0d07; --accent-soft: #3c2219; --grid: #2e3245;
  --h-plan: #232738; --h0: #3a3c47; --h1: #4a3127; --h2: #7c3f26; --h3: #d9703f; --h4: #ff8a5c; --h-on3: #1b0d07; --h-on4: #1b0d07;
  --good: #7fd19b; --good-soft: #17301f; --meh: #f0c46a; --meh-soft: #352a12; --bad: #ff8f80; --bad-soft: #3a1915;
  --beat: #b7c2ff; --beat-soft: #262c52;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--accent); }
.hidden { display: none !important; }
.small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }

/* Header */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--paper); border-bottom: 2px solid var(--rule); flex-wrap: wrap; }
.back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 1.12rem; }
.logo { width: 28px; height: 28px; }
.lg-page, .lg-tag { fill: var(--paper); stroke: var(--rule); stroke-width: 2.4; }
.lg-head, .lg-bolt { fill: var(--rule); }
.lg-h1 { fill: var(--h1); } .lg-h2 { fill: var(--h3); } .lg-h3 { fill: var(--h4); }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 5px 12px; font-size: 0.86rem; text-decoration: none; cursor: pointer; }
.pill:hover:not(:disabled) { background: var(--soft); }
.pill.solid, .btn.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.solid:hover:not(:disabled), .btn.solid:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.pill.ghost { border-style: dashed; }
.pill.tiny { padding: 2px 9px; font-size: 0.8rem; }
.pill:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

main { max-width: 1240px; margin: 0 auto; padding: 0 16px 32px; }
.hero { padding: 26px 0 10px; max-width: 860px; }
.kicker { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 5.4vw, 3.2rem); line-height: 1.05; margin: 0 0 12px; letter-spacing: -0.01em; }
.lede { font-size: 1.04rem; margin: 0 0 14px; }
.samples { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { border: 1.5px dashed var(--rule); background: transparent; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 0.88rem; }
.chip:hover { background: var(--paper); }
.chip.on { border-style: solid; background: var(--ink); color: var(--paper); }

.lanes { display: flex; gap: 8px; margin: 18px 0 14px; flex-wrap: wrap; }
.lane { border: 2px solid var(--rule); background: var(--paper); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-family: var(--serif); font-size: 1.02rem; display: inline-flex; gap: 8px; align-items: baseline; }
.lane.on { background: var(--ink); color: var(--paper); }
.lane-k { font-family: var(--mono); font-size: 0.8rem; }
.lane-when { font-family: var(--sans); font-size: 0.76rem; opacity: 0.75; }

/* Panels */
.workbench { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; align-items: start; }
.panel { background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.workbench .panel { margin-bottom: 0; }
.ph { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; margin: 0 0 8px; }
h3 { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; margin: 18px 0 6px; }
.lbl { display: block; font-size: 0.84rem; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=date], select, textarea { width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 7px; padding: 7px 9px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible, .cal-day:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.hint { font-size: 0.82rem; color: var(--muted); margin: 10px 0 0; border-top: 1px dashed var(--line); padding-top: 8px; }
.pin { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font: 700 0.7rem var(--mono); color: var(--accent-ink); background: var(--accent); margin-right: 4px; }
.restset { border: 0; padding: 0; margin: 4px 0 0; }
.wdrow { display: flex; gap: 4px; flex-wrap: wrap; }
.wdrow label { position: relative; }
.wdrow input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wdrow span { display: inline-block; border: 1.5px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 0.82rem; cursor: pointer; background: var(--bg); }
.wdrow input:checked + span { background: repeating-linear-gradient(135deg, var(--soft) 0 4px, var(--paper) 4px 8px); border-color: var(--rule); text-decoration: line-through; }
.wdrow input:focus-visible + span { outline: 2.5px solid var(--accent); }
.flags { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.86rem; }
.flags li { margin: 4px 0; }
.lv { display: inline-block; font: 700 0.68rem var(--mono); text-transform: uppercase; border-radius: 4px; padding: 1px 5px; margin-right: 6px; border: 1px solid currentColor; }
.lv-fix .lv { color: var(--bad); } .lv-warn .lv { color: var(--meh); } .lv-info .lv { color: var(--muted); }
.askbox { margin-top: 14px; border-top: 1.5px solid var(--line); padding-top: 12px; }
.btn { border: 2px solid var(--rule); border-radius: 9px; padding: 10px 16px; font-weight: 700; cursor: pointer; width: 100%; background: var(--paper); }
.meter { margin: 8px 0 0; }
.note { font-size: 0.86rem; margin: 0 0 8px; padding: 6px 9px; border-left: 3px solid var(--meh); background: var(--meh-soft); border-radius: 0 6px 6px 0; }
.note.warn { border-color: var(--bad); background: var(--bad-soft); }
.gate { font-size: 0.88rem; margin: 12px 0 0; padding: 9px 11px; border: 1.5px dashed var(--rule); border-radius: 8px; }
.gate .pill { margin-left: 4px; }
.todaybox { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 6px; font-size: 0.86rem; }
.drop { border: 1.5px dashed transparent; border-radius: 8px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.filebtn { display: inline-block; margin-top: 4px; cursor: pointer; text-decoration: underline; color: var(--muted); }
.filebtn input { display: none; }
.carried { font-size: 0.85rem; background: var(--beat-soft); border-radius: 7px; padding: 7px 10px; margin: 10px 0 0; }

/* The month */
.month-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.month-head .ph { margin: 0; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-wd { font: 600 0.72rem var(--mono); text-transform: uppercase; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-day { position: relative; text-align: left; min-height: 104px; border: 1.5px solid var(--line); border-radius: 8px; padding: 5px 6px; background: var(--h-plan); cursor: pointer; display: flex; flex-direction: column; gap: 2px; overflow: hidden; color: var(--ink); }
.cal-day:hover { border-color: var(--rule); }
.cal-day.h-0 { background: var(--h0); } .cal-day.h-1 { background: var(--h1); } .cal-day.h-2 { background: var(--h2); }
.cal-day.h-3 { background: var(--h3); color: var(--h-on3); } .cal-day.h-4 { background: var(--h4); color: var(--h-on4); }
.cal-day.h-rest { background: repeating-linear-gradient(135deg, var(--soft) 0 5px, var(--paper) 5px 10px); color: var(--muted); }
.cal-day.today { border: 2.5px solid var(--rule); box-shadow: 0 0 0 2px var(--paper) inset; }
.cal-day.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.cal-day.pending { border-style: dashed; border-color: var(--beat); }
.cd-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.cd-n { font: 700 1rem var(--serif); }
.cd-date { font: 0.68rem var(--mono); opacity: 0.8; white-space: nowrap; }
.cd-w { font: 600 0.74rem var(--mono); }
.cd-beat { align-self: flex-start; font: 700 0.64rem var(--sans); text-transform: uppercase; letter-spacing: 0.03em; color: var(--beat); background: var(--beat-soft); border-radius: 4px; padding: 1px 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-scene { font-size: 0.72rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; opacity: 0.92; }
.cd-mark { font: 600 0.62rem var(--mono); color: var(--beat); }
.cal-day.h-3 .cd-mark, .cal-day.h-4 .cd-mark { color: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; font-size: 0.78rem; color: var(--muted); }
.lg-item { display: inline-flex; align-items: center; gap: 4px; }
.lg-sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); background: var(--h-plan); }
.lg-sw.h-0 { background: var(--h0); } .lg-sw.h-1 { background: var(--h1); } .lg-sw.h-2 { background: var(--h2); } .lg-sw.h-3 { background: var(--h3); } .lg-sw.h-4 { background: var(--h4); }
.lg-sw.h-rest { background: repeating-linear-gradient(135deg, var(--soft) 0 3px, var(--paper) 3px 6px); }
.drawer { margin-top: 12px; border: 2px solid var(--rule); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
.dr-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.dr-head .pill { margin-left: auto; }
.dr-beat { margin: 6px 0 0; font-weight: 700; color: var(--beat); }
.dr-scene { margin: 6px 0; font-family: var(--serif); font-size: 1.04rem; }
.dr-prompt { margin: 0 0 6px; font-style: italic; color: var(--muted); }
.dr-log input { max-width: 120px; font-family: var(--mono); }
.cardrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pace { margin-top: 14px; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.tile { border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; background: var(--bg); min-width: 0; }
.t-k { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.t-v { font: 700 1.08rem var(--mono); overflow-wrap: anywhere; }
.tile.good { background: var(--good-soft); } .tile.good .t-v { color: var(--good); }
.tile.meh { background: var(--meh-soft); } .tile.meh .t-v { color: var(--meh); }
.tile.bad { background: var(--bad-soft); } .tile.bad .t-v { color: var(--bad); }
.pchart { margin-top: 8px; }
.pchart svg { display: block; max-width: 100%; height: auto; }
.pc-grid { stroke: var(--grid); stroke-width: 1; }
.pc-ax { fill: var(--muted); font: 10px var(--mono); }
.pc-target { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 5 4; }
.pc-area { fill: var(--h2); opacity: 0.55; }
.pc-line { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.pc-today { stroke: var(--beat); stroke-width: 1.4; }
.pc-tl { fill: var(--beat); }

/* Progress + results */
.steps { list-style: none; padding: 0; margin: 6px 0; }
.step { padding: 3px 0; color: var(--muted); font-size: 0.92rem; }
.step.done { color: var(--good); } .step.active { color: var(--ink); font-weight: 700; }
.step-ic { display: inline-block; width: 1.2em; font-family: var(--mono); }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; font: 0.8rem/1.45 var(--mono); max-height: 420px; overflow: auto; }
.res-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.res-head h2 { font-family: var(--serif); margin: 0; font-size: 1.45rem; }
.stamp { display: inline-block; font: 700 0.8rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; border: 2px solid currentColor; border-radius: 6px; padding: 3px 9px; color: var(--muted); transform: rotate(-2deg); }
.stamp.v-go, .stamp.v-keep_going { color: var(--good); background: var(--good-soft); }
.stamp.v-patch, .stamp.v-reroute { color: var(--meh); background: var(--meh-soft); }
.stamp.v-rethink, .stamp.v-rewind { color: var(--bad); background: var(--bad-soft); }
.summary { font-size: 1.04rem; }
.logline { font-family: var(--serif); font-size: 1.12rem; font-style: italic; margin: 10px 0; padding: 8px 14px; border-left: 4px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; }
.callout { border: 1.5px solid var(--line); border-radius: 9px; padding: 4px 12px 8px; background: var(--bg); margin: 10px 0; }
.callout.rewind { border-color: var(--bad); }
.acts { padding-left: 20px; }
.acts li { margin: 5px 0; }
.act-p { display: block; }
.scenes { list-style: none; padding: 0; margin: 6px 0; }
.sc { border-left: 3px solid var(--line); padding: 5px 10px; margin: 6px 0; display: flex; flex-direction: column; }
.sc.replanned { border-left-color: var(--beat); }
.sc-day { font: 600 0.76rem var(--mono); color: var(--muted); }
.sc-beat { align-self: flex-start; font: 700 0.66rem var(--sans); text-transform: uppercase; color: var(--beat); background: var(--beat-soft); border-radius: 4px; padding: 1px 5px; margin: 2px 0; }
.sc-t { font-family: var(--serif); }
.sc-p { font-size: 0.86rem; font-style: italic; color: var(--muted); }
.scenelist summary { cursor: pointer; font-weight: 600; margin-top: 12px; }
.diag { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 10px 0; }
.diag dt { font-weight: 700; font-size: 0.86rem; color: var(--muted); }
.diag dd { margin: 0; }
.sprint { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 2px solid var(--rule); border-radius: 10px; padding: 4px 14px 12px; margin: 14px 0; background: var(--bg); }
.sprint > div:first-child { flex: 1 1 280px; }
.timer { display: flex; gap: 6px; align-items: center; }
.clock { font-size: 1.8rem; font-weight: 700; min-width: 4.2ch; }
.pacenote { font-style: italic; }
.recon { padding-left: 18px; font-size: 0.88rem; }
.recon li.warn { color: var(--bad); } .recon li.info { color: var(--muted); }
li.none { list-style: none; margin-left: -18px; color: var(--muted); font-style: italic; }
.hlist { list-style: none; padding: 0; }
.hrow { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 8px 0; }
.hinfo { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.foot { max-width: 1240px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 0.86rem; }
.toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 28px)); }
.toast { background: var(--ink); color: var(--paper); border-radius: 8px; padding: 9px 12px; font-size: 0.88rem; box-shadow: 0 6px 20px rgba(0,0,0,0.2); transition: opacity 0.5s; }
.toast.err { background: var(--bad); color: #fff; }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 980px) {
  .workbench { grid-template-columns: 1fr; }
  .month { order: -1; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .cal { gap: 3px; }
  .cal-day { min-height: 58px; padding: 3px; border-radius: 6px; }
  .cd-date, .cd-scene, .cd-mark, .cd-of { display: none; }
  .cd-n { font-size: 0.86rem; }
  .cd-w { font-size: 0.62rem; }
  .cd-beat { font-size: 0; padding: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--beat); }
  .grid2 { grid-template-columns: 1fr; }
  .diag { grid-template-columns: 1fr; }
  .lane { flex: 1 1 100%; }
}
