.widget-time-tracks { display: grid; gap: 3px; margin-top: 3px; }
.widget-time-lane { position: relative; height: 24px; }
.widget-time-track { position: absolute; top: 0; bottom: 0; border: 1px solid transparent; border-radius: 5px; background: color-mix(in srgb, var(--studio-accent) 16%, var(--studio-panel)); color: var(--studio-text); touch-action: none; cursor: grab; user-select: none; }
.widget-time-track[aria-pressed=true] { border-color: var(--studio-accent); background: color-mix(in srgb, var(--studio-accent) 25%, var(--studio-panel)); }
.widget-time-name { display: block; padding: 0 17px; line-height: 22px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; }
html[data-theme] button:is(.widget-time-handle, .text-time-handle) {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 14px;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--studio-text);
    touch-action: none;
    cursor: ew-resize;
}
@media (max-width: 768px), (max-width: 1024px) and (max-height: 500px) and (pointer: coarse) {
    html[data-theme] button:is(.widget-time-handle, .text-time-handle) {
        width: 24px;
    }
}
/* Outrank the global button hover rule so only the edge grip is painted. */
html[data-theme] button:is(.widget-time-handle, .text-time-handle):is(:hover, :active, :focus-visible) {
    background: transparent;
    box-shadow: none;
    outline: none;
    color: var(--studio-accent);
}
:is(.widget-time-handle, .text-time-handle)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 10px;
    transform: translate(-50%, -50%);
    border-radius: 2px;
    background: currentColor;
    opacity: .85;
    pointer-events: none;
}
:is(.widget-time-handle, .text-time-handle):focus-visible::after {
    outline: 1px solid var(--studio-accent);
    outline-offset: 2px;
}
:is(.widget-time-handle, .text-time-handle).start { left: 0; }
:is(.widget-time-handle, .text-time-handle).end { right: 0; }
.widget-time-track:not([aria-pressed=true]) .widget-time-handle { visibility: hidden; }
.widget-time-track:focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 2px; }
.widget-time-track.outside-section { border-style: dashed; opacity: .6; cursor: pointer; }
.widget-timing-properties { min-width: 0; margin: 14px 0; padding: 10px; border: 1px solid var(--studio-border); border-radius: 8px; }
.widget-timing-properties legend { padding: 0 4px; font-size: 11px; }
.widget-time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.widget-time-fields label { display: grid; gap: 4px; margin: 0; font-size: 10px; }
.widget-time-fields input { width: 100%; min-width: 0; min-height: 36px; }
.widget-time-shortcuts { display: flex; gap: 5px; margin-top: 8px; }
html[data-theme] .widget-time-shortcuts button { flex: 1; padding: 6px; font-size: 10px; min-height: 36px; }
html[data-theme] .widget-time-split { width: 100%; min-height: 40px; font-size: 11px; margin-top: 8px; }
.widget-timing-properties small { display: block; margin-top: 8px; color: var(--studio-muted); font-size: 10px; line-height: 1.5; }
@media (max-width: 768px), (max-width: 1024px) and (max-height: 500px) and (pointer: coarse) {
    html[data-theme] .widget-time-fields input { min-height: 44px; font-size: 16px; }
    html[data-theme] .widget-time-shortcuts button { min-height: 44px; }
}

@media (max-width: 768px), (max-width: 1024px) and (max-height: 500px) and (pointer: coarse) {
    .widget-time-tracks { max-height: 82px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding-block: 2px; overflow-anchor: none; }
    .widget-time-tracks::-webkit-scrollbar { display: none; }
}

