:root {
  color-scheme: dark;
  font-family: "Inter", system-ui, sans-serif;
  background: #151719;
  color: #f2f3f4;
  --surface: #202326;
  --surface-deep: #17191b;
  --line: #444a50;
  --muted: #b9c0c7;
  --orange: #ff9c53;
  --hot: #ffab70;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
.masthead {
  border-bottom: 1px solid #a75a36;
  background:
    linear-gradient(100deg, #292d30, #1a1d20 58%, #332922),
    #202326;
  position: relative;
  overflow: hidden;
}
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, #fff1 0, #fff1 1px, transparent 1px, transparent 4px);
  opacity: .2;
  pointer-events: none;
}
.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .65rem;
  max-width: 82rem;
  margin: auto;
  padding: clamp(1.15rem, 4vw, 2.4rem) clamp(1rem, 4vw, 3rem);
}
.brand img { width: clamp(3.15rem, 9vw, 4.75rem); height: auto; }
.brand p { margin: .75rem 0 0; color: var(--orange); font-size: clamp(.8rem, 2.2vw, 1rem); font-weight: 650; line-height: 1.5; }
h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.8rem); line-height: .95; letter-spacing: .1em; font-weight: 850; }
h2 { margin: 0 0 1rem; font-size: clamp(1.25rem, 3vw, 1.65rem); letter-spacing: -.02em; }
main {
  display: grid;
  grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
  gap: clamp(.8rem, 3vw, 1.6rem);
  max-width: 82rem;
  margin: auto;
  padding: clamp(.8rem, 3vw, 2rem) clamp(.8rem, 4vw, 3rem) 3rem;
}
aside, section {
  min-width: 0;
  padding: clamp(.9rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
}
aside { align-self: start; }
.workspace { display: grid; align-content: start; gap: 1rem; min-width: 0; }
#upload { order: -1; }
.workspace:has(#upload:not([hidden])) .writing:has(#editor[hidden]) { display: none; }
.start-actions, .page-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.start-actions > button { flex: 1 1 auto; }
#new-note, #sync-pdf, #apply-crop, #editor button { background: var(--orange); color: #1d1410; border-color: var(--orange); }
button, input, textarea, summary { font: inherit; }
button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid #596168;
  border-radius: .6rem;
  padding: .55rem .85rem;
  background: #2b3034;
  color: inherit;
  font-weight: 680;
}
button:hover:not(:disabled) { filter: brightness(1.17); }
button:disabled { opacity: .5; cursor: default; }
button[aria-expanded="true"], li button[aria-current="true"] { border-color: var(--orange); color: var(--hot); }
#my-documents {
  margin-block: 1rem;
  padding: .15rem .65rem .3rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface-deep);
}
summary { min-height: 44px; padding: .65rem .1rem; cursor: pointer; font-weight: 700; }
#my-documents button { margin-block: .2rem .4rem; }
#synced-pdfs a { display: block; color: var(--hot); overflow-wrap: anywhere; padding-block: .45rem; }
.library-heading { color: var(--muted); font-size: .76rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; margin: .4rem 0 .65rem; }
ul { margin: 0; padding: 0; list-style: none; }
#notes li + li { margin-top: .45rem; }
#notes button { width: 100%; text-align: left; overflow-wrap: anywhere; }
#empty {
  min-height: clamp(12rem, 28vw, 24rem);
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}
#empty[hidden] { display: none; }
#empty h2 { margin: .85rem 0 .2rem; }
#empty p { max-width: 28ch; color: var(--muted); }
.paper-mark {
  width: 3rem;
  height: 3.8rem;
  border: 1px solid #b8754b;
  border-radius: .35rem .75rem .35rem .35rem;
  background: repeating-linear-gradient(to bottom, #fda76d75 0 1px, transparent 1px 8px) center / 52% 38% no-repeat, #2e2926;
  transform: rotate(-8deg);
}
label { display: block; margin-bottom: .4rem; font-weight: 650; }
input, textarea {
  width: 100%;
  border: 1px solid #5b6269;
  border-radius: .6rem;
  background: var(--surface-deep);
  color: inherit;
  padding: .75rem;
  margin-bottom: 1rem;
}
textarea { min-height: 18rem; resize: vertical; line-height: 1.6; }
:focus-visible { outline: 2px solid var(--hot); outline-offset: 3px; }
[role="status"] { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
[role="status"]:empty { display: none; }
#pages { padding-inline-start: 1.55rem; }
#pages li { padding: .75rem .2rem 1rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#pages li::marker { color: var(--hot); font-weight: 750; }
#pages :is(img, canvas) {
  display: block;
  max-width: 100%;
  max-height: 20rem;
  margin-block: .6rem;
  border-radius: .35rem;
  background: white;
  object-fit: contain;
}
#crop-dialog {
  width: min(36rem, calc(100% - 1.5rem));
  max-height: 90vh;
  padding: clamp(.85rem, 3vw, 1.5rem);
  background: var(--surface);
  color: inherit;
  border: 1px solid #77706b;
  border-radius: 1rem;
}
#crop-dialog::backdrop { background: #090a0cbd; }
#crop-preview { position: relative; width: fit-content; overflow: hidden; margin: auto; }
#crop-image { display: block; max-width: 100%; max-height: 38vh; }
#crop-outline { position: absolute; border: 2px solid var(--orange); box-shadow: 0 0 0 100vmax #0009; pointer-events: none; }
#crop-edges { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; margin-top: .8rem; }
#crop-edges input { display: block; min-height: 32px; padding: 0; margin: .15rem 0; accent-color: var(--orange); }
@media (max-width: 41rem) {
  main { grid-template-columns: minmax(0, 1fr); }
  .start-actions > button { flex: 1 1 7rem; }
  aside { padding-bottom: .85rem; }
}

