@font-face {
  font-family: Fraunces;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/Fraunces-700-latin.woff2") format("woff2");
}

:root {
  color: #1c2430;
  color-scheme: light;
  background: #f3f1ec;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.45;
  --ink: #1c2430;
  --sage: #16824a;
  --sage-deep: #0f6b3a;
  --mint: #e7f6ee;
  --mint-deep: #d5efe3;
  --paper: #ffffff;
  --muted: #5e6a64;
  --line: rgba(28, 36, 48, 0.1);
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
  --quiet-line: rgba(28, 36, 48, 0.12);
  --canvas: #e6e2d8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f3f1ec;
  color: var(--ink);
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }

button {
  border: 1px solid var(--quiet-line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.48rem 0.85rem;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

button:hover:not(:disabled) { background: #f6f4ef; }

button:active:not(:disabled) { transform: translateY(1px); }

button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  background: #eceae4;
  color: #9aa19c;
  border-color: transparent;
  transform: none;
}

#export-button,
#shutter,
#run-handwriting,
#confirm-crop,
.btn-primary,
.anno-export {
  background: var(--sage);
  color: #f4fff8;
  border-color: transparent;
  font-weight: 600;
}

#export-button:hover:not(:disabled),
#shutter:hover:not(:disabled),
#run-handwriting:hover:not(:disabled),
#confirm-crop:hover:not(:disabled),
.anno-export:hover:not(:disabled) {
  background: var(--sage-deep);
}

#export-button:disabled,
#shutter:disabled,
#run-handwriting:disabled,
#confirm-crop:disabled,
.btn-primary:disabled,
.anno-export:disabled {
  background: #eceae4;
  color: #9aa19c;
}

h1, h2, h3, p { margin: 0; }

h1 {
  display: flex;
  align-items: baseline;
  gap: 0.42rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand {
  min-width: min(100%, 14rem);
  flex: 1 1 14rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.brand-copy { min-width: 0; }

.logo {
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.05rem;
  flex: none;
  display: block;
}

#brand-name { white-space: nowrap; }

#brand-name[hidden] { display: none; }

#brand-en {
  font-family: Fraunces, Georgia, "Iowan Old Style", Palatino, serif;
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
  line-height: 1;
}

h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 0.45rem;
}

h3 {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.topbar {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: transparent;
  border-bottom: 0;
}

.site-header {
  position: relative;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.action-bar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
  padding: 0;
}

.action-bar > button,
#add-button {
  padding: 0.46rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
}

.add-menu { position: relative; }

.add-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 220px;
  padding: 0.55rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(28, 36, 48, 0.14);
  display: grid;
  gap: 0.15rem;
}

.add-panel[hidden] { display: none; }

.add-label {
  margin: 0.45rem 0.35rem 0.1rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.add-panel button {
  width: auto;
  margin-inline-start: 1rem;
  text-align: start;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
  font-weight: 500;
}

.add-panel button:hover:not(:disabled) { background: #f4f1ea; }

.topbar p,
.hint,
.status,
.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.top-actions,
.dialog-actions,
.rotate-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.rotate-row > button { flex: 1 1 0; }

.language-label { display: inline-flex; }

#language {
  border: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235e6a64' d='M1 1.2 6 6.2 11 1.2'/%3E%3C/svg%3E") no-repeat right 0.15rem center;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.2rem 1.1rem 0.2rem 0.15rem;
  font-size: 13px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-proxy {
  position: fixed;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) 232px;
  gap: 0.7rem;
  padding: 0.7rem;
  min-height: 0;
  overflow: hidden;
}

.pages,
.controls {
  padding: 0.7rem;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: auto;
}

.insert-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.insert-actions button {
  width: 100%;
  padding: 0.32rem 0.25rem;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.insert-actions button:hover:not(:disabled) {
  background: #f6f4ef;
  color: var(--ink);
}

#insert-front.is-on {
  background: var(--mint);
  color: var(--sage-deep);
  border-color: var(--sage);
}

.page-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.page-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem;
  align-items: stretch;
}

.page-row.is-dragging { opacity: 0.45; }

.page-row.is-drop .page-button { outline: 2px solid var(--sage); }

.page-order {
  display: grid;
  gap: 0.25rem;
}

.page-move {
  padding: 0.05rem 0.15rem;
  min-width: 1.35rem;
  line-height: 1;
  background: transparent;
  color: var(--sage);
  font-size: 16px;
  box-shadow: none;
}

.page-move:hover:not(:disabled) {
  background: transparent;
  color: var(--sage-deep);
}

.page-move:disabled {
  background: transparent;
  color: #9dcaa8;
}

.page-button {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem;
  background: #f6f4ef;
  color: var(--ink);
  font-weight: 400;
  border-radius: 14px;
}

.page-button:hover:not(:disabled) { background: var(--mint); }

.page-button.is-selected {
  background: #fff;
  color: var(--ink);
  outline: 2px solid var(--sage);
}

.page-button canvas {
  width: 72px;
  height: 54px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}

.stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.7rem;
  min-width: 0;
  min-height: 0;
  padding: 0.35rem 0.15rem;
}

