/* source: assets/archive.css lines 2846-4555 */
.notes-drawer {
    position: fixed;
    right: 16px;
    top: 72px;
    width: min(380px, calc(100vw - 32px));
    height: calc(100vh - 88px);
    min-width: 320px;
    min-height: 260px;
    background: var(--sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 22px;
    z-index: 50;
    display: none;
    flex-direction: column;
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    will-change: left, top, width, height;
}

.notes-drawer.open {
    display: flex;
}

.notes-drawer.dragging {
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.28);
}

.notes-drawer.resizing {
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.28);
}

.notes-resize-handle {
    position: absolute;
    bottom: 0;
    width: 22px;
    height: 22px;
    z-index: 3;
    overflow: visible;
}

.notes-resize-handle::before {
    content: "";
    position: absolute;
    bottom: 0px;
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    border-bottom: 3px solid rgba(211, 99, 58, 0.68);
}

.notes-resize-handle-right {
    right: 0;
    cursor: nwse-resize;
}

.notes-resize-handle-right::before {
    right: -1px;
    border-right: 3px solid rgba(211, 99, 58, 0.68);
    border-bottom-right-radius: 22px;
}

.notes-resize-handle-left {
    left: 0;
    cursor: nesw-resize;
}

.notes-resize-handle-left::before {
    left: 0px;
    border-left: 2px solid rgba(211, 99, 58, 0.68);
    border-bottom-left-radius: 22px;
}

.notes-header {
    padding: 13px 17px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    flex-shrink: 0;
    cursor: move;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.notes-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.notes-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.notes-header-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notes-search-wrap {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
}

.notes-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.86em;
    pointer-events: none;
}

.notes-search-input {
    width: 100%;
    height: 34px;
    padding: 0 34px 0 32px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
    outline: none;
    font-size: 0.82em;
}

.notes-search-input::-webkit-search-decoration,
.notes-search-input::-webkit-search-cancel-button,
.notes-search-input::-webkit-search-results-button,
.notes-search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.notes-search-input:focus {
    border-color: rgba(211, 99, 58, 0.5);
    box-shadow: 0 0 0 3px rgba(211, 99, 58, 0.08);
    background: transparent;
}

.notes-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
}

.notes-search-clear:hover {
    color: var(--accent);
    background: rgba(211, 99, 58, 0.08);
}

.notes-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 5px 10px 10px;
}

.notes-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.notes-create-btn {
    width: calc(100% - 20px);
    margin: 10px;
    align-self: center;
}

.notes-list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 9px;
}

#notes-list-container {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0;
}

.notes-pagination {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--border);
    border-bottom-right-radius: 22px;
    border-bottom-left-radius: 22px;
    background: linear-gradient(180deg, rgba(211, 99, 58, 0.02), rgba(211, 99, 58, 0.07));
    flex-shrink: 0;
}

.notes-pagination.hidden {
    display: none;
}

.notes-pagination-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.notes-pagination-btn,
.notes-pagination-page {
    min-width: 34px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82em;
    line-height: 1;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.notes-pagination-btn:hover,
.notes-pagination-page:hover {
    color: var(--accent);
    border-color: rgba(211, 99, 58, 0.32);
    background: rgba(211, 99, 58, 0.1);
}

.notes-pagination-btn.is-nav-pill {
    min-width: 46px;
    width: 46px;
    height: 34px;
    padding: 0;
    border-color: rgba(255, 236, 214, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
        linear-gradient(180deg, rgba(48, 37, 30, 0.94), rgba(31, 25, 20, 0.94));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 5px 12px rgba(0, 0, 0, 0.18);
    font-size: 0.98rem;
    font-weight: 700;
}

.notes-pagination-btn.is-nav-pill:hover:not(:disabled) {
    color: #fff2e5;
    border-color: rgba(211, 99, 58, 0.42);
    background:
        linear-gradient(180deg, rgba(211, 99, 58, 0.26), rgba(211, 99, 58, 0.14)),
        linear-gradient(180deg, rgba(60, 42, 32, 0.96), rgba(38, 29, 23, 0.96));
    transform: translateY(-1px);
}

.notes-pagination-btn:disabled {
    opacity: 0.42;
    cursor: default;
}

.notes-pagination-btn.is-nav-pill:disabled {
    transform: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 2px 8px rgba(0, 0, 0, 0.08);
}

.notes-pagination-page.is-active {
    border-color: rgba(211, 99, 58, 0.42);
    background: linear-gradient(135deg, rgba(211, 99, 58, 0.22), rgba(211, 99, 58, 0.12));
    color: var(--accent);
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(211, 99, 58, 0.12);
}

.notes-pagination-ellipsis {
    color: var(--text-muted);
    font-size: 0.88em;
    padding: 0 2px;
}

.notes-pagination-summary {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78em;
    line-height: 1.5;
}

[data-theme="light"] .notes-pagination-btn.is-nav-pill {
    border-color: rgba(133, 104, 79, 0.16);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 231, 222, 0.96)),
        rgba(255, 255, 255, 0.95);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 5px 12px rgba(102, 79, 58, 0.09);
}

