:root {
    --bg-dark: #FFFFFF;
    --bg-panel: #FFFFFF;
    --border-subtle: #E8E8E8;
    --text-primary: #7A8C90;
    --text-secondary: #7A8C90;
    --accent-color: #FF8575;
    --accent-hover: #e06f60;
    --node-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --glass-border: #E8E8E8;
}

body.canvas-mode {
    background-color: var(--bg-dark);
    margin: 0;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#agent-canvas {
    width: 100%;
    height: calc(100vh - 30px);
    margin-top: 30px;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

#agent-canvas:active {
    cursor: grabbing;
}

/* ââ GRID BACKGROUND ââââââââââââââââââââââââââââââââââââââââââââââ */
.grid-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        /* major vertical lines */
        linear-gradient(to right, rgba(122, 140, 144, 0.08) 1px, transparent 1px),
        /* major horizontal lines */
        linear-gradient(to bottom, rgba(122, 140, 144, 0.08) 1px, transparent 1px),
        /* minor vertical lines */
        linear-gradient(to right, rgba(122, 140, 144, 0.03) 1px, transparent 1px),
        /* minor horizontal lines */
        linear-gradient(to bottom, rgba(122, 140, 144, 0.03) 1px, transparent 1px);
    background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
}

/* Square dot grid: small dots every 30px, larger dots every 150px */
.grid-base {
    background-image:
        /* major dots */
        radial-gradient(circle, rgba(255,255,255,0.5) 1.5px, transparent 1.5px),
        /* minor dots */
        radial-gradient(circle, rgba(255,255,255,0.25) 0.8px, transparent 0.8px);
    background-size: 150px 150px, 30px 30px;
    background-position: 0 0, 0 0;
}

/* Highlight layer: same dot grid but purple, revealed by mouse spotlight */
.grid-highlight {
    background-image:
        radial-gradient(circle, rgba(108,92,231,0.9) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(108,92,231,0.6) 0.8px, transparent 0.8px);
    background-size: 150px 150px, 30px 30px;
    background-position: 0 0, 0 0;
    -webkit-mask-image: radial-gradient(ellipse 260px 260px at var(--mouse-x, -999px) var(--mouse-y, -999px), black 0%, transparent 100%);
    mask-image:         radial-gradient(ellipse 260px 260px at var(--mouse-x, -999px) var(--mouse-y, -999px), black 0%, transparent 100%);
}

/* Agent Nodes */
.agent-node {
    position: absolute;
    width: 260px;
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--node-shadow);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    user-select: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(10px);
}

.agent-node:hover {
    border-color: var(--text-secondary);
}

.agent-node.master-role {
    border-color: #FF8575;
    box-shadow: 0 2px 8px rgba(255, 133, 117, 0.15);
    z-index: 50;
}

.agent-node.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(255, 133, 117, 0.3);
    z-index: 100 !important;
}

.node-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px 12px 0 0;
    cursor: grab;
}

.agent-type-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 133, 117, 0.15);
    color: #FF8575;
    border: 1px solid #FF8575;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    user-select: none;
    font-weight: 700;
}

.agent-type-badge.worker {
    background: transparent;
    color: #7A8C90;
    border-color: #E8E8E8;
}

.agent-type-badge:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.node-title {
    user-select: text;
    cursor: inherit;
    flex: 1;
    margin-right: 10px;
}

.node-body {
    padding: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    outline: none;
    cursor: default;
}

