:root {
  color-scheme: light;
  --ink: #38283b;
  --muted: #6d5e6e;
  --accent: #56347d;
  --accent-hover: #684495;
  --canvas: #f6f0e8;
  --surface: #fbf8f1;
  --line: #e6ded5;
  --lavender: #e8dff7;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.5 var(--sans); color: var(--ink); background: var(--canvas); }
h1, h2, p { margin: 0; }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #7954aa; outline-offset: 4px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.stage {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(392px, 1fr);
  align-items: center;
  gap: clamp(60px, 9vw, 134px);
  padding: 32px max(48px, calc((100vw - 1080px) / 2));
}
.stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 48%;
  border-left: 1px solid #dfd2ed;
  background-color: #ebe1f6;
  background-image: radial-gradient(#b8a0d04f 1px, transparent 1px);
  background-size: 19px 19px;
}
.intro { align-self: center; display: grid; justify-items: start; }
.intro-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 40px; font-size: 13px; color: var(--muted);
}
.intro-brand b { font-weight: 750; color: var(--ink); font-size: 21px; letter-spacing: .04em; }
.intro-brand span { border-left: 1px solid #cfc1cf; padding-left: 12px; }
.intro-title {
  font: 800 clamp(59px, 6.4vw, 91px)/1.12 var(--serif);
  letter-spacing: -.085em;
}
.intro-title span { color: var(--accent); }
.intro-copy { margin-top: 22px; color: var(--muted); font-size: 16px; }
.intro-art {
  display: block; width: 145px; height: 145px;
  margin: 33px 0 35px 6px; object-fit: cover;
  border: 5px solid #fff9eb; border-radius: 25px;
  box-shadow: 0 8px 0 -2px #d6c5e4, 0 14px 22px #4d32631b;
  transform: rotate(-7deg);
}
.journey {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  list-style: none; padding: 0; margin: 0;
  font-size: 12px; color: var(--muted);
}
.journey li { display: inline-flex; align-items: center; gap: 9px; }
.journey li:not(:last-child)::after { content: "→"; color: #806c87; }
.journey span { padding: 4px 8px; border-radius: 999px; }
.journey [aria-current="step"] { background: #eadcf1; color: #51316e; font-weight: 650; }

.device {
  position: relative;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  width: min(100%, 416px);
  height: min(756px, calc(100dvh - 64px));
  min-height: 570px;
  justify-self: center;
  border: 1px solid #aa98b7;
  border-radius: 38px;
  padding: 8px;
  background: #fffdf9;
  box-shadow: 0 18px 50px #5e3c7826, 0 4px 9px #58446c17;
}
.app {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 30px;
  background: var(--surface);
}
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 66px;
  border-bottom: 1px solid var(--line);
  background: #fffdf7;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 750; letter-spacing: .06em; }
.brand img { width: 29px; height: 29px; border-radius: 9px; }
.icon-button {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent;
}
.icon-button:hover { background: #f0e8f5; }
.back { position: absolute; left: 12px; }
.organize {
  position: absolute; right: 14px; min-height: 44px; min-width: 54px;
  padding: 0 8px; border: 0; border-radius: 11px; background: transparent;
  color: var(--accent); font-size: 13px; font-weight: 650;
}
.organize:hover, [data-organizing] .organize { background: #f0e8f5; }
.icon { display: inline-block; width: 20px; height: 20px; flex: none; position: relative; }
.arrow::before { content: ""; position: absolute; inset: 9px 2px auto 3px; height: 2px; background: currentColor; border-radius: 9px; }
.arrow::after { content: ""; position: absolute; width: 8px; height: 8px; left: 3px; top: 6px; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(45deg); }
.plus::before, .plus::after { content: ""; position: absolute; inset: 9px 3px auto; height: 2px; border-radius: 4px; background: currentColor; }
.plus::after { transform: rotate(90deg); }
.close-mark::before, .close-mark::after { content: ""; position: absolute; inset: 9px 3px auto; height: 2px; border-radius: 4px; background: currentColor; transform: rotate(45deg); }
.close-mark::after { transform: rotate(-45deg); }
.plane { background: currentColor; clip-path: polygon(5% 41%, 95% 5%, 72% 93%, 50% 66%, 40% 82%, 33% 56%, 76% 24%, 26% 53%); }

.screen {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cfbfdc transparent;
  padding: 28px 24px 22px;
}
.screen[data-view="wall"] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 11%;
  overflow: hidden;
  padding-bottom: 0;
  background: #fff0d3 var(--wall-art, url("sticky-note-wall.png")) center bottom / 100% 100% no-repeat;
}
.screen-heading { margin-bottom: 22px; }
.screen-heading h2 { font: 800 36px/1.22 var(--serif); letter-spacing: -.065em; }
.screen-heading p { margin-top: 8px; font-size: 13px; color: var(--muted); }
.wall-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.screen .wall-heading h2 { font: 700 28px/1.25 var(--sans); letter-spacing: .02em; }
.wall-heading p { margin-top: 0; text-align: right; }
.wall {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 19px 13px;
  align-content: start;
  margin-inline: -8px;
  padding: 12px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b98d70a3 transparent;
  scroll-padding-block: 12px;
}
.note-slot { position: relative; min-width: 0; }
.wall-empty { grid-column: 1 / -1; margin-top: 45px; color: var(--muted); text-align: center; }
.paper {
  --paper: #ffe995;
  --tape: #bee1b7;
  position: relative;
  margin: 0;
  min-width: 0;
  background: var(--paper);
  border: 1px solid #51394716;
  border-radius: 8px 7px 17px 7px;
  box-shadow: 0 3px 0 #49384c0a, 0 8px 14px #49384c0b;
}
.paper::before {
  content: ""; position: absolute; z-index: 1;
  top: -6px; left: 50%; width: 50px; height: 15px;
  transform: translateX(-50%) rotate(-5deg);
  background: var(--tape);
  clip-path: polygon(0 0, 100% 0, 95% 27%, 100% 51%, 95% 73%, 100% 100%, 0 100%, 4% 74%, 0 51%, 5% 24%);
  pointer-events: none;
}
.paper::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  right: 0; bottom: 0; border-radius: 5px 0 14px 0;
  background: #563c701d;
  pointer-events: none;
}
.paper[data-paper="green"] { --paper: #dfedd2; --tape: #cfb9e9; }
.paper[data-paper="purple"] { --paper: #e9def6; --tape: #f2d580; }
.paper[data-paper="pink"] { --paper: #f6dedc; --tape: #d7c1e9; }
.note {
  width: 100%; height: 100%; min-height: 146px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  padding: 19px 13px 12px; text-align: left; text-decoration: none;
  border-color: #7f53302b;
  box-shadow: 0 2px 2px #5b352718, 0 7px 11px #5b35271a;
  transition: transform .16s ease, box-shadow .16s ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y pinch-zoom;
}
.note[data-paper="yellow"] { --paper: #ffe68a; }
.note:hover { transform: translateY(-3px); box-shadow: 0 9px 16px #49384c1b; }
.note:active { transform: translateY(0); }
.delete-note {
  position: absolute; z-index: 2; top: -12px; right: -8px;
  width: 44px; height: 44px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 50%; background: transparent;
}
.delete-note span {
  width: 24px; height: 24px; display: grid; place-items: center;
  border: 2px solid #fffaf3; border-radius: 50%; background: #a83c4e;
  box-shadow: 0 2px 4px #5b35273a; transform: translateY(-5px);
}
.delete-note span::before { content: ""; width: 10px; height: 2px; border-radius: 3px; background: #fff; }
.delete-note:hover span { background: #862c3c; }
@media (prefers-reduced-motion: no-preference) {
  .note.just-posted { animation: post-note .36s ease-out; transform-origin: top center; }
  @keyframes post-note {
    0% { opacity: .55; transform: translateY(9px) rotate(5deg); }
    65% { opacity: 1; transform: translateY(-1px) rotate(-1deg); }
    100% { transform: translateY(0) rotate(0); }
  }
  [data-organizing] .note { animation: wiggle-note .26s ease-in-out infinite alternate; }
  [data-organizing] .note-slot:nth-child(even) .note { animation-delay: -.26s; }
  @keyframes wiggle-note {
    from { transform: rotate(-1.15deg); }
    to { transform: rotate(1.15deg); }
  }
}
.note-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden; overflow-wrap: anywhere; white-space: pre-wrap;
  font-size: 16px; font-weight: 550; line-height: 1.55;
}
.note-meta { color: #59465b; font-size: 11px; }
.composer, .reading { padding: 20px; }
.composer textarea {
  display: block; width: 100%; height: 216px; resize: none;
  background: repeating-linear-gradient(transparent 0 31px, #6d542019 31px 32px);
  border: 0; padding: 0; color: var(--ink); line-height: 32px; font-size: 17px;
}
.composer textarea::placeholder { color: #716044; }
.count { display: block; margin-top: 8px; text-align: right; color: #625336; font-size: 12px; }
.reading { min-height: 240px; display: flex; flex-direction: column; gap: 20px; padding-top: 27px; }
.reading p { flex: 1; font-size: 21px; font-weight: 550; line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.reading .note-meta { font-size: 12px; }
.missing { padding: 14px 0; color: var(--muted); }
.footer {
  background: #fffdf7;
  border-top: 1px solid var(--line);
  padding: 14px 24px max(16px, env(safe-area-inset-bottom));
}
.primary, .secondary {
  width: 100%; min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 14px; border: 1px solid transparent; border-radius: 12px;
  font-size: 15px; font-weight: 650; text-decoration: none;
}
.primary { background: var(--accent); color: #fffdf9; box-shadow: 0 3px 0 #392151; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #392151; }
.primary:disabled { background: #e7deeb; color: #685971; box-shadow: none; }
.secondary { background: #fffdf7; color: var(--accent); border-color: #d9c9e4; }
.secondary:hover { background: #f8f0fb; }
.notice { padding: 0 0 9px; color: var(--accent); text-align: center; font-size: 13px; }

.bottom-sheet {
  position: fixed; inset: auto auto var(--sheet-bottom) var(--sheet-left);
  margin: 0; width: var(--sheet-width); max-width: none;
  max-height: var(--sheet-height); overflow: auto;
  border: 0; border-radius: 24px 24px 29px 29px;
  background: var(--surface); color: var(--ink);
  padding: 21px 22px max(22px, env(safe-area-inset-bottom));
  box-shadow: 0 -12px 34px #39215122;
}
.bottom-sheet::backdrop { background: #31213e64; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-heading h2 { font-size: 19px; }
.share-card {
  display: grid; grid-template-columns: 63px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 11px; background: #eee4f8; border: 1px solid #decee9; border-radius: 13px;
  text-decoration: none;
}
.share-card:hover { background: #e9dcf4; }
.share-card img { width: 63px; height: 63px; border-radius: 9px; }
.share-card b { display: block; font-size: 15px; }
.share-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.share-chevron { color: var(--accent); font-size: 22px; line-height: 1; }
.share-sheet .secondary { margin-top: 13px; }
.share-status { color: var(--muted); font-size: 12px; margin-top: 8px; }
.share-status:empty { display: none; }
.manual-link { width: 100%; border: 1px solid #b9a3c8; border-radius: 6px; padding: 7px; margin-top: 8px; }
.delete-preview { background: #f3ece4; padding: 10px 12px; border-radius: 9px; }
.delete-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.delete-confirm { background: #a83c4e; border-color: #a83c4e; color: #fff; }
.delete-confirm:hover { background: #862c3c; border-color: #862c3c; }

@media (max-width: 860px) {
  .stage { gap: 37px; padding-inline: 32px; }
}
@media (max-width: 780px) {
  body { background: var(--surface); }
  .stage { display: block; padding: 0; min-height: 0; }
  .stage::before, .intro { display: none; }
  .device { width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
  .app { border-radius: 0; }
  .topbar { height: 60px; }
  .bottom-sheet { border-radius: 24px 24px 0 0; }
}
@media (max-width: 350px) {
  .screen, .footer { padding-inline: 16px; }
  .screen-heading h2 { font-size: 31px; }
  .wall { gap: 15px 10px; }
  .note { padding-inline: 11px; }
  .bottom-sheet { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
