/* ============================================
   Lottie Editor — Dark Glassmorphism Theme
   ============================================ */

:root {
    /* Colors */
    --bg-base: #0b0e17;
    --bg-surface: rgba(17, 21, 35, 0.72);
    --bg-surface-hover: rgba(25, 30, 52, 0.85);
    --bg-elevated: rgba(30, 36, 62, 0.6);
    --bg-input: rgba(12, 15, 28, 0.7);
    --border: rgba(99, 115, 175, 0.15);
    --border-hover: rgba(124, 58, 237, 0.4);
    --text-primary: #e4e8f7;
    --text-secondary: #8892b0;
    --text-muted: #5a6382;
    --accent: #7c3aed;
    --accent-hover: #8b5cf6;
    --accent-glow: rgba(124, 58, 237, 0.25);
    --accent-blue: #2563eb;
    --danger: #ef4444;
    --danger-hover: #f87171;
    --success: #22c55e;
    --warning: #f59e0b;

    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.2s;
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(124, 58, 237, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(37, 99, 235, 0.06) 0%, transparent 60%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ===================== HEADER ===================== */

#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    flex-shrink: 0;
    z-index: 100;
}

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

.header-left { flex: 1; }
.header-center { flex: 0 0 auto; }
.header-right { flex: 1; justify-content: flex-end; }

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.3px;
}

.logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.file-name-label {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 4px 12px;
    border-radius: 20px;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-blue));
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

/* ===================== MAIN LAYOUT ===================== */

#app-main {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Panels */

.panel {
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

#inspector-panel {
    border-right: none;
    border-left: 1px solid var(--border);
}

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

.panel-header h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

/* ===================== LAYERS LIST ===================== */

.layers-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
}

.layers-list::-webkit-scrollbar {
    width: 5px;
}
.layers-list::-webkit-scrollbar-track {
    background: transparent;
}
.layers-list::-webkit-scrollbar-thumb {
    background: rgba(99, 115, 175, 0.2);
    border-radius: 10px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    position: relative;
    user-select: none;
}

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

.layer-item.selected {
    background: var(--accent-glow);
    border: 1px solid rgba(124, 58, 237, 0.35);
}

.layer-item:not(.selected) {
    border: 1px solid transparent;
}

.layer-thumb {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background:
        linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,.05) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,.05) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.05) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
    background-color: var(--bg-elevated);
    overflow: hidden;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1;
}

.layer-thumb svg {
    width: 100%;
    height: 100%;
}

.layer-item.selected .layer-thumb {
    box-shadow: 0 0 0 1.5px var(--accent);
}

.layer-name {
    flex: 1;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.layer-type-tag {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.layer-timing-badge {
    font-size: 9px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 5px;
    border-radius: 4px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    opacity: 0.7;
    transition: all var(--duration) var(--ease);
}

.layer-item:hover .layer-timing-badge {
    opacity: 1;
}

.layer-timing-badge.short {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    opacity: 1;
}

.layer-delete-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.layer-item:hover .layer-delete-btn {
    opacity: 1;
}

.layer-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.layer-chevron {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    margin-right: 2px;
    border-radius: 3px;
    transition: transform 0.15s ease, color 0.15s ease;
    transform: rotate(90deg);
}

.layer-chevron.collapsed {
    transform: rotate(0deg);
}

.layer-chevron:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.layer-chevron-spacer {
    flex-shrink: 0;
    width: 16px;
    margin-right: 2px;
}

.layer-move-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.layer-item:hover .layer-move-btns {
    opacity: 1;
}

.layer-move-btn {
    width: 18px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    border-radius: 2px;
    transition: all 0.1s ease;
}

.layer-move-btn:hover {
    color: var(--accent);
    background: var(--bg-elevated);
}

.btn-layer-action {
    width: 26px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.24);
    border-radius: var(--radius-sm);
    color: var(--accent);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.btn-layer-action:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.18);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.btn-layer-action:disabled {
    opacity: 0.38;
    cursor: default;
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-muted);
}

/* Extend Layer to Full button (inspector) */
.layer-extend-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    margin-top: 6px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.layer-extend-btn:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.18);
    border-color: var(--success);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.15);
}

.layer-extend-btn:disabled {
    opacity: 0.5;
    cursor: default;
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-muted);
}