.node-terminal {
    background: #FFFFFF;
    border-top: 1px solid var(--glass-border);
    border-radius: 0 0 12px 12px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: #FFFFFF;
    color: #7A8C90;
    font-size: 9px;
    padding: 4px 10px;
    letter-spacing: 1.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.terminal-content {
    padding: 6px 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 10px;
    color: #7A8C90;
    height: 16px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: 0.8;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 4px;
}

.loading-dots::after {
    content: '...';
    display: inline-block;
    width: 12px;
    text-align: left;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80% {
        content: '...';
    }
}

/* Custom Scrollbar for Terminal */
.terminal-content::-webkit-scrollbar {
    width: 4px;
}

.terminal-content::-webkit-scrollbar-track {
    background: #000;
}

.terminal-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* Ports */
.node-port {
    width: 10px;
    height: 10px;
    background: var(--text-secondary);
    border-radius: 50%;
    position: absolute;
    top: 24px;
    /* Align with header roughly */
    border: 2px solid var(--bg-panel);
    cursor: crosshair;
    transition: background 0.2s, transform 0.2s;
}

.node-port:hover {
    background: var(--accent-color);
    transform: scale(1.3);
}

.port-in {
    left: -6px;
}

.port-out {
    right: -6px;
}

/* Connections */
svg.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

path.connection-line {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 2px;
    transition: stroke 0.2s;
}

path.connection-line:hover {
    stroke: var(--accent-color);
    stroke-width: 3px;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 150px;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(10px);
}

.context-menu-item {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Settings Dropdown */
.node-settings {
    position: static;
    width: auto;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0;
    padding: 12px;
    box-shadow: none;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-row label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-right: 10px;
}

.setting-row input,
.setting-row select {
    background: #1a1a1a;
    border: 1px solid #333;
    color: var(--text-primary);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    width: 140px;
    outline: none;
    user-select: text;
    -webkit-user-select: text;
}

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

.workdir-display {
    font-size: 11px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
    display: block;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

.expand-btn {
    transition: transform 0.2s;
}

/* API Key Input in Node */
.api-key-container {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-subtle);
}

.api-key-error {
    font-size: 10px;
    color: #ff4d4d;
    display: block;
    margin-bottom: 4px;
}

.api-key-input-wrapper {
    display: flex;
    gap: 4px;
}

.api-key-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #ff4d4d;
    color: var(--text-primary);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    outline: none;
    width: auto;
    user-select: text;
    -webkit-user-select: text;
    /* Override wider input styles */
}

/* File Input Wrapper */
.file-input-wrapper {
    display: flex;
    align-items: center;
    width: 140px;
    gap: 4px;
}

.workdir-input {
    width: 100% !important;
    margin-top: 0 !important;
    flex: 1;
    text-overflow: ellipsis;
}

.browse-btn {
    margin-top: 0;
    padding: 0;
    background: #2d2d2d;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.browse-btn:hover {
    border-color: var(--accent-color);
    background: #333;
}

/* Permissions Bubbles */
.setting-group {
    margin-bottom: 12px;
}

.setting-group label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.permissions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.permission-bubble {
    font-size: 10px;
    padding: 4px 8px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
    color: var(--text-secondary);
}

.permission-bubble:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.permission-bubble.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Train Button */
.train-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    text-align: center;
}

.train-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Delete Button */
.delete-btn {
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: transparent;
    border: 1px solid #ff4d4d;
    color: #ff4d4d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    text-align: center;
}

.delete-btn:hover {
    background: #ff4d4d;
    color: white;
}

.api-key-save-btn {
    padding: 4px 8px;
    font-size: 10px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0;
    width: auto;
}

/* Sliding Panel Styles for Training */
.training-side-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 80vw;
    min-width: 400px;
    height: 100vh;
    max-width: 100%;
    background: var(--bg-dark);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.6);
    display: flex;
}

.training-side-panel.active {
    transform: translateX(0);
}

/* Resizer styles */
.resizer {
    background: transparent;
    z-index: 1200;
    transition: background 0.2s;
    flex-shrink: 0;
    position: relative;
    cursor: ew-resize;
    width: 6px;
}

.panel-resizer {
    position: absolute !important;
    left: 0;
    top: 0;
    width: 8px !important;
    height: 100%;
    background: rgba(255, 133, 117, 0.05);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1300;
}

.sidebar-resizer {
    width: 6px !important;
    height: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    z-index: 1000;
}

.resizer::after {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    width: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
}

.resizer:hover,
.resizer.dragging {
    background: var(--accent-color) !important;
}

.resizer-left {
    position: absolute !important;
    width: 2px;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 1300;
}

.resizer-middle {
    width: 1px;
    height: 100%;
    background: var(--border-subtle);
    z-index: 1300;
}

body.training-panel-active #agent-canvas {
    width: 100%;
}

