* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent double-tap zoom and pinch zoom on mobile */
html {
    touch-action: pan-x pan-y;
}

:root {
    /* These are default (dark skin) values.
       SkinManager overrides all via <style id="pxn-skin-vars">. */
    --primary: #6c5ce7;
    --primary-dark: #5b4cdb;
    --primary-light: rgba(108, 92, 231, 0.2);
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent-green: #00b894;
    --accent-orange: #e17055;
    --accent-pink: #fd79a8;
    --accent-blue: #74b9ff;
    --accent-yellow: #fdcb6e;
    --bg-base: #0c0c0f;
    --bg-dark: #1a1a2e;
    --bg-section: #1e1e36;
    --bg-card: #252542;
    --bg-hover: #2d2d4a;
    --bg-overlay: rgba(12, 12, 15, 0.8);
    --bg-panel: rgba(24, 24, 32, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-inverse: #1a1a2e;
    --fg-subtle: rgba(255, 255, 255, 0.05);
    --fg-light: rgba(255, 255, 255, 0.1);
    --fg-medium: rgba(255, 255, 255, 0.2);
    --fg-strong: rgba(255, 255, 255, 0.4);
    --fg-emphasis: rgba(255, 255, 255, 0.8);
    --border: #3a3a5c;
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-active: rgba(255, 255, 255, 0.1);
    --warning: #f39c12;
    --danger: #e74c3c;
    --status-error: #f87171;
    --status-success: #34d399;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --overlay-bg: rgba(0, 0, 0, 0.6);
}

/* Custom scrollbar — auto-hide: visible only on container hover */
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.sidebar:hover { scrollbar-color: var(--fg-light) transparent; }
.content:hover { scrollbar-color: var(--fg-light) transparent; }
.sidebar:hover ::-webkit-scrollbar-thumb,
.content:hover ::-webkit-scrollbar-thumb { background: var(--fg-light); }
.sidebar:hover ::-webkit-scrollbar-thumb:hover,
.content:hover ::-webkit-scrollbar-thumb:hover { background: var(--fg-medium); }

/* Debug Panel is now provided by shared/DebugPanel.js with scoped CSS */

/* ── Icon Badge (shared component) ── */
.pxn-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--primary-light);
    color: var(--text-primary);
    flex-shrink: 0;
    overflow: hidden;
}

.pxn-icon-badge .icon-svg {
    width: 18px;
    height: 18px;
}

.pxn-icon-badge .icon-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.pxn-icon-badge--md {
    width: 36px;
    height: 36px;
    border-radius: 9px;
}

.pxn-icon-badge--md .icon-svg {
    width: 22px;
    height: 22px;
}

.project-modal-icon {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.project-modal-icon:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

/* Plan Badge */
.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 12px;
}

.plan-badge.free {
    background: var(--text-secondary);
    color: var(--text-secondary);
}

.plan-badge.basic {
    background: color-mix(in srgb, var(--accent-blue) 20%, transparent);
    color: var(--accent-blue);
}

.plan-badge.pro {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-light));
    color: var(--accent-pink);
}

/* Beta Badge */
.beta-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: color-mix(in srgb, var(--accent-pink) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-pink) 30%, transparent);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-pink);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
    margin-left: 0;
}

.beta-badge:hover {
    background: color-mix(in srgb, var(--accent-pink) 25%, transparent);
}

/* Usage Indicator */
.usage-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.usage-indicator.warning {
    color: var(--warning);
}

.usage-indicator.danger {
    color: var(--danger);
}

.usage-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 3px;
    transition: width 0.3s, background 0.3s;
}

.usage-fill.warning {
    background: var(--warning);
}

.usage-fill.danger {
    background: var(--danger);
}

/* Limit Warning Banner */
.limit-warning {
    background: color-mix(in srgb, var(--warning) 10%, transparent);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    display: none;
}

.limit-warning.visible {
    display: flex;
}

.limit-warning-icon {
    font-size: 1.2rem;
}

.limit-warning-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--warning);
}

.limit-warning-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    background: var(--warning);
    color: var(--text-inverse);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.limit-warning-btn:hover {
    filter: brightness(1.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile (iOS Safari address bar) */
    overflow: hidden;
    /* Prevent body scroll - scroll happens in .content */
    display: flex;
    flex-direction: column;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow selection in input fields */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

/* App container - must fill body and enable flex layout */
#app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Critical for nested flex scrolling */
    overflow: hidden;
}

/* Header */
.header {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--fg-subtle);
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 100;
    overflow: visible;
    max-width: 100%;
    box-sizing: border-box;
}

/* ... existing header inner styles ... */

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    min-height: 0; /* Important for flex child scrolling */
    overflow: hidden;
    /* Build scrolling areas inside */
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Loading veil: grayscale + reduced opacity while data loads */
.main-layout.is-loading {
    filter: grayscale(0.8);
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

/* Loading spinner overlay on veil */
.main-layout.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -16px 0 0 -16px;
    width: 32px;
    height: 32px;
    border: 3px solid var(--fg-light);
    border-top-color: var(--fg-strong);
    border-radius: 50%;
    animation: thumb-spin 0.8s linear infinite;
    z-index: 10;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    /* Scrollable sidebar */
    flex-shrink: 0;
    transition: transform 0.3s ease, width 0.3s ease, margin-left 0.3s ease;
    z-index: 90;
}

/* Content Area (make it scrollable) */
.content {
    flex: 1;
    min-height: 0; /* Critical for flex child scrolling */
    padding: 30px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
    background: var(--bg-dark);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-text {
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex-shrink: 1;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

/* Collapsed state: only show the toggle button */
.search-box.collapsed input,
.search-box.collapsed .clear-search-btn {
    display: none;
}

.search-box.collapsed .search-toggle-btn {
    display: flex;
}

/* Expanded state: show input, hide toggle button */
.search-box:not(.collapsed) .search-toggle-btn {
    display: none;
}

.search-box:not(.collapsed) input {
    display: block;
}

.search-toggle-btn {
    flex-shrink: 0;
}

.search-box input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px 8px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 200px;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    width: 260px;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.clear-search-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.clear-search-btn svg {
    width: 14px;
    height: 14px;
}

.search-box input {
    padding-right: 32px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
}

.icon-btn:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    color: white;
    overflow: hidden;
}

.avatar svg {
    width: 20px;
    height: 20px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Note: .main-layout is defined at line 175, .sidebar at line 183 */
/* Removed duplicate definitions that were causing scroll issues */

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--fg-light);
    padding: 2px 8px;
    border-radius: 10px;
}

.nav-item.active .nav-item-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Temp note sidebar item */
.temp-note-item {
    gap: 8px;
}

.temp-note-item .temp-note-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.temp-note-item .temp-note-icon .icon-svg {
    width: 18px;
    height: 18px;
}

.temp-note-item.active {
    background: color-mix(in srgb, var(--primary) 70%, var(--accent-yellow));
    color: #fff;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.nav-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 8px;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.section-usage-footer {
    font-size: 0.7rem;
    color: var(--text-muted, #888);
    text-align: right;
    padding: 4px 14px 0;
}

.note-section .section-usage-footer {
    padding: 4px 16px 8px;
}

.nav-section-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-section-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.nav-section-btn svg {
    width: 16px;
    height: 16px;
}

/* Project Section (Pro only) */
.pro-feature {
    transition: all 0.3s;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.project-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.project-item.active {
    background: var(--primary-light);
    color: var(--text-primary);
}

/* .project-icon uses .pxn-icon-badge base styles */

.project-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--fg-light);
    padding: 2px 6px;
    border-radius: 8px;
}