/* Extend All button (layers panel header) */
.btn-extend-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.btn-extend-all:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.18);
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.15);
}

.btn-extend-all:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ===================== PREVIEW ===================== */

#preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.03) 0%, transparent 70%);
}

/* Checkerboard pattern */
.preview-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(45deg, rgba(255,255,255,0.02) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,0.02) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.02) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.02) 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
    pointer-events: none;
}

.lottie-player {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px dashed rgba(124, 58, 237, 0.4);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.08);
}

/* Corner markers for frame bounds */
.lottie-player::before,
.lottie-player::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
    z-index: 10;
}
.lottie-player::before {
    top: -1px;
    left: -1px;
    border-top: 2px solid rgba(124, 58, 237, 0.7);
    border-left: 2px solid rgba(124, 58, 237, 0.7);
}
.lottie-player::after {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid rgba(124, 58, 237, 0.7);
    border-right: 2px solid rgba(124, 58, 237, 0.7);
}

.lottie-player svg {
    max-width: 100%;
    max-height: 100%;
}

.text-preview-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none !important;
    max-height: none !important;
    pointer-events: none;
    z-index: 8;
}

/* Additional corner markers (top-right, bottom-left) via wrapper pseudo-elements */
#preview-container .frame-corner-tr,
#preview-container .frame-corner-bl {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
    z-index: 10;
}
#preview-container .frame-corner-tr {
    border-top: 2px solid rgba(124, 58, 237, 0.7);
    border-right: 2px solid rgba(124, 58, 237, 0.7);
}
#preview-container .frame-corner-bl {
    border-bottom: 2px solid rgba(124, 58, 237, 0.7);
    border-left: 2px solid rgba(124, 58, 237, 0.7);
}

/* Frame size label */
.frame-size-label {
    position: absolute;
    font-size: 10px;
    font-family: 'Inter', sans-serif;
    color: rgba(124, 58, 237, 0.6);
    background: rgba(11, 14, 23, 0.8);
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Playback Controls */

.playback-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.playback-controls.hidden {
    display: none;
}

.ctrl-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}
.ctrl-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.ctrl-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
    transition: transform 0.15s var(--ease);
}
.scrubber::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.frame-label {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 60px;
    text-align: right;
    flex-shrink: 0;
}
/* Trim Controls */

.trim-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.trim-controls.hidden {
    display: none;
}

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

.trim-input {
    width: 60px;
    padding: 4px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color var(--duration) var(--ease);
}

.trim-input:focus {
    border-color: var(--accent);
}

.trim-apply-btn {
    padding: 4px 10px;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    margin-left: auto;
}

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

/* ===================== INSPECTOR ===================== */

.inspector-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.inspector-content::-webkit-scrollbar {
    width: 5px;
}
.inspector-content::-webkit-scrollbar-track {
    background: transparent;
}
.inspector-content::-webkit-scrollbar-thumb {
    background: rgba(99, 115, 175, 0.2);
    border-radius: 10px;
}

.inspector-section {
    margin-bottom: 16px;
}

.inspector-section-title {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 2px;
}

.inspector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.inspector-label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 20px;
    font-weight: 500;
}

.inspector-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    outline: none;
    transition: border-color var(--duration) var(--ease);
    font-variant-numeric: tabular-nums;
}
.inspector-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.inspector-input[type="text"] {
    width: 100%;
}

/* Color swatch row */

.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: background var(--duration) var(--ease);
}
.color-row:hover {
    background: var(--bg-surface-hover);
}

.color-swatch-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: border-color var(--duration) var(--ease);
}
.color-swatch:hover {
    border-color: var(--accent);
}

.color-swatch-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.color-label {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
}

.color-hex {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Inter', monospace;
    font-variant-numeric: tabular-nums;
}

.shape-content-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.shape-content-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 8px 7px var(--shape-indent, 8px);
    background: var(--bg-elevated);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all var(--duration) var(--ease);
}

.shape-content-row:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.shape-content-row.active {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.32);
}

.shape-content-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 4px;
    color: inherit;
    font-size: 10px;
    font-weight: 700;
}

.shape-content-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
}

.shape-content-type {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.shape-move-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 9px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.shape-selected-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
}

