/* ============================================
   CYBERNOX DREAM STUDIO — Design System v2
   Responsive, Glassmorphism, Cross-browser
   ============================================ */

:root {
    /* Warm Neutrals */
    --bg-primary: #FDF8F3;
    --bg-secondary: rgba(255, 255, 255, 0.72);
    --bg-panel: rgba(255, 255, 255, 0.55);
    --bg-hover: rgba(255, 255, 255, 0.85);
    --bg-dark: #2D2A28;
    
    /* Accents */
    --accent-rose: #C27A7A;
    --accent-rose-light: #D9A0A0;
    --accent-rose-soft: rgba(194, 122, 122, 0.12);
    --accent-gold: #C9A96E;
    --accent-gold-light: #DDC094;
    --accent-gold-soft: rgba(201, 169, 110, 0.15);
    --accent-sage: #8A9A8C;
    --accent-sage-soft: rgba(138, 154, 140, 0.12);
    --accent-lavender: #9B8FBF;
    
    /* Text */
    --text-primary: #3D3D3D;
    --text-secondary: #7A7A7A;
    --text-muted: #A8A0A0;
    --text-light: #FFFFFF;
    --text-on-dark: #F0E8E0;
    
    /* Borders & Shadows */
    --border-light: rgba(232, 224, 216, 0.6);
    --border-medium: rgba(216, 208, 200, 0.7);
    --border-accent: #C9A96E;
    --shadow-soft: 0 2px 8px rgba(61, 45, 35, 0.06);
    --shadow-medium: 0 4px 20px rgba(61, 45, 35, 0.10);
    --shadow-strong: 0 8px 40px rgba(61, 45, 35, 0.15);
    --shadow-glow: 0 0 20px rgba(201, 169, 110, 0.2);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-strong: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(255, 255, 255, 0.45);
    --glass-border-strong: rgba(255, 255, 255, 0.6);
    --glass-blur: 16px;
    --glass-blur-strong: 24px;
    
    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ============================================
   LOADING SCREEN
   ============================================ */
#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    animation: fadeInUp 0.8s ease;
}

.loading-logo {
    font-size: 48px;
    color: var(--accent-gold);
    margin-bottom: 8px;
    animation: gentlePulse 2s ease-in-out infinite;
}

.loading-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.loading-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-bottom: 24px;
    opacity: 0.7;
}

.loading-bar {
    width: 180px;
    height: 3px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-rose), var(--accent-gold));
    border-radius: 3px;
    animation: loadingProgress 1.5s ease-out forwards;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* ============================================
   APP HEADER
   ============================================ */
.app-header {
    height: 56px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
    z-index: 100;
    box-shadow: var(--shadow-soft);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.header-right {
    justify-content: flex-end;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.logo:hover {
    transform: scale(1.02);
}

.logo-icon {
    font-size: 22px;
    color: var(--accent-gold);
    line-height: 1;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-gold);
    opacity: 0.6;
}

.board-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid var(--border-light);
}

/* Tool Group */
.tool-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.tool-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.tool-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke var(--transition-fast);
    pointer-events: none;
}

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

.tool-btn:hover svg {
    stroke: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent-gold-soft);
}

.tool-btn.active svg {
    stroke: var(--accent-gold);
}

.tool-sep {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 4px;
}

/* Icon Buttons */
.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

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

.header-sep {
    width: 1px;
    height: 24px;
    background: var(--border-light);
}

/* Header Buttons */
.header-btn {
    height: 34px;
    padding: 0 18px;
    border: 1px solid var(--border-medium);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.header-btn:hover {
    background: var(--glass-bg-strong);
    border-color: var(--border-accent);
}

.header-btn.primary {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--text-light);
}

.header-btn.primary:hover {
    background: var(--accent-gold-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    -webkit-user-select: none;
    user-select: none;
}

/* ============================================
   WORKSPACE LAYOUT
   ============================================ */
.workspace {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
    position: relative;
}

/* ============================================
   BOARD TITLE MARQUEE
   ============================================ */
.board-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid var(--border-light);
    flex: 1;
    max-width: 520px;
    min-width: 0;
}

.board-title-display {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), background var(--transition-fast);
    height: 34px;
    display: flex;
    align-items: center;
}