/* SCRIBE's orange and brushed-silver hardware treatment. */
body {
  background: radial-gradient(ellipse at 50% 15%, #26282a, transparent 57%), #101214;
}
.masthead {
  background:
    radial-gradient(ellipse at 50% 10%, #9a491e55, transparent 52%),
    linear-gradient(#ffffff07, transparent),
    #171a1d;
  border-bottom: 1px solid #815637;
}
.masthead::before {
  background:
    repeating-linear-gradient(90deg, #a9b3bd22 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, #a9b3bd22 0 1px, transparent 1px 32px);
  mask-image: radial-gradient(ellipse, transparent 14%, #000 75%);
  opacity: .55;
}
.masthead::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  translate: -50%;
  width: min(55%, 22rem);
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff883b, #ffbc88, #ff883b, transparent);
  box-shadow: 0 0 18px #ff7e39a0;
  pointer-events: none;
}
.brand { gap: .9rem; padding-block: clamp(1.5rem, 5vw, 3rem); }
.emblem {
  display: grid;
  place-items: center;
  width: clamp(4.5rem, 13vw, 6rem);
  aspect-ratio: 1;
  border-radius: 1.3rem;
  border: 1px solid #7e858b;
  background: linear-gradient(145deg, #373b3e, #17191b 58%, #25201c);
  box-shadow: inset 0 1px #cdd3d450, 0 7px 18px #0009, 0 0 28px #ed78372b;
}
.brand img { width: 90%; }
.brand h1 {
  font-family: "Archivo Black", "Arial Black", system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(2.25rem, 10vw, 5.2rem);
  letter-spacing: .13em;
  padding-inline-start: .13em;
  color: #f0f1f2;
  background: linear-gradient(172deg, #fff 14%, #c5ccd1 55%, #f2f4f5 58%, #aeb7be 100%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 2px #000a);
}
.brand p { color: #d0d5d9; max-width: 31rem; }
.brand p b { color: var(--hot); }
aside, section {
  background: linear-gradient(155deg, #2c3034, #1b1e21 62%);
  border-color: #51585e;
  border-radius: .85rem;
  box-shadow: 0 10px 24px #0003, inset 0 1px #ffffff12;
}
.start-actions { gap: .5rem; }
.start-actions > button { min-height: 50px; }
.start-actions span { font-size: 1.2em; margin-inline-end: .15em; }
#new-note {
  border-color: #ffab70;
  background: linear-gradient(165deg, #ffb77e, #f48137);
  box-shadow: inset 0 1px #fff6, 0 3px 12px #ff79343a;
}
#upload-note { background: linear-gradient(160deg, #3d444a, #282c30); }
#upload-note span { color: var(--hot); }
#empty {
  border-radius: .55rem;
  background: radial-gradient(ellipse at center, #ce733918, transparent 65%);
}
.paper-mark {
  border-color: #d78857;
  box-shadow: 5px 5px 0 #6f4935, 9px 9px 0 #463830, 0 0 28px #ff822936;
}
@media (forced-colors: active) {
  .brand h1 { -webkit-text-fill-color: currentColor; }
}

/* A paper workspace inside the dark SCRIBE frame. */
.masthead { border-top: 4px solid #f48242; }
.brand { padding-block: clamp(.95rem, 3.6vw, 1.8rem); gap: .65rem; }
.emblem { width: clamp(3.6rem, 11vw, 4.9rem); border-radius: 1rem; }
.brand h1 { font-size: clamp(2.1rem, 8.5vw, 4.25rem); }
.brand p { margin-top: .5rem; }
aside { border-top: 2px solid #ef8c53; }
.writing {
  color-scheme: light;
  color: #252321;
  background: #f5efe4;
  border-color: #e0cdb4;
  border-top: 4px solid #ef8c53;
  box-shadow: 0 18px 34px #0006;
}
.writing #empty {
  min-height: clamp(11rem, 23vw, 20rem);
  background:
    linear-gradient(90deg, transparent 1.6rem, #de936d60 1.6rem 1.65rem, transparent 1.65rem),
    repeating-linear-gradient(#f5efe4 0 1.72rem, #d7cbbb 1.72rem 1.76rem);
  border: 1px solid #e3d7c7;
  padding-inline: 1.75rem;
}
.writing #empty p, .writing #status { color: #584c43; }
.writing .paper-mark {
  border-color: #a94c24;
  background: repeating-linear-gradient(to bottom, #a94c24 0 1px, transparent 1px 7px) center / 52% 38% no-repeat, #fce1c8;
  box-shadow: 4px 4px 0 #dfae8d, 8px 8px 0 #e8cab2;
}
.writing :is(input, textarea) { background: #fffcf6; border-color: #a49888; }
.writing :focus-visible { outline-color: #a74722; }
.writing .secondary { background: #f5efe4; color: #422e21; border-color: #a49888; }
#upload { border-top: 3px solid #ff9c53; }
#upload .secondary, #crop-dialog .secondary { background: transparent; }

#paper-template, #note-font {
  display: block;
  width: min(100%, 18rem);
  min-height: 44px;
  margin-bottom: 1rem;
  padding: .55rem .75rem;
  font: inherit;
  color: inherit;
  background: #fffcf6;
  border: 1px solid #a49888;
  border-radius: .6rem;
}
#body[data-template="college"] {
  --rule-gap: 1.65rem;
  line-height: var(--rule-gap);
  padding-inline-start: 2.25rem;
  background-image:
    linear-gradient(90deg, transparent 1.6rem, #b8524e80 1.6rem 1.66rem, transparent 1.66rem),
    repeating-linear-gradient(transparent 0 calc(var(--rule-gap) - 1px), #8099ad66 calc(var(--rule-gap) - 1px) var(--rule-gap));
  background-position: 0 0, 0 .65rem;
  background-attachment: local;
}
#body[data-template="dot-grid"] {
  background-image: radial-gradient(circle, #7c746b85 1px, transparent 1.3px);
  background-size: 1.15rem 1.15rem;
  background-attachment: local;
}

#pdf-feedback:has(#pdf-result:not(:empty)) {
  background: #20272d;
  border: 1px solid #677785;
  border-inline-start: .3rem solid #9fb5c8;
  border-radius: .65rem;
  margin-block-start: 1rem;
  padding: .9rem 1rem;
}
#pdf-feedback:has([data-state="saved"]) { background: #192f27; border-color: #79bd9b; }
#pdf-feedback:has([data-state="error"]) { background: #3c2421; border-color: #f5a38d; }
#pdf-feedback { margin-block-end: .9rem; }
#pdf-feedback:not(:has(#pdf-result:not(:empty))) { margin: 0; }
#pdf-result { margin: 0; color: #f2f3f4; font-size: 1.1rem; font-weight: 750; }
#show-documents { margin-block-start: .7rem; }

@font-face {
  font-family: "Dancing Script";
  src: url("https://fonts.gstatic.com/s/dancingscript/v29/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BAyo3Sup8.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
.note-format {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr));
  gap: .75rem;
}
#editor [data-font="serif"] { font-family: Georgia, "Times New Roman", serif; }
#editor [data-font="mono"] { font-family: "Courier New", ui-monospace, monospace; }
#editor [data-font="script"] {
  font-family: "Dancing Script", "Segoe Script", "Apple Chancery", cursive;
  font-size: 1.25rem;
  font-weight: 500;
}

.note-mode { margin-block: 0 .9rem; }
#editor .note-mode button[aria-pressed="false"] { background: #fffcf6; border-color: #a49888; }
#note-ink {
  display: block;
  width: 100%;
  height: auto;
  background-color: #fffcf6;
  outline: 1px solid #a49888;
  border-radius: .55rem;
  margin-bottom: .9rem;
  touch-action: none;
  cursor: crosshair;
}
#note-ink[data-template="dot-grid"] {
  background-image: radial-gradient(circle, #7c746b85 1px, transparent 1.3px);
  background-size: 2.5% 3.6364%;
}
#note-ink[data-template="college"] {
  background-image: repeating-linear-gradient(transparent 0 4.8%, #8099ad66 4.8% 5%);
}
#note-saved:not(:empty) {
  padding: .75rem;
  border: 1px solid #79bd9b;
  border-radius: .6rem;
  background: #192f27;
  color: #f2f3f4;
  font-weight: 700;
  overflow-wrap: anywhere;
}
#local-save-notice { color: var(--muted); font-size: .9rem; }
#local-save-notice a { color: var(--hot); }

.document-group { border-top: 1px solid var(--line); padding-block: .8rem; }
.document-group > .library-heading { margin-top: 0; }