.shape-step-row,
.shape-offset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: center;
}

.shape-step-label,
.shape-offset-grid label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.shape-offset-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.shape-nudge-grid {
    display: grid;
    grid-template-columns: repeat(3, 34px);
    grid-template-rows: repeat(3, 28px);
    justify-content: center;
    gap: 4px;
}

.shape-nudge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.shape-nudge-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.12);
}

.shape-offset-apply {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 7px 10px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.shape-offset-apply:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: var(--accent);
}

.shape-help,
.shape-empty {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

/* ===================== EMPTY STATE ===================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
    padding: 30px;
}

.empty-state p {
    font-size: 13px;
    line-height: 1.6;
}
.empty-state strong {
    color: var(--text-secondary);
}

/* ===================== TOAST ===================== */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    pointer-events: auto;
    animation: toastIn 0.35s var(--ease) forwards;
}

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

.toast.toast-out {
    animation: toastOut 0.3s var(--ease) forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(12px) scale(0.96); }
}

/* ===================== DRAG OVER ===================== */

body.drag-over .preview-container {
    outline: 2px dashed var(--accent);
    outline-offset: -6px;
    background: rgba(124, 58, 237, 0.04);
}

/* ===================== EXPORT DROPDOWN ===================== */

.export-dropdown {
    position: relative;
}

.export-dropdown .chevron {
    transition: transform var(--duration) var(--ease);
    margin-left: 2px;
}

.export-dropdown.open .chevron {
    transform: rotate(180deg);
}

.export-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: rgba(17, 21, 35, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transition: all 0.2s var(--ease);
    z-index: 200;
}

.export-dropdown.open .export-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.export-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background var(--duration) var(--ease);
}

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

.export-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 13px;
    flex-shrink: 0;
}

.export-menu-title {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
}

.export-menu-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.3;
}

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

/* ===================== FOOTER ===================== */

#app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 20px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    flex-shrink: 0;
}

#app-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

#app-footer a:hover {
    color: var(--accent);
}

.footer-sep {
    color: var(--border);
}

/* ===================== SELECTION BOX ===================== */

.selection-box {
    position: absolute;
    pointer-events: none;
    border: 1.5px dashed rgba(124, 58, 237, 0.8);
    background: rgba(124, 58, 237, 0.04);
    z-index: 15;
    transition: opacity 0.15s var(--ease);
}

.sel-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(124, 58, 237, 0.5);
}

.sel-corner.tl { top: -4px; left: -4px; }
.sel-corner.tr { top: -4px; right: -4px; }
.sel-corner.bl { bottom: -4px; left: -4px; }
.sel-corner.br { bottom: -4px; right: -4px; }

/* ===================== INSPECTOR TABS ===================== */

.inspector-tabs {
    display: flex;
    gap: 0;
    padding: 0 !important;
    border-bottom: 1px solid var(--border);
}

.inspector-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--duration) var(--ease);
    font-family: inherit;
}

.inspector-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-elevated);
}

.inspector-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===================== HSL ADJUST ===================== */

.adjust-section {
    padding: 4px 0;
}

.comp-size-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.comp-size-field label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

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

.adjust-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 70px;
}

.adjust-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--bg-input);
    outline: none;
}

.adjust-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-elevated);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(124, 58, 237, 0.4);
}

.adjust-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 34px;
    text-align: right;
}

.adjust-reset-btn {
    width: 100%;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    font-family: inherit;
    margin-top: 6px;
}

.adjust-reset-btn:hover {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: var(--accent);
}

/* ===================== GLOBAL COLOR PALETTE ===================== */

.global-color-group {
    margin-bottom: 10px;
}

.global-color-layer-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 5px 8px;
    margin-bottom: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-color-layer-name:hover {
    background: var(--accent-glow);
    color: var(--accent-hover);
}

.color-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: auto;
}

/* ===================== TIMELINE (AE-style) ===================== */

.timeline-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    height: 220px;
    transition: height 0.22s var(--ease);
    overflow: hidden;
}

.timeline-panel.collapsed {
    height: 32px;
}

.timeline-panel.collapsed .timeline-body {
    display: none;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-shrink: 0;
    user-select: none;
}