.board-title-display:hover {
    border-color: var(--accent-gold);
    background: var(--accent-gold-soft);
}

.board-title-display:active {
    background: var(--accent-gold-soft);
}

.board-title-marquee {
    display: flex;
    white-space: nowrap;
    font-family: 'Playfair Display', serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    padding: 0 8px;
    align-items: center;
}

.board-title-marquee .marquee-content {
    display: flex;
    white-space: nowrap;
    align-items: center;
}

.board-title-marquee .marquee-content.scroll {
    animation: marqueeScroll linear infinite;
}

.board-title-marquee .marquee-content.scroll:hover {
    animation-play-state: paused;
}

.marquee-spacer {
    margin: 0 24px;
    opacity: 0.3;
    color: var(--accent-gold);
}

@keyframes marqueeScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

#board-title-input {
    flex: 1;
    font-family: 'Playfair Display', serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1.5px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    outline: none;
    width: 100%;
}

#board-title-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

#board-title-input.hidden {
    display: none !important;
}

/* Mobile title adjustments */
@media (max-width: 768px) {
    .board-title-wrap {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        max-width: 200px;
    }
    
    .board-title-marquee {
        font-size: 13px;
    }
}

.left-sidebar {
    width: 280px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    backdrop-filter: blur(var(--glass-blur-strong));
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 100;
    transition: transform var(--transition-smooth), width var(--transition-smooth);
}

.right-sidebar {
    width: 280px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    backdrop-filter: blur(var(--glass-blur-strong));
    border-right: none;
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 100;
    transition: transform var(--transition-smooth), width var(--transition-smooth);
}

.sidebar-tabs {
    display: flex;
    padding: 12px 12px 0;
    gap: 4px;
    border-bottom: 1px solid var(--glass-border);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-tabs::-webkit-scrollbar {
    display: none;
}

.sidebar-tab {
    padding: 8px 14px;
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

.sidebar-tab:hover {
    color: var(--text-secondary);
}

.sidebar-tab.active {
    color: var(--accent-gold);
    background: var(--accent-gold-soft);
}

.sidebar-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--accent-gold);
    border-radius: 2px 2px 0 0;
}

