
@keyframes soundwave {
    0% { height: 8px; opacity: 0.45; }
    50% { height: 34px; opacity: 1; }
    100% { height: 8px; opacity: 0.45; }
}

.wave-bar { animation: soundwave 1.1s ease-in-out infinite; }
.wave-bar:nth-child(2) { animation-delay: 0.16s; }
.wave-bar:nth-child(3) { animation-delay: 0.32s; }
.wave-bar:nth-child(4) { animation-delay: 0.08s; }
.wave-bar:nth-child(5) { animation-delay: 0.24s; }

.fade-enter { opacity: 0; transform: translateY(10px); }
.fade-enter-active { opacity: 1; transform: translateY(0); transition: all 0.35s ease; }

.ai-prose h4 { font-weight: 600; color: #f8fafc; margin-top: 1rem; margin-bottom: 0.5rem; font-size: 1.05rem; }
.ai-prose h1,
.ai-prose h2,
.ai-prose h3,
.ai-prose h4,
.ai-prose h5,
.ai-prose h6 {
    color: #f8fafc;
    line-height: 1.45;
    margin-bottom: 1rem;
}
.ai-prose ul { list-style-type: disc; margin-left: 1.25rem; margin-bottom: 1rem; color: #cbd5e1; }
.ai-prose li { margin-bottom: 0.25rem; }
.ai-prose p { margin-bottom: 1rem; color: #cbd5e1; line-height: 1.7; }
.ai-prose table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.ai-prose th {
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.ai-prose td {
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}
.ai-prose tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}
.ai-prose hr {
    border: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}
.ai-prose blockquote {
    border-left: 4px solid rgb(139, 92, 246);
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
    color: #cbd5e1;
}
.ai-prose [contenteditable="true"] { outline: 1px dashed rgba(99, 102, 241, 0.65); padding: 4px; border-radius: 4px; background: rgba(99, 102, 241, 0.05); }

.ai-prose.layout-reminder {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.06), rgba(15, 23, 42, 0));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 0.9rem;
    padding: 1rem;
}

.ai-prose .task-list {
    list-style: none;
    margin: 0.75rem 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.ai-prose .task-list li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.7rem;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.ai-prose .task-list label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
}

.ai-prose .task-list input[type="checkbox"] {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: #10b981;
}

.ai-prose .notification-trigger {
    margin-top: 0.8rem;
    padding: 0.7rem 0.8rem;
    border-radius: 0.7rem;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.42);
    color: #e2e8f0;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-prose .notification-trigger::before {
    content: '🕒';
}

.ai-prose.layout-wiki-research {
    --accent: var(--wiki-accent);
    --wiki-accent: #22d3ee;
    --wiki-accent-soft: rgba(34, 211, 238, 0.18);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.06), rgba(15, 23, 42, 0));
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 0.9rem;
    padding: 1.2rem 1.15rem;
}

.ai-prose table,
.layout-wiki-research table,
.ai-prose.layout-wiki-research table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) rgba(255, 255, 255, 0.03);
}

.ai-prose.layout-wiki-research table th,
.ai-prose.layout-wiki-research table td {
    white-space: nowrap;
}

.ai-prose.layout-wiki-research table::-webkit-scrollbar {
    height: 6px;
}

.ai-prose.layout-wiki-research table::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.ai-prose.layout-wiki-research table::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.ai-prose.layout-wiki-research table::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.ai-prose.layout-wiki-research h3 {
    color: #67e8f9;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.015em;
    border-left: 4px solid var(--wiki-accent);
    border-bottom: 1px solid rgba(34, 211, 238, 0.3);
    padding: 0.1rem 0 0.45rem 0.65rem;
    margin-top: 1.55rem;
    margin-bottom: 0.8rem;
    text-shadow: 0 0 14px rgba(34, 211, 238, 0.14);
}

.ai-prose.layout-wiki-research h4 {
    color: #a5f3fc;
    font-size: 1.05rem;
    font-weight: 700;
    border-left: 4px solid var(--wiki-accent-soft);
    padding-left: 0.65rem;
    margin-top: 1.15rem;
    margin-bottom: 0.6rem;
}

.ai-prose.layout-wiki-research p {
    color: #dbeafe;
    line-height: 1.68;
    margin-bottom: 0.9rem;
}

.ai-prose.layout-wiki-research p + p {
    text-indent: 0.5rem;
}

.ai-prose.layout-wiki-research blockquote {
    margin: 1.15rem 0;
    padding: 1rem 1rem 1rem 1.1rem;
    border-left: 4px solid var(--wiki-accent);
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.14), rgba(129, 140, 248, 0.12));
    border-radius: 0.25rem 0.75rem 0.75rem 0.25rem;
    color: #e0e7ff;
    font-style: italic;
    font-size: 1.03rem;
    line-height: 1.65;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.ai-prose.layout-wiki-research ul,
