/* ==========================================================================
   COLORING WORDSEARCH PUZZLES GENERATOR - STYLESHEET
   Supports draggable & resizable canvas blocks (Grid & Word List)
   ========================================================================== */

:root {
    --bg-dark-main: #131722;
    --bg-sidebar-icon: #181c28;
    --bg-sidebar-panel: #1e2330;
    --bg-card: #252b3b;
    --bg-input: #151821;
    --border-color: #2e3548;
    --border-focus: #4f46e5;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-purple: #6366f1;
    --accent-teal: #14b8a6;
    --danger-red: #ef4444;
    --paper-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-dark-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.hidden { display: none !important; }
.full-width { width: 100%; }
.margin-top { margin-top: 15px; }

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #1e2330;
    color: white;
    padding: 10px 18px;
    font-size: 14px;
}
.btn-primary:hover { background: #2b3244; }

.btn-purple-accent {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    font-size: 13px;
}
.btn-secondary:hover { background: var(--border-color); }

.btn-tool {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 14px;
    min-width: 34px;
    height: 34px;
}
.btn-tool:hover { background: var(--border-color); }

.btn-danger {
    color: var(--danger-red);
    border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.15); }

/* App View Containers */
.app-view {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==========================================================================
   VIEW 1: COLLECTIONS DASHBOARD
   ========================================================================== */
#view-collections {
    background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0f172a 60%, #090d16 100%);
    color: #f8fafc;
    min-height: 100vh;
}