.sidebar-panel {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.sidebar-panel::-webkit-scrollbar {
    width: 6px;
}

.sidebar-panel::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-panel::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.panel-header p {
    font-size: 12px;
    color: var(--text-muted);
}

/* Mobile sidebar close button */
.mobile-sidebar-close {
    display: none;
    padding: 14px;
    border: none;
    background: var(--accent-rose-soft);
    color: var(--accent-rose);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-top: 1px solid var(--glass-border);
    transition: background var(--transition-fast);
}

.mobile-sidebar-close:hover {
    background: var(--accent-rose);
    color: var(--text-light);
}

/* ============================================
   TEMPLATES
   ============================================ */
.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.template-card {
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.template-card:hover {
    transform: translateY(-2px);
}

.template-preview {
    aspect-ratio: 4/5;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    transition: box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.template-card:hover .template-preview {
    box-shadow: var(--shadow-medium);
    border-color: var(--accent-gold);
}

.template-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.template-card:hover .template-preview::before {
    opacity: 1;
}

.template-label {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255,255,255,0.85);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.template-label.blank {
    color: var(--text-muted);
    border: 1.5px dashed var(--border-medium);
    background: transparent;
}

.template-name {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
    font-weight: 500;
}

/* ============================================
   ELEMENTS PANEL
   ============================================ */
.element-section {
    margin-bottom: 24px;
}

.element-section h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.element-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.element-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.element-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.element-preview {
    width: 40px;
    height: 40px;
    background: var(--accent-gold-soft);
    border: 2px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.element-preview.heart-shape {
    background: var(--accent-rose-soft);
    border-color: var(--accent-rose);
    clip-path: path("M20 10 C20 5 15 0 10 5 C5 0 0 5 0 10 C0 18 10 24 10 24 C10 24 20 18 20 10Z");
    border: none;
    width: 36px;
    height: 36px;
}

.element-preview.star-shape {
    background: var(--accent-gold-soft);
    border: none;
    font-size: 28px;
    color: var(--accent-gold);
    line-height: 1;
}

.element-preview.diamond-shape {
    background: var(--accent-lavender);
    border: none;
    transform: rotate(45deg);
    width: 28px;
    height: 28px;
}

/* Venue Element Previews */
.element-preview.round-table-preview {
    border-radius: 50%;
    background: var(--glass-bg-strong);
    border: 2px solid var(--accent-gold);
    font-size: 10px;
    color: var(--accent-gold);
}
.element-preview.round-table-preview.large {
    width: 44px;
    height: 44px;
    font-size: 12px;
}

.element-preview.rect-table-preview {
    border-radius: 4px;
    width: 48px;
    height: 28px;
    background: var(--glass-bg-strong);
    border: 2px solid var(--accent-gold);
}

.element-preview.square-table-preview {
    border-radius: 4px;
    width: 32px;
    height: 32px;
    background: var(--glass-bg-strong);
    border: 2px solid var(--accent-gold);
}

.element-preview.head-table-preview {
    border-radius: 4px;
    width: 52px;
    height: 20px;
    background: var(--accent-gold-soft);
    border: 2px solid var(--accent-gold);
}

.element-preview.cocktail-table-preview {
    border-radius: 50%;
    background: transparent;
    border: 2px dashed var(--accent-gold);
    font-size: 14px;
    color: var(--accent-gold);
}

.element-preview.chair-round-preview,
.element-preview.chiavari-preview {
    background: transparent;
    border: none;
    font-size: 28px;
}

.element-preview.bench-preview {
    border-radius: 4px;
    width: 44px;
    height: 14px;
    background: var(--accent-gold-soft);
    border: 2px solid var(--accent-gold);
}

.element-preview.loveseat-preview {
    border-radius: 8px;
    width: 40px;
    height: 22px;
    background: var(--accent-rose-soft);
    border: 2px solid var(--accent-rose);
}

.element-preview.stage-preview {
    border-radius: 4px;
    width: 52px;
    height: 28px;
    background: linear-gradient(180deg, var(--accent-gold-soft), var(--glass-bg-strong));
    border: 2px solid var(--accent-gold);
}

.element-preview.dance-floor-preview {
    border-radius: 4px;
    width: 40px;
    height: 40px;
    background: repeating-linear-gradient(
        45deg,
        var(--accent-gold-soft),
        var(--accent-gold-soft) 4px,
        var(--glass-bg-strong) 4px,
        var(--glass-bg-strong) 8px
    );
    border: 2px solid var(--accent-gold);
}

.element-preview.bar-preview {
    border-radius: 4px;
    width: 44px;
    height: 20px;
    background: var(--glass-bg-strong);
    border: 2px solid var(--accent-sage);
    border-top: 4px solid var(--accent-sage);
}

.element-preview.buffet-preview {
    border-radius: 4px;
    width: 48px;
    height: 18px;
    background: var(--glass-bg-strong);
    border: 2px solid var(--accent-rose);
}

.element-preview.cake-table-preview {
    border-radius: 50%;
    width: 30px;
    height: 30px;
    background: var(--accent-rose-soft);
    border: 2px solid var(--accent-rose);
}

.element-preview.dj-booth-preview {
    border-radius: 4px;
    width: 36px;
    height: 28px;
    background: var(--glass-bg-strong);
    border: 2px solid var(--accent-lavender);
}

.element-preview.aisle-preview {
    width: 44px;
    height: 14px;
    background: repeating-linear-gradient(
        90deg,
        var(--accent-gold),
        var(--accent-gold) 3px,
        transparent 3px,
        transparent 6px
    );
    border: none;
    opacity: 0.6;
}

.element-preview.flower-arrangement-preview {
    background: transparent;
    border: none;
    font-size: 28px;
}

.element-preview.string-lights-preview {
    background: transparent;
    border: none;
    font-size: 28px;
}

.element-preview.champagne-tower-preview {
    background: transparent;
    border: none;
    font-size: 28px;
}

.element-preview.emoji-preview {
    background: transparent;
    border: none;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.element-item span {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================
   UPLOADS PANEL
   ============================================ */
.upload-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 16px;
    background: var(--glass-bg);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-gold);
    background: var(--accent-gold-soft);
}

.upload-zone.drag-over {
    transform: scale(1.02);
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.upload-zone p {
    font-size: 12px;
    color: var(--text-muted);
}

.uploads-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.upload-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}

.upload-thumb:hover {
    border-color: var(--accent-gold);
    transform: scale(1.05);
}

.upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.upload-thumb .upload-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--accent-rose);
}

.upload-thumb:hover .upload-delete {
    display: flex;
}

/* ============================================
   TEXT PANEL
   ============================================ */
.text-preset-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.text-preset {
    padding: 14px 16px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.4;
}

.text-preset:hover {
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-soft);
    transform: translateX(4px);
}

/* ============================================
   STICKERS SIDEBAR PANEL
   ============================================ */
.sticker-search-wrap {
    margin-bottom: 12px;
}

.sticker-search {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast);
}