.ai-prose.layout-wiki-research ol {
    margin: 0.4rem 0 0.95rem;
    padding-left: 1.25rem;
    color: #dbeafe;
}

.ai-prose.layout-wiki-research li {
    margin-bottom: 0.35rem;
    line-height: 1.55;
}

.ai-prose.layout-wiki-research hr {
    border: 0;
    height: 1px;
    margin: 1.25rem 0;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0), rgba(34, 211, 238, 0.65), rgba(167, 139, 250, 0.55), rgba(34, 211, 238, 0));
}

.ai-prose.layout-wiki-research u {
    text-decoration-color: rgba(34, 211, 238, 0.95);
    text-underline-offset: 0.18rem;
    text-decoration-thickness: 2px;
}

.ai-prose .wiki-image-prompt {
    margin-top: 0.9rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.32);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(99, 102, 241, 0.08));
    padding: 0.8rem;
    font-size: 0.8rem;
    color: #dbeafe;
}

.ai-prose .wiki-image-prompt::before {
    content: 'Illustration Placeholder';
    display: block;
    color: #93c5fd;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.ai-prose.layout-quick-note {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.08), rgba(15, 23, 42, 0));
    border: 1px solid rgba(251, 191, 36, 0.24);
    border-radius: 0.9rem;
    padding: 1rem;
}

.ai-prose .tag-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.ai-prose .tag-pill {
    font-size: 0.68rem;
    line-height: 1.1;
    padding: 0.27rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

.note-card-master {
    border-color: rgba(96, 165, 250, 0.34);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.12), 0 10px 30px rgba(37, 99, 235, 0.08);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.02));
}

.note-card-child {
    margin-left: 20px;
    transform: scale(0.985);
    border-color: rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.66), rgba(255, 255, 255, 0.015));
}

.note-card-merged {
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.18), 0 0 24px rgba(16, 185, 129, 0.12);
}

.merge-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #d1fae5;
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.34);
}

.compact-filter-shell {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(150deg, rgba(30, 41, 59, 0.55), rgba(15, 23, 42, 0.35));
    border-radius: 14px;
    padding: 0.65rem;
    backdrop-filter: blur(8px);
}

.compact-search-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    font-size: 0.86rem;
    border-radius: 10px;
    padding: 0.62rem 0.72rem;
    outline: none;
}

.compact-search-input:focus {
    border-color: rgba(99, 102, 241, 0.6);
}

.compact-filter-row {
    margin-top: 0.55rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
}

.select-wrap {
    position: relative;
}

.select-wrap::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0.62rem;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid rgba(203, 213, 225, 0.75);
    border-bottom: 2px solid rgba(203, 213, 225, 0.75);
    transform: translateY(-62%) rotate(45deg);
    pointer-events: none;
}

.compact-select {
    width: 100%;
    appearance: none;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border-radius: 10px;
    font-size: 0.72rem;
    padding: 0.48rem 1.45rem 0.48rem 0.6rem;
    outline: none;
}

.compact-select:focus {
    border-color: rgba(99, 102, 241, 0.6);
}

.note-select-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #6366f1;
}

.selection-mode .note-select-checkbox {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.note-select-checkbox {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.note-card.note-selected {
    border-color: rgba(129, 140, 248, 0.55);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4), 0 10px 30px rgba(79, 70, 229, 0.2);
}

.hierarchy-link-btn {
    width: 100%;
    text-align: left;
    font-size: 0.8rem;
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0.65rem;
    padding: 0.55rem 0.65rem;
    background: rgba(15, 23, 42, 0.5);
    transition: all 0.2s ease;
}

.hierarchy-link-btn:hover {
    border-color: rgba(129, 140, 248, 0.55);
    color: #e2e8f0;
}

.note-actions-btn {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.42);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.note-actions-btn:hover {
    color: #cbd5e1;
    border-color: rgba(129, 140, 248, 0.45);
}

.context-menu-item {
    width: 100%;
    text-align: left;
    padding: 0.58rem 0.72rem;
    font-size: 0.78rem;
    color: #d1d5db;
    background: transparent;
    border: 0;
    transition: background-color 0.15s ease;
}

.context-menu-item:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.14);
}

.context-menu-item:disabled {
    color: #64748b;
    cursor: not-allowed;
}

.context-menu-delete {
    color: #fda4af;
}

.context-menu-delete:hover {
    background: rgba(244, 63, 94, 0.14) !important;
}

.screen-hidden { display: none !important; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.modal-overlay { backdrop-filter: blur(6px); }

.ai-mic-shell::before {
    content: '';
    position: absolute;
    inset: -16px;
    border-radius: 999px;
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.2), rgba(99, 102, 241, 0.06) 40%, transparent 72%);
    filter: blur(18px);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.ai-mic-shell:hover::before {
    opacity: 0.9;
}