.project-item.active .project-count {
    background: var(--primary);
    color: #fff;
}

.project-quota-icon {
    color: var(--danger);
    font-weight: bold;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.project-orphan-icon {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    margin-left: 2px;
    flex-shrink: 0;
}

/* Lazy sync: skeleton / syncing indicators */
.project-sync-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
    flex-shrink: 0;
}

.project-sync-icon--skeleton {
    color: var(--text-secondary, #888);
    opacity: 0.7;
}

.project-sync-icon--syncing {
    color: var(--accent-color, #3b82f6);
}

.project-sync-icon--syncing svg {
    animation: project-sync-spin 1s linear infinite;
}

@keyframes project-sync-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Note sidebar tree (inside active project) --- */

.project-group {
    display: flex;
    flex-direction: column;
}

.note-sidebar-list-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    /* transition is opt-in via .animate class to prevent re-animation on DOM rebuild */
}
.note-sidebar-list-wrapper.animate {
    transition: grid-template-rows 0.25s ease;
}

.project-group.expanded .note-sidebar-list-wrapper {
    grid-template-rows: 1fr;
}

.note-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 6px 0 20px;
    overflow: hidden;
}

.project-group.expanded .note-sidebar-list {
    padding: 2px 6px 4px 20px;
}

.note-sidebar-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.note-sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.note-sidebar-item.focused {
    color: var(--text-primary);
    background: var(--primary-light);
}

/* .note-sidebar-icon uses .pxn-icon-badge; override size for compact sidebar */
.note-sidebar-icon {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    opacity: 0.7;
}

.note-sidebar-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-sidebar-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    min-width: 16px;
    text-align: right;
}

.note-sidebar-quota {
    color: var(--danger);
    font-weight: bold;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.note-sidebar-sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.6;
    flex-shrink: 0;
}

.note-sidebar-item.over-quota .note-sidebar-icon,
.note-sidebar-item.over-quota .note-sidebar-name,
.note-sidebar-item.over-quota .note-sidebar-count {
    opacity: 0.45;
}

.note-sidebar-item.drag-over {
    background: var(--primary-light);
    color: var(--text-primary);
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* Tag Section */
.tag-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 14px 8px;
}

.tag-section-toggle {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-section-toggle:hover {
    color: var(--text-primary);
}

.tag-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-filter:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.tag-filter.active {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.tag-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Size Tags */
.size-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 8px;
}

.size-tag {
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.size-tag:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.size-tag.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.filter-clear-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-clear-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Filter Banner (note list top) ── */
.filter-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    margin: 0 0 2px;
    background: color-mix(in srgb, var(--accent-yellow) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-yellow) 30%, transparent);
    border-radius: 8px;
}
.filter-banner-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}
.filter-banner-icon {
    flex-shrink: 0;
    color: var(--accent-yellow);
}
.filter-banner-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-yellow);
    white-space: nowrap;
}
.filter-banner-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--accent-yellow) 15%, transparent);
    color: var(--text-primary);
    font-size: 0.75rem;
    white-space: nowrap;
}
.filter-banner-clear {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--accent-yellow) 30%, transparent);
    background: transparent;
    color: var(--accent-yellow);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.filter-banner-clear:hover {
    background: color-mix(in srgb, var(--accent-yellow) 20%, transparent);
    border-color: var(--accent-yellow);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.storage-info {
    padding: 12px 14px;
}

.storage-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.storage-bar {
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    width: 35%;
    background: linear-gradient(90deg, var(--primary), var(--accent-pink));
    border-radius: 2px;
}

.storage-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Note: .content is defined at line 200 */

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.content-title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.content-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* .content-title-icon uses .pxn-icon-badge base styles; hidden until JS shows it */
.content-title-icon {
    display: none;
}

.content-title {
    font-size: 1.4rem;
    font-weight: 600;
}

.content-project-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.content-project-edit:hover {
    color: var(--text-primary);
    background: var(--fg-light);
}

.content-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.content-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-primary {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* ==================== */
/* Note Sections        */
/* ==================== */
.note-sections {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.note-section {
    background: var(--bg-section);
    border-radius: 16px;
    padding: 10px 14px;
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}

.note-section.orphan {
    outline: 1px solid var(--primary-glow);
    outline-offset: -1px;
    background: color-mix(in srgb, var(--bg-section) 92%, var(--primary));
    opacity: 0.8;
}

.note-section.over-quota {
    opacity: 0.6;
}

.note-section.over-quota .note-section-icon {
    filter: grayscale(0.5);
}

.note-section--temp {
    outline: 1px solid color-mix(in srgb, var(--accent-yellow) 30%, transparent);
    outline-offset: -1px;
    background: color-mix(in srgb, var(--bg-section) 90%, var(--accent-yellow));
}

.note-section--temp .note-section-icon {
    background: color-mix(in srgb, var(--accent-yellow) 20%, transparent);
}


.note-section.orphan .note-section-actions .note-section-btn.orphan-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.note-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.note-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* .note-section-icon uses .pxn-icon-badge.pxn-icon-badge--md base styles */
.note-section-icon {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.note-section-icon:hover {
    filter: brightness(1.1);
}

.note-section-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.note-section-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.note-section-sep {
    margin: 0 6px;
    opacity: 0.5;
}

.note-sync-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    color: var(--text-muted, #999);
    opacity: 0.4;
}

.note-sync-icon.unsynced {
    color: var(--warning, #f0a030);
    opacity: 0.8;
}

.note-sync-icon.blob-pending {
    color: var(--primary, #60a5fa);
    opacity: 0.8;
    gap: 2px;
}

.note-blob-pending-count {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

.note-sync-icon.quota-exceeded {
    color: var(--danger);
    opacity: 1;
    cursor: pointer;
}

.note-sync-icon.conflict {
    color: var(--warning);
    opacity: 1;
    gap: 2px;
}

.note-conflict-count {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

.note-sync-icon.shared {
    color: var(--success, #22c55e);
    opacity: 0.8;
}

.note-sync-icon.orphan {
    color: var(--primary);
    opacity: 1;
    cursor: pointer;
    animation: orphan-pulse 2s ease-in-out infinite;
}

@keyframes orphan-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.note-section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-section-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.note-section-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.note-section-btn svg {
    width: 18px;
    height: 18px;
}

.note-animation-btn svg {
    width: 14px;
    height: 14px;
}

.note-animation-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Note More Menu (Dropdown) */
.note-more-menu {
    position: fixed;
    min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow-color);
    padding: 4px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.15s, transform 0.15s;
}

.note-more-menu.active {
    opacity: 1;
    transform: translateY(0);
}

.note-more-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.note-more-menu-item:hover {
    background: var(--bg-hover);
}

.note-more-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.note-more-menu-item.danger {
    color: var(--danger);
}

.note-more-menu-item.danger:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.note-more-menu-item.disabled,
.context-menu-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.note-more-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}

.sort-indicator {
    margin-left: auto;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 800;
}

/* Icon Picker Popover */
.icon-picker-popover {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow-color);
    padding: 12px;
    z-index: 2100;
    max-width: 280px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s;
}

.icon-picker-popover.active {
    opacity: 1;
    transform: translateY(0);
}

.icon-picker-popover .icon-picker {
    margin-top: 0;
}

.icon-picker-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.icon-picker-preview-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    image-rendering: pixelated;
    object-fit: cover;
}

.icon-picker-reset {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.icon-picker-reset:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Icon Background Color Picker */
.icon-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}

.icon-color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    padding: 0;
}

.icon-color-option:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.icon-color-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary);
}

.icon-color-default {
    background: var(--primary-light);
}

.icon-color-transparent {
    background:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

.icon-color-custom {
    position: relative;
    background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
}

.icon-color-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    padding: 0;
    border: none;
}

.note-more-menu-item.disabled:hover,
.context-menu-item.disabled:hover {
    background: transparent;
}

/* Context Menu (right-click) */
.context-menu {
    position: fixed;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow-color);
    padding: 4px;
    z-index: 2000;
    animation: context-menu-appear 0.1s ease-out;
}

@keyframes context-menu-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.1s;
    text-align: left;
}