[data-theme="light"] .notes-pagination-btn.is-nav-pill:hover:not(:disabled) {
    color: var(--accent);
    border-color: rgba(184, 91, 63, 0.34);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(246, 238, 229, 0.98)),
        rgba(255, 255, 255, 0.98);
}

.note-card {
    background: var(--note-card-bg);
    border: 1px solid var(--border);
    padding: 13px;
    border-radius: 10px;
    margin: 0;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    border-color: var(--accent);
    background: rgba(211, 99, 58, 0.05);

    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.note-card.dragging {
    opacity: 0.55;
    border-color: var(--accent);
    box-shadow: 0 10px 24px rgba(211, 99, 58, 0.18);
    transform: scale(1.01);
}

.note-card-title {
    font-weight: bold;
    margin-bottom: 6px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card-preview {
    font-size: 0.83em;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.65;
}

.note-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.note-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.note-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72em;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
}

.note-badge.hit {
    color: var(--accent);
    border-color: rgba(211, 99, 58, 0.22);
    background: rgba(211, 99, 58, 0.08);
}

.note-card-time {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72em;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.note-card mark {
    background: rgba(211, 99, 58, 0.18);
    color: inherit;
    padding: 0 3px;
    border-radius: 4px;
}

.notes-empty-state {
    padding: 22px 16px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88em;
    line-height: 1.8;
    background: linear-gradient(180deg, rgba(211, 99, 58, 0.03), transparent);
}

.note-window {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(840px, calc(100vw - 32px));
    height: min(85vh, 860px);
    min-width: 320px;
    min-height: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
    z-index: 90;
    display: none;
    flex-direction: column;
    overflow: hidden;
    will-change: left, top, width, height;
}

.note-window-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 22px;
    height: 22px;
    z-index: 3;
    cursor: nwse-resize;
    overflow: visible;
    touch-action: none;
}

.note-window-resize-handle::before {
    content: "";
    position: absolute;
    right: 0px;
    bottom: 0px;
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    border-right: 3px solid rgba(211, 99, 58, 0.68);
    border-bottom: 3px solid rgba(211, 99, 58, 0.68);
    border-bottom-right-radius: 22px;
}

.note-window.open {
    display: flex;
}

.note-window.dragging {
    box-shadow: 0 26px 78px rgba(0, 0, 0, 0.48);
}

.note-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(211, 99, 58, 0.05), transparent);
}

.note-window-handle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    cursor: move;
    flex: 1;
}

.note-window-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.note-window-hint {
    font-size: 0.78em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-window-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.note-window-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--soft-btn-bg);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.note-window-btn.active-edit {
    border-color: var(--accent);
    background: rgba(211, 99, 58, 0.12);
    color: var(--accent);
}

.note-window-btn.danger {
    color: #d9381e;
    border-color: rgba(217, 56, 30, 0.24);
    background: rgba(217, 56, 30, 0.08);
}

.note-window-btn:hover {
    border-color: rgba(211, 99, 58, 0.28);
    background: rgba(211, 99, 58, 0.08);
}

.note-window-btn.danger:hover {
    border-color: rgba(217, 56, 30, 0.36);
    background: rgba(217, 56, 30, 0.14);
}