/* Custom Confirm Modal */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 99999;
    /* Fix for being under training panel (1100) */
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal-box {
    background: var(--bg-panel, #1e1e1e);
    border: 1px solid var(--border-subtle, #333);
    border-radius: 6px;
    padding: 16px 20px;
    min-width: 250px;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    text-align: center;
    color: var(--text-primary, #fff);
    font-family: inherit;
}

.custom-modal-message {
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 400;
}

.custom-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.custom-modal-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    font-weight: 500;
}

.custom-btn-secondary {
    background: transparent;
    color: #a0a0a0;
    border: 1px solid #444 !important;
}

.custom-btn-secondary:hover {
    background: #2a2a2a;
    color: #fff;
    border-color: #666 !important;
}

.custom-btn-danger {
    background: transparent;
    color: #ff4d4d;
    border: 1px solid #ff4d4d !important;
}

.custom-btn-danger:hover {
    background: rgba(255, 77, 77, 0.1);
}

/* ââ User Profile Menu ââ */
.user-menu-container {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 1050;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    padding: 4px 10px 4px 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-family: inherit;
}

.user-menu-trigger:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: #252525;
}

.user-menu-trigger.active {
    border-color: var(--accent-color);
    background: #252525;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF8575, #ffb3a7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-plan {
    font-size: 10px;
    color: var(--text-secondary);
}

.user-menu-chevron {
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.user-menu-trigger.active .user-menu-chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.user-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    width: 230px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 4px 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.96);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-email {
    padding: 8px 14px;
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 3px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 14px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.dropdown-item svg {
    color: var(--text-secondary);
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.dropdown-item span {
    flex: 1;
}

.dropdown-shortcut {
    font-size: 10px !important;
    color: var(--text-secondary) !important;
    flex: 0 !important;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: inherit;
}

.submenu-arrow {
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: auto;
    width: 12px;
    height: 12px;
}

.dropdown-item-danger {
    color: #ff6b6b;
}

.dropdown-item-danger svg {
    color: #ff6b6b;
}

.dropdown-item-danger:hover {
    background: rgba(255, 77, 77, 0.08);
}

.selection-box {
    position: absolute;
    border: 1px solid #FF8575;
    background: rgba(255, 133, 117, 0.15);
    pointer-events: none;
    z-index: 2000;
}

/* ââ Top Menu Bar (VS Code / Figma style) ââ */
.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    display: flex;
    align-items: stretch;
    background: #181818;
    border-bottom: 1px solid #2a2a2a;
    z-index: 9000;
    -webkit-app-region: drag;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.menu-bar-item {
    position: relative;
    -webkit-app-region: no-drag;
    display: flex;
    align-items: stretch;
}

.menu-bar-label {
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 400;
    color: #cccccc;
    cursor: default;
    user-select: none;
    letter-spacing: 0.01em;
}

.menu-bar-item:hover .menu-bar-label,
.menu-bar-item.open .menu-bar-label {
    background: rgba(255, 255, 255, 0.07);
    color: #e0e0e0;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #252526;
    border: 1px solid #454545;
    border-radius: 4px;
    padding: 4px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 9001;
}

.menu-bar-item.open .menu-dropdown {
    display: block;
}

.menu-dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 24px 0 8px;
    height: 28px;
    background: none;
    border: none;
    color: #cccccc;
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    cursor: default;
    text-align: left;
    gap: 0;
}

.menu-dropdown-item:hover {
    background: #094771;
    color: #ffffff;
}

.menu-dropdown-item:hover .menu-shortcut {
    color: rgba(255, 255, 255, 0.6);
}

.menu-item-icon {
    display: none;
}

.menu-dropdown-item > span:not(.menu-shortcut):not(.menu-item-icon) {
    flex: 1;
}

.menu-shortcut {
    margin-left: auto;
    padding-left: 32px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
}

.menu-divider {
    height: 1px;
    background: #454545;
    margin: 4px 0;
}

/* Hide the old floating button â keep ID for JS binding */
.add-agent-btn {
    display: none;
}

/* ââ Canvas Picker Modal ââ */
.canvas-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-picker-modal {
    background: #252526;
    border: 1px solid #454545;
    border-radius: 6px;
    width: 360px;
    max-height: 420px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.canvas-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #454545;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
}

.canvas-picker-close {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

.canvas-picker-close:hover {
    color: #fff;
}

.canvas-picker-list {
    overflow-y: auto;
    padding: 4px 0;
}

.canvas-picker-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background 0.1s;
}

.canvas-picker-item:hover {
    background: #094771;
}

.canvas-picker-name {
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
}

.canvas-picker-item:hover .canvas-picker-name {
    color: #fff;
}

.canvas-picker-meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.canvas-picker-item:hover .canvas-picker-meta {
    color: rgba(255, 255, 255, 0.5);
}

/* ââ Agent Gallery Modal ââ */
.gallery-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 5000;
    align-items: center;
    justify-content: center;
}

.gallery-overlay.open {
    display: flex;
}

.gallery-modal {
    background: #1a1a1a;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    width: 520px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    animation: gallerySlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gallerySlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.gallery-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.gallery-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.gallery-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.gallery-modal-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 24px 24px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.gallery-modal-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: #222;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal-card:hover {
    border-color: var(--accent-color);
    background: #282828;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 133, 117, 0.15);
}

.gallery-modal-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.gallery-modal-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gallery-modal-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.gallery-modal-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}