.timeline-toggle {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 3px;
    padding: 0;
    transition: transform 0.2s var(--ease), color var(--duration) var(--ease);
}

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

.timeline-panel.collapsed .timeline-toggle {
    transform: rotate(-90deg);
}

.timeline-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.timeline-info {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.timeline-zoom {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.tl-zoom-btn {
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.12s var(--ease);
}

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

.timeline-body {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.timeline-names {
    width: 180px;
    min-width: 180px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 22px; /* align past ruler */
    background: var(--bg-surface);
    scrollbar-width: none;
}
.timeline-names::-webkit-scrollbar { display: none; }

.timeline-name-row {
    display: flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-bottom: 1px solid rgba(99, 115, 175, 0.05);
    user-select: none;
    transition: background 0.1s var(--ease), color 0.1s var(--ease);
}

.timeline-name-row:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.timeline-name-row.selected {
    background: var(--accent-glow);
    color: var(--accent-hover);
    border-left: 2px solid var(--accent);
    padding-left: 8px;
}

.timeline-tracks-wrap {
    flex: 1;
    position: relative;
    overflow: auto;
}

.timeline-tracks-wrap::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.timeline-tracks-wrap::-webkit-scrollbar-track {
    background: transparent;
}
.timeline-tracks-wrap::-webkit-scrollbar-thumb {
    background: rgba(99, 115, 175, 0.2);
    border-radius: 10px;
}

.timeline-ruler {
    position: sticky;
    top: 0;
    left: 0;
    height: 22px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    cursor: ew-resize;
    z-index: 5;
    user-select: none;
}

.tl-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(99, 115, 175, 0.25);
    pointer-events: none;
}

.tl-tick.major {
    background: rgba(99, 115, 175, 0.5);
}

.tl-tick-label {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 9.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}

.timeline-tracks {
    position: relative;
}

.timeline-track-row {
    position: relative;
    height: 24px;
    border-bottom: 1px solid rgba(99, 115, 175, 0.05);
    background: transparent;
    transition: background 0.1s var(--ease);
}

.timeline-track-row:hover {
    background: rgba(124, 58, 237, 0.04);
}

.timeline-track-row.selected {
    background: rgba(124, 58, 237, 0.08);
}

.tl-bar {
    position: absolute;
    top: 3px;
    height: 18px;
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.5), rgba(124, 58, 237, 0.35));
    border: 1px solid rgba(124, 58, 237, 0.8);
    border-radius: 3px;
    cursor: grab;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.1s var(--ease);
    overflow: visible;
}

.tl-bar:active {
    cursor: grabbing;
}

.tl-bar:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 2px 6px rgba(124, 58, 237, 0.3);
}

.timeline-track-row.selected .tl-bar {
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.75), rgba(124, 58, 237, 0.55));
    border-color: var(--accent-hover);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 8px rgba(124, 58, 237, 0.4);
}

.tl-bar.short {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.5), rgba(245, 158, 11, 0.35));
    border-color: rgba(245, 158, 11, 0.8);
}

.tl-bar-label {
    position: absolute;
    top: 50%;
    left: 6px;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    max-width: calc(100% - 12px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.tl-handle {
    position: absolute;
    top: -1px;
    bottom: -1px;
    width: 6px;
    cursor: ew-resize;
    background: transparent;
    z-index: 2;
}

.tl-handle::after {
    content: '';
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.1s var(--ease);
}

.tl-bar:hover .tl-handle::after,
.tl-handle:hover::after {
    opacity: 1;
}

.tl-handle-l { left: -3px; }
.tl-handle-r { right: -3px; }

.timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--danger);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
}

.timeline-playhead-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 9px;
    height: 11px;
    background: var(--danger);
    clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
}

.tl-snap-guide {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #22d3ee;
    pointer-events: none;
    z-index: 9;
    display: none;
    box-shadow: 0 0 4px rgba(34, 211, 238, 0.7);
}

.tl-trim-tooltip {
    position: fixed;
    padding: 5px 9px;
    background: rgba(11, 14, 23, 0.95);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10000;
    display: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.tl-name-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tl-rename-input {
    flex: 1;
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--accent);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 11.5px;
    padding: 2px 6px;
    outline: none;
    min-width: 0;
}

