:root {
    --bg: #f7f2eb;
    --bg-warm: #efe5d7;
    --paper: #fffaf3;
    --paper-hover: #fdf4ea;
    --ink: #3b2d24;
    --ink-light: #6f5d50;
    --ink-faint: #9a8a7b;
    --ink-ghost: #c3b5a5;
    --accent: #b8815c;
    --accent-hover: #9f6847;
    --accent-soft: rgba(184, 129, 92, 0.12);
    --border: #d8c8b8;
    --border-light: #e9ddd0;
    --shadow-sm: 0 1px 3px rgba(60,45,30,0.06);
    --shadow-md: 0 4px 12px rgba(60,45,30,0.08);
    --shadow-lg: 0 8px 30px rgba(60,45,30,0.12);
    --shadow-hover: 0 6px 20px rgba(60,45,30,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-hand: 'Caveat', cursive;

    --note-default: #f5efe7;
    --note-rose: #f5e1dc;
    --note-sage: #dce5dc;
    --note-sky: #d8e4ee;
    --note-lavender: #e3ddef;
    --note-sand: #ece3d0;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.grain-overlay {
    position: fixed; inset: 0; z-index: 9999;
    pointer-events: none; opacity: 0.3;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

::selection { background: var(--accent-soft); color: var(--ink); }

.app-header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 32px;
    background: rgba(248, 243, 236, 0.85);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
}

.header-left { flex: 0 0 auto; }
.header-center { flex: 1; max-width: 560px; margin: 0 24px; }
.header-right { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

.app-title {
    font-family: var(--font-serif);
    font-size: 1.5rem; font-weight: 500;
    color: var(--ink); letter-spacing: -0.02em;
    display: flex; align-items: center; gap: 8px;
    user-select: none;
}

.title-icon {
    color: var(--accent); font-size: 1.1rem;
    animation: softPulse 3s ease-in-out infinite;
}

@keyframes softPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.search-container {
    position: relative; width: 100%;
}

.search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--ink-faint); transition: color var(--transition);
}

.search-input {
    width: 100%; padding: 10px 40px 10px 42px;
    background: var(--paper); border: 1px solid var(--border);
    border-radius: 24px; font-family: var(--font-sans);
    font-size: 0.9rem; color: var(--ink);
    transition: all var(--transition); outline: none;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(184, 129, 92, 0.12);
}

.search-input::placeholder { color: var(--ink-ghost); }

.search-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--ink-faint); padding: 4px;
    border-radius: 50%; display: none;
    transition: all var(--transition);
}

.search-clear:hover { color: var(--ink); background: var(--accent-soft); }
.search-input:not(:placeholder-shown) ~ .search-clear { display: flex; }

.sort-container { position: relative; }

.sort-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: var(--paper);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: 0.82rem;
    color: var(--ink-light); cursor: pointer;
    transition: all var(--transition);
}

.sort-btn:hover { border-color: var(--accent); color: var(--ink); }

.sort-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--paper); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px;
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition);
    min-width: 170px; z-index: 200;
}

.sort-dropdown.open {
    opacity: 1; visibility: visible; transform: translateY(0);
}

.sort-option {
    display: block; width: 100%; text-align: left;
    padding: 8px 14px; background: none; border: none;
    font-family: var(--font-sans); font-size: 0.85rem;
    color: var(--ink-light); cursor: pointer;
    border-radius: 6px; transition: all var(--transition);
}

.sort-option:hover { background: var(--accent-soft); color: var(--ink); }
.sort-option.active { color: var(--accent); font-weight: 500; }