.sticker-search:focus {
    border-color: var(--accent-gold);
}

.sticker-search::placeholder {
    color: var(--text-muted);
}

.sticker-cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.sticker-cat-pill {
    padding: 5px 12px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: var(--radius-xl);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.sticker-cat-pill:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.sticker-cat-pill.active {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.sticker-big-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.sticker-big-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    background: var(--glass-bg);
    border: 1px solid transparent;
    -webkit-user-select: none;
    user-select: none;
}

.sticker-big-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-gold);
    transform: scale(1.15);
}

/* ============================================
   ERASER CURSOR
   ============================================ */
.eraser-cursor {
    position: fixed;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.25), inset 0 0 4px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 100000;
    mix-blend-mode: difference;
    transition: width 0.05s, height 0.05s;
}

/* ============================================
   TOOL TOGGLE (Pen / Eraser)
   ============================================ */
.tool-toggle-row {
    gap: 4px !important;
}

.prop-tool-btn {
    flex: 1;
    height: 32px;
    border: 1px solid var(--border-medium);
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    -webkit-user-select: none;
    user-select: none;
}

.prop-tool-btn:hover {
    background: var(--bg-hover);
}

.prop-tool-btn.active {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* ============================================
   DRAWING OVERLAY
   ============================================ */
.drawing-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: visible;
}

.drawing-event-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    cursor: crosshair;
    touch-action: none;
    background: transparent;
}

/* ============================================
   DRAWING PROPERTIES
   ============================================ */
.drawing-properties {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.drawing-properties .prop-group {
    margin-bottom: 20px;
}

.drawing-properties .prop-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.drawing-properties .prop-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.drawing-properties .prop-row label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
}

.drawing-properties .prop-color {
    width: 40px;
    height: 28px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    padding: 2px;
}

.drawing-properties .prop-range {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-light);
    border-radius: 2px;
    outline: none;
}

.drawing-properties .prop-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    border: 2px solid var(--text-light);
    box-shadow: var(--shadow-soft);
}

.drawing-properties .prop-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    border: 2px solid var(--text-light);
    box-shadow: var(--shadow-soft);
}

.drawing-properties .prop-range-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.drawing-properties .btn-secondary {
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--border-medium);
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.drawing-properties .btn-secondary:hover {
    background: var(--accent-rose-soft);
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

/* ============================================
   CANVAS AREA (Dynamic)
   ============================================ */
.canvas-area {
    flex: 1;
    background: var(--bg-primary);
    position: relative;
    overflow: auto;
    padding: 20px;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.canvas {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-strong);
    position: relative;
    overflow: hidden;
    z-index: 1;
    touch-action: none;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), background var(--transition-smooth);
    transform-origin: center center;
}