.empty,
.compare,
.text-preview { grid-row: 1; }

.status { grid-row: 2; min-height: 1.2em; }

.status:empty { visibility: hidden; }

.empty {
  align-self: stretch;
  justify-self: stretch;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 1.35rem 1.35rem 1.05rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  overflow: auto;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.empty:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
}

.hero-copy {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
}

.hero-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--sage-deep);
}

.empty strong {
  max-width: 28rem;
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--ink);
}

.hero-copy > span,
.hero-card span,
.hero-drop {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 400;
}

.hero-copy > span { max-width: 34rem; }

.hero-scenes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  width: min(52rem, 100%);
  margin: 0.15rem auto 0;
}

.hero-card {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.7rem 0.65rem 0.85rem;
  background: #f7f6f2;
  border-radius: 16px;
}

.hero-card strong {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: 0;
}

.hero-art {
  display: grid;
  place-items: center;
  width: 100%;
  height: 96px;
}

.hero-art svg { max-width: 100%; height: auto; }

.hero-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem 0.8rem;
}

.hero-drop b {
  color: var(--sage-deep);
  font-weight: 700;
}

.empty-paste {
  display: grid;
  gap: 0.05rem;
  padding: 0.45rem 0.8rem 0.5rem;
  border-radius: 12px;
  background: var(--mint);
}

.empty-paste b {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--sage-deep);
}

.empty .empty-paste span {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.empty:hover {
  border-color: #cfe6da;
}

@media (max-width: 760px) {
  .empty { padding: 1rem; }
  .empty strong { font-size: 1.25rem; }
  .hero-scenes { grid-template-columns: 1fr; }
}

.empty[hidden] { display: none; }

.compare[hidden] { display: none; }

.text-preview {
  min-height: 0;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
}

.text-preview[hidden] { display: none; }

.text-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.view-switch { display: none; }

.compare {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.compare .pane-original {
  position: absolute;
  z-index: 4;
  width: 188px;
  height: 236px;
  right: 0.85rem;
  bottom: 0.85rem;
  padding: 0.45rem 0.5rem 0.55rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(28, 36, 48, 0.16);
}

.compare .pane-original .pane-view { padding: 8px; }

.compare.show-original .pane-original,
.compare.is-crop .pane-original {
  position: relative;
  z-index: 1;
  width: auto;
  height: 100%;
  right: auto;
  bottom: auto;
  padding: 0.8rem;
  cursor: default;
  box-shadow: var(--shadow);
}

.compare.is-crop .pane-original .pane-view { padding: 36px 28px; }

.compare.show-original .pane-result {
  position: absolute;
  z-index: 4;
  width: 188px;
  height: 236px;
  right: 0.85rem;
  bottom: 0.85rem;
  padding: 0.45rem 0.5rem 0.55rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(28, 36, 48, 0.16);
}

.compare.show-original .pane-result .pane-view { padding: 8px; }

.compare.is-crop .pane-result { display: none; }

.pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--paper);
  border-radius: 18px;
  padding: 0.8rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.pane-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
}

.pane-title h3 { margin: 0; }

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: none;
}

.zoom-controls button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}

.zoom-readout {
  min-width: 3.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
}

.pane-original .zoom-controls { display: none; }
.compare.show-original:not(.is-crop) .pane-original .zoom-controls { display: flex; }
.compare.show-original .pane-result .zoom-controls { display: none; }