.timeline-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 11px;
    color: var(--text-muted);
    width: 100%;
}

/* ===================== MODAL ===================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 9, 16, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: modalFadeIn 0.18s var(--ease);
}

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

.modal {
    background: rgba(17, 21, 35, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 420px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.22s var(--ease);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.modal-close {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
}
.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
}

.modal-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    width: 80px;
    flex-shrink: 0;
}

.bg-swatches {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bg-swatch {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--bg-input);
    cursor: pointer;
    padding: 0;
    transition: all var(--duration) var(--ease);
    overflow: hidden;
}

.bg-swatch:hover {
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.bg-swatch.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow), 0 0 8px rgba(124, 58, 237, 0.4);
}

.bg-swatch.checker {
    background:
        linear-gradient(45deg, rgba(255,255,255,.4) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,.4) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,.4) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.4) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
    background-color: var(--bg-input);
}

.bg-swatch-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ef4444, #f59e0b, #22c55e, #3b82f6, #a855f7);
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.bg-swatch-custom input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0;
}

.bg-swatch-custom-icon {
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.seg-control {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
    flex: 1;
}

.seg-control button {
    flex: 1;
    background: none;
    border: none;
    padding: 5px 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.12s var(--ease);
}

.seg-control button:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.seg-control button.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.modal-info {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 8px 0;
    font-variant-numeric: tabular-nums;
    border-top: 1px dashed var(--border);
    margin-top: 6px;
}

.modal-progress {
    margin-top: 10px;
    padding: 10px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-progress.hidden { display: none; }

.modal-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.modal-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-blue));
    border-radius: 3px;
    transition: width 0.15s var(--ease);
    box-shadow: 0 0 8px var(--accent-glow);
}

.modal-progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: rgba(11, 14, 23, 0.4);
}

/* ===================== TEXT OVERLAY ===================== */

#text-modal.modal-overlay {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 72px 300px 20px 20px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
}

.text-modal {
    width: 460px;
    pointer-events: auto;
}

.inspector-content.text-panel-host {
    padding: 0;
    overflow: hidden;
}

.text-panel {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: none;
}

.text-panel .modal-header {
    padding: 14px 16px;
}

.text-panel .modal-body {
    flex: 1;
    min-height: 0;
    padding: 12px;
}

.text-panel .modal-footer {
    padding: 12px;
}

.text-panel .text-modal-row {
    display: block;
}

.text-panel .modal-label {
    display: block;
    width: auto;
    padding-top: 0;
    margin-bottom: 6px;
}

.text-panel .text-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.text-panel .text-gradient-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: 0;
}

.text-modal-row {
    align-items: flex-start;
}

.text-modal-row-stack {
    margin-bottom: 12px;
}

.text-font-controls {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-font-button {
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.text-font-button:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

.text-font-name {
    min-width: 0;
    flex: 1;
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-top: 8px;
}

.text-overlay-textarea {
    flex: 1;
    width: 100%;
    min-height: 76px;
    resize: vertical;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;
    outline: none;
    transition: border-color var(--duration) var(--ease);
}

.text-overlay-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.text-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.text-gradient-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: -2px 0 14px 84px;
}

.text-field {
    min-width: 0;
}

.text-field label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.text-field input {
    width: 100%;
    height: 32px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color var(--duration) var(--ease);
}

.text-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.text-color-field input[type="color"] {
    padding: 3px;
    cursor: pointer;
}

.text-modal .modal-label {
    width: 72px;
    padding-top: 8px;
}

.text-modal .seg-control {
    min-height: 32px;
}

@media (max-width: 560px) {
    .text-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .text-gradient-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-left: 0;
    }
}

@media (max-width: 1200px) {
    #text-modal.modal-overlay {
        padding-right: 20px;
    }
}

/* ===================== HIDDEN UTILITY ===================== */

.hidden {
    display: none !important;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 1000px) {
    .panel {
        width: 220px;
        min-width: 220px;
    }
}

@media (max-width: 768px) {
    #app-main {
        flex-direction: column;
    }
    .panel {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
        border-right: none !important;
        border-left: none !important;
        border-bottom: 1px solid var(--border);
    }
    #inspector-panel {
        border-top: 1px solid var(--border);
        border-bottom: none;
    }
}