body.note-window-dragging,
body.note-window-dragging *,
body.notes-drawer-dragging,
body.notes-drawer-dragging * {
    -webkit-user-select: none !important;
    user-select: none !important;
    cursor: grabbing !important;
}

.note-window-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
    background: var(--note-window-surface);
}

.note-view-panel,
.note-edit-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    min-height: 0;
}

.hidden {
    display: none !important;
}

.note-display-meta {
    font-size: 0.8em;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.note-display-title {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 800;
    line-height: 1.35;
    color: var(--text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.2px;
    word-break: break-word;
}

.note-display-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 18px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: transparent;
    line-height: 1.9;
    white-space: normal;
    word-break: break-word;
}

.note-display-content.empty {
    color: var(--text-muted);
    font-style: italic;
}

.note-display-content > :first-child {
    margin-top: 0;
}

.note-display-content > :last-child {
    margin-bottom: 0;
}

.note-display-content p,
.note-display-content ul,
.note-display-content ol,
.note-display-content blockquote,
.note-display-content pre,
.note-display-content h2,
.note-display-content h3 {
    margin: 0 0 14px;
}

.note-display-content ul,
.note-display-content ol {
    padding-left: 1.35rem;
}

.note-display-content li + li {
    margin-top: 6px;
}

.note-display-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(211, 99, 58, 0.32);
}

.note-display-content a:hover {
    border-bottom-color: currentColor;
}

.note-display-content blockquote {
    padding: 12px 16px;
    border-left: 3px solid rgba(211, 99, 58, 0.42);
    background: rgba(211, 99, 58, 0.08);
    border-radius: 0 14px 14px 0;
    color: var(--text);
}

.note-display-content code {
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: 0.92em;
    padding: 2px 6px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.12);
}

.note-display-content pre {
    position: relative;
    max-width: 100%;
    padding: 0;
    border-radius: 18px;
    border: 1px solid rgba(255, 236, 214, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
        linear-gradient(180deg, rgba(26, 20, 16, 0.98), rgba(14, 11, 9, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 18px 38px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    white-space: normal;
}

.note-code-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 3px 12px 3px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
        linear-gradient(180deg, rgba(47, 38, 32, 0.92), rgba(34, 27, 23, 0.92));
}

.note-code-lights {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.note-code-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.32),
        0 1px 1px rgba(0, 0, 0, 0.22);
}

.note-code-dot-red {
    background: linear-gradient(180deg, #ff7b72, #eb554a);
}

.note-code-dot-yellow {
    background: linear-gradient(180deg, #ffd666, #f2b943);
}

.note-code-dot-green {
    background: linear-gradient(180deg, #4fe38a, #27c568);
}

.note-code-title {
    flex: 1;
    min-width: 0;
    color: rgba(235, 223, 203, 0.78);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-code-title.is-empty {
    visibility: hidden;
}

.note-code-copy-btn {
    position: static;
    flex-shrink: 0;
    height: 30px;
    padding: 0 14px;
    border: 1px solid rgba(255, 236, 214, 0.12);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
        rgba(40, 31, 25, 0.9);
    color: var(--text);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 10px rgba(0, 0, 0, 0.18);
    transition: all 0.2s ease;
}

.note-code-copy-btn:hover {
    color: #fff4e8;
    border-color: rgba(211, 99, 58, 0.4);
    background:
        linear-gradient(180deg, rgba(211, 99, 58, 0.28), rgba(211, 99, 58, 0.16)),
        rgba(52, 37, 29, 0.96);
    transform: translateY(-1px);
}

.note-code-copy-btn:active {
    transform: translateY(0);
}

[data-theme="light"] .note-display-content {
    background: transparent;
}

[data-theme="light"] .note-display-content pre {
    border: 1px solid rgba(133, 104, 79, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(243, 237, 229, 0.92)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 237, 229, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 14px 28px rgba(102, 79, 58, 0.08);
}

[data-theme="light"] .note-display-content code {
    background: transparent;
}

[data-theme="light"] .note-code-toolbar {
    border-bottom: 1px solid rgba(133, 104, 79, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(236, 228, 217, 0.96)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 234, 226, 0.98));
}

[data-theme="light"] .note-code-title {
    color: rgba(62, 48, 36, 0.62);
}

[data-theme="light"] .note-code-copy-btn {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(239, 232, 223, 0.96)),
        rgba(255, 255, 255, 0.92);
    border-color: rgba(133, 104, 79, 0.18);
    color: var(--text);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 4px 10px rgba(102, 79, 58, 0.08);
}

[data-theme="light"] .note-code-copy-btn:hover {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(246, 239, 231, 0.98)),
        #fff;
    color: var(--accent);
    border-color: var(--accent);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.82),
        0 6px 14px rgba(102, 79, 58, 0.12);
}

.note-display-content pre code {
    display: block;
    max-width: 100%;
    min-width: 0;
    padding: 18px 18px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)), linear-gradient(180deg, rgb(45 35 27 / 90%), rgb(22 18 14 / 96%));
    white-space: pre-wrap;
    overflow-x: hidden;
    overflow-y: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.72;
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
}