.pane-view {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: var(--canvas);
  border-radius: 14px;
  /* 四周留边。四角手柄直径 28px，留白要盖住伸出纸页的那一半。 */
  padding: 36px 28px;
}

#result-view.pane-view,
#original-view.pane-view {
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.compare.is-crop #original-view.pane-view {
  display: grid;
  place-items: center;
  padding: 36px 28px;
}

.compare.is-crop #original-stage { display: none; }

.result-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  border-radius: 10px;
}

.result-frame {
  position: relative;
  box-sizing: border-box;
  width: max-content;
  height: max-content;
  min-width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#result-frame > #result-canvas,
#original-frame > #original-canvas {
  max-width: none;
  max-height: none;
  flex: none;
}

#original-stage.can-pan #original-canvas { cursor: grab; }
#original-stage.is-panning,
#original-stage.is-panning #original-canvas { cursor: grabbing; }

#result-stage.can-pan #result-canvas { cursor: grab; }
#result-stage.can-pan #result-canvas.tool-active,
#result-canvas.tool-active { cursor: crosshair; }

#result-stage.is-panning,
#result-stage.is-panning #result-canvas {
  cursor: grabbing;
}

.pane-view > canvas,
.pane-view > .crop-layer {
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
}

#result-canvas.tool-active { cursor: crosshair; touch-action: none; }
#result-canvas.eraser-active { cursor: none; }

.edit-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.tool-group,
.hw-panel {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.tool-group:first-child { padding-top: 0; border-top: 0; }

.tool-group h2,
.hw-panel h2 { font-size: 13px; }

.eraser-options {
  display: grid;
  gap: 0.5rem;
  margin-left: 0.15rem;
  padding: 0.65rem;
  background: #eef8e4;
  border-radius: 14px;
}

.eraser-options[hidden] { display: none; }

#eraser-head {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  box-sizing: border-box;
  border: 1.5px solid var(--sage);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(23, 53, 44, 0.35);
  transform: translate(-50%, -50%);
}

#eraser-head.is-round { border-radius: 50%; }
#eraser-head.is-square { border-radius: 2px; }

#rect-preview {
  position: absolute;
  z-index: 4;
  box-sizing: border-box;
  pointer-events: none;
  border: 2px dashed #7dbea6;
  background: rgba(125, 190, 166, 0.16);
}

#rect-preview[hidden] { display: none; }

.shape-btn.is-on,
#tool-eraser.is-on,
#tool-rect.is-on {
  background: var(--mint);
  color: var(--sage-deep);
  border-color: var(--sage);
  box-shadow: none;
}

#run-handwriting,
#delete-page { width: 100%; }

#delete-page {
  background: transparent;
  color: #6d675f;
  border-color: transparent;
}

#delete-page:hover:not(:disabled) { background: #f3f0ea; color: #3d3832; }

#delete-page:disabled {
  background: transparent;
  color: #b0aaa2;
}

#original-canvas,
#result-canvas,
#crop-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: white;
  box-shadow: 0 8px 22px rgba(23, 53, 44, 0.1);
}

#original-canvas[hidden],
#result-canvas[hidden],
.crop-layer[hidden] {
  display: none !important;
}

.crop-layer {
  position: relative;
  display: none;
  max-width: 100%;
  max-height: 100%;
}

.crop-layer.is-active {
  display: block;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  touch-action: none;
  user-select: none;
  justify-self: center;
  align-self: center;
}

