@font-face {
  font-family: Newsreader;
  src: url('/assets/type/newsreader-latin-roman.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('/assets/type/courier-prime-regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Letter Script';
  src: url('/assets/hands/script.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Jane Austen';
  src: url('/assets/hands/austen.ttf') format('truetype');
  font-display: swap;
}

:root {
  color-scheme: light;
  --pine: #26342c;
  --ink: #26342c;
  --quiet: #596356;
  --line: #d9dbd0;
  --button-hover: #e8ebe0;
  --focus: #526f5b;
  --desk-base: #b9a68e;
  --stock: #f6f3e9;
  --paper-width: 710px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 100%;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #eceee6;
}
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.app-header {
  min-height: 63px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 58px);
  color: #fffdf4;
  background: #25292d;
  border-bottom: 1px solid #171a1d;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -.045em;
  text-decoration: none;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid #777c80;
  border-radius: 8px;
  background: #363b3f;
  color: #f3eddb;
}
.brand-domain { color: #c1c4c6; font-weight: 550; letter-spacing: -.03em; }
.brand-label { display: grid; line-height: 1; }
.brand-tagline {
  position: relative;
  top: 5px;
  color: #c1c4c6;
  font: 400 6px/10px 'Jane Austen', cursive;
  letter-spacing: 0;
  white-space: nowrap;
}
.app-header nav, .tray-actions { display: flex; align-items: center; gap: 10px; }
.app-header nav { margin-left: auto; }
.header-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: .875rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}
.app-header .header-link { color: #f1f2f2; }
.app-header button.header-link { border: 0; background: transparent; }
.app-header .header-link:hover { background: #41474c; }
.app-header :focus-visible { outline-color: #e2e6e9; }
[data-icon], .mini-icon { display: inline-grid; place-items: center; flex: none; }
.header-link svg, .mini-icon svg { width: 17px; height: 17px; }

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}
.workspace.app-open { grid-template-columns: minmax(0, 1fr) minmax(410px, 47%); }
.desk {
  position: relative;
  min-height: 0;
  overflow: auto;
  isolation: isolate;
  background:
    linear-gradient(126deg, #f1e6d53d 4%, #f5ebd811 52%, #5d4b371c 100%),
    var(--desk-base) url('/assets/cotton/ash-worktop.webp') center / cover no-repeat;
}
.controls {
  position: sticky;
  top: 0;
  z-index: 3;
  container-type: inline-size;
  display: flex;
  justify-content: center;
  padding: 23px 12px 0;
  pointer-events: none;
}
.toolbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px;
  border: 1px solid #a69e8b;
  border-top-color: #fefbf2;
  border-radius: 11px;
  background: #f9f7ed;
  box-shadow: 0 2px 3px #30291f2b, 0 8px 20px #382b1b20, inset 0 1px #fff;
  pointer-events: auto;
}
.instruments {
  display: flex;
  gap: 3px;
  padding: 2px;
  border: 1px solid #ddded1;
  border-radius: 7px;
  background: #edede3;
}
.instrument, .apps-button, .icon-button, .handwriting-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 35px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-size: .875rem;
  font-weight: 620;
  white-space: nowrap;
}
.instrument svg, .handwriting-summary svg { width: 17px; height: 17px; }
.instrument:hover:not(:disabled), .icon-button:hover:not(:disabled), .handwriting-summary:hover { background: var(--button-hover); }
.instrument[aria-pressed='true'] {
  color: #fffef3;
  background: #374d3e;
  border-color: #2b4134;
  box-shadow: 0 1px 2px #1f372a39, inset 0 1px #ffffff24;
}
.instrument[aria-pressed='true']:hover { background: #405944; }
.instrument-options { display: flex; align-items: center; gap: 3px; }
.paper-stock-controls { position: relative; display: inline-flex; align-items: center; gap: 3px; padding: 0 4px; border-left: 1px solid #ddded1; font-size: .78rem; white-space: nowrap; }
.paper-stock-controls label { color: #566154; }
.paper-stock-controls select, .paper-stock-controls button { max-width: 145px; min-height: 35px; border: 0; border-radius: 5px; background: transparent; color: inherit; font: inherit; }
.paper-stock-controls select:hover, .paper-stock-controls button:hover { background: var(--button-hover); }
.paper-samples summary { display: inline-flex; align-items: center; min-height: 35px; padding: 0 6px; border-radius: 5px; cursor: pointer; list-style: none; }
.paper-samples summary::-webkit-details-marker { display: none; }
.paper-samples summary:hover, .paper-samples[open] summary { background: var(--button-hover); }
.paper-samples-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: min(330px, calc(100vw - 30px)); padding: 10px; border: 1px solid #c8cabb; border-radius: 8px; background: #fbfaf2; box-shadow: 0 8px 22px #30291f38; white-space: normal; }
.paper-stock-controls .paper-sample { display: flex; min-width: 0; max-width: none; flex-direction: column; gap: 4px; padding: 4px; text-align: left; font-size: .7rem; line-height: 1.2; }
.paper-sample-image { display: block; width: 100%; height: 38px; border: 1px solid #bcb9a8; border-radius: 3px; background: #f6f3e9 center / cover; }
.paper-sample[aria-pressed='true'] .paper-sample-image { outline: 2px solid #4f6a55; outline-offset: 1px; }
.type-style { position: relative; }
.type-style select {
  min-height: 36px;
  padding: 0 24px 0 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  appearance: none;
  background: transparent;
  font-size: .875rem;
}
.type-style select:hover { background: var(--button-hover); }
.type-style span {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.type-style svg { width: 16px; height: 16px; }
.hand-select-wrap { position: relative; }
.hand-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  width: clamp(117px, 16vw, 165px);
  min-height: 41px;
  padding: 3px 7px;
  border: 1px solid #c5ceb9;
  border-radius: 6px;
  background: #f9fbf3;
  text-align: left;
}
.hand-select:hover, .hand-select[aria-expanded='true'] { background: #e9eddf; }
.hand-select svg, .hand-menu svg { width: 15px; height: 15px; flex: none; }
.hand-select .hand-font-name { padding: 0; font-family: inherit; font-size: .875rem; line-height: 1.3; }
.hand-font-name {
  display: block;
  min-width: 0;
  overflow-x: clip;
  padding-inline-start: clamp(2px, var(--hand-preview-left-overhang, 0px), .65em);
  padding-inline-end: clamp(2px, var(--hand-preview-right-overhang, 0px), .65em);
  font-family: 'Letter Script', cursive;
  font-size: var(--hand-preview-size, 1.45rem);
  line-height: max(1.5, var(--hand-preview-line-height, 0));
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hand-menu {
  position: absolute;
  z-index: 1;
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, calc(100vw - 24px));
  max-height: min(395px, calc(100dvh - 190px));
  overflow: auto;
  padding: 5px;
  border: 1px solid #b8bcab;
  border-radius: 9px;
  background: #fbfaf3;
  box-shadow: 0 10px 32px #2f2c2259, 0 2px 6px #2f2c2224;
}
.hand-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 4px 9px;
  border: 0;
  border-radius: 5px;
  background: none;
  text-align: left;
}
.hand-menu button:hover, .hand-menu button[aria-pressed='true'] { background: #e9eddf; }
.hand-menu :focus-visible { outline-offset: -2px; }
.hand-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.hand-menu-sample { flex: 0 0 3.6rem; width: 3.6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 2.15rem; text-align: center; }
.hand-menu-check { flex: 0 0 15px; width: 15px; }
.hand-menu button.hand-menu-create { min-height: 40px; margin-top: 5px; border-top: 1px solid #d9dfd3; border-radius: 0; color: #31583b; font-size: .85rem; }
.handwriting-guide {
  --serif: Newsreader, Georgia, serif;
  --sans: system-ui, sans-serif;
  border: 1px solid #c7ccbf;
  border-radius: 12px;
  background: #fdfffa;
  box-shadow: 0 18px 60px #1b251d55;
}
.handwriting-guide::backdrop { background: #101a1488; }
.handwriting-guide h2, .handwriting-guide h3, .handwriting-guide p { margin: 0; }
.handwriting-guide button { font-family: inherit; cursor: pointer; }
.handwriting-guide .handwriting-guide-close, .handwriting-guide .handwriting-guide-upload { border: 0; background: none; }
.handwriting-guide .handwriting-guide-primary { border: 0; }
.hand-menu .hand-font-name {
  padding-inline-start: max(2px, var(--hand-preview-left-overhang, 0px));
  padding-inline-end: max(2px, var(--hand-preview-right-overhang, 0px));
  font-size: var(--hand-preview-size, 1.65rem);
}
.handwriting-summary { cursor: pointer; list-style: none; }
.handwriting-summary::-webkit-details-marker { display: none; }
.handwriting-settings[open] .handwriting-summary { border-color: #c5ceb9; background: #e3eadc; }
.handwriting-controls {
  position: absolute;
  z-index: 1;
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 12px;
  width: min(312px, calc(100vw - 24px));
  max-height: calc(100dvh - 190px);
  overflow: auto;
  padding: 15px;
  border: 1px solid #b8bcab;
  border-radius: 9px;
  background: #fbfaf3;
  box-shadow: 0 10px 32px #2f2c2259, 0 2px 6px #2f2c2224;
  font-size: .875rem;
}
.handwriting-field { margin-bottom: -7px; font-weight: 600; }
.handwriting-controls .type-style select {
  width: 100%;
  min-height: 34px;
  padding-left: 9px;
  border-color: #d4d7c9;
  background: #f1f0e7;
}
.handwriting-controls .type-style span { right: 7px; }
.handwriting-ink-set { display: grid; gap: 6px; }
.handwriting-ink-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; }
#handwriting-ink-label { font-weight: 600; }
#handwriting-ink-scope, .handwriting-ink-help { color: var(--quiet); font-size: .75rem; }
.handwriting-blend-samples { display: grid; gap: 5px; color: var(--quiet); font-size: .75rem; }
.handwriting-blend-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.handwriting-blend-comparison > div { display: grid; gap: 3px; text-align: center; }
.handwriting-blend-swatch {
  display: grid;
  place-items: center;
  min-height: 38px;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #aa9576;
  border-radius: 4px;
  background: #c3ac89;
}
.handwriting-blend-swatch > span {
  color: var(--blend-sample-ink, #302d29);
  opacity: var(--blend-sample-opacity, 1);
  font: italic 1.4rem/1.2 Newsreader, Georgia, serif;
}
.handwriting-blend-multiply > span { mix-blend-mode: multiply; }
#handwriting-ink-name { color: #526350; font: italic .92rem Newsreader, Georgia, serif; text-align: right; }
.handwriting-ink-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 3px;
  padding: 4px;
  border: 1px solid #e2e5dc;
  border-radius: 6px;
  background: linear-gradient(#f8f8f3, #f1f2eb);
  box-shadow: inset 0 1px 3px #4251330c;
}
.handwriting-ink-swatches button {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 49px;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
}
.handwriting-ink-swatches button:hover { background: #e7ebe2; }
.handwriting-ink-swatches button[aria-pressed='true'] { border-color: #8ea490; background: #e5ece2; }
.handwriting-ink-swatches .ink-bottle {
  position: relative;
  width: 25px;
  height: 38px;
  filter: drop-shadow(0 2px 1px #27332635);
}
.handwriting-ink-swatches .ink-cap {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 5px;
  width: 15px;
  height: 9px;
  border: 1px solid #242a26;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #2c302d 0 2px, #50534b 2px 3px, #262c27 3px 4px);
}
.handwriting-ink-swatches .ink-glass {
  position: absolute;
  inset: 8px 0 0;
  border: 1px solid #263b32a6;
  border-radius: 4px 4px 5px 5px;
  background: linear-gradient(90deg, #ffffff55, transparent 21%, transparent 68%, #101a1738),
    linear-gradient(0deg, var(--color) 0 74%, #c2cfbb 75%, #eff4e2 100%);
  box-shadow: inset 1px 1px 1px #ffffffe0, inset -2px -2px 3px #13231a55;
}
.handwriting-ink-swatches .ink-bottle-label {
  position: absolute;
  inset: 10px 4px auto;
  height: 10px;
  border: 1px solid #c6bda3;
  border-radius: 1px;
  background: linear-gradient(#f7f3e6, #ded8c4);
}
.handwriting-ink-swatches .ink-bottle-label::after {
  content: '';
  position: absolute;
  inset: 2px 2px auto;
  height: 1px;
  background: var(--color);
  box-shadow: 0 2px 0 var(--color);
  opacity: .6;
}
.handwriting-color, .handwriting-range {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  row-gap: 3px;
  font-weight: 600;
}
.handwriting-color input {
  width: 40px;
  height: 28px;
  padding: 2px;
  border: 1px solid #d4d7c9;
  border-radius: 4px;
  background: #f1f0e7;
  cursor: pointer;
}
.handwriting-range output { color: var(--quiet); font-weight: 500; font-variant-numeric: tabular-nums; }
.handwriting-range input { grid-column: 1 / -1; width: 100%; margin: 0; accent-color: #49614c; }
#handwriting-full {
  min-height: 35px;
  padding: 5px 9px;
  border: 1px solid #c5ceb9;
  border-radius: 5px;
  background: #eff0e6;
  font-weight: 600;
  text-align: left;
}
#handwriting-full:hover { background: #e3eadc; }
#handwriting-copy-note { margin: 0; color: var(--quiet); font-size: .8125rem; line-height: 1.4; }
.apps-button {
  border-color: #d8dccf;
  padding: 0 8px;
  background: #eff0e6;
}
.apps-button:hover, .apps-button[aria-expanded='true'] { background: #dfe6d9; }
kbd {
  min-width: 1.35em;
  padding: .06em .32em;
  border: 1px solid #d4d7c9;
  border-radius: 4px;
  background: #faf9f1;
  font: .84rem 'Courier Prime', monospace;
  text-align: center;
}
.icon-button { min-width: 34px; padding: 0 5px; }
.icon-button[aria-pressed='true'] { border-color: #9dad99; background: #e3eadc; }
.ink-swatch {
  width: 29px;
  height: 35px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
}
.ink-swatch::before {
  content: '';
  display: block;
  width: 13px;
  height: 13px;
  margin: auto;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 1px 2px #0003;
}
.ink-swatch:hover, .ink-swatch[aria-pressed='true'] { border-color: #c7cbba; background: #ebece2; }

.paper-stage {
  position: relative;
  width: min(var(--paper-width), calc(100% - 46px));
  margin: 30px auto 44px;
}
.sheet {
  --sheet-gutter: clamp(23px, 7vw, 74px);
  --sheet-top: clamp(40px, 6vw, 69px);
  position: relative;
  isolation: isolate;
  min-height: max(clamp(620px, calc(100dvh - 221px), 865px), var(--paper-ink-height, 0px));
  padding: var(--sheet-top) var(--sheet-gutter) clamp(43px, 7vw, 78px);
  border: 1px solid #e5dfcb;
  border-radius: 2px 2px 4px 2px;
  color: #242b22;
  background-color: var(--stock);
  background-image: linear-gradient(119deg, #fffdf531, #f7f0db1c 86%), var(--sheet-stock-image, none);
  background-position: center top;
  background-size: 100% 100%, 100% auto;
  background-repeat: no-repeat, repeat-y;
  box-shadow:
    0 1px 1px #412d1852,
    3px 4px 5px #4b382746,
    12px 15px 22px -7px #48362661,
    -2px -2px 7px #f8f2d869,
    inset 0 1px #fffefa;
}
.sheet[data-paper-stock='ruled']::before, .sheet[data-paper-stock='grid']::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
}
.sheet[data-paper-stock='ruled']::before {
  background-image: linear-gradient(to right, transparent calc(var(--sheet-gutter) - 17px), rgba(190,102,100,.42) calc(var(--sheet-gutter) - 17px), rgba(190,102,100,.42) calc(var(--sheet-gutter) - 16px), transparent calc(var(--sheet-gutter) - 16px)), repeating-linear-gradient(to bottom, rgba(103,144,169,.38) 0 1px, transparent 1px var(--paper-ruling-spacing, 40px));
  background-position: 0 0, 0 var(--paper-ruling-offset, 0px);
}
.sheet[data-paper-stock='grid']::before {
  background-image: repeating-linear-gradient(to right, rgba(95,130,118,.31) 0 1px, transparent 1px calc(var(--paper-ruling-spacing, 40px) / 2)), repeating-linear-gradient(to bottom, rgba(95,130,118,.31) 0 1px, transparent 1px calc(var(--paper-ruling-spacing, 40px) / 2));
  background-position: var(--sheet-gutter) 0, 0 var(--paper-ruling-offset, 0px);
}
.sheet-content { width: 100%; }
.sheet-heading { position: relative; display: flow-root; border-bottom: 1px solid #a6ad976e; }
.sheet-heading:focus-within { border-bottom-color: #73886c; }
.sheet-title, .sheet-text {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  caret-color: #365740;
}
.sheet-title, .sheet-title-preview {
  padding-bottom: 11px;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2.1rem, 5vw, 3.05rem);
  line-height: 1.15;
  letter-spacing: -.034em;
}
.sheet-title-preview { overflow: hidden; white-space: nowrap; }
.sheet-title::placeholder { color: #4a5141; opacity: 1; }
.sheet-writing { position: relative; margin-top: 18px; }
.sheet-text, .sheet-text-preview {
  overflow: hidden;
  font-family: var(--typeset-font, Newsreader), Georgia, serif;
  font-size: var(--typeset-size, 1.34rem);
  line-height: var(--typeset-line-height, 1.62);
  overflow-wrap: break-word;
  white-space: pre-wrap;
}
.sheet-text {
  min-height: clamp(398px, calc(100dvh - 422px), 630px);
  resize: none;
  field-sizing: content;
}
.sheet-title-preview, .sheet-text-preview {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sheet-text::placeholder { color: #686b5c; opacity: 1; }
.sheet-title:focus-visible, .sheet-text:focus-visible { outline: none; }
.sheet[data-type-style='typewriter'] .sheet-text {
  font-family: var(--typeset-font, 'Courier Prime'), 'Courier New', monospace;
  font-size: var(--typeset-size, 1.16rem);
}
.sheet[data-type-style='typewriter'] .sheet-title {
  font-family: 'Courier Prime', 'Courier New', monospace;
}
.sheet[data-type-style='handwriting'] :is(.sheet-title, .sheet-title-preview, .sheet-text, .sheet-text-preview) {
  padding-inline-start: max(.22em, var(--handwriting-left-overhang, 0px));
  padding-inline-end: max(.22em, var(--handwriting-right-overhang, 0px));
  font-family: var(--handwriting-font, 'Letter Script'), var(--handwriting-fallbacks, 'Letter Script', cursive, serif);
  font-weight: 400;
  letter-spacing: normal;
  font-variant-ligatures: common-ligatures contextual;
}
.sheet[data-type-style='handwriting'] :is(.sheet-title, .sheet-text) {
  /* Use the existing sheet gutter for glyph overhang instead of indenting text. */
  margin-inline-start: calc(0px - min(max(.22em, var(--handwriting-left-overhang, 0px)), var(--sheet-gutter)));
  width: calc(100% + min(max(.22em, var(--handwriting-left-overhang, 0px)), var(--sheet-gutter)) + min(max(.22em, var(--handwriting-right-overhang, 0px)), var(--sheet-gutter)));
}
.sheet[data-type-style='handwriting'] :is(.sheet-title-preview, .sheet-text-preview) {
  inset-inline-start: calc(0px - min(max(.22em, var(--handwriting-left-overhang, 0px)), var(--sheet-gutter)));
  inset-inline-end: calc(0px - min(max(.22em, var(--handwriting-right-overhang, 0px)), var(--sheet-gutter)));
}
.sheet[data-type-style='handwriting'] :is(.sheet-title, .sheet-title-preview) {
  padding-block: .16em 11px;
  font-size: var(--handwriting-title-size, clamp(1.85rem, 4.4vw, 2.9rem));
  line-height: max(1.36em, var(--handwriting-title-line-min, 0px));
}
.sheet[data-type-style='handwriting'] .sheet-title {
  margin-block-start: calc(0px - var(--handwriting-title-trim-top, 0px));
  margin-block-end: calc(0px - var(--handwriting-title-trim-bottom, 0px));
}
.sheet[data-type-style='handwriting'] .sheet-title-preview {
  inset-block-start: calc(0px - var(--handwriting-title-trim-top, 0px));
  inset-block-end: calc(0px - var(--handwriting-title-trim-bottom, 0px));
}
.sheet[data-type-style='handwriting'] :is(.sheet-text, .sheet-text-preview) {
  padding-block: .16em .2em;
  font-size: var(--handwriting-size, 1.85rem);
  line-height: var(--handwriting-spacing, 1.45em);
}
.sheet[data-type-style='handwriting'] :is(.sheet-title, .sheet-text) {
  color: var(--handwriting-ink, #302d29);
  color: color-mix(in srgb, var(--handwriting-ink, #302d29) calc(var(--handwriting-opacity, 1) * 100%), transparent);
  mix-blend-mode: var(--handwriting-blend, multiply);
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .sheet[data-ink-title-preview] .sheet-title-preview, .sheet[data-ink-preview] .sheet-text-preview {
    display: block;
    color: transparent;
    background-image: var(--handwriting-texture);
    -webkit-background-clip: text;
    background-clip: text;
    opacity: var(--handwriting-opacity, 1);
    mix-blend-mode: var(--handwriting-blend, multiply);
  }
  .sheet[data-ink-title-preview] .sheet-title, .sheet[data-ink-preview] .sheet-text {
    position: relative;
    color: transparent;
    mix-blend-mode: normal;
  }
  .sheet[data-ink-preview] .sheet-text-preview[data-colored] {
    background-color: var(--handwriting-ink);
    background-image: var(--handwriting-color-layer);
    background-repeat: no-repeat;
    background-size: 100% var(--handwriting-color-height);
    background-position: left var(--handwriting-color-top);
    -webkit-mask-image: var(--handwriting-texture);
    mask-image: var(--handwriting-texture);
    mask-mode: alpha;
  }
  .sheet[data-ink-title-preview] .sheet-title::selection, .sheet[data-ink-preview] .sheet-text::selection {
    background: #a0b19866;
    color: transparent;
  }
}
@media (forced-colors: active) {
  .sheet[data-ink-title-preview] .sheet-title-preview, .sheet[data-ink-preview] .sheet-text-preview { display: none; }
  .sheet[data-type-style='handwriting'] :is(.sheet-title, .sheet-text) { color: CanvasText; mix-blend-mode: normal; }
  .sheet[data-ink-title-preview] .sheet-title::selection, .sheet[data-ink-preview] .sheet-text::selection {
    background: Highlight;
    color: HighlightText;
  }
}
.sheet-ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.sheet-ink[data-mode='eraser'] { cursor: cell; }
.desk-pen {
  position: absolute;
  top: 110px;
  left: calc(100% + 53px);
  width: auto;
  height: clamp(205px, 34vh, 322px);
  transform: rotate(16deg);
  filter: drop-shadow(5px 5px 4px #3f30247d);
  pointer-events: none;
  user-select: none;
}

.command-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 2;
  width: min(352px, calc(100vw - 24px));
  padding: 7px;
  border: 1px solid #b8bcab;
  border-radius: 9px;
  background: #fbfaf3;
  box-shadow: 0 10px 32px #2f2c2259, 0 2px 6px #2f2c2224;
}
.command-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  color: var(--quiet);
  background: #edeee4;
  border-radius: 5px;
}
.command-panel[data-source='editor'] .command-search { display: none; }
.command-search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.command-search input {
  width: 100%;
  padding: 9px 0;
  border: 0;
  outline: none;
  background: transparent;
}
.command-list { max-height: min(370px, 53dvh); overflow: auto; padding: 5px 0 0; }
.command-empty { margin: 9px; color: var(--quiet); font-size: .875rem; }
.paper-command {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 7px;
  border: 0;
  border-radius: 5px;
  text-align: left;
  background: transparent;
}
.paper-command:hover, .paper-command[aria-selected='true'] { background: #e6ebdf; }
.paper-command-icon {
  display: grid;
  place-items: center;
  flex: 0 0 31px;
  height: 31px;
  border: 1px solid #d4dacb;
  border-radius: 6px;
  background: #f6f7ef;
  color: #495d4c;
}
.paper-command-copy { display: grid; gap: 2px; flex: 1; min-width: 0; }
.paper-command-name { font-size: .875rem; font-weight: 650; }
.paper-command-detail { color: var(--quiet); font-size: .8125rem; }
.paper-command-shortcut { margin-left: auto; flex: none; }

.app-tray {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-left: 1px solid #a3ab99;
  background: #f7f7ef;
  box-shadow: -5px 0 16px #352c2426;
  z-index: 5;
}
.tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 5px 13px 5px 18px;
  border-bottom: 1px solid var(--line);
}
.tray-header h2 { margin: 0; font-size: 1rem; font-weight: 650; }
.tray-header .header-link:hover { background: var(--button-hover); }
.app-content, .app-content iframe { width: 100%; height: 100%; min-height: 0; }
.app-content iframe { display: block; border: 0; }
.app-content.read-aloud { overflow: auto; padding: 22px; }
.app-content.read-aloud p { margin: 0 0 12px; }

.desk-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 42px;
  gap: 12px;
  padding: 0 clamp(13px, 4vw, 58px);
  border-top: 1px solid #d2d6c6;
  background: #f1f2e9;
  color: #4c584d;
  font-size: .8125rem;
}
#desk-hint { display: flex; align-items: center; gap: 5px; }
.save-status { display: inline-flex; align-items: center; justify-self: end; gap: 6px; text-align: right; }
.save-status svg { width: 16px; height: 16px; }
.save-status[data-error='true'] { color: #872d2d; }
.no-script { position: fixed; bottom: 44px; left: 16px; padding: 10px; background: #fff8ed; }

#share-paper { border: 0; background: transparent; }
#share-paper:hover { background: #41474c; }
#paper-permalink {
  width: min(470px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid #c8cebd;
  border-radius: 8px;
  background: #f8f9f2;
  color: #2b342d;
}
#paper-permalink::backdrop { background: #25292d70; }
.paper-permalink-heading, .paper-link-input { display: flex; align-items: center; gap: 8px; }
.paper-permalink-heading { justify-content: space-between; }
.paper-permalink-heading h2 { margin: 0; font-size: 1.2rem; }
.paper-link-action { padding: 7px 12px; border: 1px solid #bdc5b4; border-radius: 5px; background: #eef0e8; white-space: nowrap; }
.paper-link-action:hover:enabled { background: #e4e9dc; }
.paper-link-input { flex-wrap: wrap; margin-top: 5px; }
.paper-link-input input {
  flex: 1 1 170px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #bdc5b4;
  border-radius: 5px;
  background: #fffefa;
  font-size: .875rem;
}
#paper-share-status:empty { display: none; }
#paper-sheets-dialog { max-width: min(32rem, calc(100% - 32px)); width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 24px; color: var(--ink); background: #fffdf7; }
#paper-sheets-dialog::backdrop { background: #1c231e80; }
#paper-sheets-dialog p { font-size: 14px; color: var(--quiet); }
#paper-sheets-list { display: grid; gap: 6px; max-height: 40vh; overflow: auto; margin: 16px 0; }
.paper-sheet-item { display: grid; gap: 2px; width: 100%; padding: 10px; text-align: left; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.paper-sheet-item span { color: var(--quiet); font-size: 12px; }
#paper-sheets-status:empty { display: none; }
.paper-load-error { padding: 20px; text-align: center; }
body[data-paper-snapshot] :is(.controls, #background-menu, #open-paper-studio, #open-writing-desk, #desk-hint, [data-paper-edit], #paper-share-description) { display: none !important; }
.app-header .header-link > .paper-share-label { display: inline; }

@media (max-width: 1040px) {
  .desk-pen { display: none; }
}
.workspace.app-open .desk-pen { display: none; }

@media (max-width: 820px) {
  .workspace.app-open { grid-template-columns: minmax(0, 1fr); }
  .app-tray { position: absolute; inset: 0; border-left: 0; }
}

@container (max-width: 710px) {
  .toolbox:has(#handwriting-options:not([hidden])) { flex-wrap: wrap; justify-content: center; }
  #handwriting-options { order: 1; width: 100%; justify-content: center; }
}

@container (max-width: 580px) {
  .toolbox:has(.pen-options:not([hidden])) { flex-wrap: wrap; justify-content: center; }
  .pen-options { order: 1; width: 100%; justify-content: center; }
}

@container (max-width: 448px) {
  .toolbox { gap: 5px; flex-wrap: wrap; justify-content: center; }
  .instrument > span:first-child { display: none; }
  .instrument-options { order: 1; width: 100%; justify-content: center; }
}

@media (max-width: 1100px) {
  .app-header { position: relative; }
  .app-header nav { gap: 6px; }
  .app-header .header-link { padding-inline: 7px; gap: 6px; }
  .app-header :is(#background-menu > summary, #open-paper-studio, #app-directory) { width: 38px; gap: 0; justify-content: center; font-size: 0; }
  .app-header #background-menu { position: static; }
  .app-header #background-menu .background-menu-panel { top: calc(100% + 4px); right: 12px; }
}
@media (max-width: 750px) {
  .app-header { padding-inline: 12px; gap: 5px; }
  .app-header nav { gap: 3px; }
  .app-header :is(.header-link, #background-menu > summary) { width: auto; min-width: 31px; padding-inline: 7px; gap: 0; justify-content: center; font-size: 0; }
  .app-header .header-link > span { display: inline-grid; }
}
@media (max-width: 545px) {
  .app-header { min-height: 55px; }
  .controls { padding-top: 14px; }
  .paper-stage { width: calc(100% - 24px); margin-top: 20px; }
  .sheet { min-height: max(560px, calc(100dvh - 178px), var(--paper-ink-height, 0px)); }
  .sheet-text { min-height: max(390px, calc(100dvh - 337px)); }
  .desk-footer { grid-template-columns: auto minmax(max-content, 1fr) auto; gap: 8px; }
  #desk-hint { justify-self: center; }
  .save-status > span:first-child { display: none; }
}
@media (max-width: 405px) { .brand-domain { display: none; } }
@media (max-width: 365px) {
  .instrument { padding-inline: 6px; }
  .apps-button .mini-icon, .apps-button kbd { display: none; }
  .type-style select { padding-left: 4px; }
  .desk-footer { font-size: .75rem; }
}
@media (max-width: 360px) {
  body:not([data-paper-snapshot]) .app-header { flex-wrap: wrap; gap: 2px; padding: 5px 8px; }
  body:not([data-paper-snapshot]) .app-header nav { width: 100%; margin-left: 0; justify-content: space-between; gap: 0; }
  body:not([data-paper-snapshot]) .app-header :is(.header-link, #background-menu > summary) { min-width: 40px; min-height: 40px; }
}