@media (max-width: 768px) {
    .app-header {
        padding: 12px 16px;
        flex-wrap: wrap; gap: 8px;
    }

    .header-left { flex: 0 0 auto; }

    .app-title { font-size: 1.3rem; }

    .header-center {
        order: 3; flex-basis: 100%; margin: 0;
    }

    .search-input { padding: 10px 36px 10px 38px; font-size: 0.88rem; }

    .header-right { gap: 6px; }
    .sort-label { display: none; }
    .sort-btn { padding: 8px 10px; }
    .view-toggle { padding: 8px; }

    .main-content { padding: 16px 14px 100px; }

    .composer-wrapper { margin-bottom: 20px; }
    .composer-collapsed { padding: 12px 16px; }
    .composer-title { padding: 14px 16px 4px; font-size: 1.05rem; }
    .composer-body { padding: 6px 16px 14px; min-height: 60px; font-size: 0.88rem; }
    .composer-toolbar { padding: 6px 8px; flex-wrap: wrap; gap: 4px; }
    .toolbar-btn { padding: 8px; }

    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .note-card {
        padding: 14px 14px;
        min-height: 80px;
    }

    .note-card-title { font-size: 0.95rem; }
    .note-card-body { font-size: 0.8rem; max-height: 100px; }
    .note-card-pin { opacity: 1; }
    .note-card-delete { opacity: 1; }

    .mobile-fab { display: flex; }

    .modal {
        width: 100%; max-width: 100%;
        max-height: 92vh; height: auto;
        border-radius: 16px 16px 0 0;
        align-self: flex-end;
    }

    .modal-overlay {
        align-items: flex-end;
    }
    .modal-overlay.open .modal {
        transform: translateY(0);
    }

    .modal-overlay.fullscreen .modal {
        border-radius: 0; height: 100%; max-height: 100%;
    }

    .modal-overlay.fullscreen .modal-body { padding: 16px 20px; }
    .modal-overlay.fullscreen .modal-header { padding: 16px 20px 4px; }
    .modal-overlay.fullscreen .modal-title { font-size: 1.25rem; }
    .modal-overlay.fullscreen .modal-toolbar { padding: 8px 16px; }
    .modal-overlay.fullscreen .modal-footer { padding: 10px 20px; }

    .modal-header { padding: 16px 18px 4px; }
    .modal-title { font-size: 1.15rem; }
    .modal-body { padding: 12px 18px; min-height: 160px; max-height: 55vh; font-size: 0.9rem; }
    .modal-toolbar { padding: 6px 12px; gap: 1px; }
    .modal-footer { padding: 10px 18px; }
    .color-dot { width: 20px; height: 20px; }

    .section-label { font-size: 0.68rem; margin-bottom: 10px; }
}

@media (max-width: 480px) {
    .app-header { padding: 10px 12px; gap: 6px; }
    .app-title { font-size: 1.15rem; gap: 6px; }
    .title-icon { font-size: 0.9rem; }

    .search-input { padding: 9px 34px 9px 36px; font-size: 0.85rem; border-radius: 20px; }
    .search-icon { left: 12px; }

    .main-content { padding: 12px 10px 100px; }

    .composer-wrapper { margin-bottom: 16px; }
    .composer { border-radius: 10px; }
    .composer-collapsed { padding: 12px 14px; }
    .composer-placeholder { font-size: 0.88rem; gap: 8px; }
    .composer-title { padding: 12px 14px 2px; font-size: 1rem; }
    .composer-body { padding: 4px 14px 12px; font-size: 0.85rem; min-height: 50px; }
    .composer-toolbar {
        flex-direction: column; gap: 6px;
        padding: 8px 10px;
    }
    .toolbar-left { flex-wrap: wrap; }
    .toolbar-right { width: 100%; justify-content: flex-end; }
    .composer-save-btn { padding: 8px 24px; }
    .composer-close-btn { padding: 8px 18px; }

    .notes-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .note-card {
        padding: 14px 14px;
        min-height: 70px;
        border-radius: 10px;
    }

    .note-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    .note-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    .note-card-title { font-size: 0.92rem; }
    .note-card-body { font-size: 0.78rem; max-height: 80px; line-height: 1.5; 
    }
    .note-card-footer { margin-top: 8px; padding-top: 6px; }
    .note-card-date { font-size: 0.65rem; }

    .modal {
        width: 100%; border-radius: 14px 14px 0 0;
        max-height: 95vh;
    }
  .modal-header { padding: 14px 14px 2px; gap: 4px; }
    .modal-title { font-size: 1.1rem; }
    .modal-body { padding: 10px 14px; font-size: 0.88rem; max-height: 50vh; }
    .modal-toolbar {
        padding: 6px 10px;
        flex-wrap: wrap; gap: 1px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .toolbar-divider { margin: 0 2px; }
    .color-picker-inline { gap: 4px; }
    .color-dot { width: 18px; height: 18px; }
    .modal-footer { padding: 8px 14px; flex-wrap: wrap; gap: 8px; }
    .modal-timestamp { font-size: 0.65rem; flex-basis: 100%; }
    .modal-footer-actions { width: 100%; justify-content: flex-end; }
    .delete-btn { padding: 8px 12px; font-size: 0.78rem; }
    .save-btn { padding: 8px 20px; font-size: 0.78rem; }

    .mobile-fab { bottom: 20px; right: 16px; width: 52px; height: 52px; }

    .empty-state, .no-results { padding: 40px 16px; }
    .empty-illustration svg { width: 90px; height: 90px; }
    .empty-title { font-size: 1rem; }
    .empty-subtitle { font-size: 0.78rem; }

    .toast { font-size: 0.8rem; padding: 8px 20px; }
    .toast-container { bottom: 80px; }
}

@media (hover: none) {
    .note-card:hover {
        box-shadow: var(--shadow-sm);
        transform: none;
        border-color: var(--border);
    }
    .note-card:active {
        transform: scale(0.98);
        box-shadow: var(--shadow-md);
    }
}

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.note-card { animation: cardEnter 0.35s ease both; }

.view-toggle {
    padding: 8px; background: var(--paper);
   border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--ink-light); cursor: pointer;
    transition: all var(--transition); display: flex;
}