.canvas[data-bg="cream"] { background: #F5EDE6; }
.canvas[data-bg="white"] { background: #FFFFFF; }
.canvas[data-bg="linen"] { background: #E0D0B0; }
.canvas[data-bg="blush"] { background: #F0C8C0; }
.canvas[data-bg="sage"] { background: #C8D8C8; }
.canvas[data-bg="lavender"] { background: #D8C8E0; }
.canvas[data-bg="champagne"] { background: #F0E0C0; }
.canvas[data-bg="dusty-rose"] { background: #E0C0C0; }

.canvas-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-soft);
    z-index: 50;
}

.mobile-canvas-controls {
    display: none;
}

.canvas-control-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

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

#zoom-level,
#zoom-level-mobile {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 36px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   CANVAS ITEMS
   ============================================ */
.canvas-item {
    position: absolute;
    cursor: move;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    transition: box-shadow var(--transition-fast);
}

.canvas-item:hover {
    z-index: 1000 !important;
}

.canvas-item.selected {
    z-index: 1001 !important;
}

.canvas-item.selected::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid var(--accent-gold);
    border-radius: 2px;
    pointer-events: none;
    z-index: 1002;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-gold);
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
    cursor: pointer;
    z-index: 1003;
    display: none;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-fast);
    touch-action: none;
}

.resize-handle:hover {
    transform: scale(1.3);
}

.canvas-item.selected .resize-handle {
    display: block;
}

.resize-handle.nw { top: -7px; left: -7px; cursor: nw-resize; }
.resize-handle.ne { top: -7px; right: -7px; cursor: ne-resize; }
.resize-handle.sw { bottom: -7px; left: -7px; cursor: sw-resize; }
.resize-handle.se { bottom: -7px; right: -7px; cursor: se-resize; }
.resize-handle.n { top: -7px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.resize-handle.s { bottom: -7px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.resize-handle.w { left: -7px; top: 50%; transform: translateY(-50%); cursor: w-resize; }
.resize-handle.e { right: -7px; top: 50%; transform: translateY(-50%); cursor: e-resize; }

.resize-handle.n:hover,
.resize-handle.s:hover {
    transform: translateX(-50%) scale(1.3);
}

.resize-handle.w:hover,
.resize-handle.e:hover {
    transform: translateY(-50%) scale(1.3);
}

/* Rotation Handle */
.rotation-handle {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: var(--accent-rose);
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
    cursor: grab;
    z-index: 1003;
    display: none;
    box-shadow: var(--shadow-soft);
    touch-action: none;
}

.rotation-handle::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 10px;
    background: var(--accent-gold);
}

.rotation-handle:active {
    cursor: grabbing;
}

.canvas-item.selected .rotation-handle {
    display: block;
}

/* Item Content Types */
.item-image > div {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: inherit;
    pointer-events: none;
}

.item-text {
    min-width: 60px;
    min-height: 30px;
    outline: none;
    cursor: text;
    padding: 4px;
    border-radius: 4px;
}

.item-text:hover,
.item-text:focus {
    background: rgba(201, 169, 110, 0.05);
}

.item-text:focus {
    cursor: text;
}

.item-text:empty::before {
    content: 'Type here...';
    color: var(--text-muted);
    font-style: italic;
}

.item-text:not(:empty)::before {
    display: none;
}

.item-shape {
    width: 100%;
    height: 100%;
}

.item-sticker {
    font-size: 48px;
    line-height: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Polaroid Frame */
.item-polaroid {
    background: #FFFFFF;
    padding: 8px 8px 32px 8px;
    box-shadow: var(--shadow-soft);
}

.item-polaroid img {
    width: 100%;
    display: block;
}

/* ============================================
   RIGHT SIDEBAR — PROPERTIES
   ============================================ */
.sidebar-header {
    padding: 24px 16px 12px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

#selected-label {
    font-size: 11px;
    color: var(--text-muted);
}

.properties-panel {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.right-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.right-panel.active {
    display: flex;
}

.prop-empty-state {
    text-align: center;
    padding: 40px 16px;
}

.prop-empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.prop-empty-state p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Property Groups */
.prop-group {
    margin-bottom: 20px;
}

.prop-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.prop-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.prop-row label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 60px;
    flex-shrink: 0;
}

.prop-input,
.prop-select,
.prop-color {
    flex: 1;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast);
}

.prop-input:focus,
.prop-select:focus {
    border-color: var(--accent-gold);
}

.prop-color {
    padding: 2px 4px;
    cursor: pointer;
    width: 50px;
    flex: 0 0 50px;
}

.prop-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    outline: none;
}

.prop-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: var(--shadow-soft);
}

.prop-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: var(--shadow-soft);
}

.prop-range-value {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Color Palette */
.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--accent-gold);
}

/* ============================================
   LAYERS PANEL
   ============================================ */
.layers-section {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.layers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.layers-header h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

#layer-count {
    font-size: 11px;
    color: var(--text-muted);
}

