/* ---------- page ---------- */
.nb { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
.nb-gl { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 40; }
.nb-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; width: 100%; }
.nb-brand { display: flex; flex-direction: column; gap: 4px; }
.nb-title { margin: 0; font: 400 52px/1 var(--hand); color: #f6eedf; -webkit-text-stroke: 1px currentColor; }
.nb-tagline { margin: 0; font-size: 15px; color: var(--muted); }
.nb-meta { white-space: nowrap; display: flex; align-items: center; gap: 20px; font: 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nb-sound { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px -10px -10px 0; color: var(--muted); background: none; border: 0; border-radius: 50%; cursor: pointer; }
.nb-sound:hover { color: var(--chalk); }
.nb-main { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }
.nb-noscript { max-width: 600px; margin: 40px auto; padding: 32px 40px; background: var(--paper); color: var(--ink); border-radius: 6px; }
.nb-noscript h2 { font: 42px/1.2 var(--hand); margin: 8px 0; }
.nb-noscript .nb-pre { font: 26px/32px var(--hand); white-space: pre-line; }
.nb-stamp { font: 12px var(--mono); color: #5d6271; }
.nb-404 { align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px; }
body.nb-locked { overflow: hidden; }

/* ---------- the book ---------- */
.nb-book { position: relative; flex-shrink: 0; }
.nb-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.nb-shadow { position: absolute; background: var(--wood); }
.nb-empty { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.nb-empty-title { margin: 0; font: 42px/1.1 var(--hand); color: #f2e6d2; }
.nb-empty-sub { margin: 0; font-size: 15px; color: #d6c7ad; }
.nb-empty .hb { min-height: 50px; padding: 2px 26px; font-size: 26px; box-shadow: 3px 4px 0 var(--shadow); }
.nb-under, .nb-sheet, .nb-edge { position: absolute; inset: 0; }
.nb-edge.e2 { background: #e9e1d0; }
.nb-edge.e1 { background: #f2ebdc; }
.nb-sheet { background: var(--paper); z-index: 1; overflow: hidden; }
.nb-holes { position: absolute; display: flex; justify-content: space-between; }
.nb-hole { border-radius: 50%; background: #2a231d; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6); }
.nb-stub { position: absolute; background: var(--paper); z-index: 2; }
.nb-perf { position: absolute; }
.nb-fallback { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 3; }
.nb-layer { position: absolute; z-index: 5; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; }
.nb-layer.grabbing { cursor: grabbing; }
.nb-pop { position: absolute; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transform: scale(.4); transition: opacity 260ms ease, transform 420ms cubic-bezier(.2, 1.6, .4, 1); }
.nb-pop.on { opacity: 1; transform: scale(1); }
.nb-coils { position: absolute; display: flex; justify-content: space-between; z-index: 6; pointer-events: none; }
.nb-coil { border: 4px solid #b9bdc4; }

/* ---------- notes ---------- */
.nb-note { position: relative; padding: 18px 14px 14px; color: #2b2418; box-shadow: 0 8px 14px rgba(0, 0, 0, .35); }
.nb-tape { position: absolute; top: -11px; left: 50%; width: 66px; height: 22px; margin-left: -33px; background: rgba(255, 255, 255, .5); transform: rotate(-4deg); pointer-events: none; }
.nb-tape.big { top: -14px; width: 120px; height: 28px; margin-left: -60px; background: rgba(255, 255, 255, .55); transform: rotate(-3deg); }
.nb-note-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.nb-note-name { font: 20px var(--hand); -webkit-text-stroke: .4px currentColor; overflow-wrap: anywhere; }
.nb-note-ago { font: 10px var(--mono); color: #5c5040; white-space: nowrap; }
.nb-note-text { font: 21px/1.15 var(--hand); white-space: pre-line; overflow-wrap: anywhere; }
.nb-wall .nb-note-text { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.nb-wall { position: absolute; left: calc(100% + 34px); top: 96px; width: 200px; display: flex; flex-direction: column; gap: 22px; z-index: 30; }
.nb-wall.is-drop { z-index: 31; pointer-events: none; }
.nb-wall-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.nb-wall-btns .hb { min-height: 44px; padding: 0 12px; font-size: 22px; }
.nb-write { color: #2b2418 !important; background: #f6e7a1; border-color: #f6e7a1 !important; transform: rotate(-1.5deg); }
.nb-peekwrap { position: absolute; top: 70px; right: -8px; z-index: 45; transform: rotate(5deg); transform-origin: top right; }
.nb-peekwrap.is-drop { z-index: 46; pointer-events: none; }
.nb-peek { position: relative; width: 92px; min-height: 72px; padding: 14px 8px 8px; color: #2b2418; background: #f6e7a1; border: 0; border-radius: 0; box-shadow: 0 6px 10px rgba(0, 0, 0, .3); -webkit-text-stroke: 0; }
.nb-peek.is-falling { animation: nbPeekFall 1100ms cubic-bezier(.55, 0, .9, .5) forwards; }
.nb-peek-in { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nb-peek .nb-tape { top: -9px; width: 46px; height: 18px; margin-left: -23px; background: rgba(255, 255, 255, .55); transform: rotate(-5deg); }
.nb-peek-n { font: 22px/1 var(--hand); -webkit-text-stroke: .5px currentColor; }
.nb-peek-l { font: 17px/1.1 var(--hand); }

/* ---------- under the book ---------- */
.nb-hintrow { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 34px; }
.nb-tension { position: relative; width: 130px; height: 10px; flex-shrink: 0; }
.nb-tension-line { position: absolute; left: 0; right: 0; top: 4px; border-top: 2px dashed #4a4036; }
.nb-tension-fill { position: absolute; left: 0; top: 2px; height: 6px; width: 0; border-radius: 3px 6px 2px 5px; background: var(--accent); }
.nb-tension-fill.hot { background: #e0533d; }
.nb-hint { font: 24px var(--hand); color: var(--chalk-2); }
.nb-controls, .nb-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.nb-actions:empty { display: none; }
.nb-react { padding: 0 12px; font-size: 24px; border-radius: 18px 24px 16px 26px / 24px 16px 26px 18px; box-shadow: none; }
.nb-react.on { color: var(--ink); }
.nb-gap { width: 14px; }

/* ---------- desktop ---------- */
.is-desktop { padding: 40px clamp(16px, 4vw, 64px) 64px; gap: 36px; }
.is-desktop .nb-head { max-width: 1200px; margin: 0 auto; }
.is-desktop .nb-book, .is-desktop .nb-hintrow, .is-desktop .nb-controls, .is-desktop .nb-actions { margin-right: clamp(0px, 15vw, 230px); }
.is-desktop .nb-controls { max-width: 760px; }
.is-desktop .nb-actions { margin-top: -10px; }
.is-desktop .nb-hint { min-width: 340px; }
.is-desktop .nb-shadow { top: 10px; left: 6px; right: -10px; bottom: -12px; border-radius: 6px 16px 16px 6px; box-shadow: 0 30px 60px rgba(0, 0, 0, .55); }
.is-desktop .nb-empty { gap: 22px; padding: 40px 40px 40px 80px; }
.is-desktop .nb-edge.e2 { top: 6px; left: 2px; right: -6px; bottom: -7px; border-radius: 4px 10px 10px 4px; }
.is-desktop .nb-edge.e1 { top: 3px; left: 1px; right: -3px; bottom: -3px; border-radius: 4px 10px 10px 4px; }
.is-desktop .nb-sheet { border-radius: 4px 10px 10px 4px; }
.is-desktop .nb-holes { left: 14px; top: 22px; bottom: 22px; flex-direction: column; }
.is-desktop .nb-hole { width: 13px; height: 13px; }
.is-desktop .nb-stub { left: 0; top: 0; bottom: 0; width: 56px; border-radius: 4px 0 0 4px; }
.is-desktop .nb-perf { left: 50px; top: 0; bottom: 0; border-left: 2px dotted #ddd2bd; }
.is-desktop .nb-layer { left: 40px; top: -10px; right: -10px; bottom: -10px; }
.is-desktop .nb-coils { left: -16px; top: 18px; bottom: 18px; width: 48px; flex-direction: column; }
.is-desktop .nb-coil { width: 44px; height: 21px; border-left-color: #6f747c; border-bottom-color: #8d9199; border-radius: 12px; box-shadow: 0 3px 3px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .6); }

/* ---------- mobile ---------- */
.is-mobile { padding: max(22px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); gap: 12px; }
.is-mobile .nb-head, .is-mobile .nb-main > :not(.nb-book) { width: 100%; max-width: 480px; margin-left: auto; margin-right: auto; }
.is-mobile .nb-head { flex-wrap: nowrap; gap: 12px; }
.is-mobile .nb-brand { gap: 2px; }
.is-mobile .nb-title { font-size: 36px; }
.is-mobile .nb-tagline { font-size: 13px; }
.is-mobile .nb-meta { font-size: 11px; gap: 8px; padding-bottom: 3px; }
.is-mobile .nb-main { gap: 12px; }
.is-mobile .nb-book { margin-top: 14px; }
.is-mobile .nb-shadow { top: 6px; left: 6px; right: -6px; bottom: -12px; border-radius: 6px 6px 14px 14px; box-shadow: 0 24px 48px rgba(0, 0, 0, .55); }
.is-mobile .nb-empty { gap: 16px; padding: 64px 28px 28px; }
.is-mobile .nb-empty-title { font-size: 36px; }
.is-mobile .nb-edge.e2 { top: 2px; left: 2px; right: -2px; bottom: -7px; border-radius: 4px 4px 10px 10px; }
.is-mobile .nb-edge.e1 { top: 1px; left: 1px; right: -1px; bottom: -3px; border-radius: 4px 4px 10px 10px; }
.is-mobile .nb-sheet { border-radius: 4px 4px 10px 10px; }
.is-mobile .nb-holes { top: 14px; left: 20px; right: 20px; }
.is-mobile .nb-hole { width: 12px; height: 12px; }
.is-mobile .nb-stub { left: 0; right: 0; top: 0; height: 58px; border-radius: 4px 4px 0 0; }
.is-mobile .nb-perf { left: 0; right: 0; top: 52px; border-top: 2px dotted #ddd2bd; }
.is-mobile .nb-layer { left: -10px; top: 40px; right: -10px; bottom: -10px; }
.is-mobile .nb-coils { top: -16px; left: 16px; right: 16px; height: 46px; }
.is-mobile .nb-coil { width: 20px; height: 42px; border-top-color: #6f747c; border-right-color: #8d9199; border-radius: 11px; box-shadow: 2px 3px 3px rgba(0, 0, 0, .45), inset 1px 0 0 rgba(255, 255, 255, .6); }
.is-mobile .nb-hintrow { justify-content: flex-start; gap: 10px; min-height: 28px; margin-top: 4px; }
.is-mobile .nb-tension { width: 64px; }
.is-mobile .nb-hint { font-size: 20px; line-height: 1.1; }
.is-mobile .nb-controls { flex-wrap: nowrap; justify-content: flex-start; gap: 6px; }
.is-mobile .nb-react { padding: 0 8px; gap: 3px; font-size: 21px; }
.nb-flex { flex: 1 1 auto; }
.nb-share-m { width: 50px; padding: 0; }
.is-mobile .nb-actions { flex-wrap: nowrap; }
.is-mobile .nb-actions .hb { flex: 1 1 auto; min-height: 48px; }

/* ---------- dialogs ---------- */
.nb-backdrop { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 8, 6, .72); animation: nbFade 160ms ease-out; }
.nb-backdrop.is-sheet { align-items: flex-end; padding: 0; }
.nb-dialog { position: relative; max-width: 100%; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; overscroll-behavior: contain; }
.nb-dialog.is-modal { max-height: 90vh; padding: 28px; border-radius: 12px; box-shadow: 0 24px 50px rgba(0, 0, 0, .5); }
.nb-dialog.is-sheet { width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; padding: 12px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; gap: 16px; animation: nbSheet 220ms cubic-bezier(.2, .9, .3, 1); }
.nb-grip { width: 40px; height: 4px; border-radius: 2px; background: #6b5a48; align-self: center; flex-shrink: 0; }
.nb-dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.nb-dlg-actions { display: flex; gap: 10px; flex-shrink: 0; }
.nb-dlg-title { margin: 0; font: 34px/1.05 var(--hand); color: #f6eedf; -webkit-text-stroke: .8px currentColor; overflow-wrap: anywhere; }
.nb-dlg-sub { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.nb-dlg-stamp { font: 11px var(--mono); color: #d6c7ad; margin-bottom: 6px; }
.nb-notes { background: var(--wood); }
.nb-notes.is-modal { width: 760px; }
.nb-notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 26px 20px; padding: 10px 4px; }
.is-sheet .nb-notes-grid { grid-template-columns: 1fr; gap: 20px; }
.nb-composer { width: 460px; padding: 40px 30px 28px !important; color: #2b2418; background: #f6e7a1; border-radius: 0 !important; transform: rotate(-1.2deg); overflow: visible !important; }
.nb-composer .nb-dlg-title { color: #2b2418; font-size: 32px; }
.nb-composer .nb-dlg-sub { color: #5c5040; margin: 0; }
.nb-sheet-form { position: relative; margin-top: 6px; padding: 26px 18px 18px; color: #2b2418; background: #f6e7a1; transform: rotate(-.6deg); }
.nb-form { display: flex; flex-direction: column; gap: 10px; }
.nb-form label { font: 22px var(--hand); -webkit-text-stroke: .4px currentColor; }
.nb-form input, .nb-form textarea { width: 100%; padding: 0 4px; border: 0; color: var(--ink); background: transparent; font: 26px var(--hand); }
.nb-form input { min-height: 44px; border-bottom: 2px dashed #2b2418; }
.nb-form textarea { line-height: 32px; resize: none; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(43, 36, 24, .25) 31px, rgba(43, 36, 24, .25) 32px); }
.nb-form ::placeholder { color: rgba(43, 36, 24, .45); }
.nb-form-btns { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.nb-form-btns .hb { min-height: 46px; padding: 0 22px; font-size: 25px; color: #2b2418; border-color: #2b2418; box-shadow: 2px 3px 0 #2b2418; }
.nb-form-btns .hb.ink { color: var(--paper); }
.nb-form-msg { margin: 0; min-height: 20px; font-size: 14px; color: #8a2f1c; }
.nb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nb-share { background: var(--desk-2); border: 1px solid var(--desk-line); }
.nb-share.is-modal { width: 820px; }
.nb-share.is-sheet { border-radius: 22px 22px 0 0; border-width: 1px 0 0; }
.nb-share-body { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.nb-share-left { flex: 0 0 auto; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.nb-share-right { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.nb-share-preview { display: flex; align-items: center; justify-content: center; width: 300px; height: 420px; }
.nb-share-preview canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.nb-share-fmts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.nb-share-fmts .hb { min-height: 44px; font-size: 22px; box-shadow: none; }
.nb-share-targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.nb-target { justify-content: flex-start; min-height: 50px; padding: 0 14px; gap: 10px; border-color: var(--paper); }
.nb-share-msg { margin: 0; min-height: 22px; font-size: 14px; color: var(--accent); }
.nb-share-foot { margin: 0; font-size: 13px; color: #a89c86; }
.is-sheet.nb-share .nb-share-body { gap: 16px; }
.is-sheet .nb-share-left { flex-direction: row; width: 100%; justify-content: flex-start; }
.is-sheet .nb-share-preview { width: 128px; height: 160px; flex-shrink: 0; }
.is-sheet .nb-share-fmts { flex-direction: column; align-items: stretch; }

@keyframes nbFade { from { opacity: 0; } }
@keyframes nbSheet { from { transform: translateY(40px); opacity: 0; } }
@keyframes nbNoteFall0 { 0% { transform: translate(0, 0) rotate(0deg); } 14% { transform: translate(3px, -6px) rotate(-5deg); } 100% { transform: translate(46px, 980px) rotate(34deg); opacity: .15; } }
@keyframes nbNoteFall1 { 0% { transform: translate(0, 0) rotate(0deg); } 16% { transform: translate(-2px, -5px) rotate(4deg); } 100% { transform: translate(-34px, 900px) rotate(-30deg); opacity: .15; } }
@keyframes nbNoteFall2 { 0% { transform: translate(0, 0) rotate(0deg); } 12% { transform: translate(2px, -4px) rotate(-3deg); } 100% { transform: translate(22px, 820px) rotate(48deg); opacity: .15; } }
@keyframes nbPeekFall { 0% { transform: translate(0, 0) rotate(0deg); } 14% { transform: translate(-2px, -5px) rotate(-6deg); } 100% { transform: translate(-30px, 760px) rotate(-38deg); opacity: .15; } }
@keyframes nbStick { 0% { transform: translateY(-8px) scale(1.08); opacity: 0; } 65% { transform: translateY(0) scale(.98); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

@media (max-width: 359px) {
  .is-mobile .nb-title { font-size: 30px; }
  .is-mobile .nb-tagline { font-size: 12px; }
}