.view-toggle:hover { border-color: var(--accent); color: var(--ink); }
/* ========== MAIN CONTENT ========== */
.main-content {
    max-width: 1200px; margin: 0 auto;
    padding: 24px 32px 80px;
}

/* ========== COMPOSER ========== */
.composer-wrapper {
    max-width: 600px; margin: 0 auto 40px;
}

.composer {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
    overflow: hidden;
}

.composer:hover { box-shadow: var(--shadow-md); }

.composer-collapsed {
    padding: 14px 20px; cursor: text;
}

.composer-placeholder {
    display: flex; align-items: center; gap: 10px;
    color: var(--ink-faint); font-size: 0.95rem;
    font-family: var(--font-sans);
}

.composer-expanded { display: none; }
.composer.active .composer-collapsed { display: none; }
.composer.active .composer-expanded { display: block; }

.composer-title {
    width: 100%; padding: 16px 20px 4px;
    border: none; outline: none; background: none;
    font-family: var(--font-serif); font-size: 1.15rem;
    font-weight: 500; color: var(--ink);
}

.composer-title::placeholder { color: var(--ink-ghost); }

.composer-body {
    padding: 8px 20px 16px; min-height: 80px; max-height: 300px;
    overflow-y: auto; outline: none;
    font-family: var(--font-sans); font-size: 0.9rem;
    line-height: 1.7; color: var(--ink);
}

.composer-body:empty::before {
    content: attr(data-placeholder);
    color: var(--ink-ghost); pointer-events: none;
}

.composer-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-top: 1px solid var(--border-light);
}

.toolbar-left { display: flex; align-items: center; gap: 2px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.toolbar-btn {
    padding: 7px; background: none; border: none;
    color: var(--ink-faint); cursor: pointer;
    border-radius: 6px; display: flex;
    transition: all var(--transition);
}

.toolbar-btn:hover { background: var(--accent-soft); color: var(--ink); }

.toolbar-divider {
    width: 1px; height: 18px;
    background: var(--border); margin: 0 4px;
}

.composer-close-btn {
    padding: 6px 16px; background: none;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: 0.82rem;
    color: var(--ink-light); cursor: pointer;
    transition: all var(--transition);
}

.composer-close-btn:hover { border-color: var(--ink-faint); color: var(--ink); }

.composer-save-btn {
    padding: 6px 20px; background: var(--accent);
    border: none; border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: 0.82rem;
    color: #fff;
    transition: all var(--transition);
}

.composer-save-btn:hover { background: var(--accent-hover); }

.section-label {
    font-family: var(--font-sans); font-size: 0.72rem;
    font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--ink-faint);
    margin-bottom: 14px; padding-left: 4px;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.notes-grid.list-view {
    grid-template-columns: 1fr;
    max-width: 700px;
}

.note-card {
    background: var(--note-default);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 100px;
}

.note-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--ink-ghost);
}

.note-card.dragging {
    opacity: 0.5; transform: rotate(2deg) scale(0.95);
}

.note-card.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(184, 129, 92, 0.2);
}

.note-card[data-color="rose"] { background: var(--note-rose); }
.note-card[data-color="sage"] { background: var(--note-sage); }
.note-card[data-color="sky"] { background: var(--note-sky); }
.note-card[data-color="lavender"] { background: var(--note-lavender); }
.note-card[data-color="sand"] { background: var(--note-sand); }

.note-card-header {
    display: flex; align-items: flex-start;
    justify-content: space-between; margin-bottom: 6px;
}

.note-card-title {
    font-family: var(--font-serif);
    font-size: 1.05rem; font-weight: 500;
    color: var(--ink); line-height: 1.35;
    flex: 1; margin-right: 8px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
}

