:root {
  font:
    14px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  color: #182e42;
  background: #f2f5f7;
  --blue: #104b7c;
  --line: #e1e7ea;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button,
a {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 7px;
  white-space: nowrap;
}
button:disabled {
  opacity: 0.43;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #2183c6;
  outline-offset: 2px;
}
header {
  height: 64px;
  min-height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
header button:not(#pick),
#settings {
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 600;
}
header nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.divider,
footer i,
#foot i {
  width: 1px;
  background: var(--line);
  height: 20px;
  flex: none;
}
header nav .divider {
  margin: 0 5px;
}
#pick {
  padding: 0 4px;
  display: flex;
}
#pick img {
  width: 44px;
  height: 42px;
  object-fit: contain;
}
.right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
#settings {
  display: flex;
  align-items: center;
  border-radius: 8px;
}
#settings svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
#export,
.primary {
  background: var(--blue);
  color: white;
  padding: 9px 16px !important;
}
button:not(:disabled):hover,
#settings:hover {
  background: #eaf0f4;
}
#export:not(:disabled):hover,
.primary:hover {
  background: #16639c;
}
button[aria-pressed="true"] {
  background: #dfecf6;
  color: #084978;
}
#count {
  font-weight: 700;
  color: #b52b3e;
  white-space: nowrap;
  font-size: 12px;
}
/* The viewport stays still when the PDF is zoomed or scrolled. */
#drawingViewport { flex: 1; min-height: 0; position: relative; overflow: hidden; isolation: isolate; container-type: size; }
#stage {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background-color: #eff3f5;
  background-image: radial-gradient(#cdd7dd 0.7px, transparent 0.7px);
  background-size: 16px 16px;
}
#stage.dragging {
  box-shadow: inset 0 0 0 3px #167dc0;
}
#empty {
  display: grid;
  place-items: center;
  gap: 9px;
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(360px, 80vw);
  height: 204px;
  background: #ffffffdd;
  border: 1px dashed #acbbc5;
  border-radius: 16px;
}
#empty:hover {
  background: white;
  border-color: #507c9f;
}
#empty strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
#empty small {
  color: #69808f;
  letter-spacing: 0.15em;
}
.sheet svg {
  width: 42px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linejoin: round;
}
.sheet {
  align-self: end;
}
#empty small {
  align-self: start;
}
#board {
  margin: 24px auto 72px;
  position: relative;
  background: white;
  box-shadow: 0 2px 12px #223b501c;
  touch-action: none;
}
#paper,
#marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#marks {
  overflow: hidden;
  cursor: grab;
}
#marks:active {
  cursor: grabbing;
}
#marks.editing {
  cursor: crosshair;
}
.mark,
.selection {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}
.mark {
  background: #f7505c1a;
  outline: 1px solid #e53145;
  color: #c31529;
  line-height: 1;
  white-space: nowrap;
}
.mark.focus {
  outline: 3px solid #bc1226;
}
.selection {
  background: white;
  border: 1px dashed #4082ad;
}
#foot,
#noteBox,
#risks,
#status {
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 4px 18px #16365018;
}
#foot {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 3;
  font-size: 13px;
}
#foot button {
  padding: 4px 8px;
}
#foot i {
  height: 14px;
  margin: 0 3px;
}
#page,
#scale {
  font-variant-numeric: tabular-nums;
}
#risks {
  position: fixed;
  right: 14px;
  top: 78px;
  width: min(315px, 85vw);
  max-height: 68dvh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  z-index: 4;
}
.panehead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.panehead button {
  font-size: 22px;
}
#list {
  overflow: auto;
  padding: 6px;
}
.row {
  display: block;
  padding: 7px 10px;
  text-align: left;
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  color: #a12636;
}
#reviewOnly {align-self:flex-start;margin:6px 14px;padding:3px 8px;}
.review-actions {display:flex;gap:6px;margin:0 10px 8px;}
.review-actions button,#list details button {font-size:12px;border:1px solid var(--line);border-radius:5px;padding:2px 6px;}
#list details {font-size:12px;color:#476076;padding:8px;}
#list details div {padding-top:5px;overflow-wrap:anywhere;}
.mark.pending {outline-color:#bc8121;background:#dba4481c;color:#704a0e;}
.row small {
  display: block;
  color: #647987;
}
.row:disabled {
  opacity: 1;
  cursor: text;
}
.warn {
  padding: 8px;
  color: #86540b;
  font-size: 12px;
}
/* The input lives on the paper; only formatting controls occupy the utility bar. */
#noteBox {position:fixed;bottom:62px;left:50%;transform:translateX(-50%);z-index:7;padding:5px 8px;border-radius:8px;display:flex;align-items:center;justify-content:center;gap:8px;max-width:96vw;flex-wrap:wrap;}
#noteBox button {padding:4px 8px;}
#board #noteText {position:absolute;z-index:3;appearance:none;border:0;border-radius:0;outline:1px dashed #3783ae;outline-offset:1px;background:transparent;box-shadow:none;margin:0;padding:0;line-height:1;font-weight:normal;font-family:DzNote,'Microsoft YaHei',sans-serif;letter-spacing:0;}
body:has(#noteBox:not([hidden])) #status {bottom:118px;pointer-events:none;}
#size {
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: 5px;
}
#noteBox label {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
}
#size,
#color {
  width: 50px;
}
#status {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(86vw, 760px);
  padding: 7px 14px;
  border-radius: 8px;
  z-index: 8;
  font-size: 13px;
}
.busy:after {
  content: "";
  display: block;
  position: fixed;
  top: 62px;
  height: 2px;
  width: 27vw;
  background: #2c79b2;
  left: 0;
  pointer-events: none;
  animation: progress 1.3s ease-in-out infinite;
  z-index: 10;
}
@keyframes progress {
  from { transform: translateX(-100%); }
  to { transform: translateX(100vw); }
}
/* Decorative only: the real counts live in #status. No canvas repaints. */
#scanBeam { display:none; pointer-events:none; }
#translationCoverage {position:fixed;bottom:14px;left:12px;z-index:6;background:white;border:1px solid var(--line);border-radius:8px;padding:5px 10px;font-size:12px;max-width:min(420px,86vw);}
#translationCoverage summary {cursor:pointer;color:#715018;} #translationIssues {max-height:35vh;overflow:auto;white-space:normal;overflow-wrap:anywhere;}
#translationIssues p{margin:6px 0;padding-bottom:5px;border-bottom:1px dashed var(--line);color:#3d5265;}
#translationIssues p b{color:#8a5a10;font-weight:700;}
#translationIssues p em{display:block;font-style:normal;color:#5d7386;font-size:11px;}
#translationIssues p button{margin-left:6px;border:1px solid var(--line);border-radius:5px;padding:1px 7px;font-size:11px;color:#104b7c;background:#fff;}
#translationIssues p button:hover{background:#eaf0f4;}
.busy[data-ai-sweep]::after { content:none; animation:none; }
@media (prefers-reduced-motion: no-preference) {
  .busy[data-ai-sweep][data-ai-stage] #scanBeam {
    --ink: 11, 150, 184;
    position:absolute; display:block; inset:0 0 auto; height:14px; z-index:1;
    background:
      linear-gradient(90deg,transparent,rgba(var(--ink),.46) 10%,rgba(var(--ink),.87) 50%,rgba(var(--ink),.46) 90%,transparent) bottom / 100% 1px no-repeat,
      linear-gradient(0deg,rgba(var(--ink),.14),rgba(var(--ink),.045) 40%,transparent);
    animation: drawing-sweep 3.2s linear infinite;
  }
  .busy[data-ai-sweep][data-ai-stage="translate"] #scanBeam { --ink: 119, 83, 202; }
  .busy[data-ai-sweep][data-ai-stage="write"] #scanBeam { --ink: 0, 151, 122; }
  @keyframes drawing-sweep {
    from {transform:translateY(-100%)}
    to {transform:translateY(calc(100vh - 64px));transform:translateY(100cqh)}
  }
}
.busy[data-ai-stage] #status { border-inline-start: 3px solid #6caec8; font-variant-numeric: tabular-nums; }
.busy[data-ai-stage="translate"] #status { border-color: #9a89ce; }
.busy[data-ai-stage="write"] #status { border-color: #5ab49d; }
@media (max-width: 760px) {
  header {
    gap: 4px;
    padding: 0 6px;
  }
  header button:not(#pick) {
    font-size: 12px;
    padding: 7px;
  }
  #pick img {
    width: 32px;
  }
  .right {
    gap: 1px;
  }
  #settings {
    padding: 5px;
  }
  #export {
    padding: 8px !important;
  }
}
/* Keep the action strip independent from document paints. */
header { display:grid; grid-template-columns:minmax(max-content,1fr) minmax(0,max-content) minmax(max-content,1fr); gap:12px; isolation:isolate; }
#pick { justify-self:start; align-items:center; gap:9px; color:#123e62; }
#pick strong {font-size:18px; letter-spacing:.02em;}
header nav {min-width:0; padding:3px 1px; gap:6px;}
header nav button, #settings {flex:none; border:1px solid #a6b9c7; background:#fff;}
header nav button {line-height:1.4;}
header nav button:disabled {opacity:1; color:#8293a1; border-color:#c4cfd6; background:#f7f9fa;}
header nav button[aria-pressed=true] {color:#104b7c; background:#e5eff8; border-color:#7199b8;}
header .right {justify-self:end; margin:0;}
#count {min-width:6ch; text-align:right; font-variant-numeric:tabular-nums;}
#count[hidden] {display:inline-block!important; visibility:hidden;}
#noteLayer {position:absolute; inset:0; pointer-events:none; overflow:visible;}
.note-hit {pointer-events:auto; position:absolute; padding:0; border:1px solid transparent; border-radius:2px; background:transparent!important; touch-action:none; cursor:move;}
.note-hit:hover,.note-hit.selected {border-color:#1974a8; outline:1px dashed #ffffff;}
.note-hit.dragging {border-style:dashed; background:#ffffffdd!important; overflow:hidden; text-align:left; line-height:1.1;}
.note-action {position:absolute; bottom:100%; right:0; margin-bottom:2px; background:#104b7c; color:white; padding:1px 8px; font-size:12px; border-radius:4px; cursor:pointer;}
.note-wrap {position:absolute; pointer-events:none;}
.note-wrap .note-hit {inset:0; width:100%; height:100%;}
.note-wrap .note-action {pointer-events:auto;}
.note-wrap:has(.selected) {z-index:1;}
.note-action.below {bottom:auto; top:100%;}
@media(max-width:1250px){header {grid-template-columns:auto minmax(0,1fr) auto;}header nav {justify-self:center; max-width:100%;}header nav button:not(#pick){padding:7px 8px;}header nav .divider {margin:0 2px;}}
@media(max-width:760px){header {gap:5px;} #pick {gap:4px;}#pick strong{font-size:13px;}header nav {justify-self:stretch;} header nav button:not(#pick){padding:6px 7px;}}
@media (prefers-reduced-motion: reduce) {
  .busy:after {
    animation: none;
    width: 100%;
    transform: none;
  }
}
