: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; }
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; }
.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-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; }
#add-image { padding-inline: .45rem; }
.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 { margin-bottom: .65rem; }
.eraser-options {
  margin-left: .1rem;
  padding-left: .55rem;
  border-left: 2px solid #becbbf;
}
.eraser-options[data-inactive] { visibility: hidden; }
.eraser-sizes[data-inactive] { visibility: hidden; }
.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[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 {
  z-index: 5;
  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;
}
.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; }
.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; }