.note-card-pin {
    flex-shrink: 0;
    background: none; border: none; cursor: pointer;
    color: var(--ink-ghost); padding: 2px;
    border-radius: 4px; transition: all var(--transition);
    opacity: 0;
}

.note-card:hover .note-card-pin { opacity: 1; }
.note-card-pin.pinned { opacity: 1; color: var(--accent); }

.note-card-body {
    font-family: var(--font-sans);
    font-size: 0.83rem; color: var(--ink-light);
    line-height: 1.55; max-height: 140px;
    overflow: hidden; word-break: break-word;
}

.note-card-body img {
    max-width: 100%; border-radius: 6px;
    margin: 4px 0;
}

.note-card-footer {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-top: 12px; padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.04);
}

.note-card-date {
    font-size: 0.7rem; color: var(--ink-ghost);
    font-family: var(--font-sans);
}

.note-card-delete {
    background: none; border: none; cursor: pointer;
    color: var(--ink-ghost); padding: 4px;
    border-radius: 4px; opacity: 0;
    transition: all var(--transition);
}

.note-card:hover .note-card-delete { opacity: 1; }
.note-card-delete:hover { color: var(--ink); }

.empty-state, .no-results {
    text-align: center; padding: 60px 20px;
}

.empty-illustration { margin-bottom: 20px; opacity: 0.7; }

.empty-title {
    font-family: var(--font-serif);
    font-size: 1.2rem; color: var(--ink-light);
    margin-bottom: 6px;
}

.empty-subtitle {
    font-size: 0.85rem; color: var(--ink-faint);
}

.modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(60, 48, 41, 0.3);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.open {
    opacity: 1; visibility: visible;
}

.modal {
    background: var(--paper); width: 90%;
    max-width: 640px; max-height: 85vh;
    border-radius: 16px; box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
    transform: translateY(12px) scale(0.98);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal-overlay.fullscreen .modal {
    width: 100%; max-width: 100%; max-height: 100%;
    height: 100%; border-radius: 0;
}

.modal-overlay.fullscreen .modal-body {
    max-height: none; flex: 1;
    padding: 24px 48px;
    font-size: 1rem; line-height: 1.85;
}

.modal-overlay.fullscreen .modal-header {
    padding: 20px 48px 4px;
}

.modal-overlay.fullscreen .modal-title {
    font-size: 1.6rem;
}

modal-overlay.fullscreen .modal-toolbar {
    padding: 8px 40px;
}

.modal-overlay.fullscreen .modal-footer {
    padding: 12px 48px;
}

.modal-header {
    display: flex; align-items: center;
    padding: 20px 24px 4px; gap: 8px;
}

.modal-title {
    flex: 1; border: none; outline: none; background: none;
    font-family: var(--font-serif);
    font-size: 1.3rem; font-weight: 500; color: var(--ink);
}

.modal-title::placeholder { color: var(--ink-ghost); }

.modal-actions-top { display: flex; align-items: center; gap: 2px; }

.fullscreen-btn {
    padding: 6px; background: none; border: none;
    color: var(--ink-ghost); cursor: pointer;
    border-radius: 6px; display: flex;
    transition: all var(--transition);
}

.fullscreen-btn:hover { color: var(--accent); background: var(--accent-soft); }

.pin-btn {
    padding: 6px; background: none; border: none;
    color: var(--ink-ghost); cursor: pointer;
    border-radius: 6px; display: flex;
    transition: all var(--transition);
}

.pin-btn:hover { color: var(--accent); background: var(--accent-soft); }
.pin-btn.pinned { color: var(--accent); }

.modal-close {
    padding: 6px; background: none; border: none;
    color: var(--ink-faint); cursor: pointer;
    border-radius: 6px; display: flex;
    transition: all var(--transition);
}

.modal-close:hover { color: var(--ink); background: var(--accent-soft); }

.modal-toolbar {
    display: flex; align-items: center; gap: 2px;
    padding: 8px 16px; border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.color-picker-inline { display: flex; gap: 5px; align-items: center; }

.color-dot {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer;
    transition: all var(--transition);
}

.color-dot:hover { transform: scale(1.15); }
.color-dot.active { border-color: var(--accent); }

.modal-body {
    flex: 1; padding: 16px 24px; min-height: 200px;
    max-height: 50vh; overflow-y: auto; outline: none;
    font-family: var(--font-sans);
    font-size: 0.92rem; line-height: 1.75; color: var(--ink);
}

.modal-body:empty::before {
    content: attr(data-placeholder);
    color: var(--ink-ghost); pointer-events: none;
}

.modal-body img {
    max-width: 100%; border-radius: 8px; margin: 8px 0;
}

.modal-footer {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 12px 24px; border-top: 1px solid var(--border-light);
}

.modal-timestamp {
    font-size: 0.72rem; color: var(--ink-ghost);
}

.modal-footer-actions { display: flex; gap: 10px; }

.delete-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; background: none;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: 0.82rem;
    color: var(--ink-faint); cursor: pointer;
    transition: all var(--transition);
}

.delete-btn:hover { border-color: #c0392b; color: #c0392b; background: rgba(192,57,43,0.05); }

.save-btn {
    padding: 7px 24px; background: var(--accent);
    border: none; border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: 0.82rem;
    color: #fff; cursor: pointer; font-weight: 500;
    transition: all var(--transition);
}

.save-btn:hover { background: var(--accent-hover); }

.checklist-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 3px 0; line-height: 1.6;
}

.checklist-item input[type="checkbox"] {
    margin-top: 5px; accent-color: var(--accent);
    width: 16px; height: 16px; cursor: pointer;
    flex-shrink: 0;
}

.checklist-item.checked span {
    text-decoration: line-through;
    color: var(--ink-ghost);
}

.toast-container {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%); z-index: 10000;
    display: flex; flex-direction: column; gap: 8px;
    align-items: center;
}