.context-menu-item:hover {
    background: var(--bg-hover);
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}


/* Note Selection State */
.note-section.selected {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-light));
    box-shadow: 0 0 0 2px var(--primary);
}

.note-section.selected .note-section-header {
    border-bottom-color: var(--primary-light);
}

.note-section.selected .note-section-icon {
    background: var(--primary);
    color: white;
}

/* Note Dragging State - リアルタイム並び替え */
.note-section--dragging {
    opacity: 0;  /* 完全透明（スペースは維持、ゴーストのみ表示） */
    pointer-events: none;
    background: transparent !important;
}

/* Note FLIPアニメーション用トランジション */
.note-section--animating {
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}

/* Note タッチドラッグ: 長押し検出の視覚フィードバック */
.note-section--touch-drag-ready {
    transform: scale(1.02);
    box-shadow: 0 0 0 2px var(--primary), 0 4px 16px var(--primary-glow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 10;
    position: relative;
}

/* Note タッチドラッグゴースト */
.note-touch-drag-ghost {
    animation: touch-ghost-appear 0.15s ease-out;
    opacity: 0.9;
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-color);
    background: var(--bg-section, #1a1a2e);
    border: 2px solid var(--primary);
    overflow: hidden;
}

/* ========================================
   整理モード
   ======================================== */

/* 整理モードトグルボタン（content-header 内） */
.organize-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.organize-mode-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.organize-mode-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.organize-mode-toggle svg {
    width: 16px;
    height: 16px;
}

/* 整理モード: コンパクト表示 */
.note-sections.organize-mode .note-section {
    margin-bottom: 2px;
    padding: 10px 14px;
    cursor: grab;
}

.note-sections.organize-mode .note-section:active {
    cursor: grabbing;
}

.note-sections.organize-mode .note-section-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 整理モード中の上下ボタン（disabled状態） */
.note-section-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Arts Grid */
.arts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--grid-gap, 20px);
}

.art-card {
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: 120px 180px;
}

.art-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    /* Solid dark background for padding area */
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.art-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.art-thumbnail img {
    /* Size is set dynamically by JS based on aspect ratio */
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    pointer-events: none;
    /* Checkerboard only behind the actual image (shows through transparent pixels) */
    background-color: var(--bg-section);
    background-image:
        linear-gradient(45deg, var(--bg-dark) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bg-dark) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bg-dark) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bg-dark) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

/* Thumbnail loading state */
.art-thumb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
}

.art-thumb-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--fg-light);
    border-top-color: var(--fg-medium);
    border-radius: 50%;
}

.art-thumb-spinner.spinning {
    animation: thumb-spin 0.8s linear infinite;
}

@keyframes thumb-spin {
    to { transform: rotate(360deg); }
}

.art-thumbnail img.art-thumb-fadein {
    animation: thumb-fadein 0.25s ease-out;
}

@keyframes thumb-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.art-size-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
}

/* Favorite button */
.art-favorite-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.art-favorite-btn svg {
    width: 16px;
    height: 16px;
}

.art-favorite-btn:hover {
    background: var(--bg-panel);
    color: var(--accent-pink);
}

.art-favorite-btn--active {
    color: var(--accent-pink);
    opacity: 1;
}

.art-card:hover .art-favorite-btn {
    opacity: 1;
}

/* Sync badge (unsynced indicator on art card) */
.art-sync-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--overlay-bg);
    color: var(--warning, #f0a030);
    z-index: 2;
}

/* Conflict badge (stale data indicator on art card) */
.art-conflict-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    padding: 0;
    border-radius: 50%;
    background: var(--overlay-bg);
    color: var(--warning);
    z-index: 2;
    cursor: pointer;
}

/* Conflict banner (top of ArtGrid when conflicts exist) */
.conflict-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 4px;
    color: var(--warning);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.conflict-banner:hover {
    background: color-mix(in srgb, var(--warning) 20%, transparent);
}

/* Blob pending variant (uploading — blue accent) */
.art-sync-badge.blob-pending {
    color: var(--primary, #60a5fa);
}

/* Quota exceeded variant of sync badge */
.art-sync-badge.quota-exceeded {
    border: none;
    padding: 0;
    width: 18px;
    height: 18px;
    background: color-mix(in srgb, var(--danger) 90%, transparent);
    color: #fff;
    font-weight: bold;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    z-index: 3;
    border-radius: 50%;
}

.art-card.quota-exceeded .art-thumbnail {
    opacity: 0.3;
    filter: grayscale(0.4);
    transition: opacity 0.2s, filter 0.2s;
}

.art-card.quota-exceeded:hover .art-thumbnail {
    opacity: 0.75;
    filter: grayscale(0.1);
}

.art-sync-badge.orphan {
    border: none;
    padding: 0;
    background: var(--primary-glow);
    color: var(--primary);
    cursor: pointer;
    z-index: 3;
    animation: orphan-pulse 2s ease-in-out infinite;
}

/* Delete button */
.art-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    font-size: 16px;
    line-height: 1;
}

.art-delete-btn:hover {
    background: color-mix(in srgb, var(--danger) 80%, transparent);
    color: #fff;
}

.art-card:hover .art-delete-btn {
    opacity: 1;
}

/* More button (context menu trigger) */
.art-more-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.art-more-btn svg {
    width: 16px;
    height: 16px;
}

.art-more-btn:hover {
    background: var(--bg-hover);
}

.art-card:hover .art-more-btn {
    opacity: 1;
}

.art-card:not(.art-card--selected):not(.art-card--multi-selected):hover {
    box-shadow: 0 0 0 1px var(--border-active);
}

.art-card:hover .art-actions {
    opacity: 1;
}

.art-card:hover .art-checkbox {
    opacity: 1;
}

/* ========================================
   Drag & Drop Animation Styles
   ======================================== */

/* ドラッグ中のカード - DOM上は透明にしてゴースト画像のみ表示 */
.art-card--dragging {
    opacity: 0;  /* 完全透明（スペースは維持） */
    pointer-events: none;
    background: transparent !important;
}