.ai-mic-button {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    border-radius: 50%;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transform: none !important;
    position: relative;
    z-index: 2;
}

.recording-active {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.85), rgba(139, 92, 246, 0.85)) !important;
    border-color: rgba(196, 181, 253, 0.6) !important;
    box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.3), 0 0 36px rgba(99, 102, 241, 0.38), 0 0 72px rgba(139, 92, 246, 0.28);
}

.recording-state .ai-mic-button {
    animation: aiPulse 1.8s ease-in-out infinite;
}

#record-pulse.animate-pulse {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.45) 0%, rgba(139, 92, 246, 0.22) 45%, rgba(99, 102, 241, 0) 74%);
    filter: blur(12px);
    animation: auraPulse 1.8s ease-in-out infinite;
}

@keyframes aiPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

@keyframes auraPulse {
    0% { opacity: 0.4; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.06); }
    100% { opacity: 0.4; transform: scale(0.98); }
}

.processing-state .ai-mic-button {
    cursor: wait;
    opacity: 0.88;
    border-color: rgba(129, 140, 248, 0.5);
    background: linear-gradient(145deg, rgba(79, 70, 229, 0.34), rgba(59, 130, 246, 0.34));
}

.ai-mic-shell {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-secondary-btn {
    white-space: nowrap;
}

.mic-spinner {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: rgba(255, 255, 255, 0.95);
    animation: micSpin 0.8s linear infinite;
}

@keyframes micSpin {
    to { transform: rotate(360deg); }
}

#sidebar-recent-notes {
    will-change: transform;
}

.recent-note-link {
    width: 100%;
    display: block;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.25rem;
    color: #cbd5e1;
    padding: 0.65rem 0.75rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.recent-note-link:hover {
    border-color: rgba(167, 139, 250, 0.5);
    background: rgba(124, 58, 237, 0.12);
    color: #e2e8f0;
}

.backlink-badge {
    display: block;
    font-size: 0.78rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.backlink-badge:hover {
    border-color: rgba(167, 139, 250, 0.4);
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.035);
}

.outbound-link-badge {
    display: block;
    font-size: 0.78rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.outbound-link-badge:hover {
    border-color: rgba(167, 139, 250, 0.4);
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.035);
}

.processing-skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.processing-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    animation: shimmer 1.35s ease-in-out infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

#graphCanvas {
    background:
        radial-gradient(circle at 20% 20%, rgba(167, 139, 250, 0.08), transparent 28%),
        radial-gradient(circle at 80% 30%, rgba(59, 130, 246, 0.07), transparent 24%),
        linear-gradient(180deg, rgba(11, 12, 16, 0.98), rgba(9, 10, 15, 1));
}

.note-actions-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 208px;
    padding: 6px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 17, 23, 0.98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
}

.note-actions-menu button {
    display: flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    padding: 7px 10px;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 12px;
    text-align: left;
}

.note-actions-menu button:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.12);
    color: #f8fafc;
}

.note-actions-menu button:disabled {
    color: #64748b;
    cursor: not-allowed;
}

.note-actions-menu button.hidden {
    display: none;
}

.graph-mode-control {
    position: absolute;
    top: 18px;
    left: 50%;
    z-index: 2;
    display: flex;
    width: 220px;
    height: 36px;
    padding: 3px;
    transform: translateX(-50%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 17, 23, 0.88);
    backdrop-filter: blur(14px);
}

.graph-mode-option {
    flex: 1;
    border-radius: 5px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
}

.graph-mode-option.is-active {
    background: rgba(34, 211, 238, 0.16);
    color: #a5f3fc;
}

.graph-axis-label {
    position: absolute;
    left: 14px;
    color: rgba(148, 163, 184, 0.62);
    font-size: 10px;
    font-weight: 600;
    pointer-events: none;
}

.graph-axis-label-top { top: 72px; }
.graph-axis-label-bottom { bottom: 92px; }

@media (min-width: 1024px) {
    body {
        padding: 18px 24px;
        background:
            radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.12), transparent 34%),
            radial-gradient(circle at 80% 20%, rgba(34, 211, 238, 0.09), transparent 28%),
            #0d0e12;
    }

    .main-shell {
        width: min(100%, 1440px) !important;
        max-width: 1440px !important;
        border-radius: 22px;
        border: 1px solid rgba(148, 163, 184, 0.18);
        box-shadow: 0 40px 120px rgba(0, 0, 0, 0.55);
    }

    #tab-record,
    #tab-notes,
    #tab-graph {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    #notes-list-container {
        max-width: 1280px;
        margin-left: auto;
        margin-right: auto;
    }
}