.layers-list {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

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

.layer-item.active {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
    color: var(--text-primary);
    font-weight: 500;
}

.layer-thumb {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

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

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

.layer-visibility {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.layer-visibility:hover {
    opacity: 1;
}

.layer-delete {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.layer-item:hover .layer-delete {
    opacity: 0.6;
}

.layer-delete:hover {
    opacity: 1 !important;
    color: var(--accent-rose);
}

/* ============================================
   MOBILE BOTTOM BAR
   ============================================ */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    backdrop-filter: blur(var(--glass-blur-strong));
    border-top: 1px solid var(--glass-border);
    z-index: 90;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
}

.mobile-bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.mobile-bottom-btn span:first-child {
    font-size: 20px;
    line-height: 1;
}

.mobile-bottom-btn span:last-child {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-bottom-btn:hover {
    background: var(--bg-hover);
}

.mobile-bottom-btn:active {
    background: var(--accent-gold-soft);
}

/* ============================================
   CYBERNOX WATERMARK (Subtle)
   ============================================ */
.cybernox-watermark {
    position: fixed;
    bottom: 12px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.15;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.cybernox-watermark:hover {
    opacity: 0.5;
}

.cw-icon {
    font-size: 10px;
    color: var(--accent-gold);
}

.cw-text {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ============================================
   CONTEXT MENU
   ============================================ */
.context-menu {
    position: fixed;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-strong);
    padding: 6px 0;
    min-width: 160px;
    z-index: 10000;
    display: none;
    animation: contextFade 0.15s ease;
}

@keyframes contextFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.context-item {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.context-item:hover {
    background: var(--accent-gold-soft);
    color: var(--accent-gold);
}

.context-sep {
    height: 1px;
    background: var(--glass-border);
    margin: 6px 0;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 42, 40, 0.4);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    backdrop-filter: blur(var(--glass-blur-strong));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-strong);
    width: 440px;
    max-width: 100%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

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

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 24px 20px;
}

.btn-secondary,
.btn-primary {
    height: 38px;
    padding: 0 20px;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    -webkit-user-select: none;
    user-select: none;
}

.btn-secondary {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

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

.btn-primary {
    background: var(--accent-gold);
    color: var(--text-light);
}

.btn-primary:hover {
    background: var(--accent-gold-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* Export Options */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--glass-bg);
}

.export-option:hover,
.export-option.selected {
    border-color: var(--accent-gold);
    background: var(--accent-gold-soft);
}

.export-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.export-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.export-info p {
    font-size: 12px;
    color: var(--text-muted);
}

.export-settings label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.export-settings select {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
}

/* ============================================
   SAVE MODAL
   ============================================ */
.save-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--glass-bg);
    margin-bottom: 10px;
}

.save-option:hover,
.save-option.selected {
    border-color: var(--accent-gold);
    background: var(--accent-gold-soft);
}

.save-option-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.save-option-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.save-option-info p {
    font-size: 12px;
    color: var(--text-muted);
}

.save-name-row {
    margin-top: 16px;
}

.save-name-row label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ============================================
   DRAWER (Boards)
   ============================================ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 42, 40, 0.3);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 9998;
    display: none;
}

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

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    backdrop-filter: blur(var(--glass-blur-strong));
    border-right: 1px solid var(--glass-border);
    z-index: 9999;
    box-shadow: var(--shadow-strong);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

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

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

.drawer-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.drawer-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

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

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.new-board-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-gold);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 16px;
    -webkit-user-select: none;
    user-select: none;
}

.new-board-btn:hover {
    border-color: var(--accent-gold);
    background: var(--accent-gold-soft);
}

.boards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.boards-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.boards-bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.bulk-select-all input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-gold);
    cursor: pointer;
}

.board-bulk-btn {
    padding: 6px 12px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.board-bulk-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-gold);
    color: var(--text-primary);
}

.board-bulk-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.board-bulk-btn.danger:hover:not(:disabled) {
    background: var(--accent-rose-soft);
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

.board-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-gold);
    cursor: pointer;
    flex-shrink: 0;
}

.board-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1.5px solid transparent;
}

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

.board-item.active {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
}

.board-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    flex-shrink: 0;
    overflow: hidden;
}

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

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

.board-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.board-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.board-item:hover .board-actions {
    opacity: 1;
}

.board-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.board-action-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-rose);
}

.board-action-btn[data-action="rename"]:hover {
    color: var(--accent-gold);
}