/* ドラッグ中は他カードのホバーエフェクトを抑制 */
.arts-grid--dragging .art-card:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* FLIPアニメーション用トランジション */
.art-card--animating {
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.3s ease-out;
}

/* ドロップ位置インジケーター - 左側 */
.art-card--drop-before {
    position: relative;
}

.art-card--drop-before::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
    animation: drop-indicator-pulse 0.8s ease-in-out infinite;
}

/* ドロップ位置インジケーター - 右側 */
.art-card--drop-after {
    position: relative;
}

.art-card--drop-after::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
    animation: drop-indicator-pulse 0.8s ease-in-out infinite;
}

@keyframes drop-indicator-pulse {
    0%, 100% {
        opacity: 1;
        transform: scaleY(0.9);
    }
    50% {
        opacity: 0.7;
        transform: scaleY(1);
    }
}

/* ドラッグオーバー時のグリッド全体のフィードバック（クロスノートドラッグ） */
.arts-grid.drag-over {
    background: var(--primary-light);
    border-radius: 10px;
    outline: 2px dashed var(--primary-glow);
    outline-offset: 4px;
    transition: background 0.15s ease, outline 0.15s ease;
}

/* タッチドラッグ準備状態 */
.art-card--touch-drag-ready {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--primary), 0 8px 24px var(--primary-glow);
    z-index: 100;
}

/* タッチドラッグゴースト（JSで生成） */
.touch-drag-ghost {
    animation: touch-ghost-appear 0.15s ease-out;
}

@keyframes touch-ghost-appear {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 0.9;
    }
}

/* クロスノートドラッグ中のプレースホルダー（挿入先スロット） */
.art-card--placeholder {
    border: 2px dashed var(--primary-glow);
    background: var(--primary-light);
    border-radius: 8px;
    pointer-events: none;
    min-height: 120px;
}

/* クロスノート移動で到着したカードのフェードイン */
.art-card--just-arrived {
    animation: art-card-arrive 0.3s ease-out;
}

@keyframes art-card-arrive {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ドラッグゴーストの件数バッジ（複数選択ドラッグ時） */
.drag-count-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 24px;
    height: 24px;
    background: var(--primary, #6c5ce7);
    color: white;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 6px var(--shadow-color);
    z-index: 10;
}

/* ドラッグゴーストの背面スタックカード（タッチ用） */
.drag-ghost-stack {
    background: var(--bg-card, #1a1a2e);
    border-radius: 10px;
    border: 2px solid var(--fg-light);
    box-shadow: 0 2px 8px var(--shadow-color);
}


/* ========================================
   Art Card Selection & Action Menu
   ======================================== */

.art-card--selected {
    box-shadow: 0 0 0 2px var(--primary);
}

/* Multi-selection styles */
.art-card--multi-selected {
    box-shadow: 0 0 0 2px var(--primary);
}

.art-card--multi-selected .art-select-check {
    opacity: 1;
}

.art-select-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 15;
    pointer-events: none;
}

.art-select-check svg {
    width: 14px;
    height: 14px;
    color: white;
}

/* Selection mode: hide favorite button to avoid overlap with check */
.art-grid--selection-mode .art-favorite-btn {
    display: none;
}

/* Selection mode: show unchecked circle on hover */
.art-grid--selection-mode .art-card:not(.art-card--multi-selected) .art-select-check {
    opacity: 0.5;
    background: var(--fg-medium);
    border: 2px solid var(--fg-strong);
}

.art-grid--selection-mode .art-card:not(.art-card--multi-selected) .art-select-check svg {
    display: none;
}

.art-grid--selection-mode .art-card:hover .art-select-check {
    opacity: 1;
}

.art-action-menu {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 4px 16px var(--shadow-color);
    z-index: 100;
    animation: menu-appear 0.15s ease-out;
}

@keyframes menu-appear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(100%) scale(1);
    }
}

.art-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.art-action-btn svg {
    width: 18px;
    height: 18px;
}

.art-action-btn:hover {
    background: var(--primary);
    color: white;
}

.art-action-btn--danger:hover {
    background: var(--danger, var(--danger));
    color: white;
}

.art-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid var(--fg-strong);
    background: var(--shadow-color);
    opacity: 0;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.art-checkbox:hover {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.art-checkbox.checked {
    opacity: 1;
    background: var(--primary);
    border-color: var(--primary);
}

.art-checkbox svg {
    width: 12px;
    height: 12px;
    color: white;
    display: none;
}

.art-checkbox.checked svg {
    display: block;
}

.art-thumb {
    aspect-ratio: 1;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.art-thumb canvas {
    width: 70%;
    height: 70%;
    image-rendering: pixelated;
}

.art-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.art-action-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: none;
    background: var(--overlay-bg);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.art-action-btn:hover {
    background: var(--primary);
}

.art-action-btn svg {
    width: 12px;
    height: 12px;
}

.art-info {
    padding: 10px;
}

.art-title {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.art-seq {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.85em;
}

.art-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    gap: 4px;
    overflow: hidden;
}

.art-size {
    font-family: monospace;
    background: var(--bg-dark);
    padding: 2px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.art-time {
    flex-shrink: 0;
    white-space: nowrap;
}

.art-tag-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.art-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.art-tag-more {
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* New Art Card */
.new-art-card {
    background: var(--fg-subtle);
    border: none;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 160px;
}

.new-art-card:hover {
    background: var(--primary-light);
}

.new-art-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.2s;
}

.new-art-card:hover .new-art-icon {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.new-art-icon svg {
    width: 18px;
    height: 18px;
}

.new-art-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* New Note Section */
.new-note-section {
    background: var(--fg-subtle);
    border: none;
    border-radius: 16px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.new-note-section:hover {
    background: var(--primary-light);
}

.new-note-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.2s;
}

.new-note-section:hover .new-note-icon {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.new-note-icon svg {
    width: 28px;
    height: 28px;
}

.new-note-text {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Selection Bar */
.selection-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 20, 30, 0.92);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.selection-bar.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.selection-count {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.selection-count strong {
    color: #74b9ff;
    font-size: 1.1rem;
}

.selection-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
}

.selection-actions {
    display: flex;
    gap: 8px;
}

.selection-btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.selection-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.selection-btn.danger:hover {
    background: rgba(220, 53, 69, 0.45);
}

.selection-btn.cancel {
    margin-left: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.85);
}

.selection-btn.cancel:hover {
    background: var(--fg-light);
    border-color: var(--fg-strong);
}

.selection-btn svg {
    width: 16px;
    height: 16px;
}

/* Collapsed Note */
.note-section.collapsed {
    /* 折りたたみ時は content-visibility の 500px 推定サイズを使わない */
    contain-intrinsic-size: auto 80px;
}

.note-section.collapsed .arts-grid {
    display: none;
}

.note-section.collapsed .note-section-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.collapse-icon {
    transition: transform 0.2s;
}

.note-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* ── Focus Mode ── */

/* Hide non-focused note sections */
.focus-mode .note-section:not(.focused) {
    display: none;
}

/* Remove card frame from focused note */
.focus-mode .note-section.focused {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    /* Disable content-visibility optimization in focus mode (single section) */
    content-visibility: visible;
    contain-intrinsic-size: auto;
}

/* Hide note section header (info is in content-header) */
.focus-mode .note-section.focused .note-section-header {
    display: none;
}

/* Hide filter banner in focus mode */
.focus-mode .filter-banner {
    display: none;
}

/* Hide "new note" placeholder card in focus mode */
.focus-mode .new-note-section {
    display: none;
}

/* Simple card display mode styles are injected via <style id="cardSimpleStyle">
   in DashboardView._updateDisplayMode() to avoid layout thrashing
   with content-visibility: auto on art-card elements.
   Toggle button uses .icon-btn in header — no extra CSS needed. */

/* ── Scroll Navigation ── */

.scroll-nav {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 20;
}

.scroll-nav.visible {
    pointer-events: auto;
    opacity: 1;
}

.scroll-nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--fg-light);
    color: var(--fg-strong);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.scroll-nav-btn:hover {
    background: var(--fg-light);
    color: var(--fg-emphasis);
}

.scroll-nav-btn svg {
    width: 16px;
    height: 16px;
}

/* Debug Panel */
.debug-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    z-index: 1000;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.debug-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.debug-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.debug-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.debug-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.debug-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.debug-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Usage Indicators */
.usage-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    background: var(--bg-dark);
    color: var(--text-secondary);
}

.usage-badge.warning {
    background: color-mix(in srgb, var(--accent-yellow) 20%, transparent);
    color: var(--accent-yellow);
}

.usage-badge.danger {
    background: color-mix(in srgb, var(--danger) 20%, transparent);
    color: var(--danger);
}

.usage-badge.clickable {
    cursor: pointer;
}

.usage-badge.clickable:hover {
    background: color-mix(in srgb, var(--danger) 35%, transparent);
}

.usage-badge svg {
    width: 14px;
    height: 14px;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.plan-badge.free {
    background: var(--bg-dark);
    color: var(--text-secondary);
}

.plan-badge.basic {
    background: var(--primary-light);
    color: var(--primary);
}

.plan-badge.pro {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent-yellow) 30%, transparent), rgba(225, 112, 85, 0.3));
    color: var(--accent-yellow);
}

