:root {
  color-scheme: dark;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #171a22;
  color: #edf0f5;
  --muted: #a9b0c2;
  --accent: #c9b6ff;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100svh; height: 100dvh; overflow: hidden; -webkit-user-select: none; user-select: none; }
button, a, label, summary { -webkit-user-select: none; user-select: none; }
.note-title, .note-excerpt, .content, .content *, input:not([type="range"]), textarea, [contenteditable="true"] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
main {
  width: min(100%, 750px); height: 100%; margin: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
header, .section-heading, .header-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
header { flex: 0 0 40px; }
#refresh-handle { font: inherit; color: inherit; letter-spacing: inherit; background: transparent; border: 0; padding: 0 12px 0 0; min-height: 40px; touch-action: none; user-select: none; -webkit-user-select: none; }
.status-bubble { position: fixed; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 8px 14px; border: 1px solid #68558f; border-radius: 20px; background: #292e3b; color: var(--accent); font-size: 12px; text-align: center; pointer-events: none; box-shadow: 0 4px 16px #0005; }
#pull-status { top: calc(env(safe-area-inset-top, 0px) + 56px); z-index: 5; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#pull-icon { display: inline-block; transform: rotate(calc(var(--pull, 0) * 180deg)); }
h1 { font-size: 28px; letter-spacing: -1px; line-height: 1; color: var(--accent); margin: 0; }
h2 { font-size: 18px; line-height: 1.3; margin: 0; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p { margin: 10px 0; }
button, input {
  font: inherit; border-radius: 9px; border: 1px solid #454b5d;
  background: #292e3b; color: inherit; padding: 8px 12px; min-height: 36px;
}
button { cursor: pointer; touch-action: manipulation; }
button, input { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease, box-shadow 150ms ease, transform 100ms ease; }
button:not(:disabled):active { filter: brightness(.9); }
button:not(#record):not(#save):not(:disabled):active { transform: scale(.97); }
input:focus { border-color: var(--accent); }
@keyframes micro-in { from { opacity: .25; } to { opacity: 1; } }
@keyframes icon-in { from { opacity: .4; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
#preview-player:not([hidden]), #recent-post:not([hidden]), #recent-status:not([hidden]), #pull-status:not([hidden]), .tag-filter:not([hidden]) { animation: micro-in 160ms ease; }
.note-play-button svg { animation: icon-in 120ms ease; }
.hold-feedback, .note-delete-countdown, #queue li { animation: micro-in 140ms ease; }
.status-dot { transition: background-color 180ms ease, box-shadow 180ms ease; }
button:disabled { opacity: .4; cursor: default; }
button[aria-current], button.primary { background: #7953be; border-color: #9d7bd5; font-weight: 650; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; font-size: 24px; background: transparent; border-color: transparent; }
.header-actions { gap: 2px; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #929bab; }
.status-dot[data-state="synced"] { background: #70d49a; box-shadow: 0 0 0 4px #70d49a12; }
.status-dot[data-state="pending"] { background: #e5b361; box-shadow: 0 0 0 4px #e5b36112; }
.status-dot[data-state="processing"] { background: #e5b361; box-shadow: 0 0 0 4px #e5b36122; animation: processing-blink 1.2s ease-in-out infinite; }
@keyframes processing-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.view { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.card { background: #202530; border: 1px solid #343b4c; border-radius: 14px; padding: 16px; margin-bottom: 12px; }
#capture-dock { position: fixed; z-index: 10; right: max(16px, calc((100vw - 750px) / 2 + 16px), env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; }
#capture-dock > * { pointer-events: auto; }
#record-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.write-action { display: grid; place-items: center; width: 48px; height: 48px; min-height: 48px; flex: 0 0 48px; padding: 0; border-radius: 50%; background: #292e3b; color: var(--accent); box-shadow: 0 4px 16px #0005; }
#write-text { width: 100%; height: clamp(120px, 35dvh, 280px); resize: vertical; padding: 12px; border-radius: 9px; border: 1px solid #454b5d; background: #292e3b; color: inherit; font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
#write-text:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#record { display: flex; align-items: center; justify-content: center; gap: 10px; width: 64px; height: 64px; min-height: 64px; padding: 0; border-radius: 32px; box-shadow: 0 5px 22px #0006; font-size: 18px; flex: 0 0 auto; transition: width 180ms ease, background-color 150ms ease, border-color 150ms ease; }
body[data-recording="true"] #record { width: 164px; }
body[data-recording="true"] #record-icon { display: none; }
body[data-recording="true"] #record-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
#draft-panel { width: 100%; padding: 14px; border: 1px solid #68558f; border-radius: 20px; background: #252b38; box-shadow: 0 6px 30px #0008; max-height: calc(100dvh - 120px); overflow-y: auto; }
#draft-panel:not([hidden]) { animation: draft-in 180ms ease; }
@keyframes draft-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
#recent-capture { margin-bottom: 0; }
#elapsed { font-variant-numeric: tabular-nums; }
.recent-status { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; max-width: 100%; padding: 18px 12px; border: 1px solid #68558f; border-radius: 12px; background: #252b38; }
.recent-status strong { font-size: 16px; }
.spinner { width: 24px; height: 24px; border: 2px solid #4e4169; border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
#save { flex: 0 0 auto; width: 100%; min-height: 56px; font-size: 20px; font-weight: 650; }
body[data-recording="true"] #record { background: #983e57; border-color: #c96a7d; }
.save-action { background: #c9b6ff; border-color: #c9b6ff; color: #211831; }
.save-controls { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.save-controls #save { flex: 1; min-width: 0; width: auto; }
.capture-action { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; padding: 0; background: transparent; color: var(--muted); }
.capture-action[data-mode="undo"] { color: var(--accent); }
#record-actions .capture-action { border-radius: 50%; background: #292e3b; box-shadow: 0 4px 16px #0005; }
.muted { font-size: 12px; color: var(--muted); }
audio { width: 100%; height: 40px; flex: 0 0 auto; }
#notice, .warning { color: #e6cb96; white-space: pre-wrap; overflow-wrap: anywhere; }
#notice { margin: 0; }
#notice:empty, #settings-notice:empty { display: none; }
.preview-player { width: 100%; min-width: 0; padding: 0 0 14px; }
.preview-caption { display: block; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.preview-controls { display: flex; align-items: center; gap: 16px; }
.preview-controls .note-play-button { width: 72px; height: 72px; min-height: 72px; }
.preview-timeline { flex: 1; min-width: 0; }
.preview-times { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#preview-seek { display: block; width: 100%; height: 36px; min-height: 36px; margin: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); -webkit-appearance: none; appearance: none; cursor: pointer; }
#preview-seek::-webkit-slider-runnable-track { height: 6px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--progress, 0%), #545064 var(--progress, 0%)); }
#preview-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; border: 0; background: var(--accent); }
#preview-seek::-moz-range-track { height: 6px; border-radius: 4px; background: #545064; }
#preview-seek::-moz-range-progress { height: 6px; border-radius: 4px; background: var(--accent); }
#preview-seek::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--accent); }
#preview-seek::-webkit-slider-thumb { transition: box-shadow 120ms ease; }
#preview-seek:active::-webkit-slider-thumb { box-shadow: 0 0 0 5px #c9b6ff25; }
#preview-seek::-moz-range-thumb { transition: box-shadow 120ms ease; }
#preview-seek:active::-moz-range-thumb { box-shadow: 0 0 0 5px #c9b6ff25; }
label { display: block; margin: 10px 0 6px; color: var(--muted); font-size: 12px; }
input { width: 100%; min-width: 0; font-size: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.search-box { display: flex; align-items: center; gap: 2px; margin-top: 14px; padding: 4px; border: 1px solid #454b5d; border-radius: 24px; background: #292e3b; transition: border-color 150ms ease, box-shadow 150ms ease; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #c9b6ff12; }
.search-box #search { flex: 1; border: 0; background: transparent; padding: 7px 4px; outline: none; border-radius: 0; }
#search::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-submit, #search-clear { position: relative; display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; min-height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
#search-clear { font-size: 24px; }
#search-form[data-loading="true"] .search-submit svg { opacity: 0; }
#search-form[data-loading="true"] .search-submit::after { content: ''; position: absolute; inset: 9px; border: 2px solid #665773; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.empty-state { padding: 24px 12px; text-align: center; border: 1px dashed #454b5d; border-radius: 12px; animation: micro-in 160ms ease; }
.empty-state strong { font-size: 16px; }
.note-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-top: 8px; font-size: 13px; line-height: 1.45; color: #c9cddd; }
.actions { display: flex; gap: 8px; margin: 8px 0; }
.actions > * { flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tags button { font-size: 12px; min-height: 32px; padding: 4px 9px; border-radius: 18px; }
.tag-tools { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
#tags-toggle { width: 52px; height: 52px; min-height: 52px; flex: 0 0 52px; padding: 0; border-radius: 50%; font-size: 12px; }
#tags-toggle[aria-expanded="true"], #tags-toggle[data-active="true"], .tags button[aria-pressed="true"] { border-color: var(--accent); background: #49385f; color: #ede5ff; }
.tag-filter { max-width: calc(100% - 62px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 20px; color: var(--accent); }
#tag-panel { display: grid; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.tag-panel-inner { margin-top: 10px; padding: 12px; border: 1px solid #454b5d; border-radius: 12px; background: #252b38; max-height: min(38dvh, 260px); min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#tag-panel .tags { margin: 0; }
.note { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid #3b4354; border-radius: 0; padding: 14px 0; }
.note strong, .note small { display: block; }
.note small { font-size: 12px; color: var(--muted); margin-top: 5px; }
#queue { padding-left: 20px; }
#queue li { margin: 12px 0; }
a { color: var(--accent); }
pre, .content { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.content { line-height: 1.8; margin: 14px 0; }
.note-entry { position: relative; overflow: hidden; border: 1px solid #3b4354; border-radius: 12px; background: #252b38; padding: 14px; margin-top: 12px; opacity: 1; animation: micro-in 150ms ease; transition: border-color 480ms ease, background-color 480ms ease, box-shadow 150ms ease, opacity 480ms ease, height 400ms ease, padding 400ms ease, margin 400ms ease, border-width 400ms ease; }
.note-entry > .note-summary, .note-entry > .note-detail { filter: grayscale(0); opacity: 1; transition: filter 480ms ease, opacity 480ms ease; }
.note-entry.note-deleted > .note-summary, .note-entry.note-deleted > .note-detail { filter: grayscale(1); opacity: .55; }
.note-entry.note-removing { min-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; border-top-width: 0; border-bottom-width: 0; opacity: 0; overflow: hidden; }
.note-action.note-undo { border-color: currentColor; border-radius: 50%; }
.note-entry.expanded { border-color: #8567b1; box-shadow: inset 3px 0 #8567b1; }
.note-entry.recent-note { border-color: #68558f; }
.note-entry.note-deleted { background: #27282b; border-color: #41434a; }
.note-entry .note-summary { padding: 0; border: 0; }
.note-detail h2 { overflow-wrap: anywhere; }
.note-collapse { font: inherit; font-weight: inherit; display: flex; align-items: flex-start; gap: 10px; padding: 0; border: 0; background: transparent; text-align: left; width: 100%; }
.related-notes { border-top: 1px solid #454b5d; margin-top: 16px; padding-top: 4px; }
.related-note { border: 1px solid #454b5d; border-radius: 9px; padding: 10px; margin-top: 8px; }
#library { overflow-anchor: none; }
#library, #queue-view { padding-bottom: 88px; }
body[data-draft="true"] .view { padding-bottom: 300px; }
#library-back { display: grid; place-items: center; position: fixed; z-index: 10; left: max(16px, calc((100vw - 750px) / 2 + 16px), env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); width: 52px; height: 52px; min-height: 52px; padding: 0; border-radius: 50%; background: #49385f; border-color: #9d7bd5; box-shadow: 0 4px 16px #0005; }
.detail-heading { display: flex; align-items: flex-start; gap: 12px; }
.detail-heading h2 { flex: 1; min-width: 0; }
.detail-heading .note-action { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; color: var(--muted); }
.note-action:hover { color: var(--accent); background: #c9b6ff0d; }
.note-playback { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.note-playback .note-collapse-icon { width: 44px; height: 44px; min-height: 44px; margin-right: auto; color: var(--muted); }
.note-play-button { display: grid; place-items: center; width: 64px; height: 64px; min-height: 64px; flex: 0 0 auto; border-radius: 50%; padding: 0; background: var(--accent); border-color: var(--accent); color: #211831; }
.note-playback .note-play-button { width: 38.4px; height: 38.4px; min-height: 38.4px; }
.note-playback .note-play-button svg { width: 16.8px; height: 16.8px; }
.note-play-button[data-state="playing"] { background: #983e57; border-color: #c96a7d; color: #fff; }
details summary { cursor: pointer; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '›'; display: inline-block; width: 16px; margin-right: 5px; color: var(--muted); transform-origin: center; transition: transform 160ms ease; }
details[open] > summary::before { transform: rotate(90deg); }
details[data-motion-open="false"] > summary::before { transform: rotate(0); }
dialog { width: min(450px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid #454b5d; border-radius: 16px; padding: 18px; background: #202530; color: inherit; }
dialog::backdrop { background: #090c14bb; }
.shared-source { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 35dvh; overflow-y: auto; padding: 12px; border: 1px solid #454b5d; border-radius: 9px; }
#share-comment { width: 100%; resize: vertical; font: inherit; color: inherit; background: #292e3b; border: 1px solid #454b5d; border-radius: 9px; padding: 10px; }
.share-actions { display: flex; gap: 10px; justify-content: flex-end; }
#share-pair { margin-top: 12px; width: 100%; }
#shortcut-prefix { width: 100%; }
dialog #pair, dialog #logout { width: 100%; margin-top: 10px; }
.hold-button { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hold-button.holding { color: #ef7483; }
.hold-feedback, .note-delete-countdown { position: fixed; z-index: 15; width: 88px; height: 88px; display: grid; place-items: center; transform: translate(-50%, -50%); border-radius: 50%; background: #202530f2; box-shadow: 0 4px 24px #0006; pointer-events: none; }
.hold-feedback { color: #ef7483; }
.note-delete-countdown { position: absolute; z-index: 1; left: 50%; top: 50%; color: var(--accent); font-size: 36px; font-weight: 650; font-variant-numeric: tabular-nums; }
.hold-feedback svg { width: 30px; height: 30px; }
.hold-feedback::before, .note-delete-countdown::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(currentColor calc(var(--hold, 0) * 1turn), #454b5d 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0); pointer-events: none; }
#toast { z-index: 20; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 80px); }
body[data-draft="true"] #toast { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 292px); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
}
@media (max-height: 650px) {
  main { gap: 6px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  header { flex-basis: 34px; }
  h1 { font-size: 25px; }
  .icon-button { width: 34px; height: 34px; min-height: 34px; }
  #save { min-height: 52px; font-size: 18px; }
  .preview-player { padding-bottom: 12px; }
  .preview-caption { margin-bottom: 8px; }
  .preview-controls { gap: 12px; }
  .preview-controls .note-play-button { width: 64px; height: 64px; min-height: 64px; }
  audio { height: 36px; }
}
