:root { --cyan: #00c8e5; --red: #dd4040; --green: #4eb046; --ink: #222; --mid: #6f6f6f; --line: #e3e3e3; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--ink); background: #f4f4f4; }
[hidden] { display: none !important; }
.muted { color: var(--mid); }
.small { font-size: 12px; }
.grow { flex: 1; }
button { font: inherit; padding: 6px 12px; border: 1px solid #bbb; border-radius: 6px; background: #fff; cursor: pointer; }
button:hover { background: #f0f0f0; }
button.primary { background: var(--cyan); border-color: var(--cyan); color: #fff; font-weight: 600; }
button.link { border: none; background: none; color: #0077aa; padding: 0; }
a { color: #0077aa; }
input[type=email], textarea, select { font: inherit; padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; }
h3 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--mid); }

/* sign in: set as the book's title page, on the reader's desk with the reader's page shadow */
#signin, .desk { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; font-family: Inter, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
.titlepage { width: 100%; max-width: 480px; min-height: min(720px, calc(100vh - 64px)); display: flex; flex-direction: column; padding: 76px 48px 36px; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); text-align: center; }
.titlepage .welcome { margin: 0 0 14px; font: italic 400 21px/1.3 "Libertinus Serif", Georgia, serif; color: var(--mid); }
.titlepage h1 { margin: 0; font: 700 48px/1.06 "Libertinus Serif", Georgia, serif; font-feature-settings: "liga", "dlig"; }
.titlepage .lede { max-width: 34ch; margin: 28px auto 0; font-size: 15px; line-height: 1.6; color: var(--mid); }
.signin-foot { margin-top: auto; padding-top: 40px; text-align: left; }
.titlepage.short { min-height: 0; }
.titlepage.short .signin-foot { padding-top: 28px; }
.titlepage.short .signin-foot button { width: 100%; }
.signin-foot form { display: flex; flex-direction: column; gap: 8px; }
#code-form { margin-top: 20px; }
.signin-foot .code-toggle { margin-top: 10px; padding: 0; font-size: 13px; font-weight: 500; color: #0077aa; background: none; border: none; text-decoration: underline; text-underline-offset: 2px; }
.signin-foot .code-toggle:hover { background: none; color: #005a82; }
.signin-foot label { font-size: 13px; font-weight: 500; }
.signin-foot input { width: 100%; padding: 11px 12px; font: inherit; font-size: 16px; border: 1px solid #c9c9c9; border-radius: 6px; }
#code:not(:placeholder-shown) { letter-spacing: .15em; }
.signin-foot button { padding: 12px 16px; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); background: var(--cyan); border: 1px solid var(--cyan); border-radius: 6px; }
.signin-foot button:hover { background: #00b6d1; }
.signin-foot button:disabled { opacity: .6; cursor: default; }
.signin-foot input:focus-visible, .signin-foot button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
/* messages use the book's own margin-note colours */
#signin-status { margin: 14px 0 0; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; color: #604819; background: #fff5d7; border-radius: 4px; }
#signin-status:empty { display: none; }
#signin-status.error { color: #8a1c1c; background: #fbecec; }
.fine { margin: 18px 0 0; font-size: 12px; color: var(--mid); text-align: center; }
#code-form:not([hidden]) { animation: reveal .2s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { #code-form:not([hidden]) { animation: none; } }
@media (max-width: 520px) {
  #signin, .desk { padding: 16px; align-items: flex-start; }
  .titlepage { min-height: 0; padding: 48px 24px 28px; }
  .titlepage .welcome { font-size: 18px; }
  .titlepage h1 { font-size: 38px; }
}
/* the "not configured" notice */
.card { background: #fff; padding: 32px; border-radius: 12px; box-shadow: 0 2px 16px rgba(0,0,0,.08); max-width: 420px; }
.card h1 { font-size: 20px; margin: 0 0 8px; }

/* app */
header { display: flex; gap: 16px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; }
#review { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - 45px); }
#viewer { display: flex; flex-direction: column; align-items: center; overflow: auto; padding: 12px; }
#viewer.scrolling { align-items: flex-start; }
#nav { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; justify-content: center; }
#jump { max-width: 300px; }
.zoom { display: inline-flex; gap: 4px; align-items: center; }
.zoom button { padding: 4px 8px; }
#zoom-label { min-width: 38px; text-align: center; }
#page-wrap { box-shadow: 0 2px 12px rgba(0,0,0,.18); background: #fff; line-height: 0; }
#page { max-width: 100%; }
#side { background: #fff; border-left: 1px solid var(--line); padding: 16px; overflow: auto; }
#where { color: var(--mid); margin-bottom: 10px; }
#where b { color: var(--ink); }
.rec { width: 100%; font-size: 18px; padding: 16px; border-radius: 10px; background: var(--cyan); border-color: var(--cyan); color: #fff; font-weight: 600; }
.rec.on { background: var(--red); border-color: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }
#live { min-height: 56px; border: 1px dashed #ccc; border-radius: 6px; padding: 8px; margin-top: 8px; white-space: pre-wrap; }
#live.interim { color: #888; }
#typed { width: 100%; min-height: 70px; margin-bottom: 6px; }

/* notes */
.note { border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 6px; background: #fafafa; position: relative; }
.note.done { background: #f1f9f1; border-color: #cfe8cf; }
.note.declined { background: #f6f6f6; color: #666; }
.note small { color: #888; }
.note .del { position: absolute; right: 6px; top: 6px; border: none; background: none; color: #aaa; font-size: 16px; padding: 0 4px; }
.note .del:hover { color: var(--red); }
.note .text { white-space: pre-wrap; margin: 4px 0; }
.note .st { font-size: 12px; margin-top: 4px; }
.note .st.done { color: #1f6b2a; }
.note .st.declined { color: #777; }
.note .st select, .note .st input { font-size: 12px; padding: 2px 4px; }
.note audio { width: 100%; height: 28px; margin-top: 4px; }

/* all feedback */
#all { padding: 16px 24px; max-width: 1000px; margin: 0 auto; }
.toolbar { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.group h2 { font-size: 16px; margin: 20px 0 6px; }
.group h4 { font-size: 13px; margin: 12px 0 4px; color: var(--mid); }
.row { display: grid; grid-template-columns: 70px 1fr 260px; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: 6px; align-items: start; }
.row .pg a { font-weight: 600; }
.row .res { display: flex; flex-direction: column; gap: 4px; }
.row .res input { width: 100%; }