.crop-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.crop-overlay polygon {
  fill: rgba(31, 107, 82, 0.16);
  stroke: var(--sage);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.crop-guide {
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1;
  stroke-dasharray: 6 4;
  vector-effect: non-scaling-stroke;
}

.corner-handle {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 2px solid #f4fff8;
  background: var(--sage);
  color: #f4fff8;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(23, 53, 44, 0.25);
  z-index: 2;
  touch-action: none;
}

.corner-handle:hover,
.corner-handle:focus-visible {
  outline: none;
  background: var(--sage-deep);
}

.controls-stack {
  display: grid;
  gap: 0.45rem;
}

.controls button {
  padding: 0.32rem 0.4rem;
  font-size: 12px;
  border-radius: 10px;
}

.controls .rotate-row { gap: 0.35rem; }

.controls label {
  display: grid;
  gap: 0.2rem;
}

.controls label span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

output {
  color: var(--sage);
  font-weight: 400;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: #b6dfa8;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  border: 0;
  background: var(--sage);
  box-shadow: 0 1px 4px rgba(23, 53, 44, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: #b6dfa8;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--sage);
}

.controls-stack.is-disabled button,
.controls-stack.is-disabled input {
  pointer-events: none;
}

.hint { margin-top: 1rem; line-height: 1.55; }

.busy {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(23, 53, 44, 0.28);
}

.busy[hidden] { display: none; }

.busy-card {
  width: min(340px, calc(100vw - 2rem));
  padding: 1.45rem 1.5rem 1.25rem;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(23, 53, 44, 0.18);
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  text-align: center;
}

.busy-card p {
  color: var(--ink);
  font-size: 15px;
}

.busy-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #d3efc4;
  border-top-color: var(--sage);
  animation: busy-spin 0.8s linear infinite;
}

.busy-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e7f8dc;
  overflow: hidden;
}

.busy-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--sage);
  animation: busy-slide 1.15s ease-in-out infinite;
}

@keyframes busy-spin {
  to { transform: rotate(360deg); }
}

@keyframes busy-slide {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(280%); }
}

dialog {
  border: 0;
  border-radius: 18px;
  padding: 1rem;
  background: #fff;
  width: min(640px, calc(100vw - 2rem));
  box-shadow: 0 24px 60px rgba(23, 53, 44, 0.18);
}

dialog::backdrop { background: rgba(23, 53, 44, 0.4); }

#paste-dialog {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 1.5rem));
  height: auto;
  max-height: none;
  margin: 0;
  padding: 1.15rem 1.1rem 1rem;
  background: #fff;
  overflow: visible;
}
#paste-dialog strong { display: block; font-size: 1.15rem; }
.paste-hint {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0.3rem;
  color: var(--muted, #66706b);
  font-size: 0.92rem;
  line-height: 1.45;
}
.paste-hint-touch { display: none; }
#paste-catcher {
  display: block;
  width: 100%;
  height: auto;
  min-height: 7.5rem;
  max-height: 32vh;
  margin-top: 0.75rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid #d7efe4;
  border-radius: 12px;
  background: #f7fbf8;
  color: var(--ink);
  caret-color: auto;
  resize: none;
  font: inherit;
  line-height: 1.45;
}
#paste-catcher:focus {
  outline: none;
  border-color: #16824a;
  box-shadow: 0 0 0 3px rgba(22, 130, 74, 0.15);
}
.paste-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 1;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8a938e;
  font-size: 1.25rem;
  line-height: 1;
}

#camera-video {
  width: 100%;
  max-height: 60vh;
  background: #10241c;
  border-radius: 14px;
}

.dialog-actions { margin-top: 0.75rem; }

.annotate-dialog {
  width: min(1100px, calc(100vw - 1.5rem));
  height: min(92vh, 900px);
  max-height: 92vh;
  padding: 0.85rem 1rem 1rem;
  display: none;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.annotate-dialog[open] { display: grid; }

.anno-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.anno-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.anno-slider {
  display: grid;
  gap: 0.15rem;
  min-width: 140px;
  font-size: 0.85rem;
  color: var(--muted);
}

.anno-slider input[type="range"] { width: 140px; }

.anno-export { margin-left: auto; }

.anno-stage {
  position: relative;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #e7f8dc;
  border-radius: 14px;
  padding: 0.75rem;
}

.anno-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  box-shadow: 0 8px 22px rgba(23, 53, 44, 0.1);
}

.anno-frame canvas {
  display: block;
  max-width: 100%;
  background: #fff;
}

#anno-overlay {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  cursor: crosshair;
  touch-action: none;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #b6dfa8;
  border-radius: 999px;
  border: 2px solid transparent;
}
::-webkit-scrollbar-track { background: transparent; }

.hero-drop-touch { display: none; }

@media (pointer: coarse) {
  .paste-keys,
  .paste-hint-key,
  .hero-drop-key { display: none; }
  .paste-hint-touch { display: flex; }
  .hero-drop-touch { display: inline; }
}

@media (min-width: 1101px) {
  .tool-drawer > summary { display: none; }
}