/* Mobile Menu Button (matches Editor .header-btn) */
.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0 8px 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--fg-strong);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: -8px;
}

.mobile-menu-btn:hover {
    color: var(--fg-emphasis);
    background: var(--fg-subtle);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease, width 0.3s ease, margin-left 0.3s ease;
    z-index: 100;
}

/* Hidden State for Desktop (toggled via class) */
.sidebar.hidden {
    margin-left: -260px;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    z-index: 150;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.sidebar-mobile-title { font-size: 0.9rem; font-weight: 600; }
.sidebar-close-btn {
    width: 28px; height: 28px; border-radius: 6px;
    border: none; background: transparent;
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.sidebar-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-close-btn svg { width: 20px; height: 20px; }

@media (max-width: 768px), (max-width: 960px) and (orientation: portrait) {

    /* Mobile Styles */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        margin-left: 0;
        z-index: 200;
        /* Above overlay (z-index: 150) */
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* On mobile, 'hidden' class does nothing, we use 'active' to show */
    .sidebar.hidden {
        margin-left: 0;
    }

    .sidebar-mobile-header {
        display: flex;
    }

    .sidebar {
        padding-top: 10px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .header {
        padding: 0 12px;
    }

    .header-left {
        gap: 8px;
    }

    .header-actions {
        gap: 8px;
    }

    /* Mobile: search box collapsible — icon always visible */
    .search-box {
        display: flex;
    }
    .search-box:not(.collapsed) input {
        width: 140px;
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    .search-box:not(.collapsed) input:focus {
        width: 160px;
    }

    /* Hide undo/redo/notification on mobile - accessible via settings */
    #undoBtn,
    #redoBtn,
    #notificationBtn {
        display: none;
    }

    .content {
        padding: 16px;
        /* Ensure scrolling works on iOS */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Fill available space */
        flex: 1;
        min-height: 0;
    }

    .content-header {
        gap: 8px;
        margin-bottom: 16px;
        flex-wrap: nowrap;
    }

    .content-title {
        font-size: 1.1rem;
    }

    .plan-badge {
        display: none;
    }

    .usage-badge {
        display: none;
    }

    .organize-mode-toggle {
        padding: 8px;
        gap: 0;
    }

    .organize-mode-toggle span {
        display: none;
    }

    #newNoteBtn,
    #focusAddArtBtn {
        padding: 8px;
    }

    #newNoteBtn span,
    #focusAddArtBtn span {
        display: none;
    }

    .arts-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: var(--grid-gap-mobile, 10px);
    }

    .note-section {
        padding: 8px;
    }

    .note-section-header {
        gap: 6px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .note-section-icon {
        width: 28px;
        height: 28px;
        border-radius: 7px;
    }

    .note-section-icon .icon-svg {
        width: 18px;
        height: 18px;
    }

    .note-section-title {
        gap: 8px;
        min-width: 0;
    }

    .note-section-name {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .note-section-count {
        display: none;
    }

    .note-sync-icon {
        display: none;
    }


    .note-section-actions {
        gap: 4px;
        flex-shrink: 0;
    }

    .note-section-btn {
        width: 36px;
        height: 36px;
    }

    .note-section-btn svg {
        width: 18px;
        height: 18px;
    }


    .modal {
        width: 95%;
        margin: 16px;
    }

    /* Selection bar - mobile optimized */
    .selection-bar {
        left: 16px;
        right: 16px;
        transform: translateX(0) translateY(80px);
        width: auto;
        flex-wrap: wrap;
        padding: 14px 16px;
        bottom: 16px;
    }

    .selection-bar.visible {
        transform: translateX(0) translateY(0);
    }

    .selection-actions {
        flex-wrap: wrap;
    }

    .selection-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Debug panel on mobile */
    .debug-panel {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
    }

    .debug-buttons {
        justify-content: center;
    }

    /* User menu positioning */
    .user-menu {
        right: -60px;
    }

    /* New note section */
    .new-note-section {
        padding: 16px;
    }

    /* Mobile: Compact action buttons */
    .art-favorite-btn,
    .art-more-btn {
        opacity: 1;
        width: 22px;
        height: 22px;
        padding: 3px;
        border-radius: 50%;
        background: var(--bg-panel);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .art-favorite-btn {
        top: 2px;
        left: 2px;
    }

    .art-more-btn {
        bottom: 2px;
        right: 2px;
    }

    .art-favorite-btn svg,
    .art-more-btn svg {
        width: 12px;
        height: 12px;
    }

    /* Delete button: hidden on mobile (accessible via more menu) */
    .art-delete-btn {
        display: none;
    }

    /* Art card - fully disable hover effects on touch devices */
    .art-card:not(.art-card--selected):not(.art-card--multi-selected):hover {
        transform: none;
        box-shadow: none;
    }

    .art-card:not(.art-card--selected):not(.art-card--multi-selected):hover .art-favorite-btn:not(.art-favorite-btn--active),
    .art-card:not(.art-card--selected):not(.art-card--multi-selected):hover .art-more-btn,
    .art-card:hover .art-delete-btn,
    .art-card:hover .art-actions,
    .art-card:hover .art-checkbox {
        opacity: 0;
    }

    .art-card:active {
        transform: scale(0.98);
    }

    /* Hide floating action menu on mobile (use more-btn context menu instead) */
    .art-action-menu {
        display: none;
    }

    /* Selected card: no vertical shift on mobile */
    .art-card--selected {
        transform: none;
    }

    /* Hide action buttons on mobile (only show on selected cards) */
    .art-favorite-btn:not(.art-favorite-btn--active),
    .art-more-btn {
        opacity: 0;
        pointer-events: none;
    }

    .art-card--selected .art-favorite-btn,
    .art-card--selected .art-more-btn,
    .art-card--multi-selected .art-favorite-btn,
    .art-card--multi-selected .art-more-btn {
        opacity: 1;
        pointer-events: auto;
    }

    /* Larger touch targets for note list items */
    .note-item {
        min-height: 48px;
    }

    /* Bottom-sheet style menus on mobile */
    .context-menu,
    .note-more-menu {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
        max-width: 100%;
        max-height: 70vh;
        max-height: 70dvh;
        overflow-y: auto;
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 8px);
        box-shadow: 0 -4px 20px var(--shadow-color);
    }

    .context-menu {
        animation: bottom-sheet-up 0.2s ease-out;
    }

    .note-more-menu {
        transform: translateY(100%);
    }

    .note-more-menu.active {
        transform: translateY(0);
        transition: transform 0.2s ease-out;
    }

    @keyframes bottom-sheet-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Selection mode on mobile - always show checkboxes */
    .art-grid--selection-mode .art-select-check {
        opacity: 1 !important;
    }

    .art-checkbox {
        width: 28px;
        height: 28px;
    }

    .art-checkbox svg {
        width: 16px;
        height: 16px;
    }
}

/* ==================== */
/* Modal / Dialog Base  */
/* ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.art-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.art-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
}

.art-info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.art-info-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.modal-footer .btn svg {
    width: 15px;
    height: 15px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn svg {
    width: 18px;
    height: 18px;
}

/* Colored-background buttons: always white text regardless of skin */
.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(1.1);
}

.btn:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.btn-block {
    width: 100%;
}

/* Login Modal */
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    border-radius: 16px;
    display: inline-grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    padding: 8px;
    margin-bottom: 12px;
}