.board-item.active .board-checkbox {
    accent-color: var(--accent-gold);
}

/* ============================================
   STICKER PANEL
   ============================================ */
.sticker-panel {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    backdrop-filter: blur(var(--glass-blur-strong));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-strong);
    z-index: 200;
    width: min(420px, 90vw);
    max-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--transition-smooth);
}

.sticker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.sticker-header button {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.sticker-header button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sticker-categories {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.sticker-categories::-webkit-scrollbar {
    display: none;
}

.sticker-cat {
    padding: 6px 10px;
    border: none;
    background: var(--glass-bg);
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
}

.sticker-cat:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.sticker-cat.active {
    background: var(--accent-gold-soft);
    box-shadow: inset 0 0 0 2px var(--accent-gold);
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 14px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.sticker-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    background: var(--glass-bg);
    border: 1px solid transparent;
    -webkit-user-select: none;
    user-select: none;
}

.sticker-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-gold);
    transform: scale(1.15);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 320px;
}

.toast {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
    animation: toastIn 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    border-left: 3px solid var(--accent-sage);
}

.toast.error {
    border-left: 3px solid var(--accent-rose);
}

.toast.info {
    border-left: 3px solid var(--accent-gold);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.fade-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(20px); }
}

/* ============================================
   RESPONSIVE — TABLET (≤1024px)
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .header-center {
        position: static;
        transform: none;
        margin-left: auto;
        margin-right: auto;
    }
    
    .board-title-wrap {
        margin-left: 12px;
        padding-left: 12px;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================ */
@media (max-width: 768px) {
    .app-header {
        height: 50px;
        padding: 0 12px;
    }
    
    .header-left {
        gap: 8px;
    }
    
    .logo-text-group {
        display: none;
    }
    
    .board-title-wrap {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }
    
    .board-title-marquee {
        font-size: 13px;
    }
    
    .header-center {
        display: none;
    }
    
    .header-right {
        gap: 4px;
    }
    
    .header-btn {
        padding: 0 12px;
        height: 32px;
        font-size: 12px;
    }
    
    .icon-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .workspace {
        height: calc(100vh - 50px);
    }
    
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        height: 55vh;
        max-height: 420px;
        z-index: 100;
        transform: translateY(100%);
        transition: transform var(--transition-smooth);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
        overflow: hidden;
    }
    
    .sidebar::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255,255,255,0.3);
        border-radius: 2px;
        z-index: 1;
    }
    
    .sidebar.open {
        transform: translateY(0);
    }
    
    .right-sidebar {
        left: 0;
        right: 0;
        transform: translateY(100%);
    }
    
    .right-sidebar.open {
        transform: translateY(0);
    }
    
    .mobile-sidebar-close {
        display: block;
    }
    
    .canvas-area {
        padding: 8px;
    }
    
    .canvas {
        border-radius: var(--radius-md);
    }
    
    .canvas-controls {
        display: none;
    }
    
    .mobile-canvas-controls {
        display: flex;
        bottom: 72px;
    }
    
    .mobile-bottom-bar {
        display: flex;
    }
    
    .cybernox-watermark {
        bottom: 72px;
    }
    
    .template-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .element-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .sticker-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .toast-container {
        bottom: 72px;
        left: 16px;
        right: 16px;
        max-width: none;
    }
    
    .toast {
        width: 100%;
    }
    
    .modal {
        width: 100%;
        max-height: 70vh;
    }
    
    .context-menu {
        min-width: 140px;
    }
    
    .resize-handle {
        width: 16px;
        height: 16px;
    }
    
    .resize-handle.nw { top: -9px; left: -9px; }
    .resize-handle.ne { top: -9px; right: -9px; }
    .resize-handle.sw { bottom: -9px; left: -9px; }
    .resize-handle.se { bottom: -9px; right: -9px; }
    .resize-handle.n { top: -9px; }
    .resize-handle.s { bottom: -9px; }
    .resize-handle.w { left: -9px; }
    .resize-handle.e { right: -9px; }
    
    .rotation-handle {
        width: 18px;
        height: 18px;
        top: -32px;
    }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (≤480px)
   ============================================ */
