:root {
  color-scheme: light;
  font: 16px system-ui, sans-serif;
  color: #25291f;
  background: #f3f1e9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header, .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
header {
  justify-content: space-between;
  min-height: calc(4.75rem + 1px);
  padding: 1rem max(1rem, 5vw);
  border-bottom: 1px solid #d6d4c9;
}
header a { font: 1.65rem Georgia, serif; text-decoration: none; }
#editor-toast {
  position: fixed;
  z-index: 30;
  inset: .7rem 0 auto;
  width: min(27rem, calc(100% - 2rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .45rem .45rem .45rem 1rem;
  color: #70352c;
  background: #fffaf5;
  border: 1px solid #d6aba0;
  border-radius: .75rem;
  box-shadow: 0 .4rem 1.5rem #25291f25;
  animation: editor-toast-enter .22s ease-out both;
}
#editor-toast p { flex: 1; margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
#editor-toast button {
  flex: 0 0 2.75rem;
  min-width: 2.75rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: inherit;
  font-size: 1.35rem;
}
#editor-toast button:hover { background: #f5e7df; }
@keyframes editor-toast-enter { from { opacity: 0; transform: translateY(-100%); } }
@media (prefers-reduced-motion: reduce) { #editor-toast { animation: none; } }
body > header { -webkit-user-select: none; user-select: none; }
a { color: #315941; }
main { max-width: 62rem; margin: auto; padding: 1rem clamp(1rem, 4vw, 3rem) 3rem; }
#startup-status {
  position: absolute;
  inset: 5.75rem 1rem auto;
  margin: 0;
  text-align: center;
  color: #536157;
  animation: show-startup 0s .2s both;
}
@keyframes show-startup { from { visibility: hidden; } to { visibility: visible; } }
body:has(#app[aria-busy="true"]) #sign-out, #app[aria-busy="true"] { visibility: hidden; }
body:has(#app[aria-busy="false"]) #startup-status { display: none; }
h1 { font: 2rem Georgia, serif; overflow-wrap: anywhere; }
form { display: grid; gap: .85rem; max-width: 26rem; margin-bottom: 1rem; }
label { display: grid; gap: .35rem; }
input, button, textarea { font: inherit; }
input, button { min-height: 2.75rem; padding: .5rem .75rem; border: 1px solid #787f71; border-radius: .35rem; }
button { background: #e0eadc; color: #243f2c; cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
button[aria-pressed="true"]:not(:disabled) { background: #315941; color: #fffefa; border-color: #315941; }
:focus-visible { outline: 2px solid #315941; outline-offset: 3px; }
#notice { min-height: 1.4em; }
#library { padding-top: clamp(.5rem, 3vw, 2rem); }
.library-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #d6d4c9;
}
.library-heading h1 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  letter-spacing: -.035em;
}
#create {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  max-width: none;
  margin: 0;
  gap: .6rem;
}
#create label { color: #46534b; font-size: .875rem; }
#create input { width: 100%; background: #fffefa; border-color: #9da69a; }
#create button { background: #315941; border-color: #315941; color: #fffefa; }
#create button:hover { background: #244a35; }
#documents {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
#documents li {
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 1px solid #d6d4c9;
  border-radius: .75rem;
  background: #fffefa;
}
#documents li:focus-within, #documents li:hover { border-color: #92a493; }
#documents a {
  flex: 1;
  display: grid;
  align-content: start;
  gap: .9rem;
  padding: .75rem .75rem .5rem;
  border-radius: .75rem;
  color: #25291f;
  font-weight: 600;
  text-decoration: none;
}
#documents a:hover span { text-decoration: underline; }
#documents a::before {
  content: "";
  height: 6rem;
  border-radius: .4rem;
  background:
    linear-gradient(#fffefa, #fffefa) calc(50% + 6px) calc(50% - 4px) / 30px 40px no-repeat,
    linear-gradient(#bac7b5, #bac7b5) calc(50% + 6px) calc(50% - 4px) / 32px 42px no-repeat,
    linear-gradient(#f2efe4, #f2efe4) calc(50% - 6px) calc(50% + 4px) / 30px 40px no-repeat,
    linear-gradient(#bac7b5, #bac7b5) calc(50% - 6px) calc(50% + 4px) / 32px 42px no-repeat,
    radial-gradient(#bdcbbb 1px, transparent 1px) 0 0 / 12px 12px #e6ece2;
}
#documents button {
  align-self: start;
  margin: 0 .4rem .3rem;
  border-color: transparent;
  background: transparent;
  font-size: .875rem;
}
#documents button:hover { background: #edf1e9; }
#empty-library {
  padding: 2rem 1rem;
  margin: 1.5rem 0 0;
  text-align: center;
  color: #46534b;
  border: 1px dashed #b3b9ab;
  border-radius: .75rem;
}
#account-settings {
  margin-top: 2rem;
  padding-top: .75rem;
  border-top: 1px solid #d6d4c9;
  color: #46534b;
  font-size: .875rem;
}
#account-settings summary { width: fit-content; padding: .6rem 0; cursor: pointer; }
#delete-account { background: #fffefa; color: #853b31; border-color: #c8a9a2; }
@media (max-width: 35rem) { #create { width: 100%; } }
#sharing-dialog {
  width: min(41rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  color: #25291f;
  background: #fffefa;
  border: 1px solid #d6d4c9;
  border-radius: 1rem;
  box-shadow: 0 1.25rem 4rem #25291f30;
}
#sharing-dialog::backdrop { background: #25291f55; }
#sharing-dialog > * { padding: 1.15rem clamp(1rem, 4vw, 1.75rem); }
#sharing-dialog > * + * { border-top: 1px solid #e1dfd5; }
.sharing-heading { background: #f3f5ee; overflow-wrap: anywhere; }
.sharing-heading h2 { margin: 0; font: 1.85rem Georgia, serif; }
.sharing-heading p { margin: .35rem 0 0; color: #46534b; }
#sharing-dialog h3 { margin: 0 0 .8rem; font-size: 1rem; }
#sharing-dialog form {
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  align-items: end;
  max-width: none;
  margin: 0;
  gap: .55rem;
}
#sharing-dialog #create-guest-link { grid-template-columns: minmax(0, 1fr) max-content; }
#sharing-dialog label { font-size: .875rem; color: #46534b; }
#sharing-dialog input { width: 100%; }
#sharing-dialog input, #sharing-dialog select, #sharing-dialog button {
  border: 1px solid #aeb8ac;
  border-radius: .45rem;
  min-height: 2.75rem;
}
.sharing-select { position: relative; display: block; min-width: 0; color: #46534b; }
.sharing-select::after {
  content: '';
  position: absolute;
  inset-inline-end: .9rem;
  top: 50%;
  width: .38rem;
  height: .38rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
#sharing-dialog select {
  appearance: none;
  width: 100%;
  font: inherit;
  padding: .5rem .75rem;
  padding-inline-end: 2rem;
  background: #fffefa;
  color: #25291f;
}
#sharing-dialog button { background: #f3f5ee; }
#sharing-dialog button:hover { background: #e0eadc; }
#sharing-dialog #close-sharing { background: #315941; color: #fffefa; border-color: #315941; }
#sharing-dialog ul { padding: 0; margin: 0 0 .85rem; list-style: none; }
#sharing-dialog ul:empty { display: none; }
#sharing-dialog li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  margin: 0;
  padding: .55rem .65rem;
  background: #f5f4ed;
  border-radius: .45rem;
  font-size: .875rem;
}
#sharing-dialog li + li { margin-top: .35rem; }
.sharing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.sharing-footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.sharing-footer p { margin: 0; color: #853b31; }
#created-guest-link { margin-top: .65rem; }
@media (max-width: 34rem) {
  #sharing-dialog #invite-member label:first-child { grid-column: 1 / -1; }
  #sharing-dialog #invite-member { grid-template-columns: minmax(0, 1fr) max-content; }
}
.account-panel {
  max-width: 32rem;
  margin-inline: auto;
  padding: clamp(1.25rem, 5vw, 2rem);
  border: 1px solid #d6d4c9;
  background: #fffefa;
  border-radius: .5rem;
}
.account-panel h1 { margin-top: 0; }
.account-panel p { line-height: 1.55; overflow-wrap: anywhere; }
.account-panel .account-email {
  padding: .65rem .85rem;
  background: #f3f1e9;
  border-radius: .35rem;
}
.account-panel .toolbar { margin-top: 1.25rem; }
.account-panel form { max-width: none; }
.account-panel input { width: 100%; }
.account-link {
  border: 0;
  padding-inline: 0;
  background: transparent;
  color: #315941;
  text-decoration: underline;
}
.account-action {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .5rem .75rem;
  border: 1px solid #787f71;
  border-radius: .35rem;
  background: #e0eadc;
  text-decoration: none;
}
li { margin-block: .75rem; overflow-wrap: anywhere; }
body:has(#editor:not([hidden])) { display: flex; flex-direction: column; height: 100dvh; }
body:has(#editor:not([hidden])) > header { flex: 0 0 auto; }
#sign-out {
  border: 0;
  background: transparent;
  color: #46534b;
  font-size: .875rem;
}
#sign-out:hover { background: #e9e9e1; }
main:has(#editor:not([hidden])) {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0 clamp(.65rem, 2vw, 1.5rem) .65rem;
}
#editor { display: flex; flex: 1; flex-direction: column; min-height: 0; }
#editor > :not(.workspace) { flex-shrink: 0; }
.editor-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .8rem;
  padding: .8rem 0 .65rem;
}
.editor-heading > a { font-size: .8rem; color: #536157; text-decoration: none; }
.editor-heading > a:hover { text-decoration: underline; }
.editor-heading h1 { margin: 0; font-size: 1.4rem; }
.editor-heading #notice { min-height: 0; margin: 0 0 0 auto; font-size: .8rem; color: #4b5c51; }
.editor-heading #notice { -webkit-user-select: none; user-select: none; }
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .55rem;
  margin-bottom: .45rem;
  font-size: .85rem;
}
.control-group {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  max-width: 100%;
  padding: .15rem;
  border: 1px solid #dedfd5;
  border-radius: .65rem;
  background: #fbfbf6;
}
.editor-toolbar button, .editor-toolbar select {
  min-height: 2.35rem;
  padding: .35rem .65rem;
  border: 1px solid transparent;
  border-radius: .45rem;
  background: transparent;
  color: #34443b;
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
}
.editor-toolbar button:hover:not(:disabled), .editor-toolbar select:hover { background: #eeefe7; }
.editor-toolbar button[aria-pressed="true"]:not(:disabled) {
  background: #315941;
  color: #fffefa;
  border-color: #315941;
}
.editor-toolbar button:disabled { opacity: .46; }
.editor-toolbar :focus-visible { outline-offset: 1px; }
.editor-toolbar { -webkit-user-select: none; user-select: none; }
.toolbar-section {
  display: flex;
  flex-wrap: wrap;
  max-width: 100%;
  gap: inherit;
}
.toolbar-section > .control-group { flex: 0 0 auto; }
.toolbar-section button { padding-inline: .55rem; }
.history-controls button {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
}
.history-controls svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.zoom-controls button { min-width: 2.35rem; padding-inline: .35rem; font-size: 1.15rem; }
.zoom-controls output { min-width: 3.1rem; text-align: center; font-variant-numeric: tabular-nums; color: #4b5c51; }
.page-picker select { cursor: pointer; max-width: 10rem; }
.workspace-tools { position: relative; margin-bottom: .65rem; }
.eraser-options {
  position: absolute;
  z-index: 8;
  top: calc(100% + 1.15rem);
  inset-inline-start: .5rem;
  max-width: calc(100% - 1rem);
  margin: 0;
  padding: .3rem;
  background: #fffefa;
  border: 1px solid #d6d4c9;
  border-radius: .75rem;
  box-shadow: 0 .25rem .8rem #25291f24;
}
.eraser-options[data-inactive], .eraser-sizes[data-inactive] { display: none; }
.eraser-sizes button {
  display: grid;
  place-items: center;
  min-width: 2.35rem;
  padding: .35rem;
}
.eraser-sizes button::before {
  content: '';
  width: var(--swatch-size);
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.eraser-sizes [data-eraser-diameter="6"] { --swatch-size: .45rem; }
.eraser-sizes [data-eraser-diameter="12"] { --swatch-size: .75rem; }
.eraser-sizes [data-eraser-diameter="24"] { --swatch-size: 1.15rem; }
.workspace {
  position: relative;
  flex: 1;
  min-height: 10rem;
  overflow: hidden;
  background: #e9e7df;
  border: 1px solid #dedbd1;
  border-radius: .65rem;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.workspace textarea { -webkit-user-select: text; user-select: text; }
.workspace { -webkit-touch-callout: none; }
.workspace textarea { -webkit-touch-callout: default; }
#touch-actions { position: fixed; z-index: 20; box-shadow: 0 3px 14px #25382730; }
#touch-actions[hidden] { display: none; }
#touch-actions button { background: transparent; border-color: transparent; }
.workspace[data-hand] { cursor: grab; }
.workspace[data-panning] { cursor: grabbing; }
.workspace[data-hand] .paper { pointer-events: none; }
#scene { position: absolute; transform-origin: 0 0; }
.paper { position: absolute; z-index: 1; background: #fffefa; outline: 1px solid #d6d4c9; }
.paper-handle {
  position: absolute;
  z-index: 4;
  bottom: 100%;
  left: 50%;
  width: 36px;
  height: 18px;
  min-height: 0;
  padding: 0;
  transform: translateX(-50%) scale(var(--paper-handle-scale, 1));
  transform-origin: bottom center;
  border: 1px solid #aaa79d;
  border-bottom: 0;
  border-radius: .4rem .4rem 0 0;
  background: #f2f0e7;
  color: #536151;
  cursor: grab;
}
.paper-handle::after {
  content: '';
  display: block;
  width: 15px;
  height: 8px;
  margin: auto;
  background: radial-gradient(circle, currentColor 1.15px, transparent 1.5px) 0 0 / 5px 4px;
}
#page[data-paper-selected] .paper-handle, .paper-handle:hover, .paper-handle:focus-visible { background: #e0eadc; }
#scene:not([data-paper-handles]) .paper-handle, .workspace[data-hand] .paper-handle { visibility: hidden; }
#scene:has(.passive-surface:not(.tabletop-surface)) .paper:not(.tabletop-surface) {
  box-shadow: 0 0 0 2px #aaa79d;
}
.tabletop-surface {
  z-index: 0;
  background-color: #e9e7df;
  background-image: radial-gradient(#c5c6b8 .8px, transparent .8px);
  background-size: 15px 15px;
  outline: 1px dashed #b5b9ab;
}
.passive-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.group-frame {
  position: absolute;
  z-index: 4;
  outline: 2px dashed #47745b;
  background: #47745b12;
  pointer-events: none;
}
#page { width: 630px; height: 891px; }
.ink-layer { position: absolute; pointer-events: none; }
.remote-layer, .remote-peer, .remote-ink { position: absolute; inset: 0; pointer-events: none; }
.ink-layer, .passive-ink, .remote-ink { z-index: 1; }
.remote-peer {
  --peer-color: hsl(var(--peer-hue) 65% 38%);
  --peer-fill: hsl(var(--peer-hue) 80% 92% / .88);
}
.remote-peer > div { position: absolute; }
.remote-selection, .remote-marquee { z-index: 4; border: 2px solid var(--peer-color); border-radius: .2rem; }
.remote-marquee { background: hsl(var(--peer-hue) 65% 55% / .12); }
.remote-block, .remote-text {
  z-index: 3;
  color: #25291f;
  background: var(--peer-fill);
  border: 1px solid var(--peer-color);
  border-radius: .3rem;
  padding: .3rem .4rem;
  white-space: pre-wrap;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.remote-ink { width: 100%; height: 100%; fill: none; stroke: var(--peer-color); stroke-width: .8; stroke-linecap: round; }
.remote-pointer {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  --peer-color: hsl(var(--peer-hue) 65% 38%);
  transition: left 100ms linear, top 100ms linear;
  color: white;
  background: var(--peer-color);
  border-radius: .25rem;
  padding: .12rem .35rem;
  margin: .25rem;
  font: .75rem system-ui, sans-serif;
  width: max-content !important;
  height: auto !important;
}
@media (prefers-reduced-motion: reduce) { .remote-pointer { transition: none; } }
.remote-pointer::before {
  content: '';
  position: absolute;
  left: -.35rem;
  top: -.35rem;
  width: .45rem;
  height: .45rem;
  background: var(--peer-color);
  border-radius: 50%;
}
.eraser-cursor { position: absolute; z-index: 5; border: 1px solid #47745b; border-radius: 50%; pointer-events: none; }
#page[data-tool="pen"], #page[data-tool="eraser"] { cursor: crosshair; }
#page[data-tool="eraser"]:has(.eraser-cursor:not([hidden])) { cursor: none; }
#page[data-tool="pen"] .element-block, #page[data-tool="eraser"] .element-block { pointer-events: none; }
.element-block {
  position: absolute;
  width: 35%;
  height: 10.77%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  border: 1px solid #d6d4c9;
  border-radius: .3rem;
  background: #fffefa;
  cursor: grab;
}
.element-block:active { cursor: grabbing; }
.element-block[data-remote-moving] { opacity: 0; }
.element-block:focus:not(:focus-visible), .element-block[data-selected]:focus { outline: none; }
.text-block { z-index: 2; }
.image-block { z-index: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #536151; font-size: .85rem; }
#page[data-tool="select"] [data-image-placeholder] { cursor: pointer; }
.image-upload {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
  padding: .25rem;
  border: 1px dashed #7f9584;
  border-radius: .3rem;
  background: #e7eee5f2;
  color: #315941;
  font-size: .85rem;
  text-align: center;
}
.remote-image { z-index: 0; }
.image-block img, .remote-block img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.remote-block:has(img) { padding: 0; }
#page:focus { outline: none; }
.selection-frame {
  position: absolute;
  z-index: 4;
  outline: 2px solid #47745b;
  pointer-events: none;
}
.resize-handle {
  position: absolute;
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  padding: 0;
  background: #e0eadc;
  pointer-events: auto;
  touch-action: none;
}
.resize-handle[data-corner="nw"] { top: -.5rem; left: -.5rem; cursor: nwse-resize; }
.resize-handle[data-corner="ne"] { top: -.5rem; right: -.5rem; cursor: nesw-resize; }
.resize-handle[data-corner="sw"] { bottom: -.5rem; left: -.5rem; cursor: nesw-resize; }
.resize-handle[data-corner="se"] { bottom: -.5rem; right: -.5rem; cursor: nwse-resize; }
.resize-handle[data-corner="w"], .resize-handle[data-corner="e"] {
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}
.resize-handle[data-corner="w"] { left: -.5rem; }
.resize-handle[data-corner="e"] { right: -.5rem; }
.selection-box {
  position: absolute;
  z-index: 4;
  border: 1px solid #47745b;
  background: #47745b20;
  pointer-events: none;
}
.block-text, .block-label {
  width: 100%;
  min-height: 0;
  border: 0;
  resize: none;
  background: transparent;
  color: inherit;
  padding: .45em .55em;
  line-height: 1.45;
}
.block-label { align-self: start; max-height: 100%; white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; }
