@font-face {
  font-family: 'Desk Note Title';
  src: url('sticky-note-invitation.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Desk Note Hand';
  src: url('sticky-note-hand.ttf') format('truetype');
  font-display: swap;
}

.sticky-note-dialog {
  --sheet-size: min(340px, calc(100vw - 36px), calc(100dvh - 116px));
  width: var(--sheet-size);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  outline: none;
  margin: auto;
  overflow: visible;
  color: #ffedce;
  background: transparent;
}

.sticky-note-dialog::backdrop { background: transparent; }
.sticky-note-dialog[data-view=history]::backdrop { background: #1b120b79; }
.sticky-note-dialog[data-lifting] > * { visibility: hidden; }

.sticky-note-paper {
  position: relative;
  width: var(--sheet-size);
  height: var(--sheet-size);
  padding: clamp(14px, 5dvh, 32px);
  color: #3c2a1d;
}

.sticky-note-writing {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: auto;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: clamp(22px, 5.7dvh, 31px)/1.35 'Desk Note Hand', 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
}

.sticky-note-writing::placeholder { color: #6b5034; opacity: 1; font: 600 .59em/1.2 'Desk Note Title', cursive; }
.sticky-note-reading-scroll {
  position: absolute;
  inset: 6.8% 5% 15.8% 7.6%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #9e834b transparent;
}
.sticky-note-reading-scroll::after {
  content: '';
  display: block;
  height: calc(100% + var(--sheet-size) * var(--sticky-scroll-lines, 0) * .086);
}
.sticky-note-reading-scroll:focus-visible { outline: 1px solid #71543a; outline-offset: 2px; }
.sticky-note-reading-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .sticky-note-dialog[open]:not([data-lifting]) :is(.sticky-note-writing, .sticky-note-actions, .sticky-note-reading-scroll) {
    animation: sticky-note-controls-in 180ms ease-out;
  }
}
@keyframes sticky-note-controls-in { from { opacity: 0; } to { opacity: 1; } }

.sticky-note-actions { display: flex; justify-content: center; gap: 8px; padding-top: 12px; }
.sticky-note-actions button, .sticky-note-history button {
  min-height: 40px;
  padding: 7px 16px;
  border: 1px solid #efdba75c;
  border-radius: 7px;
  background: #33251c;
  color: #f9ecd3;
  font-size: 15px;
}
.sticky-note-actions button[type=submit], .sticky-note-actions .sticky-note-tear { background: #edce86; color: #2c1d13; }
.sticky-note-actions button:disabled { opacity: .62; cursor: default; }
.sticky-note-status {
  position: absolute;
  top: 100%;
  width: 100%;
  margin: 6px 0 0;
  padding: 4px 8px;
  border-radius: 4px;
  background: #2a1a13;
  color: #fff0d7;
  font: 13px/1.4 system-ui, sans-serif;
  text-align: center;
}
.sticky-note-status:empty { visibility: hidden; }

.sticky-note-dialog[data-view=history] { width: min(620px, calc(100vw - 32px)); }
.sticky-note-dialog[data-view=owner-login] { width: min(420px, calc(100vw - 32px)); }
.sticky-note-owner-panel {
  padding: 22px;
  color: #f7e7ca;
  background: #32251c;
  border: 1px solid #ad8e6580;
  border-radius: 10px;
  box-shadow: 0 14px 50px #150d09b0;
}
.sticky-note-owner-panel h1 { margin: 0 0 8px; font-size: 19px; }
.sticky-note-owner-panel p { margin: 0 0 16px; }
.sticky-note-owner-panel label { display: grid; gap: 8px; font: 14px/1.5 system-ui, sans-serif; }
.sticky-note-owner-panel input {
  width: 100%;
  padding: 11px 12px;
  color: #33251d;
  background: #fff8ea;
  border: 1px solid #ad8e65;
  border-radius: 5px;
  font: inherit;
}
.sticky-note-owner-status { min-height: 1.4em; margin: 10px 0 !important; font: 13px/1.4 system-ui, sans-serif; }
.sticky-note-history {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(680px, calc(100dvh - 32px));
  overflow: hidden;
  background: #32251c;
  color: #f7e7ca;
  border: 1px solid #ad8e6580;
  border-radius: 10px;
  box-shadow: 0 14px 50px #150d09b0;
}
.sticky-note-history header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #ad8e6580;
}
.sticky-note-history h1 { margin: 0; font-size: 19px; font-weight: 600; }
.sticky-note-history-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 14px 16px; }
.sticky-note-history-status { margin: 0; }
.sticky-note-history-status:empty { display: none; }
.sticky-note-history ol { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; }
.sticky-note-history li { padding: 11px 13px; border-radius: 3px; background: #efdaa3; color: #3c2a1d; }
.sticky-note-history li p {
  margin: 0 0 7px;
  font: 19px/1.4 'Desk Note Hand', 'STKaiti', 'KaiTi', serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sticky-note-history li time, .sticky-note-history li span { font: 13px/1.5 system-ui, sans-serif; color: #604629; }
.sticky-note-history li span { margin-left: 10px; }
.sticky-note-history-next { display: block; margin: 12px auto 0; }