.widget-track-tools { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.widget-track-tools[hidden] { display: none; }
html[data-theme] .widget-track-tools button { min-height: 36px; padding: 5px 9px; background: transparent; border: 0; color: var(--studio-muted); font-size: 11px; }
.widget-track-manager { width: min(440px, calc(100vw - 24px)); max-height: 75dvh; padding: 14px; color: var(--studio-text); background: var(--studio-panel); border: 1px solid var(--studio-border); border-radius: 12px; }
.widget-track-manager::backdrop { background: #0009; }
.widget-track-manager-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; }
.widget-track-manager-heading h2 { font-size: 15px; font-weight: 600; margin: 0; }
.widget-track-list { display: grid; gap: 0; margin-top: 2px; }
.widget-track-list-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--studio-border); }
.widget-track-list-row:last-child { border-bottom: 0; }
html[data-theme] .widget-track-list-row > :first-child { flex: 1; min-width: 0; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; text-align: left; font-size: 12px; font-weight: 500; background: transparent; border: 1px solid transparent; border-radius: 6px; box-shadow: none; }
.widget-track-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-track-list-row small { flex: none; color: var(--studio-muted); font-size: 10px; font-weight: 400; font-variant-numeric: tabular-nums; margin: 0; }
html[data-theme] .widget-track-list-row > :first-child:hover { background: var(--studio-hover); }
html[data-theme] .widget-track-list-row > [aria-pressed=true] { color: var(--studio-accent); background: var(--studio-hover); }
html[data-theme] .widget-track-manager :is(.widget-track-close,.widget-track-delete) { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--studio-muted); box-shadow: none; }
html[data-theme] .widget-track-manager .widget-track-close:hover { background: var(--studio-hover); color: var(--studio-text); }
html[data-theme] .widget-track-manager .widget-track-delete:hover { background: #e66c7b18; color: #e98d98; }
.widget-track-manager button svg { pointer-events: none; }
@media (pointer: coarse) {
    html[data-theme] .widget-track-list-row > :first-child { min-height: 44px; }
    html[data-theme] .widget-track-manager :is(.widget-track-close,.widget-track-delete) { flex-basis: 44px; width: 44px; height: 44px; min-height: 44px; }
}
@media (max-width: 768px), (max-width: 1024px) and (max-height: 500px) and (pointer: coarse) {
    .widget-time-tracks.expanded { max-height: min(360px, calc(100dvh - 300px)); }
    .widget-time-tracks { overscroll-behavior-y: contain; scrollbar-width: thin; }
    html[data-theme] .widget-track-tools button { min-height: 44px; }
}

@media (max-height: 500px) and (max-width: 1024px) and (pointer: coarse) {
    .widget-time-tracks { max-height: 28px; }
    .widget-time-tracks.expanded { max-height: 45dvh; }
    .widget-track-tools { margin-top: 0; }
}

.widget-track-tools [aria-expanded] { display: none; }
@media (max-width: 768px), (max-width: 1024px) and (max-height: 500px) and (pointer: coarse) {
    .widget-track-tools [aria-expanded] { display: block; }
    html[data-theme] .editor > .timeline.widget-tracks-focused { position: fixed; z-index: 90; top: calc(58px + env(safe-area-inset-top)); left: max(6px, env(safe-area-inset-left)); right: max(6px, env(safe-area-inset-right)); bottom: calc(100px + env(safe-area-inset-bottom)); padding: 10px; border: 1px solid var(--studio-border); border-radius: 12px; background: var(--studio-panel); box-shadow: 0 0 0 100vmax #0008; }
    .widget-tracks-focused .widget-track-tools { margin-top: 6px; }
}

html[data-theme] .timeline > .widget-track-tools { padding: 0; margin: 0; border: 0; border-radius: 0; min-width: 0; background: transparent; background-image: none; white-space: normal; overflow: visible; }

.widget-animation-section { margin: 12px 0; border-top: 1px solid var(--studio-border, #ffffff20); padding-top: 10px; }
.widget-animation-section summary { cursor: pointer; font-size: 12px; color: var(--studio-text, #e3e9f3); }
.widget-animation-properties { min-width: 0; margin: 8px 0 0; padding: 0; border: 0; }
.widget-animation-properties legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.widget-animation-properties .widget-time-fields { margin-bottom: 10px; gap: 8px; }
.widget-animation-properties input,.widget-animation-properties select { width: 100%; min-width: 0; }
.widget-animation-properties label { font-size: 11px; }