.toast {
    background: var(--ink); color: var(--paper);
    padding: 10px 24px; border-radius: 24px;
    font-family: var(--font-sans); font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.2s forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-ghost); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

.mobile-fab {
    display: none;
    position: fixed; bottom: 24px; right: 24px;
    width: 56px; height: 56px;
    background: var(--accent); color: var(--paper);
    border: none; border-radius: 50%;
    box-shadow: 0 4px 16px rgba(184, 129, 92, 0.35);
    cursor: pointer; z-index: 90;
    align-items: center; justify-content: center;
    transition: all var(--transition);
}

.mobile-fab:hover { background: var(--accent-hover); transform: scale(1.05); }
.mobile-fab:active { transform: scale(0.95); }

.auth-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(250, 248, 244, 0.85); /* Matches paper note bg somewhat */
    backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center;
    z-index: 9999;
}

.auth-overlay.open {
    display: flex;
}

.auth-modal {
    background: var(--paper);
    width: 90%; max-width: 360px;
    padding: 32px; border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-title {
    font-family: var(--font-serif);
    font-size: 1.5rem; color: var(--ink);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-family: var(--font-sans);
    font-size: 0.85rem; color: var(--ink-faint);
    margin-bottom: 24px;
}

.auth-form {
    display: flex; flex-direction: column; gap: 12px;
}

.auth-input {
    width: 100%; padding: 12px 16px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-sizing: border-box;
    font-family: var(--font-sans); font-size: 0.9rem;
    color: var(--ink); outline: none; transition: all var(--transition);
}

.auth-input:focus { border-color: var(--accent); }

.auth-btn {
    width: 100%; padding: 12px;
    border-radius: var(--radius-sm); font-family: var(--font-sans);
    font-size: 0.9rem; cursor: pointer; transition: all var(--transition);
    box-sizing: border-box;
}

.Primary-btn {
    background: var(--accent); color: var(--paper); border: none;
}

.Primary-btn:hover { background: var(--accent-hover); }

.Secondary-btn {
    background: transparent; color: var(--ink);
    border: 1px solid var(--border);
}

.Secondary-btn:hover { border-color: var(--ink-faint); }

.auth-buttons {
    display: flex; gap: 8px; margin-top: 8px;
}

.auth-divider {
    position: relative; text-align: center; margin: 20px 0;
    color: var(--ink-ghost); font-size: 0.8rem;
}

.auth-divider::before {
    content: ''; position: absolute; left: 0; top: 50%;
    width: 100%; height: 1px; background: var(--border-light); z-index: 1;
}

.auth-divider span {
    background: var(--paper); padding: 0 10px;
    position: relative; z-index: 2;
}

.guest-btn {
    width: 100%; padding: 10px;
    background: none; border: 1px dashed var(--border);
    border-radius: var(--radius-sm); font-family: var(--font-sans);
    font-size: 0.85rem; color: var(--ink-light); cursor: pointer;
    transition: all var(--transition);
}

.guest-btn:hover { border-color: var(--ink-faint); color: var(--ink); }