.note-display-content pre code br {
    display: none;
}

[data-theme="light"] .note-display-content pre code {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)),
        linear-gradient(180deg, rgba(252, 250, 246, 0.94), rgba(245, 239, 232, 0.98));
}

.note-display-content h2,
.note-display-content h3 {
    line-height: 1.35;
    color: var(--text);
}

.note-display-content h2 {
    font-size: 1.16rem;
}

.note-display-content h3 {
    font-size: 1.02rem;
}

.note-display-content hr {
    border: none;
    border-top: 1px solid rgba(211, 99, 58, 0.22);
    margin: 18px 0;
}

.detail-title-input {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 1.06rem;
    font-weight: 400;
}

.note-editor-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.04);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.note-editor-toolbar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0;
    align-items: center;
    padding: 8px 9px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(211, 99, 58, 0.08), rgba(211, 99, 58, 0.02));
    overflow-x: auto;
    scrollbar-width: none;
}

.note-editor-toolbar::-webkit-scrollbar {
    display: none;
}

.note-editor-toolbar-track {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: max-content;
    margin: 0 auto;
}

.note-editor-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.note-editor-group:not(:last-child) {
    padding-right: 5px;
    border-right: 1px solid rgba(211, 99, 58, 0.12);
}

.note-editor-btn {
    min-width: 0;
    height: 28px;
    padding: 0 7px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78em;
    font-weight: 600;
    line-height: 1;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.note-editor-btn svg {
    width: 16px;
    height: 16px;
}

.note-editor-btn.icon-only {
    width: 28px;
    padding: 0;
}

.note-editor-btn[data-command="formatBlock"][data-value="h2"] {
    min-width: 34px;
}

.note-editor-btn[data-command="strikeThrough"] {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

.note-editor-btn.color-btn {
    gap: 5px;
    padding-left: 6px;
    padding-right: 7px;
}

.note-editor-btn:hover,
.note-editor-btn:focus-visible,
.note-editor-btn.active {
    color: var(--accent);
    border-color: rgba(211, 99, 58, 0.28);
    background: rgba(211, 99, 58, 0.12);
}

.note-editor-btn:focus-visible {
    outline: none;
}

.note-editor-btn:active {
    transform: translateY(1px);
}

.note-editor-color-chip {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d3633a, #f09b73);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.note-editor-color-chip.is-default {
    background: linear-gradient(135deg, #d3633a, #f09b73);
}

.note-editor-bg-chip {
    background: linear-gradient(135deg, rgba(211, 99, 58, 0.3), rgba(240, 155, 115, 0.9));
}

.note-editor-color-panel {
    position: fixed;
    left: 0;
    top: 0;
    display: none;
    width: 194px;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(211, 99, 58, 0.18);
    border-radius: 14px;
    background: rgba(31, 23, 17, 0.96);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    z-index: 160;
}

.note-editor-color-panel.open {
    display: flex;
    flex-direction: column;
}

.note-editor-color-panel-title {
    font-size: 0.78em;
    color: rgba(255, 245, 232, 0.92);
    letter-spacing: 0.04em;
    font-weight: 700;
    cursor: move;
}

.note-editor-color-grid {
    display: grid;
    grid-template-columns: repeat(5, 26px);
    gap: 8px;
}

.note-editor-color-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.78em;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(211, 99, 58, 0.14);
}

.note-editor-color-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px;
    border-radius: 8px;
}

.note-editor-color-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.92em;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

.note-editor-color-tab:hover {
    background: rgba(255, 255, 255, 0.08);
}

.note-editor-color-tab.active {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .note-editor-color-panel-title {
    color: #6d5240;
}

:root[data-theme="light"] .note-editor-color-custom {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(184, 91, 63, 0.22);
}

:root[data-theme="light"] .note-editor-color-tabs {
    background: rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .note-editor-color-tab {
    color: #887;
}

:root[data-theme="light"] .note-editor-color-tab:hover {
    background: rgba(255, 255, 255, 0.5);
}

:root[data-theme="light"] .note-editor-color-tab.active {
    background: #fff;
    color: #493527;
}

:root[data-theme="light"] .note-editor-color-clear {
    color: #493527;
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(184, 91, 63, 0.24);
}

:root[data-theme="light"] .note-editor-color-clear:hover {
    color: var(--accent);
    background: rgba(184, 91, 63, 0.14);
}

.note-editor-color-custom input[type="color"] {
    width: 34px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.note-editor-color-custom input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.note-editor-color-custom input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(211, 99, 58, 0.24);
    border-radius: 8px;
}

.note-editor-color-swatch {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
    cursor: pointer;
}

.note-editor-color-swatch:hover {
    transform: scale(1.05);
}

.note-editor-color-clear {
    height: 30px;
    border: 1px solid rgba(211, 99, 58, 0.22);
    border-radius: 999px;
    background: rgba(211, 99, 58, 0.16);
    color: #fff8ef;
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
}

.note-editor-color-clear:hover {
    color: var(--accent);
    background: rgba(211, 99, 58, 0.12);
}

.note-editor-surface {
    flex: 1;
    min-height: 260px;
    padding: 18px 18px 20px;
    overflow-y: auto;
    line-height: 1.9;
    outline: none;
}

.note-editor-surface::selection,
.note-editor-surface *::selection {
    background: rgba(211, 99, 58, 0.16);
    color: currentColor;
    text-shadow: none;
}

.note-editor-surface::-moz-selection,
.note-editor-surface *::-moz-selection {
    background: rgba(211, 99, 58, 0.16);
    color: currentColor;
    text-shadow: none;
}

.note-editor-surface:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.note-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.78em;
    color: var(--text-muted);
}

.note-editor-stats,
.note-editor-tip {
    min-width: 0;
}

.note-editor-tip {
    text-align: right;
}

.note-content-area-hidden {
    display: none;
}

.note-editor-surface p,
.note-editor-surface ul,
.note-editor-surface ol,
.note-editor-surface blockquote,
.note-editor-surface pre,
.note-editor-surface h2,
.note-editor-surface h3 {
    margin: 0 0 12px;
}

.note-editor-surface ul,
.note-editor-surface ol {
    padding-left: 1.35rem;
}

.note-editor-surface blockquote {
    padding: 12px 16px;
    border-left: 3px solid rgba(211, 99, 58, 0.42);
    background: rgba(211, 99, 58, 0.08);
    border-radius: 0 14px 14px 0;
}

.note-editor-surface code,
.note-editor-surface pre {
    font-family: "Cascadia Code", "Consolas", monospace;
}

.note-editor-surface code {
    padding: 2px 6px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.12);
}

.note-editor-surface pre {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(211, 99, 58, 0.16);
    background: rgba(0, 0, 0, 0.18);
    white-space: pre-wrap;
}

.note-editor-surface pre code {
    padding: 0;
    background: transparent;
}

.note-editor-surface a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(211, 99, 58, 0.32);
}

