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

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background:
        repeating-linear-gradient(0deg, rgba(0,0,0,0.2) 0px, transparent 2px, transparent 4px),
        repeating-linear-gradient(90deg, rgba(0,0,0,0.2) 0px, transparent 2px, transparent 4px),
        linear-gradient(135deg, #0f1419 0%, #1a2028 50%, #0f1419 100%);
    color: #b8d4f0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at top, rgba(45, 85, 120, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(20, 35, 50, 0.12) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.header {
    background:
        linear-gradient(180deg, rgba(25, 35, 45, 0.95) 0%, rgba(15, 22, 30, 0.98) 100%);
    padding: 8px 40px;
    border: 2px solid;
    border-image: linear-gradient(90deg, #3a5570, #5a8ab5, #3a5570) 1;
    border-top: none;
    border-left: none;
    border-right: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(90, 138, 181, 0.2);
    position: sticky;
    top: 0;
    z-index: 150;
    flex-wrap: wrap;
    gap: 8px;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #5a8ab5 20%, #5a8ab5 80%, transparent);
    box-shadow: 0 0 10px rgba(90, 138, 181, 0.5);
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #b8d4f0;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(90, 180, 220, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.5px;
}

.copyright {
    font-size: 10px;
    font-weight: 400;
    color: #6a8599;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 2px 10px;
    background:
        linear-gradient(180deg, rgba(35, 50, 65, 0.85) 0%, rgba(20, 30, 40, 0.9) 100%);
    border: 1px solid #3a5570;
    color: #b8d4f0;
    cursor: pointer;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    transition: all 0.2s ease;
    position: relative;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(90, 138, 181, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-icon {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.85;
    line-height: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(90, 138, 181, 0.1) 0%, transparent 50%);
    border-radius: 2px;
    pointer-events: none;
}

.btn:hover {
    background:
        linear-gradient(180deg, rgba(50, 70, 90, 0.9) 0%, rgba(30, 45, 60, 0.95) 100%);
    border-color: #5a8ab5;
    transform: translateY(-1px);
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(90, 138, 181, 0.4),
        0 0 12px rgba(90, 138, 181, 0.25);
    color: #d4e8ff;
}

.btn:active {
    transform: translateY(0px);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.7),
        inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.canvas-container {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 70px);
    padding: 40px 20px;
    padding-bottom: 320px;
    background:
        repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0px, transparent 1px, transparent 40px, rgba(255,255,255,0.03) 41px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, transparent 1px, transparent 40px, rgba(255,255,255,0.03) 41px);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: visible;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.canvas-wrapper {
    position: relative;
    width: 1400px;
    height: 800px;
    transform-origin: center center;
    transition: transform 0.2s ease-out;
    background: transparent;
}


.draggable {
    position: absolute;
    cursor: move;
    user-select: none;
    padding: 12px;
    border-radius: 50%;
    font-size: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
    width: 50px;
    height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.icon-note {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    border: none;
    color: #fff;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
    border-radius: 3px;
    width: auto;
    min-width: 60px;
    max-width: 150px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 3px rgba(0, 0, 0, 0.8);
}

.draggable:hover .icon-note {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.icon-note:focus {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.icon-note.has-content {
    opacity: 1;
    pointer-events: auto;
    background: transparent;
    border: none;
}

.icon-note.has-content:focus {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.tank .icon-note {
    color: #c69b6d;
}

.healer .icon-note {
    color: #50c878;
}

.dps .icon-note {
    color: #e94560;
}

.ranged .icon-note {
    color: #c94560;
}

.player .icon-note {
    color: #4a90e2;
}

.mob .icon-note {
    color: #8b4789;
}

.boss .icon-note {
    color: #ff6b6b;
}

.icon-note:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.8);
}

.icon-note::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.tank, .healer, .dps, .ranged {
    width: 60px;
    height: 60px;
    font-size: 28px;
}

.boss {
    width: 80px;
    height: 80px;
    font-size: 48px;
    border: none;
    background: transparent;
    box-shadow: none;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
}

.boss-icon {
    font-size: 48px;
}

.boss-name {
    font-size: 14px;
    font-weight: 900;
    color: #fff;
    text-align: center;
    word-wrap: break-word;
    width: 100%;
    max-width: 110px;
}

.boss-name input {
    background: transparent;
    border: none;
    color: #fff;
    padding: 2px 4px;
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    border-radius: 3px;
    width: 100%;
    max-width: 110px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.boss:hover .boss-name input {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.boss-name input:focus {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.boss-name input.has-content {
    opacity: 1;
    pointer-events: auto;
    background: transparent;
    border: none;
}

.boss-name input.has-content:focus {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.color-picker {
    display: none; /* Hidden - not used for simplified boss/mob icons */
}

.boss:hover .color-picker {
    display: none;
}

.player .icon-note, .mob .icon-note {
    max-width: 120px;
}

.draggable:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.player {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    border: 2px solid #2c5f8d;
}

.tank {
    background: linear-gradient(135deg, #c69b6d 0%, #a67c52 100%);
    border: 2px solid #8b6839;
}

.healer {
    background: linear-gradient(135deg, #50c878 0%, #3da75f 100%);
    border: 2px solid #2d7a45;
}

.dps {
    background: linear-gradient(135deg, #e94560 0%, #c23650 100%);
    border: 2px solid #9c2940;
}

.ranged {
    background: linear-gradient(135deg, #c94560 0%, #a83650 100%);
    border: 2px solid #8c2940;
}

.mob {
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 60px;
    width: 60px;
    height: 60px;
    font-size: 40px;
}

.boss {
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 80px;
    font-size: 48px;
    padding: 5px;
}

.note {
    background: transparent;
    color: #fff;
    border: none;
    min-width: 150px;
    max-width: 400px;
    min-height: 80px;
    padding: 12px;
    padding-top: 32px;
    font-size: 20px;
    font-weight: bold;
    text-align: left;
    box-shadow: none;
    border-radius: 12px;
    width: fit-content;
    height: auto;
    backdrop-filter: none;
    transition: all 0.3s;
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.note:hover {
    box-shadow: none;
    border: none;
}

.note-drag-handle {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 16px;
    cursor: move;
    opacity: 0.6;
    user-select: none;
}

.note:hover .note-drag-handle {
    opacity: 1;
}

.note-lock-btn {
    position: absolute;
    top: 5px;
    right: 30px;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.6;
    user-select: none;
    transition: opacity 0.2s;
    z-index: 15;
    padding: 2px 4px;
}

.note:hover .note-lock-btn {
    opacity: 1;
}

/* When note is locked, hide all controls */
.note.locked .note-size-slider,
.note.locked .note-color-picker,
.note.locked .delete-btn,
.note.locked .note-drag-handle {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.note.locked textarea {
    pointer-events: none;
    user-select: none;
}

/* Keep lock button visible when locked */
.note.locked .note-lock-btn {
    opacity: 1;
    pointer-events: auto;
}

.note-color-picker {
    width: 100%;
    height: 30px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

.note:hover .note-color-picker {
    opacity: 1;
}

.note-size-slider {
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
    outline: none;
}

.note-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #f97316;
    border-radius: 50%;
    cursor: pointer;
}

.note-size-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #f97316;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.note:hover .note-size-slider {
    opacity: 1;
}

.note textarea {
    width: 100%;
    min-width: 150px;
    height: 100%;
    background: transparent;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: 20px;
    font-weight: bold;
    resize: none;
    outline: none;
    overflow: hidden;
}

.delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #e94560;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    line-height: 18px;
    text-align: center;
    display: none;
    z-index: 10;
    transition: transform 0.2s;
}

.delete-btn:hover {
    transform: scale(1.15);
    background: #c23650;
}

.note .delete-btn {
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 20px;
}

.boss .delete-btn {
    top: -5px;
    right: -5px;
}

.draggable:hover .delete-btn {
    display: block;
}

.role-selector {
    position: fixed;
    top: 100px;
    left: 50px;
    background:
        linear-gradient(180deg, rgba(25, 35, 45, 0.95) 0%, rgba(15, 22, 30, 0.98) 100%);
    padding: 18px;
    border-radius: 6px;
    border: 3px solid;
    border-image: linear-gradient(180deg, #5a8ab5, #3a5570, #5a8ab5) 1;
    z-index: 101;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(90, 138, 181, 0.2);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
}

.role-selector::-webkit-scrollbar {
    width: 8px;
}

.role-selector::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}

.role-selector::-webkit-scrollbar-thumb {
    background: rgba(90, 138, 181, 0.6);
    border-radius: 4px;
}

.role-selector::-webkit-scrollbar-thumb:hover {
    background: rgba(90, 138, 181, 0.8);
}

.role-selector h3 {
    margin-bottom: 6px;
    color: #b8d4f0;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    border-bottom: 2px solid rgba(90, 138, 181, 0.3);
    padding-bottom: 4px;
}

.role-btn {
    display: block;
    width: 100%;
    margin: 3px 0;
    padding: 6px 8px;
    background:
        linear-gradient(180deg, rgba(35, 50, 65, 0.8) 0%, rgba(20, 30, 40, 0.9) 100%);
    border: 2px solid #3a5570;
    color: #b8d4f0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(90, 138, 181, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

.role-btn:hover {
    background:
        linear-gradient(180deg, rgba(50, 70, 90, 0.9) 0%, rgba(30, 45, 60, 0.95) 100%);
    border-color: #5a8ab5;
    transform: translateX(3px);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(90, 138, 181, 0.4),
        0 0 12px rgba(90, 180, 220, 0.2);
    color: #d4e8ff;
}

.role-btn:active {
    transform: translateX(1px) translateY(1px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.9),
        inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.role-btn.image-btn {
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    min-height: auto;
    transition: opacity 0.2s ease;
}

.role-btn.image-btn:hover {
    background: none;
    border: none;
    box-shadow: none;
    transform: none;
    opacity: 0.7;
}

.role-btn.image-btn:active {
    transform: none;
    box-shadow: none;
}

.role-btn.image-btn img {
    width: 32px;
    height: 32px;
    display: block;
    pointer-events: none;
    cursor: pointer;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.modal.active {
    display: flex;
    pointer-events: auto;
}

.modal-content {
    background:
        linear-gradient(180deg, rgba(25, 35, 45, 0.98) 0%, rgba(15, 22, 30, 0.99) 100%);
    padding: 28px;
    border-radius: 8px;
    border: 3px solid;
    border-image: linear-gradient(135deg, #5a8ab5, #3a5570, #5a8ab5) 1;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.95),
        inset 0 1px 0 rgba(90, 138, 181, 0.2);
    min-width: 400px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #b8d4f0;
    font-size: 22px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    text-align: center;
    border-bottom: 2px solid rgba(90, 138, 181, 0.3);
    padding-bottom: 10px;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    background: rgba(10, 15, 20, 0.7);
    border: 2px solid #3a5570;
    border-radius: 4px;
    color: #b8d4f0;
    font-size: 14px;
    font-weight: 500;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.modal-content input[type="text"]:focus {
    outline: none;
    border-color: #5a8ab5;
    background: rgba(10, 15, 20, 0.9);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.7),
        0 0 10px rgba(90, 180, 220, 0.3);
}

.modal-content input[type="text"]::placeholder {
    color: #3a5570;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.saved-layouts {
    margin-top: 20px;
}

.layout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(15, 20, 25, 0.6);
    border: 2px solid #3a5570;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.layout-item:hover {
    background: rgba(25, 35, 45, 0.8);
    border-color: #5a8ab5;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.7);
}

.layout-name {
    color: #b8d4f0;
    font-weight: 600;
    font-size: 14px;
    flex: 1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

.layout-date {
    color: #6a8599;
    font-size: 11px;
    margin-right: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

.layout-actions {
    display: flex;
    gap: 6px;
}

.layout-btn {
    padding: 6px 12px;
    background:
        linear-gradient(180deg, rgba(35, 50, 65, 0.8) 0%, rgba(20, 30, 40, 0.9) 100%);
    border: 2px solid #3a5570;
    color: #b8d4f0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(90, 138, 181, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

.layout-btn:hover {
    background:
        linear-gradient(180deg, rgba(50, 70, 90, 0.9) 0%, rgba(30, 45, 60, 0.95) 100%);
    border-color: #5a8ab5;
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(90, 138, 181, 0.4);
    color: #d4e8ff;
}

.layout-btn.delete:hover {
    background:
        linear-gradient(180deg, rgba(139, 50, 50, 0.9) 0%, rgba(89, 30, 30, 0.95) 100%);
    border-color: #e94560;
    box-shadow:
        0 3px 6px rgba(233, 69, 96, 0.5),
        inset 0 1px 0 rgba(233, 69, 96, 0.3);
}

/* Animation Timeline Styles */
.timeline-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.95) 100%);
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    backdrop-filter: blur(20px);
    z-index: 50;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

.timeline-container.active {
    transform: translateY(0);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.timeline-header h3 {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.timeline-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    cursor: pointer;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.timeline-btn:hover {
    background: linear-gradient(135deg, rgba(45, 108, 223, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
    border-color: rgba(99, 102, 241, 0.5);
}

.timeline-btn.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #15803d;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}

.speed-control label {
    font-size: 11px;
    color: rgba(203, 213, 225, 0.8);
    font-weight: 600;
}

.speed-control select {
    padding: 4px 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
}

.timeline-content {
    flex: 1;
    overflow: hidden;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.timeline-fixed-section {
    flex-shrink: 0;
}

.timeline-tracks-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: 200px;
    padding-right: 8px;
}

.timeline-tracks-section::-webkit-scrollbar {
    width: 8px;
}

.timeline-tracks-section::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}

.timeline-tracks-section::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 4px;
}

.timeline-tracks-section::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

.timeline-ruler {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding-left: 140px;
    position: relative;
}

.timeline-ruler-line {
    flex: 1;
    height: 32px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    position: relative;
    min-width: 800px;
}

.timeline-ruler-marks {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    pointer-events: none;
}

.timeline-ruler-mark {
    position: absolute;
    height: 100%;
    border-left: 1px solid rgba(148, 163, 184, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline-ruler-mark::after {
    content: attr(data-time);
    position: absolute;
    top: 2px;
    font-size: 9px;
    color: rgba(203, 213, 225, 0.6);
    font-weight: 600;
}

.timeline-scrubber {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #22c55e;
    pointer-events: none;
    z-index: 10;
}

.timeline-scrubber-handle {
    position: absolute;
    top: -4px;
    left: -6px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
}

.timeline-track {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
}

.timeline-track-label {
    width: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 10px;
}

.timeline-track-name {
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.track-remove-btn {
    padding: 2px 6px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    cursor: pointer;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s;
}

.track-remove-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fff;
}

.timeline-track-bar {
    flex: 1;
    height: 28px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    min-width: 800px;
}

.timeline-track-bar:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(99, 102, 241, 0.3);
}

.timeline-waypoint-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 100%);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: all 0.2s;
}

.timeline-waypoint-marker:hover {
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

.timeline-waypoint-marker.selected {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: #fff;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.6);
}

.timeline-waypoint-time {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #a5b4fc;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
}

.timeline-duration-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
}

.timeline-duration-control label {
    font-size: 10px;
    color: rgba(203, 213, 225, 0.8);
    font-weight: 600;
}

.timeline-duration-control input {
    width: 60px;
    padding: 4px 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
}

.timeline-add-waypoint-hint {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(99, 102, 241, 0.6);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.timeline-track-bar:hover .timeline-add-waypoint-hint {
    opacity: 1;
}

.timeline-empty {
    text-align: center;
    padding: 32px;
    color: rgba(203, 213, 225, 0.6);
    font-size: 13px;
}

.context-menu {
    position: fixed;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.95) 100%);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 8px;
    z-index: 9999;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 8px 16px;
    color: #e2e8f0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.context-menu-item:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #fff;
}

.waypoint-ghost {
    position: absolute;
    border: 2px dashed #a5b4fc;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #a5b4fc;
}

.waypoint-path-line {
    position: absolute;
    pointer-events: none;
    border-top: 2px dotted;
    opacity: 0.4;
    z-index: 6;
    transform-origin: left center;
}

.waypoint-canvas-marker {
    position: absolute;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    z-index: 7;
    border: 1px solid;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -100%);
    margin-top: -8px;
}

.timeline-toggle {
    position: fixed;
    bottom: 16px;
    right: 24px;
    z-index: 60;
}

/* Image Library Styles */
.folder-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 16px;
    background: rgba(15, 22, 30, 0.5);
    border: 2px solid #3a5570;
    border-radius: 4px;
}

.folder-card {
    background: linear-gradient(180deg, rgba(35, 50, 65, 0.8) 0%, rgba(20, 30, 40, 0.9) 100%);
    border: 2px solid #3a5570;
    border-radius: 6px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(90, 138, 181, 0.3);
}

.folder-card:hover {
    background: linear-gradient(180deg, rgba(50, 70, 90, 0.9) 0%, rgba(30, 45, 60, 0.95) 100%);
    border-color: #5a8ab5;
    transform: translateY(-3px);
    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(90, 138, 181, 0.5),
        0 0 20px rgba(90, 138, 181, 0.3);
}

.folder-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.folder-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
    border: 2px solid rgba(90, 138, 181, 0.3);
}

.folder-name {
    color: #b8d4f0;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
}

.folder-count {
    color: #7a9bb8;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.image-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(15, 22, 30, 0.5);
    border: 2px solid #3a5570;
    border-radius: 4px;
}

.library-image-item {
    position: relative;
    aspect-ratio: 16/9;
    border: 2px solid #3a5570;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(0, 0, 0, 0.5);
}

.library-image-item:hover {
    border-color: #5a8ab5;
    transform: scale(1.05);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(90, 138, 181, 0.4);
}

.library-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    color: #b8d4f0;
    padding: 4px 6px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