.dashboard-header {
    height: 54px;
    background-color: #181c28;
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid #2e3548;
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo-icon { font-size: 22px; color: #f8fafc; }

.dash-nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.dash-nav-links .nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}

.dash-nav-links .nav-link:hover,
.dash-nav-links .nav-link.active { color: #ffffff; }

.dash-header-right .user-avatar {
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
}

/* Dashboard Body & Card */
.dashboard-body {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}

.dashboard-container {
    width: 100%;
    max-width: 1280px;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Brand Badge */
.dash-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 6px 16px;
    border-radius: 30px;
    margin-bottom: 20px;
}

.brand-icon-box {
    color: #818cf8;
    font-size: 14px;
}

.brand-title {
    color: #c7d2fe;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Hero Titles */
.dash-hero-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.dash-hero-subtitle {
    font-size: 15px;
    color: #94a3b8;
    max-width: 520px;
    line-height: 1.5;
    margin-bottom: 32px;
}

/* Create Collection Card Bar */
.create-collection-card {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 620px;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 8px;
    border-radius: 14px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    margin-bottom: 40px;
}

.create-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.create-input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    color: #64748b;
    font-size: 16px;
    pointer-events: none;
}

.dash-input {
    width: 100%;
    background-color: transparent !important;
    border: none !important;
    color: #f8fafc !important;
    padding: 12px 14px 12px 42px !important;
    font-size: 14px !important;
}

.dash-input::placeholder {
    color: #64748b !important;
}

.dash-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.dash-btn-create {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: all 0.2s ease;
}

.dash-btn-create:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

/* Collections Grid Section */
.collections-section {
    width: 100%;
    text-align: left;
}

.collections-section-header {
    border-bottom: 1px solid #334155;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.collections-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #818cf8;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    width: 100%;
}

.dash-collection-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dash-collection-card:hover {
    border-color: #6366f1;
    transform: translateY(-4px);
    box-shadow: 0 16px 30px -10px rgba(99, 102, 241, 0.3);
}

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

.dash-card-icon {
    width: 38px;
    height: 38px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #818cf8;
    font-size: 16px;
}

.dash-card-badge {
    background: #0f172a;
    border: 1px solid #334155;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.dash-card-body {
    margin-bottom: 20px;
}

.dash-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 6px;
    line-height: 1.3;
}

.dash-card-date {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dash-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dash-btn-open {
    flex: 1;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.dash-collection-card:hover .dash-btn-open {
    background: #6366f1;
    color: #ffffff;
}

.dash-btn-remove {
    background-color: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.dash-btn-remove:hover {
    background-color: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}


/* ==========================================================================
   VIEW 2: CANVAS EDITOR WORKSPACE
   ========================================================================== */
.app-header {
    height: 52px;
    background-color: var(--bg-sidebar-icon);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.header-left .nav-btn {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.banner-alert {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #fde047;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.banner-alert .close-alert {
    background: none;
    color: inherit;
    font-size: 16px;
    padding: 0 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Icon Sidebar */
.icon-sidebar {
    width: 64px;
    background-color: var(--bg-sidebar-icon);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 16px;
}

.nav-icon-btn {
    width: 52px;
    height: 52px;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    flex-direction: column;
    font-size: 18px;
    gap: 4px;
}

.nav-icon-btn span { font-size: 10px; }
.nav-icon-btn:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.05); }
.nav-icon-btn.active { color: white; background: var(--accent-purple); }

/* Settings Sidebar */
.settings-sidebar {
    width: 320px;
    background-color: var(--bg-sidebar-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-tab {
    display: none;
    flex-direction: column;
    height: 100%;
}

.sidebar-tab.active { display: flex; }

.sidebar-header {
    padding: 18px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 { font-size: 16px; font-weight: 600; color: var(--text-main); }
.sidebar-header .subtitle { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.sidebar-content { padding: 16px; flex: 1; }
.sidebar-content.scrollable { overflow-y: auto; }

/* Elements Grid */
.elements-grid {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.element-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.element-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.element-preview { font-size: 32px; color: var(--accent-blue); }
.element-card span { font-size: 12px; font-weight: 500; text-align: center; }

/* Form Controls */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus { border-color: var(--accent-purple); }

/* Direction Tags */
.direction-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.direction-tags .tag {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.direction-tags .tag:hover { border-color: var(--text-muted); }

.direction-tags .tag.active {
    background: var(--bg-card);
    border-color: var(--accent-blue);
    color: white;
    font-weight: 600;
}

/* Toggle Switches */
.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-group label { margin-bottom: 0; }

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
}

.slider.round { border-radius: 22px; }
.slider.round:before { border-radius: 50%; }

input:checked + .slider {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

input:checked + .slider:before { transform: translateX(18px); }

/* Color Picker Wrapper */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: 1px solid var(--border-color);
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
    border-radius: 4px; border: none;
}

.color-picker-wrapper span {
    font-size: 13px;
    font-family: monospace;
    color: var(--text-muted);
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

.highlight-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 10px 12px;
    border-radius: 6px;
}

/* Subtabs */
.subtab-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.subtab-btn {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
}

.subtab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    font-weight: 600;
}

.subtab-content { display: none; }
.subtab-content.active { display: block; }

/* Margins Grid */
.margins-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.mini-label {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
}

.form-control.mini {
    padding: 4px 6px;
    font-size: 12px;
    text-align: center;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox-group label { margin-bottom: 0; cursor: pointer; }

/* Canvas Workspace & Stacked Vertical Pages */
.canvas-workspace {
    flex: 1;
    background-color: var(--bg-dark-main);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.canvas-top-bar {
    height: 48px;
    background-color: var(--bg-sidebar-icon);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.select-font { width: 180px; font-size: 13px; }

.font-size-control {
    display: flex;
    align-items: center;
}

.input-size {
    width: 50px;
    text-align: center;
    border-radius: 0;
    border-left: none;
    border-right: none;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

.input-size::-webkit-outer-spin-button,
.input-size::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.font-size-control button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.font-size-control button:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* Vertical Stacked Pages Container */
.paper-container {
    flex: 1;
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    overflow-y: auto;
}

.paper-page {
    width: 612px;
    height: 792px;
    background: #ffffff;
    color: #1a202c;
    box-shadow: var(--paper-shadow);
    border-radius: 2px;
    position: relative;
    box-sizing: border-box;
    transition: outline 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.paper-page.active-page {
    outline: 2px solid #3b82f6;
    outline-offset: 4px;
}

.page-title-label {
    position: absolute;
    top: -24px;
    left: 0;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.page-number-footer {
    position: absolute;
    bottom: 12px;
    font-size: 12px;
    color: #4a5568;
    font-weight: 500;
    pointer-events: none;
    z-index: 5;
}

.page-floating-actions {
    position: absolute;
    top: -30px;
    right: 0;
    display: flex;
    gap: 6px;
}

.btn-page-action {
    background: var(--bg-sidebar-icon);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 11px;
}
.btn-page-action:hover { background: var(--border-color); }

.margin-guide-box {
    position: absolute;
    top: 36px; left: 36px; right: 36px; bottom: 36px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    pointer-events: none;
}

.margin-guide-box.no-border { border: none; }

.canvas-stage {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: auto;
}

/* Draggable & Resizable Canvas Block Wrapper */
.canvas-block-wrapper {
    position: absolute;
    cursor: move;
    border: 1.5px dashed transparent;
    user-select: none;
    box-sizing: border-box;
}

.canvas-block-wrapper.selected {
    border-color: #3b82f6;
}

/* Corner Resize Handles */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #3b82f6;
    border: 2px solid #ffffff;
    border-radius: 50%;
    z-index: 10;
}

.handle-tl { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-tr { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-bl { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle-br { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* Canvas Bottom Pagination & Zoom */
.canvas-bottom-bar {
    height: 38px;
    background-color: var(--bg-sidebar-icon);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.page-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-pill {
    background: #22c55e;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.btn-help {
    background: #0d9488;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background-color: var(--bg-sidebar-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
    width: 180px;
}

.context-menu ul { list-style: none; padding: 6px 0; }
.context-menu li {
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}
.context-menu li:hover { background-color: var(--accent-purple); color: white; }
.context-menu li.ctx-delete { color: #ef4444; }
.context-menu li.ctx-delete:hover { background-color: #dc2626; color: white; }
.context-menu .menu-divider { height: 1px; background: var(--border-color); margin: 4px 0; padding: 0; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: var(--bg-sidebar-panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 460px;
    max-width: 90vw;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}

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

.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; font-size: 20px; color: var(--text-muted); }
.modal-close:hover { color: white; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    background: var(--bg-sidebar-icon);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* SVG Outline text */
.puzzle-svg { width: 100%; height: 100%; overflow: visible; }
/* outline-cell-text font/color styles are set dynamically in the SVG by the renderer */
.outline-cell-text {
    user-select: none;
}
/* word-item-text styles are set dynamically in the SVG by the renderer */

/* Image Upload Dropzone & Gallery Grid */
.image-dropzone {
    margin-top: 15px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px 12px;
    background: var(--bg-input);
    text-align: center;
    transition: border-color 0.2s, background-color 0.2s;
    min-height: 60px;
}

.image-dropzone.dragover {
    border-color: var(--accent-purple);
    background: rgba(99, 102, 241, 0.1);
}

.dropzone-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
}

.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.gallery-item {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    padding: 6px;
}

.gallery-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-purple);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.gallery-item img {
    max-width: 100%;
    max-height: 75px;
    object-fit: contain;
}

.gallery-item-actions {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(19, 23, 34, 0.92);
    padding: 4px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    z-index: 10;
}

.btn-gallery-insert {
    flex: 1;
    background: var(--accent-purple);
    color: white;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.btn-gallery-insert:hover {
    background: #4f46e5;
}

.gallery-item-del {
    background: rgba(239, 68, 68, 0.85);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}
.gallery-item-del:hover {
    background: #dc2626;
}

.canvas-image-content {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