.note-editor-surface hr {
    border: none;
    border-top: 1px solid rgba(211, 99, 58, 0.22);
    margin: 18px 0;
}

@media (max-width: 1100px) {
    .sidebar {
        width: 250px;
    }

    .notes-drawer {
        width: min(340px, calc(100vw - 24px));
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
        align-items: center;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(320px, 88vw) !important;
        transform: translateX(-100%);
        z-index: 19;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .top-bar {
        padding: 0 10px;
        min-height: 60px;
        height: auto;
    }

    body.page-app.standalone-app .top-bar {
        min-height: calc(60px + env(safe-area-inset-top, 0px));
        height: calc(60px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 10px 0;
    }

    body.page-app.standalone-app .sidebar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .top-bar-left {
        padding-right: 60px;
        gap: 10px;
    }

    .top-bar-right {
        padding-left: 10px;
        gap: 6px;
    }

    .url-display {
        max-width: min(72vw, calc(100vw - 124px));
        gap: 3px;
    }

    .url-display-primary,
    .url-display-secondary {
        white-space: nowrap;
    }

    .url-display-primary {
        font-size: 0.9em;
    }

    .url-display-secondary {
        font-size: 0.74em;
    }

    .bookmark-item {
        align-items: flex-start;
        padding: 8px 8px;
    }

    .bookmark-main {
        align-items: flex-start;
    }

    .bookmark-main .icon {
        margin-top: 2px;
    }

    .bookmark-main .title {
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-height: 1.36;
        max-height: 2.72em;
    }

    .notes-drawer {
        width: min(92vw, 380px) !important;
        height: min(78vh, calc(100vh - 24px)) !important;
        top: 12px !important;
        right: 10px !important;
        left: auto;
        bottom: auto;
        border-radius: 22px;
    }

    .notes-drawer.open {
        right: 10px !important;
    }

    .notes-drawer {
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        min-width: 0;
        min-height: 0;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        resize: none;
        transform: none !important;
    }

    .notes-resize-handle {
        display: none;
    }

    .notes-header {
        padding-top: calc(13px + env(safe-area-inset-top, 0px));
    }

    .notes-body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .notes-pagination {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .note-window {
        width: calc(100vw - 20px);
        height: min(84vh, 860px);
    }

    .note-editor-toolbar {
        gap: 8px;
        padding: 10px 12px;
    }

    .note-editor-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .note-editor-tip {
        text-align: left;
    }

    .backup-actions {
        grid-template-columns: 1fr;
    }

    .welcome-msg {
        align-items: flex-start;
        justify-content: center;
        padding: 34px 16px 72px;
    }

    .welcome-panel {
        width: min(94vw, 760px);
        padding: 22px 18px 20px;
        border-radius: 22px;
        margin: 0 auto;
    }

    .welcome-title {
        font-size: clamp(1.5rem, 7vw, 2.2rem);
    }

    .welcome-detail {
        font-size: 0.94rem;
        line-height: 1.7;
    }

    .welcome-metrics {
        gap: 10px;
    }

    .welcome-metric {
        min-width: 0;
        flex: 1 1 calc(50% - 10px);
        padding: 10px 12px;
    }

    .welcome-dashboard {
        gap: 16px;
        margin-top: 18px;
    }

    .welcome-stats-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .welcome-session-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .welcome-session-head span {
        text-align: left;
    }

    .welcome-session-actions {
        grid-template-columns: 1fr;
    }

    .welcome-session-btn {
        width: 100%;
        min-width: 0;
    }

    .bookmark-health-controls {
        grid-template-columns: 1fr;
    }

    .bookmark-health-results-head,
    .bookmark-health-actions,
    .bookmark-health-item-head,
    .welcome-stats-top-copy {
        flex-direction: column;
        align-items: stretch;
    }

    .welcome-stats-top-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .welcome-stats-top-head span {
        text-align: left;
    }

    .welcome-stats-top-value {
        align-self: flex-start;
    }

    .welcome-stats-tools {
        padding: 15px;
    }

    .welcome-stats-top {
        margin-top: 12px;
        padding: 13px;
    }

    .welcome-stats-top-item {
        gap: 6px;
    }

    .welcome-stats-top-rank {
        min-width: 48px;
        padding: 3px 8px;
    }

    .welcome-stats-top-bar {
        height: 6px;
    }

    .bookmark-health-badge {
        min-width: 0;
        align-self: flex-start;
    }

    .bookmark-health-list {
        max-height: none;
    }

    .welcome-session-tools {
        margin-top: 18px;
        padding: 15px;
        border-radius: 18px;
    }

    .welcome-orbit {
        width: min(86vw, 420px);
        right: -18%;
        top: auto;
        bottom: -10%;
        transform: none;
        opacity: 0.5;
    }

    .welcome-grid {
        inset: 10%;
    }
}

@media (max-height: 860px) {
    .welcome-msg {
        align-items: flex-start;
        justify-content: center;
        padding: 24px 20px 88px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    .welcome-panel {
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 36px 22px;
        border-radius: 18px;
    }

    .auth-emblem {
        width: 60px;
        height: 60px;
    }

    .auth-title {
        font-size: 1.2em;
        letter-spacing: 2px;
    }

    .orbit-ring {
        width: 290px;
        height: 290px;
    }

    .auth-sep {
        display: none;
    }

    .top-bar {
        padding: 0 10px;
    }

    .top-bar-left {
        padding-right: 54px;
        gap: 8px;
    }

    .top-bar-right {
        padding-left: 8px;
        gap: 4px;
    }

    .url-display {
        max-width: min(30vw, calc(55vw - 106px));
        gap: 2px;
    }

    .url-display-primary {
        font-size: 0.84em;
    }

    .url-display-secondary {
        font-size: 0.7em;
    }

    .topbar-action-btn {
        min-width: 30px;
        height: 30px;
        padding: 0 8px;
        font-size: 0.74em;
    }

    .bookmark-item {
        padding: 7px 7px;
    }

    .bookmark-actions {
        gap: 4px;
    }

    :root.touch-optimized .bookmark-actions .action-btn {
        width: 24px;
        height: 24px;
    }

    .refresh-circle-btn {
        width: 40px;
        height: 40px;
    }

    .refresh-circle-btn svg {
        width: 18px;
        height: 18px;
    }

    .welcome-panel {
        width: min(95vw, 640px);
        padding: 20px 14px 18px;
    }

    .welcome-badge {
        letter-spacing: 0.16em;
        font-size: 0.68rem;
    }

    .welcome-metric {
        flex-basis: 100%;
    }

    .welcome-stats-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .welcome-stats-metric {
        padding: 8px 10px;
        border-radius: 14px;
    }

    .welcome-stats-metric strong {
        font-size: 0.98rem;
    }

    .welcome-stats-metric em {
        font-size: 0.68rem;
        line-height: 1.45;
    }

    .welcome-stats-tools {
        padding: 13px;
    }

    .welcome-stats-top {
        padding: 11px;
    }

    .welcome-stats-top-head strong {
        font-size: 0.88rem;
    }

    .welcome-stats-top-head span,
    .welcome-stats-top-value {
        font-size: 0.74rem;
    }

    .welcome-stats-top-label {
        font-size: 0.86rem;
    }

    .welcome-stats-empty {
        padding: 12px 14px;
        font-size: 0.78rem;
    }

    .notes-pagination-row {
        gap: 6px;
    }

    .notes-pagination-btn,
    .notes-pagination-page {
        min-width: 42px;
        height: 38px;
        padding: 0 10px;
    }

    .notes-pagination-summary {
        font-size: 0.74em;
    }
}

.note-toast-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, rgba(34, 184, 92, 0.95), rgba(24, 144, 66, 0.95));
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 14px 28px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 12px 36px rgba(24, 144, 66, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.note-toast-msg.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.notes-list-scroll::-webkit-scrollbar,
.note-display-content::-webkit-scrollbar,
.note-editor-surface::-webkit-scrollbar {
    width: 6px;
}
.notes-list-scroll::-webkit-scrollbar-track,
.note-display-content::-webkit-scrollbar-track,
.note-editor-surface::-webkit-scrollbar-track {
    background: transparent;
    margin: 16px 0;
}
.notes-list-scroll::-webkit-scrollbar-thumb,
.note-display-content::-webkit-scrollbar-thumb,
.note-editor-surface::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 4px;
}
.notes-list-scroll::-webkit-scrollbar-thumb:hover,
.note-display-content::-webkit-scrollbar-thumb:hover,
.note-editor-surface::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent);
}