.login-logo-pixel {
    background: var(--fg-emphasis);
    border-radius: 2px;
}

.login-logo-pixel:nth-child(2),
.login-logo-pixel:nth-child(4),
.login-logo-pixel:nth-child(6),
.login-logo-pixel:nth-child(8) {
    background: var(--fg-medium);
}

.login-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.social-login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.social-login-divider::before,
.social-login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.social-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s;
}

.social-btn:hover {
    border-color: var(--text-secondary);
    background: var(--bg-hover);
}

.social-btn svg {
    width: 20px;
    height: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Icon Picker */
.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.icon-option {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-option svg {
    width: 22px;
    height: 22px;
}

.icon-option:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    transform: scale(1.1);
}

.icon-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* New Art Modal */
.size-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.size-preset {
    padding: 10px 8px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--bg-dark);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.size-preset:hover {
    border-color: var(--primary);
}

.size-preset.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.size-preset-value {
    font-size: 0.95rem;
    font-weight: 600;
    font-family: monospace;
    margin-bottom: 2px;
}

.size-preset-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.custom-size {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.custom-size-input {
    width: 80px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: monospace;
    text-align: center;
}

.custom-size-input:focus {
    outline: none;
    border-color: var(--primary);
}

.custom-size-separator {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* Palette Presets (New Art Modal) */
.palette-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.palette-card {
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--bg-dark);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.palette-card:hover {
    border-color: var(--primary);
}

.palette-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.palette-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.palette-card-name {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.palette-card-count {
    font-size: 0.65rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 4px;
}

.palette-card-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.palette-swatch {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid var(--fg-light);
}

.palette-card-empty {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-style: italic;
}

.palette-card-actions {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
}

.palette-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s;
}

.palette-action-btn .icon-svg {
    width: 14px;
    height: 14px;
}

.palette-action-btn:hover {
    opacity: 1;
    color: var(--accent);
}

.palette-action-btn--danger:hover {
    color: var(--danger);
}

.palette-section-label {
    grid-column: 1 / -1;
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.palette-manage-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 11px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}
.palette-manage-link:hover { text-decoration: underline; }

/* Palette Management Modal */
.pm-toolbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pm-toolbar-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pm-quota { font-size: 12px; color: var(--text-tertiary); }
.pm-sort-bar { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.pm-sort-btn {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    font-size: 11px; color: var(--text-secondary); cursor: pointer;
    padding: 3px 8px; white-space: nowrap;
}
.pm-sort-btn:hover { background: var(--bg-hover); color: var(--text); }
.pm-sort-btn.active { background: var(--primary-subtle, var(--primary-light)); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.pm-sort-clear { border-color: transparent; color: var(--text-tertiary); padding: 3px 5px; }
.pm-sort-clear:hover { color: var(--danger); }
.pm-list.pm-sorted .pm-drag-handle { display: none; }
.pm-list { display: flex; flex-direction: column; gap: 8px; }
.pm-empty { text-align: center; color: var(--text-tertiary); padding: 24px 12px; font-size: 13px; }
.pm-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pm-item-header { display: flex; align-items: center; gap: 8px; padding: 10px; cursor: pointer; }
.pm-item-header:hover { background: var(--bg-hover); }
.pm-item.expanded .pm-item-header { border-bottom: 1px solid var(--border); background: var(--bg-hover); }
.pm-drag-handle {
    cursor: grab; color: var(--text-tertiary);
    display: flex; align-items: center; justify-content: center;
    padding: 2px; border-radius: 3px; flex-shrink: 0;
}
.pm-drag-handle:hover { color: var(--text-secondary); background: var(--bg-hover); }
.pm-drag-handle:active { cursor: grabbing; }
.pm-item.pm-dragging { opacity: 0.4; }
.pm-drop-indicator { height: 3px; background: var(--primary); border-radius: 2px; margin: -2px 0; position: relative; z-index: 1; }
.pm-item[draggable="true"] { transition: transform 0.15s ease; }
.pm-item-name { flex: 1; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-item-count { font-size: 0.75rem; color: var(--text-secondary); margin-right: 4px; white-space: nowrap; }
.pm-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.pm-item-swatches { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 10px 8px; }
.pm-more { font-size: 11px; color: var(--text-tertiary); margin-left: 4px; }
.pm-item.expanded .pm-item-swatches { display: none; }

/* Palette Editor (expanded) */
.pm-item-editor { padding: 12px; }
.pm-edit-field { margin-bottom: 10px; }
.pm-edit-field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.pm-edit-field .form-input { width: 100%; box-sizing: border-box; }
.pm-edit-field textarea.form-input { resize: vertical; min-height: 48px; }

/* Color Grid */
.pm-color-grid { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pm-color-item { position: relative; }
.pm-color-swatch {
    width: 28px; height: 28px;
    border-radius: 4px; border: 1px solid var(--border);
    cursor: pointer; transition: transform 0.1s;
}
.pm-color-swatch:hover { transform: scale(1.15); }
.pm-color-remove {
    display: none; position: absolute; top: -6px; right: -6px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--danger); color: #fff; border: none;
    font-size: 10px; cursor: pointer; line-height: 16px;
    text-align: center; padding: 0;
}
.pm-color-item:hover .pm-color-remove { display: block; }
.pm-color-picker { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.pm-color-add {
    width: 28px; height: 28px;
    border: 2px dashed var(--border); border-radius: 4px;
    background: transparent; cursor: pointer;
    font-size: 16px; color: var(--text-tertiary);
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.pm-color-add:hover { border-color: var(--primary); color: var(--primary); }
.pm-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Tag Selection */
.tag-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-option:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.tag-option.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.tag-selection-toggle {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px dashed var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-selection-toggle:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

/* Collapsible Section (New Art Modal) */
.collapsible-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.collapsible-header:hover {
    background: var(--bg-hover);
}

.collapsible-chevron {
    font-size: 0.65rem;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.collapsible-section.expanded .collapsible-chevron {
    transform: rotate(90deg);
}

.collapsible-summary {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collapsible-section.expanded .collapsible-summary {
    display: none;
}

.collapsible-content {
    display: none;
    margin-top: 8px;
}

.collapsible-section.expanded .collapsible-content {
    display: block;
}

/* Tag Management Modal */
.tag-create-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.tag-color-input {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}

.tag-manage-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.tag-manage-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-dark);
    transition: background 0.2s;
}

.tag-manage-item:hover {
    background: var(--bg-hover);
}

.tag-manage-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-manage-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.tag-manage-actions {
    display: flex;
    gap: 4px;
}

.tag-manage-btn-icon {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tag-manage-btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tag-manage-btn-icon.danger:hover {
    color: var(--danger);
}

.tag-edit-form {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.tag-edit-name {
    font-size: 0.85rem;
    padding: 4px 8px;
}

.tag-manage-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px;
    font-size: 0.85rem;
}

/* Trash Modal */
.trash-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 450px;
    overflow-y: auto;
}

.trash-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 12px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trash-section-title:first-child {
    margin-top: 0;
}

.trash-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.trash-item:hover {
    background: var(--bg-hover);
}

.trash-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    text-align: center;
    line-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trash-item-info {
    flex: 1;
    min-width: 0;
}

.trash-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trash-item-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.trash-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.trash-item-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.trash-item-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.trash-item-btn.danger:hover {
    color: var(--danger);
}

.trash-item-btn.restore:hover {
    color: var(--primary);
}

.trash-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 24px;
}

.trash-empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.4;
}

.trash-empty-text {
    font-size: 0.85rem;
}

/* Conflict Modal */
.conflict-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.conflict-item:last-child {
    margin-bottom: 0;
}

.conflict-item-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.conflict-item-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    margin-right: 10px;
}

.conflict-item-info {
    flex: 1;
    min-width: 0;
}

.conflict-item-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.conflict-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.conflict-item-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Conflict thumbnails comparison */
.conflict-thumbs {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.conflict-thumb-col {
    flex: 1;
    text-align: center;
}

.conflict-thumb-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.conflict-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary, #1a1a2e);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.conflict-thumb img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    object-fit: contain;
}

.conflict-thumb-info {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Conflict detail (non-artwork) */
.conflict-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Conflict badge in sidebar */
.conflict-btn {
    color: var(--warning, var(--warning));
}

.conflict-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--warning, var(--warning));
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: auto;
}

/* Settings Modal */
.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    margin: 0 -24px;
}

.settings-tab {
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.settings-tab:hover {
    color: var(--text-primary);
}

.settings-tab.active {
    color: var(--primary);
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.settings-section {
    display: none;
}

.settings-section.active {
    display: block;
}

.settings-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 24px 0 12px;
}

.settings-section-title:first-child {
    margin-top: 0;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-info {
    flex: 1;
}

.settings-item-label {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.settings-item-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Skin Selector */
.settings-item:has(.skin-selector) {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.skin-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skin-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.skin-option:hover {
    border-color: var(--text-secondary);
}

.skin-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--text-primary);
}

.skin-preview {
    display: flex;
    width: 48px;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
}

.skin-preview span {
    flex: 1;
}

.skin-option-label {
    white-space: nowrap;
}

/* Toggle Switch */
.toggle-switch {
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

/* User Profile in Settings */
.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: 12px;
    margin-bottom: 20px;
}

.user-avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    overflow: hidden;
    color: white;
}

.user-avatar-large svg {
    width: 32px;
    height: 32px;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-edit-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.avatar-edit-buttons {
    display: flex;
    gap: 8px;
}

.avatar-edit-buttons .btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
}

.avatar-edit-buttons .btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.avatar-edit-buttons .btn-ghost:hover {
    background: var(--fg-subtle);
    color: var(--text-primary);
}

/* Avatar Editor Modal */
.avatar-editor-preview-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.avatar-editor-preview {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: default;
    position: relative;
}

.avatar-editor-preview.has-image {
    cursor: move;
}

.avatar-editor-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--fg-emphasis);
}

.avatar-editor-placeholder svg {
    width: 48px;
    height: 48px;
}

.avatar-editor-placeholder span {
    font-size: 0.85rem;
}

.avatar-editor-preview canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.avatar-editor-hint {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.avatar-editor-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.avatar-editor-actions .btn {
    display: flex;
    align-items: center;
    padding: 10px 16px;
}

.avatar-editor-delete {
    display: flex;
    justify-content: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-active);
}

.btn-ghost-danger {
    background: transparent;
    color: var(--danger);
    border: none;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.85rem;
}

.btn-ghost-danger:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-name-input {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 2px 6px;
    margin: -2px -6px;
    width: calc(100% + 12px);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.user-name-input:hover {
    border-color: var(--fg-light);
}

.user-name-input:focus {
    border-color: var(--primary);
    background: var(--fg-subtle);
}

.user-name-input[readonly] {
    pointer-events: none;
    border-color: transparent;
}

.user-account-reveal-btn {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0;
    margin-top: 4px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.user-account-reveal-btn:hover {
    opacity: 1;
}

.user-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.plan-card {
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.plan-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.plan-card-name {
    font-size: 1rem;
    font-weight: 600;
}

.plan-card-badge {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.75rem;
}

.plan-card-limits {
    font-size: 0.85rem;
    opacity: 0.9;
}

.plan-upgrade-btn {
    margin-top: 16px;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--fg-medium);
    background: var(--fg-light);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.plan-upgrade-btn:hover {
    background: var(--fg-medium);
}

/* Plan Grid (plan upgrade modal) */
.plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.plan-card-option {
    border: 1px solid var(--border-color, var(--fg-light));
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-card-option:hover {
    border-color: var(--primary, #6c5ce7);
    transform: translateY(-2px);
}

.plan-card-current {
    border-color: var(--primary, #6c5ce7);
    background: var(--primary-light);
}

.plan-card-option-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.plan-card-option-name {
    font-weight: 600;
    font-size: 1rem;
}

.plan-card-option-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.plan-card-option-limits {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.plan-card-option-badge {
    font-size: 0.75rem;
    color: var(--primary, #6c5ce7);
    font-weight: 500;
    text-align: center;
    padding: 4px 0;
}

.plan-select-btn {
    width: 100%;
}

@media (max-width: 480px) {
    .plan-grid {
        grid-template-columns: 1fr;
    }
}

/* Danger Zone */
.danger-zone {
    border: 1px solid var(--danger);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
}

.danger-zone-title {
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.danger-zone-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.danger-zone-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

/* Diagnostics Zone */
.diagnostics-zone {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.diagnostics-zone-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Debug meta overlay (injected by DebugPanel, hidden by default) */
.pxn-debug-meta {
    display: none;
}

/* Sync Status Indicator */
.sync-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
}

.sync-indicator:hover {
    opacity: 0.7;
}

.sync-indicator.syncing {
    color: var(--accent);
}
.sync-indicator.syncing svg {
    animation: sync-pulse 1.5s ease-in-out infinite;
}

.sync-indicator.unsynced {
    color: var(--warning, #f0a030);
}

.sync-indicator.synced {
    color: var(--success, #2ecc71);
}

.sync-indicator.check-server {
    color: var(--accent-blue);
    opacity: 0.7;
}

.sync-indicator.error {
    color: var(--danger, var(--danger));
}

.sync-indicator.offline {
    color: var(--text-muted);
    opacity: 0.5;
}

.sync-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--warning, #f0a030);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
}

@keyframes sync-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(1.1); }
}

/* User Menu Dropdown */
.user-menu-wrapper {
    position: relative;
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 32px var(--shadow-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 200;
}

.user-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.user-menu-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-menu-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-menu-item svg {
    width: 18px;
    height: 18px;
}

.user-menu-item.danger {
    color: var(--danger);
}

.user-menu-item.danger:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* ==================== */
/* Inline Edit Input    */
/* ==================== */
.inline-edit-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: inherit;
    font-family: inherit;
    color: var(--text-primary);
    width: 100%;
    max-width: 200px;
    box-sizing: border-box;
}

.inline-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Vault Browser Modal */
.vault-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 60vh;
    max-height: 60dvh;
    overflow-y: auto;
}

.vault-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.vault-item:hover {
    background: var(--bg-hover);
}

.vault-item-thumb {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-tertiary);
    background-image: linear-gradient(45deg, var(--bg-active) 25%, transparent 25%),
                      linear-gradient(-45deg, var(--bg-active) 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, var(--bg-active) 75%),
                      linear-gradient(-45deg, transparent 75%, var(--bg-active) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vault-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.vault-item-body {
    flex: 1;
    min-width: 0;
}

.vault-item-header {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vault-item-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.vault-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vault-item-badge {
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.vault-item-badge.unresolved {
    background: color-mix(in srgb, var(--warning) 15%, transparent);
    color: var(--warning);
}

.vault-item-badge.resolved {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.vault-item-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.vault-item-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vault-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.vault-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 24px;
}

.vault-empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.4;
}

.vault-empty-text {
    font-size: 0.85rem;
}

/* =====================================================================
   Animation Modal
   ===================================================================== */

.animation-modal {
    max-width: 640px;
    width: 90vw;
}

.animation-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px !important;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.animation-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    max-height: 320px;
    flex-shrink: 0;
    background: var(--bg-dark);
    border-radius: 8px;
    overflow: hidden;
    padding: 16px;
}

#animationCanvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Controls: play/pause, step, frame counter */
.animation-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
}

.anim-ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.anim-ctrl-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.anim-ctrl-btn svg {
    width: 16px;
    height: 16px;
}

.anim-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.anim-play-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.anim-play-btn svg {
    width: 20px;
    height: 20px;
}

.animation-frame-counter {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* FPS slider */
.animation-fps-control {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    flex-shrink: 0;
}

.animation-fps-control label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.animation-fps-control input[type="range"] {
    width: 140px;
    accent-color: var(--primary);
}

#animFpsValue {
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 24px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Frame thumbnail strip */
.animation-frames-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 4px;
    scrollbar-width: none;
    flex-shrink: 0;
}
.animation-frames-strip::-webkit-scrollbar {
    display: none;
}

.anim-frame-thumb {
    flex-shrink: 0;
    width: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border-radius: 6px;
    padding: 4px;
    transition: all 0.15s;
    border: 2px solid transparent;
}

.anim-frame-thumb:hover {
    background: var(--bg-hover);
}

.anim-frame-thumb.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.anim-frame-thumb.missing {
    opacity: 0.5;
}

.anim-frame-thumb.missing .anim-frame-label {
    color: var(--accent-orange);
}

.anim-frame-thumb canvas {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.anim-frame-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.anim-frame-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: color-mix(in srgb, var(--danger) 80%, transparent);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.anim-frame-thumb {
    position: relative;
}

.anim-frame-thumb:hover .anim-frame-remove {
    display: flex;
}

/* Drag & drop */
.anim-frame-thumb.dragging {
    opacity: 0.3;
}

.anim-frame-thumb.drag-insert-before::before,
.anim-frame-thumb.drag-insert-after::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    pointer-events: none;
}

.anim-frame-thumb.drag-insert-before::before {
    left: -4px;
}

.anim-frame-thumb.drag-insert-after::after {
    right: -4px;
}

/* Frame Toolbar */
.anim-frame-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.anim-toolbar-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.anim-toolbar-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.anim-toolbar-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.anim-toolbar-btn svg {
    width: 14px;
    height: 14px;
}

.anim-toolbar-btn--danger:hover:not(:disabled) {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.anim-toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

/* Animation Tabs */
.anim-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 2px;
}

.anim-tab {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.anim-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.anim-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Edit Panel */
.anim-edit-panel {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.anim-edit-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.anim-title-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.anim-title-input:focus {
    outline: none;
    border-color: var(--primary);
}

.anim-save-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.anim-save-btn:hover {
    background: var(--primary-dark);
}

.anim-save-copy-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.anim-save-copy-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-card);
}

.anim-delete-btn {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--accent-orange);
    background: transparent;
    color: var(--accent-orange);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.anim-delete-btn:hover {
    background: var(--accent-orange);
    color: #fff;
}

/* Frame Picker */
.anim-frame-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.anim-picker-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 0;
}
.anim-picker-toggle:hover {
    color: var(--text-primary);
}
.anim-picker-arrow {
    transition: transform 0.2s;
}
.anim-picker-toggle.open .anim-picker-arrow {
    transform: rotate(90deg);
}

.anim-picker-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-height: 160px;
    overflow-y: auto;
}

.anim-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.anim-picker-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.anim-picker-item canvas {
    width: 36px;
    height: 36px;
    border-radius: 3px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Export Panel */
.anim-export-panel {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.anim-export-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.anim-export-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.anim-export-select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.anim-export-size {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-left: 4px;
}

.anim-export-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: var(--accent-green);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.15s;
    margin-left: auto;
}

.anim-export-btn:hover {
    opacity: 0.85;
}

/* Note sections loading spinner (project sync) */
.note-sections-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    color: var(--text-secondary);
}
.note-sections-loading .loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: sync-spin 0.8s linear infinite;
}
.note-sections-loading p {
    margin: 0;
    font-size: 0.85rem;
}

/* Editor iframe overlay (hybrid navigation) */
.editor-iframe {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: none;
    z-index: 10000;
    background: #1a1a1a;
}