@media (max-width: 480px) {
    .app-header {
        padding: 0 8px;
    }
    
    .logo-icon {
        font-size: 18px;
    }
    
    .board-title-marquee {
        font-size: 12px;
    }
    
    .header-btn {
        padding: 0 8px;
        font-size: 11px;
    }
    
    .sidebar {
        width: 90vw;
    }
    
    .template-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .template-preview {
        border-radius: var(--radius-sm);
    }
    
    .element-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .uploads-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sticker-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .sticker-item {
        font-size: 22px;
    }
    
    .prop-row {
        flex-wrap: nowrap;
        gap: 6px;
    }
    
    .prop-row label {
        min-width: 50px;
        width: auto;
        font-size: 11px;
        flex-shrink: 0;
    }
    
    .drawing-properties .prop-row {
        flex-wrap: nowrap;
    }
    
    .drawing-properties .prop-row label {
        min-width: 50px;
        width: auto;
    }
    
    .prop-range {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }
    
    .prop-range-value {
        min-width: 28px;
        font-size: 10px;
    }
    
    .prop-tool-btn {
        font-size: 11px;
        height: 28px;
    }
    
    .mobile-bottom-btn span:last-child {
        font-size: 8px;
    }
    
    .cybernox-watermark {
        display: none;
    }
}

/* ============================================
   RESPONSIVE — LARGE DESKTOP (≥1440px)
   ============================================ */
@media (min-width: 1440px) {
    .sidebar {
        width: 300px;
    }
    
    .canvas {
        max-width: none;
    }
    
    .template-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .element-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   ORIENTATION — LANDSCAPE ON MOBILE
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .app-header {
        height: 44px;
    }
    
    .workspace {
        height: calc(100vh - 44px);
    }
    
    .sidebar {
        bottom: 0;
        height: 50vh;
        max-height: 320px;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    
    .mobile-bottom-bar {
        height: 50px;
    }
    
    .mobile-canvas-controls {
        bottom: 58px;
    }
    
    .cybernox-watermark {
        bottom: 58px;
    }
}

/* ============================================
   SCROLLBAR STYLING (Cross-browser)
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    background-clip: content-box;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */
.item-appear {
    animation: itemAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes itemAppear {
    from { opacity: 0; transform: scale(0.5) rotate(-5deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

.item-delete {
    animation: itemDelete 0.3s ease forwards;
}

@keyframes itemDelete {
    to { opacity: 0; transform: scale(0.3) rotate(10deg); }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-bar-fill {
        animation: none;
        width: 100%;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-light: rgba(200, 200, 200, 0.8);
        --border-medium: rgba(160, 160, 160, 0.9);
        --text-secondary: #555555;
        --text-muted: #777777;
    }
    
    .canvas-item.selected::after {
        border-width: 3px;
    }
}

/* Dark mode support (subtle) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1e;
        --bg-secondary: rgba(40, 40, 48, 0.72);
        --bg-panel: rgba(50, 50, 58, 0.55);
        --bg-hover: rgba(60, 60, 68, 0.85);
        --bg-dark: #E8E4E0;
        --text-primary: #E8E4E0;
        --text-secondary: #A8A0A0;
        --text-muted: #808080;
        --text-light: #1a1a1e;
        --text-on-dark: #3D3D3D;
        --border-light: rgba(80, 80, 90, 0.6);
        --border-medium: rgba(100, 100, 110, 0.7);
        --glass-bg: rgba(40, 40, 48, 0.65);
        --glass-bg-strong: rgba(50, 50, 58, 0.82);
        --glass-border: rgba(255, 255, 255, 0.08);
        --glass-border-strong: rgba(255, 255, 255, 0.15);
    }
    
    .canvas[data-bg="cream"] { background: #2A2520; }
    .canvas[data-bg="white"] { background: #333338; }
    .canvas[data-bg="linen"] { background: #3A3028; }
    .canvas[data-bg="blush"] { background: #3A2828; }
    .canvas[data-bg="sage"] { background: #283A28; }
    .canvas[data-bg="lavender"] { background: #28283A; }
    .canvas[data-bg="champagne"] { background: #3A3A28; }
    .canvas[data-bg="dusty-rose"] { background: #3A2828; }
    
    .item-text:empty::before {
        color: #808080;
    }
    
    .item-polaroid {
        background: #333338;
    }
}
